Qt 4.8
Public Functions | Public Variables | List of all members
QInputDialogPrivate Class Reference
Inheritance diagram for QInputDialogPrivate:
QDialogPrivate QWidgetPrivate QObjectPrivate QObjectData

Public Functions

void _q_currentRowChanged (const QModelIndex &newIndex, const QModelIndex &oldIndex)
 
void _q_textChanged (const QString &text)
 
void chooseRightTextInputWidget ()
 
void ensureComboBox ()
 
void ensureDoubleSpinBox ()
 
void ensureEnabledConnection (QAbstractSpinBox *spinBox)
 
void ensureIntSpinBox ()
 
void ensureLayout ()
 
void ensureLayout () const
 
void ensureLineEdit ()
 
void ensureListView ()
 
QString listViewText () const
 
 QInputDialogPrivate ()
 
void setComboBoxText (const QString &text)
 
void setInputWidget (QWidget *widget)
 
void setListViewText (const QString &text)
 
bool useComboBoxOrListView () const
 
- Public Functions inherited from QDialogPrivate
void hideDefault ()
 Hides the default button indicator. More...
 
virtual void mac_nativeDialogModalHelp ()
 
 QDialogPrivate ()
 
void resetModalitySetByOpen ()
 
void setDefault (QPushButton *)
 This function is called by the push button pushButton when it becomes the default button. More...
 
void setMainDefault (QPushButton *)
 This function sets the default default push button to pushButton. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QDialogButtonBoxbuttonBox
 
QComboBoxcomboBox
 
QDoubleSpinBoxdoubleSpinBox
 
QWidgetinputWidget
 
QSpinBoxintSpinBox
 
QLabellabel
 
QLineEditlineEdit
 
QListViewlistView
 
QVBoxLayoutmainLayout
 
QByteArray memberToDisconnectOnClose
 
QInputDialog::InputDialogOptions opts
 
QPointer< QObjectreceiverToDisconnectOnClose
 
QString textValue
 
- Public Variables inherited from QDialogPrivate
bool doShowExtension
 
QPointer< QEventLoopeventLoop
 
QWidgetextension
 
QPoint lastRMBPress
 
QPointer< QPushButtonmainDef
 
QSize max
 
QSize min
 
Qt::Orientation orientation
 
int rescode
 
int resetModalityTo
 
QSizeGripresizer
 
QSize size
 
bool sizeGripEnabled
 
bool wasModalitySet
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 165 of file qinputdialog.cpp.

Constructors and Destructors

◆ QInputDialogPrivate()

QInputDialogPrivate::QInputDialogPrivate ( )

Definition at line 204 of file qinputdialog.cpp.

205  : label(0), buttonBox(0), lineEdit(0), intSpinBox(0), doubleSpinBox(0), comboBox(0), listView(0),
206  inputWidget(0), mainLayout(0)
207 {
208 }
QDoubleSpinBox * doubleSpinBox
QDialogButtonBox * buttonBox
QVBoxLayout * mainLayout

Functions

◆ _q_currentRowChanged()

void QInputDialogPrivate::_q_currentRowChanged ( const QModelIndex newIndex,
const QModelIndex oldIndex 
)

Definition at line 428 of file qinputdialog.cpp.

Referenced by ensureListView().

430 {
431  _q_textChanged(comboBox->model()->data(newIndex).toString());
433 }
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
QPushButton * button(StandardButton which) const
Returns the QPushButton corresponding to the standard button which, or 0 if the standard button doesn...
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
QAbstractItemModel * model() const
Returns the model used by the combobox.
Definition: qcombobox.cpp:1968
void setEnabled(bool)
Definition: qwidget.cpp:3447
void _q_textChanged(const QString &text)
QDialogButtonBox * buttonBox

◆ _q_textChanged()

void QInputDialogPrivate::_q_textChanged ( const QString text)

Definition at line 419 of file qinputdialog.cpp.

Referenced by _q_currentRowChanged(), chooseRightTextInputWidget(), ensureComboBox(), and ensureLineEdit().

420 {
421  Q_Q(QInputDialog);
422  if (textValue != text) {
423  textValue = text;
424  emit q->textValueChanged(text);
425  }
426 }
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
#define text
Definition: qobjectdefs.h:80

◆ chooseRightTextInputWidget()

void QInputDialogPrivate::chooseRightTextInputWidget ( )

Definition at line 364 of file qinputdialog.cpp.

