Qt 4.8
Public Functions | Static Public Functions | Public Variables | List of all members
QComboBoxPrivate Class Reference

#include <qcombobox_p.h>

Inheritance diagram for QComboBoxPrivate:
QWidgetPrivate QObjectPrivate QObjectData QFontComboBoxPrivate

Public Functions

void _q_complete ()
 
void _q_dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
void _q_editingFinished ()
 
void _q_emitCurrentIndexChanged (const QModelIndex &index)
 
void _q_emitHighlighted (const QModelIndex &)
 
void _q_itemSelected (const QModelIndex &item)
 
void _q_modelDestroyed ()
 
void _q_modelReset ()
 
void _q_resetButton ()
 
void _q_returnPressed ()
 
void _q_rowsInserted (const QModelIndex &parent, int start, int end)
 
void _q_rowsRemoved (const QModelIndex &parent, int start, int end)
 
void _q_updateIndexBeforeChange ()
 
void adjustComboBoxSize ()
 
int computeWidthHint () const
 
bool contains (const QString &text, int role)
 
void emitActivated (const QModelIndex &)
 
void init ()
 
QIcon itemIcon (const QModelIndex &index) const
 
int itemRole () const
 
QString itemText (const QModelIndex &index) const
 
void keyboardSearchString (const QString &text)
 
Qt::MatchFlags matchFlags () const
 
void modelChanged ()
 
QStyle::SubControl newHoverControl (const QPoint &pos)
 
QRect popupGeometry (int screen=-1) const
 
 QComboBoxPrivate ()
 
QSize recomputeSizeHint (QSize &sh) const
 
void setCurrentIndex (const QModelIndex &index)
 
void updateArrow (QStyle::StateFlag state)
 
void updateDelegate (bool force=false)
 
bool updateHoverControl (const QPoint &pos)
 
void updateLayoutDirection ()
 
void updateLineEditGeometry ()
 
void updateViewContainerPaletteAndOpacity ()
 
QComboBoxPrivateContainerviewContainer ()
 
 ~QComboBoxPrivate ()
 
- 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
 

Static Public Functions

static QPalette viewContainerPalette (QComboBox *cmb)
 
- 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)
 

Public Variables

QStyle::StateFlag arrowState
 
uint autoCompletion: 1
 
Qt::CaseSensitivity autoCompletionCaseSensitivity
 
QPointer< QCompletercompleter
 
QComboBoxPrivateContainercontainer
 
QPersistentModelIndex currentIndex
 
uint duplicatesEnabled: 1
 
uint frame: 1
 
QStyle::SubControl hoverControl
 
QRect hoverRect
 
QSize iconSize
 
int indexBeforeChange
 
bool inserting
 
QComboBox::InsertPolicy insertPolicy
 
QLineEditlineEdit
 
int maxCount
 
int maxVisibleItems
 
int minimumContentsLength
 
QSize minimumSizeHint
 
QAbstractItemModelmodel
 
int modelColumn
 
uint padding: 26
 
QPersistentModelIndex root
 
uint shownOnce: 1
 
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
 
QSize sizeHint
 
- 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 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 340 of file qcombobox_p.h.

Constructors and Destructors

◆ QComboBoxPrivate()

QComboBoxPrivate::QComboBoxPrivate ( )

Definition at line 89 of file qcombobox.cpp.

90  : QWidgetPrivate(),
91  model(0),
92  lineEdit(0),
93  container(0),
97  shownOnce(false),
98  autoCompletion(true),
99  duplicatesEnabled(false),
100  frame(true),
101  maxVisibleItems(10),
102  maxCount(INT_MAX),
103  modelColumn(0),
104  inserting(false),
109 #ifndef QT_NO_COMPLETER
110  , completer(0)
111 #endif
112 {
113 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
QAbstractItemModel * model
Definition: qcombobox_p.h:385
QStyle::SubControl hoverControl
Definition: qcombobox_p.h:404
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
QStyle::StateFlag arrowState
Definition: qcombobox_p.h:403
Qt::CaseSensitivity autoCompletionCaseSensitivity
Definition: qcombobox_p.h:408
QComboBox::InsertPolicy insertPolicy
Definition: qcombobox_p.h:388
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
QPointer< QCompleter > completer
Definition: qcombobox_p.h:411
QWidgetPrivate(int version=QObjectPrivateVersion)
Definition: qwidget.cpp:288
#define INT_MAX

◆ ~QComboBoxPrivate()

QComboBoxPrivate::~QComboBoxPrivate ( )
inline

Definition at line 345 of file qcombobox_p.h.

345 {}

Functions

◆ _q_complete()

void QComboBoxPrivate::_q_complete ( )

◆ _q_dataChanged()

void QComboBoxPrivate::_q_dataChanged ( const QModelIndex topLeft,
const QModelIndex bottomRight 
)

Definition at line 1032 of file qcombobox.cpp.

1033 {
1034  Q_Q(QComboBox);
1035  if (inserting || topLeft.parent() != root)
1036  return;
1037 
1039  sizeHint = QSize();
1041  q->updateGeometry();
1042  }
1043 
1044  if (currentIndex.row() >= topLeft.row() && currentIndex.row() <= bottomRight.row()) {
1045  if (lineEdit) {
1046  lineEdit->setText(q->itemText(currentIndex.row()));
1048  }
1049  q->update();
1050  }
1051 #ifndef QT_NO_ACCESSIBILITY
1053 #endif
1054 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
int row() const
Returns the row this persistent model index refers to.
QPersistentModelIndex root
Definition: qcombobox_p.h:407
void adjustComboBoxSize()
Definition: qcombobox.cpp:351
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
#define Q_Q(Class)
Definition: qglobal.h:2483
void updateLineEditGeometry()
Definition: qcombobox.cpp:1168
int row() const
Returns the row this model index refers to.
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
void setText(const QString &)
Definition: qlineedit.cpp:401
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ _q_editingFinished()

void QComboBoxPrivate::_q_editingFinished ( )

Definition at line 1199 of file qcombobox.cpp.

1200 {
1201  Q_Q(QComboBox);
1202  if (lineEdit && !lineEdit->text().isEmpty()) {
1203  //here we just check if the current item was entered
1204  const int index = q_func()->findText(lineEdit->text(), matchFlags());
1205  if (index != -1 && itemText(currentIndex) != lineEdit->text()) {
1206  q->setCurrentIndex(index);
1208  }
1209  }
1210 
1211 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
QString itemText(const QModelIndex &index) const
Definition: qcombobox.cpp:1312
#define Q_Q(Class)
Definition: qglobal.h:2483
void emitActivated(const QModelIndex &)
Definition: qcombobox.cpp:1282
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString text
the line edit&#39;s text
Definition: qlineedit.h:72
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
Qt::MatchFlags matchFlags() const
Definition: qcombobox.cpp:1187
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
quint16 index

◆ _q_emitCurrentIndexChanged()

void QComboBoxPrivate::_q_emitCurrentIndexChanged ( const QModelIndex index)

Definition at line 1302 of file qcombobox.cpp.

Referenced by _q_modelReset().

1303 {
1304  Q_Q(QComboBox);
1305  emit q->currentIndexChanged(index.row());
1306  emit q->currentIndexChanged(itemText(index));
1307 #ifndef QT_NO_ACCESSIBILITY
1309 #endif
1310 }
QString itemText(const QModelIndex &index) const
Definition: qcombobox.cpp:1312
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
int row() const
Returns the row this model index refers to.
#define emit
Definition: qobjectdefs.h:76
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62

◆ _q_emitHighlighted()

void QComboBoxPrivate::_q_emitHighlighted ( const QModelIndex index)

Definition at line 1292 of file qcombobox.cpp.

1293 {
1294  Q_Q(QComboBox);
1295  if (!index.isValid())
1296  return;
1297  QString text(itemText(index));
1298  emit q->highlighted(index.row());
1299  emit q->highlighted(text);
1300 }
QString itemText(const QModelIndex &index) const
Definition: qcombobox.cpp:1312
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
int row() const
Returns the row this model index refers to.
#define emit
Definition: qobjectdefs.h:76
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
#define text
Definition: qobjectdefs.h:80

◆ _q_itemSelected()

void QComboBoxPrivate::_q_itemSelected ( const QModelIndex item)

Definition at line 1270 of file qcombobox.cpp.

1271 {
1272  Q_Q(QComboBox);
1273  if (item != currentIndex) {
1274  setCurrentIndex(item);
1275  } else if (lineEdit) {
1276  lineEdit->selectAll();
1277  lineEdit->setText(q->itemText(currentIndex.row()));
1278  }
1280 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
int row() const
Returns the row this persistent model index refers to.
#define Q_Q(Class)
Definition: qglobal.h:2483
void emitActivated(const QModelIndex &)
Definition: qcombobox.cpp:1282
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
void setCurrentIndex(const QModelIndex &index)
Definition: qcombobox.cpp:2109
void setText(const QString &)
Definition: qlineedit.cpp:401
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405

◆ _q_modelDestroyed()

void QComboBoxPrivate::_q_modelDestroyed ( )

Definition at line 219 of file qcombobox.cpp.

220 {
222 }
QAbstractItemModel * model
Definition: qcombobox_p.h:385
static QAbstractItemModel * staticEmptyModel()

◆ _q_modelReset()

void QComboBoxPrivate::_q_modelReset ( )

Definition at line 207 of file qcombobox.cpp.

208 {
209  Q_Q(QComboBox);
210  if (lineEdit) {
213  }
216  q->update();
217 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
int row() const
Returns the row this persistent model index refers to.
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
void updateLineEditGeometry()
Definition: qcombobox.cpp:1168
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
void setText(const QString &)
Definition: qlineedit.cpp:401
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
void _q_emitCurrentIndexChanged(const QModelIndex &index)
Definition: qcombobox.cpp:1302

◆ _q_resetButton()

void QComboBoxPrivate::_q_resetButton ( )

Definition at line 1027 of file qcombobox.cpp.

1028 {
1030 }
void updateArrow(QStyle::StateFlag state)
Definition: qcombobox.cpp:196

◆ _q_returnPressed()

void QComboBoxPrivate::_q_returnPressed ( )

Definition at line 1213 of file qcombobox.cpp.

1214 {
1215  Q_Q(QComboBox);
1216  if (lineEdit && !lineEdit->text().isEmpty()) {
1217  if (q->count() >= maxCount && !(this->insertPolicy == QComboBox::InsertAtCurrent))
1218  return;
1219  lineEdit->deselect();
1220  lineEdit->end(false);
1221  QString text = lineEdit->text();
1222  // check for duplicates (if not enabled) and quit
1223  int index = -1;
1224  if (!duplicatesEnabled) {
1225  index = q->findText(text, matchFlags());
1226  if (index != -1) {
1227  q->setCurrentIndex(index);
1229  return;
1230  }
1231  }
1232  switch (insertPolicy) {
1234  index = 0;
1235  break;
1237  index = q->count();
1238  break;
1242  if (!q->count() || !currentIndex.isValid())
1243  index = 0;
1245  q->setItemText(q->currentIndex(), text);
1247  index = q->currentIndex() + 1;
1249  index = q->currentIndex();
1250  break;
1252  index = 0;
1253  for (int i=0; i< q->count(); i++, index++ ) {
1254  if (text.toLower() < q->itemText(i).toLower())
1255  break;
1256  }
1257  break;
1258  case QComboBox::NoInsert:
1259  default:
1260  break;
1261  }
1262  if (index >= 0) {
1263  q->insertItem(index, text);
1264  q->setCurrentIndex(index);
1266  }
1267  }
1268 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
void end(bool mark)
Moves the text cursor to the end of the line unless it is already there.
Definition: qlineedit.cpp:940
void deselect()
Deselects any selected text.
Definition: qlineedit.cpp:1417
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
void emitActivated(const QModelIndex &)
Definition: qcombobox.cpp:1282
QComboBox::InsertPolicy insertPolicy
Definition: qcombobox_p.h:388
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString text
the line edit&#39;s text
Definition: qlineedit.h:72
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
Qt::MatchFlags matchFlags() const
Definition: qcombobox.cpp:1187
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
QString toLower() const Q_REQUIRED_RESULT
Returns a lowercase copy of the string.
Definition: qstring.cpp:5389
quint16 index
#define text
Definition: qobjectdefs.h:80
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ _q_rowsInserted()

void QComboBoxPrivate::_q_rowsInserted ( const QModelIndex parent,
int  start,
int  end 
)

Definition at line 1056 of file qcombobox.cpp.

1057 {
1058  Q_Q(QComboBox);
1059  if (inserting || parent != root)
1060  return;
1061 
1063  sizeHint = QSize();
1065  q->updateGeometry();
1066  }
1067 
1068  // set current index if combo was previously empty
1069  if (start == 0 && (end - start + 1) == q->count() && !currentIndex.isValid()) {
1070  q->setCurrentIndex(0);
1071  // need to emit changed if model updated index "silently"
1072  } else if (currentIndex.row() != indexBeforeChange) {
1073  q->update();
1075  }
1076 }
int row() const
Returns the row this persistent model index refers to.
QPersistentModelIndex root
Definition: qcombobox_p.h:407
void adjustComboBoxSize()
Definition: qcombobox.cpp:351
#define Q_Q(Class)
Definition: qglobal.h:2483
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void _q_emitCurrentIndexChanged(const QModelIndex &index)
Definition: qcombobox.cpp:1302
static const KeyPair *const end
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ _q_rowsRemoved()

void QComboBoxPrivate::_q_rowsRemoved ( const QModelIndex parent,
int  start,
int  end 
)

Definition at line 1083 of file qcombobox.cpp.

1084 {
1085  Q_Q(QComboBox);
1086  if (parent != root)
1087  return;
1088 
1090  sizeHint = QSize();
1092  q->updateGeometry();
1093  }
1094 
1095  // model has changed the currentIndex
1096  if (currentIndex.row() != indexBeforeChange) {
1097  if (!currentIndex.isValid() && q->count()) {
1098  q->setCurrentIndex(qMin(q->count() - 1, qMax(indexBeforeChange, 0)));
1099  return;
1100  }
1101  if (lineEdit) {
1102  lineEdit->setText(q->itemText(currentIndex.row()));
1104  }
1105  q->update();
1107  }
1108 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
int row() const
Returns the row this persistent model index refers to.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QPersistentModelIndex root
Definition: qcombobox_p.h:407
void adjustComboBoxSize()
Definition: qcombobox.cpp:351
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
void updateLineEditGeometry()
Definition: qcombobox.cpp:1168
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
void setText(const QString &)
Definition: qlineedit.cpp:401
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void _q_emitCurrentIndexChanged(const QModelIndex &index)
Definition: qcombobox.cpp:1302
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ _q_updateIndexBeforeChange()

void QComboBoxPrivate::_q_updateIndexBeforeChange ( )

Definition at line 1078 of file qcombobox.cpp.

1079 {
1081 }
int row() const
Returns the row this persistent model index refers to.
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406

◆ adjustComboBoxSize()

void QComboBoxPrivate::adjustComboBoxSize ( )

Definition at line 351 of file qcombobox.cpp.

352 {
354 }
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
QComboBoxPrivateContainer * viewContainer()
Definition: qcombobox.cpp:1005
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ computeWidthHint()

int QComboBoxPrivate::computeWidthHint ( ) const

Definition at line 272 of file qcombobox.cpp.

273 {
274  Q_Q(const QComboBox);
275 
276  int width = 0;
277  const int count = q->count();
278  const int iconWidth = q->iconSize().width() + 4;
279  const QFontMetrics &fontMetrics = q->fontMetrics();
280 
281  for (int i = 0; i < count; ++i) {
282  const int textWidth = fontMetrics.width(q->itemText(i));
283  if (q->itemIcon(i).isNull())
284  width = (qMax(width, textWidth));
285  else
286  width = (qMax(width, textWidth + iconWidth));
287  }
288 
290  q->initStyleOption(&opt);
291  QSize tmp(width, 0);
292  tmp = q->style()->sizeFromContents(QStyle::CT_ComboBox, &opt, tmp, q);
293  return tmp.width();
294 }
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ contains()

bool QComboBoxPrivate::contains ( const QString text,
int  role 
)

◆ emitActivated()

void QComboBoxPrivate::emitActivated ( const QModelIndex index)

Definition at line 1282 of file qcombobox.cpp.

1283 {
1284  Q_Q(QComboBox);
1285  if (!index.isValid())
1286  return;
1287  QString text(itemText(index));
1288  emit q->activated(index.row());
1289  emit q->activated(text);
1290 }
QString itemText(const QModelIndex &index) const
Definition: qcombobox.cpp:1312
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
int row() const
Returns the row this model index refers to.
#define emit
Definition: qobjectdefs.h:76
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
#define text
Definition: qobjectdefs.h:80

◆ init()

void QComboBoxPrivate::init ( )

Definition at line 991 of file qcombobox.cpp.

992 {
993  Q_Q(QComboBox);
994  q->setFocusPolicy(Qt::WheelFocus);
998  q->setModel(new QStandardItemModel(0, 1, q));
999  if (!q->isEditable())
1000  q->setAttribute(Qt::WA_InputMethodEnabled, false);
1001  else
1002  q->setAttribute(Qt::WA_InputMethodEnabled);
1003 }
The QStandardItemModel class provides a generic model for storing custom data.
void setLayoutItemMargins(int left, int top, int right, int bottom)
Definition: qwidget.cpp:12860
#define Q_Q(Class)
Definition: qglobal.h:2483
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62

◆ itemIcon()

QIcon QComboBoxPrivate::itemIcon ( const QModelIndex index) const

Definition at line 1750 of file qcombobox.cpp.

1751 {
1752  QVariant decoration = model->data(index, Qt::DecorationRole);
1753  if (decoration.type() == QVariant::Pixmap)
1754  return QIcon(qvariant_cast<QPixmap>(decoration));
1755  else
1756  return qvariant_cast<QIcon>(decoration);
1757 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QAbstractItemModel * model
Definition: qcombobox_p.h:385
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.
Type type() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1901
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60

◆ itemRole()

int QComboBoxPrivate::itemRole ( ) const

Definition at line 1317 of file qcombobox.cpp.

1318 {
1319  return q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole;
1320 }

◆ itemText()

QString QComboBoxPrivate::itemText ( const QModelIndex index) const

Definition at line 1312 of file qcombobox.cpp.

1313 {
1314  return index.isValid() ? model->data(index, itemRole()).toString() : QString();
1315 }
QAbstractItemModel * model
Definition: qcombobox_p.h:385
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
The QString class provides a Unicode character string.
Definition: qstring.h:83
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.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
int itemRole() const
Definition: qcombobox.cpp:1317

◆ keyboardSearchString()

void QComboBoxPrivate::keyboardSearchString ( const QString text)

Definition at line 3216 of file qcombobox.cpp.

3217 {
3218  // use keyboardSearch from the listView so we do not duplicate code
3221  int currentRow = view->currentIndex().row();
3222  view->keyboardSearch(text);
3223  if (currentRow != view->currentIndex().row()) {
3224  setCurrentIndex(view->currentIndex());
3226  }
3227 }
QAbstractItemView * itemView() const
Definition: qcombobox.cpp:514
void emitActivated(const QModelIndex &)
Definition: qcombobox.cpp:1282
int row() const
Returns the row this model index refers to.
QComboBoxPrivateContainer * viewContainer()
Definition: qcombobox.cpp:1005
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
QModelIndex currentIndex() const
Returns the model index of the current item.
void setCurrentIndex(const QModelIndex &index)
Definition: qcombobox.cpp:2109
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
The QAbstractItemView class provides the basic functionality for item view classes.
virtual void keyboardSearch(const QString &search)
Moves to and selects the item best matching the string search.

◆ matchFlags()

Qt::MatchFlags QComboBoxPrivate::matchFlags ( ) const

Definition at line 1187 of file qcombobox.cpp.

1188 {
1189  // Base how duplicates are determined on the autocompletion case sensitivity
1190  Qt::MatchFlags flags = Qt::MatchFixedString;
1191 #ifndef QT_NO_COMPLETER
1193 #endif
1194  flags |= Qt::MatchCaseSensitive;
1195  return flags;
1196 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
QCompleter * completer() const
Returns the current QCompleter that provides completions.
Definition: qlineedit.cpp:686
Qt::CaseSensitivity caseSensitivity
the case sensitivity of the matching
Definition: qcompleter.h:73

◆ modelChanged()

void QComboBoxPrivate::modelChanged ( )

Definition at line 3229 of file qcombobox.cpp.

3230 {
3231  Q_Q(QComboBox);
3232 
3234  sizeHint = QSize();
3236  q->updateGeometry();
3237  }
3238 }
void adjustComboBoxSize()
Definition: qcombobox.cpp:351
#define Q_Q(Class)
Definition: qglobal.h:2483
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ newHoverControl()

QStyle::SubControl QComboBoxPrivate::newHoverControl ( const QPoint pos)

Definition at line 255 of file qcombobox.cpp.

Referenced by updateHoverControl().

256 {
257  Q_Q(QComboBox);
259  q->initStyleOption(&opt);
261  hoverControl = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, pos, q);
263  ? q->style()->subControlRect(QStyle::CC_ComboBox, &opt, hoverControl, q)
264  : QRect();
265  return hoverControl;
266 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyle::SubControl hoverControl
Definition: qcombobox_p.h:404
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
Definition: qstyleoption.h:693

◆ popupGeometry()

QRect QComboBoxPrivate::popupGeometry ( int  screen = -1) const

Definition at line 226 of file qcombobox.cpp.

227 {
228 #ifdef Q_WS_WIN
229  return QApplication::desktop()->screenGeometry(screen);
230 #elif defined Q_WS_X11
231  if (X11->desktopEnvironment == DE_KDE)
232  return QApplication::desktop()->screenGeometry(screen);
233  else
234  return QApplication::desktop()->availableGeometry(screen);
235 #else
236  return QApplication::desktop()->availableGeometry(screen);
237 #endif
238 }
#define X11
Definition: qt_x11_p.h:724
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
const QRect screenGeometry(int screen=-1) const
const QRect availableGeometry(int screen=-1) const

◆ recomputeSizeHint()

QSize QComboBoxPrivate::recomputeSizeHint ( QSize sh) const

Definition at line 296 of file qcombobox.cpp.

297 {
298  Q_Q(const QComboBox);
299  if (!sh.isValid()) {
301  int count = q->count();
302  QSize iconSize = q->iconSize();
303  const QFontMetrics &fm = q->fontMetrics();
304 
305  // text width
306  if (&sh == &sizeHint || minimumContentsLength == 0) {
307  switch (sizeAdjustPolicy) {
310  if (count == 0) {
311  sh.rwidth() = 7 * fm.width(QLatin1Char('x'));
312  } else {
313  for (int i = 0; i < count; ++i) {
314  if (!q->itemIcon(i).isNull()) {
315  hasIcon = true;
316  sh.setWidth(qMax(sh.width(), fm.boundingRect(q->itemText(i)).width() + iconSize.width() + 4));
317  } else {
318  sh.setWidth(qMax(sh.width(), fm.boundingRect(q->itemText(i)).width()));
319  }
320  }
321  }
322  break;
324  for (int i = 0; i < count && !hasIcon; ++i)
325  hasIcon = !q->itemIcon(i).isNull();
326  default:
327  ;
328  }
329  } else {
330  for (int i = 0; i < count && !hasIcon; ++i)
331  hasIcon = !q->itemIcon(i).isNull();
332  }
333  if (minimumContentsLength > 0)
334  sh.setWidth(qMax(sh.width(), minimumContentsLength * fm.width(QLatin1Char('X')) + (hasIcon ? iconSize.width() + 4 : 0)));
335 
336 
337  // height
338  sh.setHeight(qMax(qCeil(QFontMetricsF(fm).height()), 14) + 2);
339  if (hasIcon) {
340  sh.setHeight(qMax(sh.height(), iconSize.height() + 2));
341  }
342 
343  // add style and strut values
345  q->initStyleOption(&opt);
346  sh = q->style()->sizeFromContents(QStyle::CT_ComboBox, &opt, sh, q);
347  }
349 }
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
int qCeil(qreal v)
Definition: qmath.h:63
static QSize globalStrut()
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
int width() const
Returns the width.
Definition: qsize.h:126
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
int height() const
Returns the height.
Definition: qsize.h:129
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
The QFontMetricsF class provides font metrics information.
Definition: qfontmetrics.h:145
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
int & rwidth()
Returns a reference to the width.
Definition: qsize.h:141

◆ setCurrentIndex()

void QComboBoxPrivate::setCurrentIndex ( const QModelIndex index)

Definition at line 2109 of file qcombobox.cpp.

2110 {
2111  Q_Q(QComboBox);
2112 
2113  QModelIndex normalized;
2114  if (mi.column() != modelColumn)
2115  normalized = model->index(mi.row(), modelColumn, mi.parent());
2116  if (!normalized.isValid())
2117  normalized = mi; // Fallback to passed index.
2118 
2119  bool indexChanged = (normalized != currentIndex);
2120  if (indexChanged)
2121  currentIndex = QPersistentModelIndex(normalized);
2122  if (lineEdit) {
2123  QString newText = q->itemText(normalized.row());
2124  if (lineEdit->text() != newText)
2125  lineEdit->setText(newText);
2127  }
2128  if (indexChanged) {
2129  q->update();
2131  }
2132 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
QAbstractItemModel * model
Definition: qcombobox_p.h:385
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
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...
void updateLineEditGeometry()
Definition: qcombobox.cpp:1168
QString text
the line edit&#39;s text
Definition: qlineedit.h:72
int row() const
Returns the row this model index refers to.
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
void setText(const QString &)
Definition: qlineedit.cpp:401
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
The QPersistentModelIndex class is used to locate data in a data model.
The QModelIndex class is used to locate data in a data model.
void _q_emitCurrentIndexChanged(const QModelIndex &index)
Definition: qcombobox.cpp:1302

◆ updateArrow()

void QComboBoxPrivate::updateArrow ( QStyle::StateFlag  state)

Definition at line 196 of file qcombobox.cpp.

197 {
198  Q_Q(QComboBox);
199  if (arrowState == state)
200  return;
201  arrowState = state;
203  q->initStyleOption(&opt);
204  q->update(q->style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, q));
205 }
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyle::StateFlag arrowState
Definition: qcombobox_p.h:403
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796

◆ updateDelegate()

void QComboBoxPrivate::updateDelegate ( bool  force = false)
Warning
This function is not part of the public interface. update the default delegate depending on the style's SH_ComboBox_Popup hint, we use a different default delegate.

but we do not change the delegate is the combobox use a custom delegate, unless force is set to true.

Definition at line 1736 of file qcombobox.cpp.

1737 {
1738  Q_Q(QComboBox);
1740  q->initStyleOption(&opt);
1741  if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) {
1742  if (force || qobject_cast<QComboBoxDelegate *>(q->itemDelegate()))
1743  q->setItemDelegate(new QComboMenuDelegate(q->view(), q));
1744  } else {
1745  if (force || qobject_cast<QComboMenuDelegate *>(q->itemDelegate()))
1746  q->setItemDelegate(new QComboBoxDelegate(q->view(), q));
1747  }
1748 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796

◆ updateHoverControl()

bool QComboBoxPrivate::updateHoverControl ( const QPoint pos)

Definition at line 240 of file qcombobox.cpp.

241 {
242 
243  Q_Q(QComboBox);
244  QRect lastHoverRect = hoverRect;
245  QStyle::SubControl lastHoverControl = hoverControl;
246  bool doesHover = q->testAttribute(Qt::WA_Hover);
247  if (lastHoverControl != newHoverControl(pos) && doesHover) {
248  q->update(lastHoverRect);
249  q->update(hoverRect);
250  return true;
251  }
252  return !doesHover;
253 }
SubControl
This enum describes the available sub controls.
Definition: qstyle.h:402
#define Q_Q(Class)
Definition: qglobal.h:2483
QStyle::SubControl hoverControl
Definition: qcombobox_p.h:404
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QStyle::SubControl newHoverControl(const QPoint &pos)
Definition: qcombobox.cpp:255
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ updateLayoutDirection()

void QComboBoxPrivate::updateLayoutDirection ( )

Definition at line 356 of file qcombobox.cpp.

357 {
358  Q_Q(const QComboBox);
360  q->initStyleOption(&opt);
362  q->style()->styleHint(QStyle::SH_ComboBox_LayoutDirection, &opt, q));
363  if (lineEdit)
365  if (container)
367 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
void setLayoutDirection(Qt::LayoutDirection direction)
Definition: qwidget.cpp:5199
#define Q_Q(Class)
Definition: qglobal.h:2483
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
LayoutDirection
Definition: qnamespace.h:1580
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796

◆ updateLineEditGeometry()

void QComboBoxPrivate::updateLineEditGeometry ( )

Definition at line 1168 of file qcombobox.cpp.

Referenced by _q_modelReset().

1169 {
1170  if (!lineEdit)
1171  return;
1172 
1173  Q_Q(QComboBox);
1175  q->initStyleOption(&opt);
1176  QRect editRect = q->style()->subControlRect(QStyle::CC_ComboBox, &opt,
1178  if (!q->itemIcon(q->currentIndex()).isNull()) {
1179  QRect comboRect(editRect);
1180  editRect.setWidth(editRect.width() - q->iconSize().width() - 4);
1181  editRect = QStyle::alignedRect(q->layoutDirection(), Qt::AlignRight,
1182  editRect.size(), comboRect);
1183  }
1184  lineEdit->setGeometry(editRect);
1185 }
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
Definition: qstyle.cpp:2120
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
#define Q_Q(Class)
Definition: qglobal.h:2483
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300

◆ updateViewContainerPaletteAndOpacity()

void QComboBoxPrivate::updateViewContainerPaletteAndOpacity ( )

Definition at line 1111 of file qcombobox.cpp.

1112 {
1113  if (!container)
1114  return;
1115  Q_Q(QComboBox);
1117  q->initStyleOption(&opt);
1118 #ifndef QT_NO_MENU
1119  if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) {
1120  QMenu menu;
1121  menu.ensurePolished();
1122  container->setPalette(menu.palette());
1124  } else
1125 #endif
1126  {
1127  container->setPalette(q->palette());
1129  }
1130  if (lineEdit)
1131  lineEdit->setPalette(q->palette());
1132 }
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
void ensurePolished() const
Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette).
Definition: qwidget.cpp:10024
#define Q_Q(Class)
Definition: qglobal.h:2483
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
qreal windowOpacity() const
const QPalette & palette() const
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
Definition: qstyleoption.h:796
void setWindowOpacity(qreal level)
Definition: qwidget.cpp:11497
void setPalette(const QPalette &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4858

◆ viewContainer()

QComboBoxPrivateContainer * QComboBoxPrivate::viewContainer ( )

Definition at line 1005 of file qcombobox.cpp.

Referenced by adjustComboBoxSize().

1006 {
1007  if (container)
1008  return container;
1009 
1010  Q_Q(QComboBox);
1014  updateDelegate(true);
1017  QObject::connect(container, SIGNAL(itemSelected(QModelIndex)),
1020  SIGNAL(currentChanged(QModelIndex,QModelIndex)),
1022  QObject::connect(container, SIGNAL(resetButton()), q, SLOT(_q_resetButton()));
1023  return container;
1024 }
QAbstractItemModel * model
Definition: qcombobox_p.h:385
#define SLOT(a)
Definition: qobjectdefs.h:226
void _q_itemSelected(const QModelIndex &item)
Definition: qcombobox.cpp:1270
QAbstractItemView * itemView() const
Definition: qcombobox.cpp:514
void _q_emitHighlighted(const QModelIndex &)
Definition: qcombobox.cpp:1292
#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 updateLayoutDirection()
Definition: qcombobox.cpp:356
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
void updateDelegate(bool force=false)
Definition: qcombobox.cpp:1736
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.
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
void setTextElideMode(Qt::TextElideMode mode)
The QModelIndex class is used to locate data in a data model.
void updateViewContainerPaletteAndOpacity()
Definition: qcombobox.cpp:1111

◆ viewContainerPalette()

static QPalette QComboBoxPrivate::viewContainerPalette ( QComboBox cmb)
inlinestatic

Definition at line 413 of file qcombobox_p.h.

414  { return cmb->d_func()->viewContainer()->palette(); }
const QPalette & palette() const

Properties

◆ arrowState

QStyle::StateFlag QComboBoxPrivate::arrowState

Definition at line 403 of file qcombobox_p.h.

Referenced by updateArrow().

◆ autoCompletion

uint QComboBoxPrivate::autoCompletion

Definition at line 393 of file qcombobox_p.h.

◆ autoCompletionCaseSensitivity

Qt::CaseSensitivity QComboBoxPrivate::autoCompletionCaseSensitivity

Definition at line 408 of file qcombobox_p.h.

◆ completer

QPointer<QCompleter> QComboBoxPrivate::completer

Definition at line 411 of file qcombobox_p.h.

◆ container

QComboBoxPrivateContainer* QComboBoxPrivate::container

Definition at line 387 of file qcombobox_p.h.

Referenced by adjustComboBoxSize(), and updateLayoutDirection().

◆ currentIndex

QPersistentModelIndex QComboBoxPrivate::currentIndex

Definition at line 406 of file qcombobox_p.h.

Referenced by _q_modelReset().

◆ duplicatesEnabled

uint QComboBoxPrivate::duplicatesEnabled

Definition at line 394 of file qcombobox_p.h.

◆ frame

uint QComboBoxPrivate::frame

Definition at line 395 of file qcombobox_p.h.

◆ hoverControl

QStyle::SubControl QComboBoxPrivate::hoverControl

Definition at line 404 of file qcombobox_p.h.

Referenced by newHoverControl(), and updateHoverControl().

◆ hoverRect

QRect QComboBoxPrivate::hoverRect

Definition at line 405 of file qcombobox_p.h.

Referenced by newHoverControl(), and updateHoverControl().

◆ iconSize

QSize QComboBoxPrivate::iconSize

Definition at line 391 of file qcombobox_p.h.

Referenced by recomputeSizeHint().

◆ indexBeforeChange

int QComboBoxPrivate::indexBeforeChange

Definition at line 409 of file qcombobox_p.h.

Referenced by _q_modelReset().

◆ inserting

bool QComboBoxPrivate::inserting

Definition at line 400 of file qcombobox_p.h.

◆ insertPolicy

QComboBox::InsertPolicy QComboBoxPrivate::insertPolicy

Definition at line 388 of file qcombobox_p.h.

◆ lineEdit

QLineEdit* QComboBoxPrivate::lineEdit

Definition at line 386 of file qcombobox_p.h.

Referenced by _q_modelReset(), and updateLayoutDirection().

◆ maxCount

int QComboBoxPrivate::maxCount

Definition at line 398 of file qcombobox_p.h.

◆ maxVisibleItems

int QComboBoxPrivate::maxVisibleItems

Definition at line 397 of file qcombobox_p.h.

◆ minimumContentsLength

int QComboBoxPrivate::minimumContentsLength

Definition at line 390 of file qcombobox_p.h.

Referenced by recomputeSizeHint().

◆ minimumSizeHint

QSize QComboBoxPrivate::minimumSizeHint
mutable

Definition at line 401 of file qcombobox_p.h.

◆ model

QAbstractItemModel* QComboBoxPrivate::model

Definition at line 385 of file qcombobox_p.h.

Referenced by _q_modelDestroyed().

◆ modelColumn

int QComboBoxPrivate::modelColumn

Definition at line 399 of file qcombobox_p.h.

◆ padding

uint QComboBoxPrivate::padding

Definition at line 396 of file qcombobox_p.h.

◆ root

QPersistentModelIndex QComboBoxPrivate::root

Definition at line 407 of file qcombobox_p.h.

◆ shownOnce

uint QComboBoxPrivate::shownOnce

Definition at line 392 of file qcombobox_p.h.

◆ sizeAdjustPolicy

QComboBox::SizeAdjustPolicy QComboBoxPrivate::sizeAdjustPolicy

Definition at line 389 of file qcombobox_p.h.

Referenced by recomputeSizeHint().

◆ sizeHint

QSize QComboBoxPrivate::sizeHint
mutable

Definition at line 402 of file qcombobox_p.h.

Referenced by recomputeSizeHint().


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