365 {
366  QWidget *widget;
367 
368  if (useComboBoxOrListView()) {
370  ensureListView();
371  widget = listView;
372  } else {
373  widget = comboBox;
374  }
375  } else {
376  ensureLineEdit();
377  widget = lineEdit;
378  }
379 
380  setInputWidget(widget);
381 
382  if (inputWidget == comboBox) {
384  } else if (inputWidget == listView) {
386  }
387 }
QInputDialog::InputDialogOptions opts
void setInputWidget(QWidget *widget)
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool useComboBoxOrListView() const
QString listViewText() const
void _q_textChanged(const QString &text)
QString currentText
the current text
Definition: qcombobox.h:70
bool isEditable() const
Definition: qcombobox.cpp:1723

◆ ensureComboBox()

void QInputDialogPrivate::ensureComboBox ( )

Definition at line 261 of file qinputdialog.cpp.

Referenced by ensureListView().

262 {
263  Q_Q(QInputDialog);
264  if (!comboBox) {
265  comboBox = new QComboBox(q);
266 #ifndef QT_NO_IM
268 #endif
269  comboBox->hide();
270  QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
272  QObject::connect(comboBox, SIGNAL(currentIndexChanged(QString)),
274  }
275 }
#define SLOT(a)
Definition: qobjectdefs.h:226
uint inheritsInputMethodHints
Definition: qwidget_p.h:778
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
void hide()
Hides the widget.
Definition: qwidget.h:501
void _q_textChanged(const QString &text)
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920

◆ ensureDoubleSpinBox()

void QInputDialogPrivate::ensureDoubleSpinBox ( )

Definition at line 306 of file qinputdialog.cpp.

307 {
308  Q_Q(QInputDialog);
309  if (!doubleSpinBox) {
311  doubleSpinBox->hide();
312  QObject::connect(doubleSpinBox, SIGNAL(valueChanged(double)),
313  q, SIGNAL(doubleValueChanged(double)));
314  }
315 }
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void hide()
Hides the widget.
Definition: qwidget.h:501
QDoubleSpinBox * doubleSpinBox

◆ ensureEnabledConnection()

void QInputDialogPrivate::ensureEnabledConnection ( QAbstractSpinBox spinBox)

Definition at line 317 of file qinputdialog.cpp.

Referenced by ensureLayout(), and setInputWidget().

318 {
319  if (spinBox) {
321  QObject::connect(spinBox, SIGNAL(textChanged(bool)), okButton, SLOT(setEnabled(bool)), Qt::UniqueConnection);
322  }
323 }
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
#define SLOT(a)
Definition: qobjectdefs.h:226
QPushButton * button(StandardButton which) const
Returns the QPushButton corresponding to the standard button which, or 0 if the standard button doesn...
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QDialogButtonBox * buttonBox

◆ ensureIntSpinBox()

void QInputDialogPrivate::ensureIntSpinBox ( )

Definition at line 295 of file qinputdialog.cpp.

296 {
297  Q_Q(QInputDialog);
298  if (!intSpinBox) {
300  intSpinBox->hide();
301  QObject::connect(intSpinBox, SIGNAL(valueChanged(int)),
302  q, SIGNAL(intValueChanged(int)));
303  }
304 }
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void hide()
Hides the widget.
Definition: qwidget.h:501

◆ ensureLayout() [1/2]

void QInputDialogPrivate::ensureLayout ( )

Definition at line 210 of file qinputdialog.cpp.

Referenced by setInputWidget().

211 {
212  Q_Q(QInputDialog);
213 
214  if (mainLayout)
215  return;
216 
217  if (!inputWidget) {
218  ensureLineEdit();
220  }
221 
222  if (!label)
223  label = new QLabel(QInputDialog::tr("Enter a value:"), q);
224 #ifndef QT_NO_SHORTCUT
226 #endif
228 
230  QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
231  QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
232 
233  mainLayout = new QVBoxLayout(q);
234  //we want to let the input dialog grow to available size on Symbian.
235 #ifndef Q_OS_SYMBIAN
237 #else
239 #endif
243  ensureEnabledConnection(qobject_cast<QAbstractSpinBox *>(inputWidget));
244  inputWidget->show();
245 }
#define SLOT(a)
Definition: qobjectdefs.h:226
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void ensureEnabledConnection(QAbstractSpinBox *spinBox)
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void show()
Shows the widget and its child widgets.
void setBuddy(QWidget *)
Sets this label&#39;s buddy to buddy.
Definition: qlabel.cpp:1297
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
QDialogButtonBox * buttonBox
void setSizeConstraint(SizeConstraint)
Definition: qlayout.cpp:1435
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
QVBoxLayout * mainLayout

◆ ensureLayout() [2/2]

void QInputDialogPrivate::ensureLayout ( ) const
inline

Definition at line 184 of file qinputdialog.cpp.

Referenced by ensureLayout().

◆ ensureLineEdit()

void QInputDialogPrivate::ensureLineEdit ( )

Definition at line 247 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget(), and ensureLayout().

248 {
249  Q_Q(QInputDialog);
250  if (!lineEdit) {
251  lineEdit = new QLineEdit(q);
252 #ifndef QT_NO_IM
254 #endif
255  lineEdit->hide();
256  QObject::connect(lineEdit, SIGNAL(textChanged(QString)),
258  }
259 }
#define SLOT(a)
Definition: qobjectdefs.h:226
uint inheritsInputMethodHints
Definition: qwidget_p.h:778
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void hide()
Hides the widget.
Definition: qwidget.h:501
void _q_textChanged(const QString &text)
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920

◆ ensureListView()

void QInputDialogPrivate::ensureListView ( )

Definition at line 277 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget().

278 {
279  Q_Q(QInputDialog);
280  if (!listView) {
281  ensureComboBox();
282 
283  listView = new QListView(q);
284  listView->hide();
290  SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
292  }
293 }
void setSelectionMode(QAbstractItemView::SelectionMode mode)
#define SLOT(a)
Definition: qobjectdefs.h:226
void setEditTriggers(EditTriggers triggers)
The QInputDialog class provides a simple convenience dialog to get a single value from the user...
Definition: qinputdialog.h:59
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void _q_currentRowChanged(const QModelIndex &newIndex, const QModelIndex &oldIndex)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
QAbstractItemModel * model() const
Returns the model used by the combobox.
Definition: qcombobox.cpp:1968
void hide()
Hides the widget.
Definition: qwidget.h:501
The QListView class provides a list or icon view onto a model.
Definition: qlistview.h:57
The QModelIndex class is used to locate data in a data model.

◆ listViewText()

QString QInputDialogPrivate::listViewText ( ) const

Definition at line 409 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget().

410 {
412  int row = listView->selectionModel()->selectedRows().value(0).row();
413  return comboBox->itemText(row);
414  } else {
415  return QString();
416  }
417 }
QModelIndexList selectedRows(int column=0) const
Returns the indexes in the given column for the rows where all columns are selected.
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString itemText(int index) const
Returns the text for the given index in the combobox.
Definition: qcombobox.cpp:2161
QItemSelectionModel * selectionModel() const
Returns the current selection model.
int row() const
Returns the row this model index refers to.
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
bool hasSelection() const
Returns true if the selection model contains any selection ranges; otherwise returns false...

◆ setComboBoxText()

void QInputDialogPrivate::setComboBoxText ( const QString text)

Definition at line 389 of file qinputdialog.cpp.

Referenced by setInputWidget().

390 {
391  int index = comboBox->findText(text);
392  if (index != -1) {
393  comboBox->setCurrentIndex(index);
394  } else if (comboBox->isEditable()) {
395  comboBox->setEditText(text);
396  }
397 }
void setCurrentIndex(int index)
Definition: qcombobox.cpp:2102
int findText(const QString &text, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
Returns the index of the item containing the given text; otherwise returns -1.
Definition: qcombobox.h:113
quint16 index
bool isEditable() const
Definition: qcombobox.cpp:1723
void setEditText(const QString &text)
Sets the text in the combobox&#39;s text edit.
Definition: qcombobox.cpp:2776

◆ setInputWidget()

void QInputDialogPrivate::setInputWidget ( QWidget widget)

Definition at line 325 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget().

326 {
327  Q_ASSERT(widget);
328  if (inputWidget == widget)
329  return;
330 
331  if (mainLayout) {
334  inputWidget->hide();
335  mainLayout->insertWidget(1, widget);
336  widget->show();
337 
338  // disconnect old input widget
340  if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(inputWidget))
341  QObject::disconnect(spinBox, SIGNAL(textChanged(bool)), okButton, SLOT(setEnabled(bool)));
342 
343  // connect new input widget and update enabled state of OK button
345  ensureEnabledConnection(spinBox);
346  okButton->setEnabled(!spinBox || spinBox->hasAcceptableInput());
347  }
348 
350 
351  // synchronize the text shown in the new text editor with the current
352  // textValue
353  if (widget == lineEdit) {
355  } else if (widget == comboBox) {
357  } else if (widget == listView) {
359  ensureLayout();
361  }
362 }
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
T qobject_cast(QObject *object)
Definition: qobject.h:375
QPointer< QWidget > widget
#define SLOT(a)
Definition: qobjectdefs.h:226
void ensureEnabledConnection(QAbstractSpinBox *spinBox)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QPushButton * button(StandardButton which) const
Returns the QPushButton corresponding to the standard button which, or 0 if the standard button doesn...
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void insertWidget(int index, QWidget *widget, int stretch=0, Qt::Alignment alignment=0)
Inserts widget at position index, with stretch factor stretch and alignment alignment.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
void show()
Shows the widget and its child widgets.
void setEnabled(bool)
Definition: qwidget.cpp:3447
bool hasAcceptableInput() const
void hide()
Hides the widget.
Definition: qwidget.h:501
void setText(const QString &)
Definition: qlineedit.cpp:401
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
bool hasSelection() const
Returns true if the selection model contains any selection ranges; otherwise returns false...
void setComboBoxText(const QString &text)
QDialogButtonBox * buttonBox
QVBoxLayout * mainLayout
void setListViewText(const QString &text)
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
Definition: qlayout.cpp:1516

◆ setListViewText()

void QInputDialogPrivate::setListViewText ( const QString text)

Definition at line 399 of file qinputdialog.cpp.

Referenced by setInputWidget().

400 {
401  int row = comboBox->findText(text);
402  if (row != -1) {
403  QModelIndex index(comboBox->model()->index(row, 0));
406  }
407 }
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
QItemSelectionModel * selectionModel() const
Returns the current selection model.
int findText(const QString &text, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
Returns the index of the item containing the given text; otherwise returns -1.
Definition: qcombobox.h:113
QAbstractItemModel * model() const
Returns the model used by the combobox.
Definition: qcombobox.cpp:1968
The QModelIndex class is used to locate data in a data model.
quint16 index

◆ useComboBoxOrListView()

bool QInputDialogPrivate::useComboBoxOrListView ( ) const
inline

Definition at line 185 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget().

185 { return comboBox && comboBox->count() > 0; }
int count
the number of items in the combobox
Definition: qcombobox.h:69

Properties

◆ buttonBox

QDialogButtonBox* QInputDialogPrivate::buttonBox
mutable

◆ comboBox

QComboBox* QInputDialogPrivate::comboBox
mutable

◆ doubleSpinBox

QDoubleSpinBox* QInputDialogPrivate::doubleSpinBox
mutable

Definition at line 193 of file qinputdialog.cpp.

Referenced by ensureDoubleSpinBox().

◆ inputWidget

QWidget* QInputDialogPrivate::inputWidget
mutable

Definition at line 196 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget(), ensureLayout(), and setInputWidget().

◆ intSpinBox

QSpinBox* QInputDialogPrivate::intSpinBox
mutable

Definition at line 192 of file qinputdialog.cpp.

Referenced by ensureIntSpinBox().

◆ label

QLabel* QInputDialogPrivate::label
mutable

Definition at line 189 of file qinputdialog.cpp.

Referenced by ensureLayout().

◆ lineEdit

QLineEdit* QInputDialogPrivate::lineEdit
mutable

◆ listView

QListView* QInputDialogPrivate::listView
mutable

◆ mainLayout

QVBoxLayout* QInputDialogPrivate::mainLayout
mutable

Definition at line 197 of file qinputdialog.cpp.

Referenced by ensureLayout(), and setInputWidget().

◆ memberToDisconnectOnClose

QByteArray QInputDialogPrivate::memberToDisconnectOnClose

Definition at line 201 of file qinputdialog.cpp.

◆ opts

QInputDialog::InputDialogOptions QInputDialogPrivate::opts

Definition at line 198 of file qinputdialog.cpp.

Referenced by chooseRightTextInputWidget().

◆ receiverToDisconnectOnClose

QPointer<QObject> QInputDialogPrivate::receiverToDisconnectOnClose

Definition at line 200 of file qinputdialog.cpp.

◆ textValue

QString QInputDialogPrivate::textValue

Definition at line 199 of file qinputdialog.cpp.

Referenced by _q_textChanged(), and setInputWidget().


The documentation for this class was generated from the following file: