Qt 4.8
qcombobox_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QCOMBOBOX_P_H
43 #define QCOMBOBOX_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "QtGui/qcombobox.h"
57 
58 #ifndef QT_NO_COMBOBOX
59 #include "QtGui/qabstractslider.h"
60 #include "QtGui/qapplication.h"
61 #include "QtGui/qitemdelegate.h"
62 #include "QtGui/qstandarditemmodel.h"
63 #include "QtGui/qlineedit.h"
64 #include "QtGui/qlistview.h"
65 #include "QtGui/qpainter.h"
66 #include "QtGui/qstyle.h"
67 #include "QtGui/qstyleoption.h"
68 #include "QtCore/qhash.h"
69 #include "QtCore/qpair.h"
70 #include "QtCore/qtimer.h"
71 #include "private/qwidget_p.h"
72 #include "QtCore/qpointer.h"
73 #include "QtGui/qcompleter.h"
74 #include "QtGui/qevent.h"
75 #include "QtCore/qdebug.h"
76 
77 #include <limits.h>
78 
80 
81 class QAction;
82 
84 {
85  Q_OBJECT
86 public:
87  QComboBoxListView(QComboBox *cmb = 0) : combo(cmb) {}
88 
89 protected:
91  {
94  }
95 
97  {
99  option.showDecorationSelected = true;
100  if (combo)
101  option.font = combo->font();
102  return option;
103  }
104 
106  {
107  if (combo) {
109  opt.initFrom(combo);
110  opt.editable = combo->isEditable();
112  //we paint the empty menu area to avoid having blank space that can happen when scrolling
113  QStyleOptionMenuItem menuOpt;
114  menuOpt.initFrom(this);
115  menuOpt.palette = palette();
116  menuOpt.state = QStyle::State_None;
118  menuOpt.menuRect = e->rect();
119  menuOpt.maxIconWidth = 0;
120  menuOpt.tabWidth = 0;
121  QPainter p(viewport());
122  combo->style()->drawControl(QStyle::CE_MenuEmptyArea, &menuOpt, &p, this);
123  }
124  }
126  }
127 
128 private:
130 };
131 
132 
133 class QStandardItemModel;
134 
136 {
137  Q_OBJECT
138 
139 public:
141  : QWidget(parent), sliderAction(action)
142  {
145  }
146  QSize sizeHint() const {
147  return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight));
148  }
149 
150 protected:
151  inline void stopTimer() {
152  timer.stop();
153  }
154 
155  inline void startTimer() {
156  timer.start(100, this);
157  fast = false;
158  }
159 
160  void enterEvent(QEvent *) {
161  startTimer();
162  }
163 
164  void leaveEvent(QEvent *) {
165  stopTimer();
166  }
168  if (e->timerId() == timer.timerId()) {
169  emit doScroll(sliderAction);
170  if (fast) {
171  emit doScroll(sliderAction);
172  emit doScroll(sliderAction);
173  }
174  }
175  }
177  stopTimer();
178  }
179 
181  {
182  // Enable fast scrolling if the cursor is directly above or below the popup.
183  const int mouseX = e->pos().x();
184  const int mouseY = e->pos().y();
185  const bool horizontallyInside = pos().x() < mouseX && mouseX < rect().right() + 1;
186  const bool verticallyOutside = (sliderAction == QAbstractSlider::SliderSingleStepAdd) ?
187  rect().bottom() + 1 < mouseY : mouseY < pos().y();
188 
189  fast = horizontallyInside && verticallyOutside;
190  }
191 
193  QPainter p(this);
194  QStyleOptionMenuItem menuOpt;
195  menuOpt.init(this);
197  menuOpt.menuRect = rect();
198  menuOpt.maxIconWidth = 0;
199  menuOpt.tabWidth = 0;
201  if (sliderAction == QAbstractSlider::SliderSingleStepAdd)
202  menuOpt.state |= QStyle::State_DownArrow;
203 #ifndef Q_WS_S60
204  p.eraseRect(rect());
205 #endif
206  style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p);
207  }
208 
209 Q_SIGNALS:
210  void doScroll(int action);
211 
212 private:
215  bool fast;
216 };
217 
219 {
220  Q_OBJECT
221 
222 public:
224  QAbstractItemView *itemView() const;
225  void setItemView(QAbstractItemView *itemView);
226  int spacing() const;
227  void updateTopBottomMargin();
228 
232 
233 public Q_SLOTS:
234  void scrollItemView(int action);
235  void updateScrollers();
236  void viewDestroyed();
237 
238 protected:
239  void changeEvent(QEvent *e);
240  bool eventFilter(QObject *o, QEvent *e);
241  void mousePressEvent(QMouseEvent *e);
243  void showEvent(QShowEvent *e);
244  void hideEvent(QHideEvent *e);
246  void leaveEvent(QEvent *e);
247  void resizeEvent(QResizeEvent *e);
248  QStyleOptionComboBox comboStyleOption() const;
249 
250 Q_SIGNALS:
251  void itemSelected(const QModelIndex &);
252  void resetButton();
253 
254 private:
259 #ifdef QT_SOFTKEYS_ENABLED
260  QAction *selectAction;
261  QAction *cancelAction;
262 #endif
263 };
264 
266 { Q_OBJECT
267 public:
269 
270 protected:
271  void paint(QPainter *painter,
272  const QStyleOptionViewItem &option,
273  const QModelIndex &index) const {
274  QStyleOptionMenuItem opt = getStyleOption(option, index);
275 #ifndef Q_WS_S60
276  painter->fillRect(option.rect, opt.palette.background());
277 #endif
278  mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo);
279  }
281  const QModelIndex &index) const {
282  QStyleOptionMenuItem opt = getStyleOption(option, index);
283  return mCombo->style()->sizeFromContents(
284  QStyle::CT_MenuItem, &opt, option.rect.size(), mCombo);
285  }
286 
287 private:
288  QStyleOptionMenuItem getStyleOption(const QStyleOptionViewItem &option,
289  const QModelIndex &index) const;
291 };
292 
293 // Note that this class is intentionally not using QStyledItemDelegate
294 // Vista does not use the new theme for combo boxes and there might
295 // be other side effects from using the new class
297 { Q_OBJECT
298 public:
299  QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {}
300 
301  static bool isSeparator(const QModelIndex &index) {
302  return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator");
303  }
305  model->setData(index, QString::fromLatin1("separator"), Qt::AccessibleDescriptionRole);
306  if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(model))
307  if (QStandardItem *item = m->itemFromIndex(index))
308  item->setFlags(item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled));
309  }
310 
311 protected:
312  void paint(QPainter *painter,
313  const QStyleOptionViewItem &option,
314  const QModelIndex &index) const {
315  if (isSeparator(index)) {
316  QRect rect = option.rect;
317  if (const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3*>(&option))
318  if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(v3->widget))
319  rect.setWidth(view->viewport()->width());
320  QStyleOption opt;
321  opt.rect = rect;
322  mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, mCombo);
323  } else {
324  QItemDelegate::paint(painter, option, index);
325  }
326  }
327 
329  const QModelIndex &index) const {
330  if (isSeparator(index)) {
331  int pm = mCombo->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, mCombo);
332  return QSize(pm, pm);
333  }
334  return QItemDelegate::sizeHint(option, index);
335  }
336 private:
338 };
339 
341 {
343 public:
346  void init();
347  QComboBoxPrivateContainer* viewContainer();
348  void updateLineEditGeometry();
349  Qt::MatchFlags matchFlags() const;
350  void _q_editingFinished();
351  void _q_returnPressed();
352  void _q_complete();
353  void _q_itemSelected(const QModelIndex &item);
354  bool contains(const QString &text, int role);
355  void emitActivated(const QModelIndex&);
356  void _q_emitHighlighted(const QModelIndex&);
357  void _q_emitCurrentIndexChanged(const QModelIndex &index);
358  void _q_modelDestroyed();
359  void _q_modelReset();
360 #ifdef QT_KEYPAD_NAVIGATION
361  void _q_completerActivated();
362 #endif
363  void _q_resetButton();
364  void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
365  void _q_updateIndexBeforeChange();
366  void _q_rowsInserted(const QModelIndex & parent, int start, int end);
367  void _q_rowsRemoved(const QModelIndex & parent, int start, int end);
368  void updateArrow(QStyle::StateFlag state);
369  bool updateHoverControl(const QPoint &pos);
370  QRect popupGeometry(int screen = -1) const;
371  QStyle::SubControl newHoverControl(const QPoint &pos);
372  int computeWidthHint() const;
373  QSize recomputeSizeHint(QSize &sh) const;
374  void adjustComboBoxSize();
375  QString itemText(const QModelIndex &index) const;
376  QIcon itemIcon(const QModelIndex &index) const;
377  int itemRole() const;
378  void updateLayoutDirection();
379  void setCurrentIndex(const QModelIndex &index);
380  void updateDelegate(bool force = false);
381  void keyboardSearchString(const QString &text);
382  void modelChanged();
383  void updateViewContainerPaletteAndOpacity();
384 
395  uint frame : 1;
396  uint padding : 26;
398  int maxCount;
400  bool inserting;
402  mutable QSize sizeHint;
410 #ifndef QT_NO_COMPLETER
412 #endif
414  { return cmb->d_func()->viewContainer()->palette(); }
415 };
416 
418 
419 #endif // QT_NO_COMBOBOX
420 
421 #endif // QCOMBOBOX_P_H
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
Definition: qcombobox_p.h:312
QPoint pos() const
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
Definition: qobject.cpp:1623
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
QRect menuRect
the rectangle for the entire menu
Definition: qstyleoption.h:449
QLineEdit * lineEdit
Definition: qcombobox_p.h:386
QStyleOptionViewItem viewOptions() const
Reimplemented Function
Definition: qcombobox_p.h:96
QAbstractItemModel * model
Definition: qcombobox_p.h:385
int spacing() const
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qwidget.cpp:9842
SubControl
This enum describes the available sub controls.
Definition: qstyle.h:402
QFont font
the font used for the item
Definition: qstyleoption.h:552
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QPersistentModelIndex root
Definition: qcombobox_p.h:407
QComboMenuDelegate(QObject *parent, QComboBox *cmb)
Definition: qcombobox_p.h:268
QComboBox * mCombo
Definition: qcombobox_p.h:290
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionMenuItem class is used to describe the parameter necessary for drawing a menu item...
Definition: qstyleoption.h:435
void resizeEvent(QResizeEvent *event)
Reimplemented Function
Definition: qcombobox_p.h:90
void timerEvent(QTimerEvent *e)
Reimplemented Function
Definition: qlistview.cpp:846
QSize sizeHint() const
Definition: qcombobox_p.h:146
const QBrush & background() const
Use window() instead.
Definition: qpalette.h:134
virtual void leaveEvent(QEvent *)
This event handler can be reimplemented in a subclass to receive widget leave events which are passed...
Definition: qwidget.cpp:9491
QSize contentsSize() const
Definition: qlistview.cpp:759
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
SizeAdjustPolicy
This enum specifies how the size hint of the QComboBox should adjust when new content is added or con...
Definition: qcombobox.h:144
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
int maxIconWidth
the maximum icon width for the icon in the menu item
Definition: qstyleoption.h:452
void init(const QWidget *w)
Use initFrom(widget) instead.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void paintEvent(QPaintEvent *e)
Reimplemented Function
Definition: qlistview.cpp:996
The QStandardItemModel class provides a generic model for storing custom data.
EventLoopTimerRef timer
bool editable
whether or not the combobox is editable or not
Definition: qstyleoption.h:802
#define Q_SLOTS
Definition: qobjectdefs.h:71
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_SIGNALS
Definition: qobjectdefs.h:72
InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user...
Definition: qcombobox.h:119
int height() const
static bool isSeparator(const QModelIndex &index)
Definition: qcombobox_p.h:301
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
Definition: qevent.h:95
QStyle * style() const
Definition: qwidget.cpp:2742
bool event(QEvent *e)
Reimplemented Function
Definition: qlistview.cpp:1693
QComboBoxPrivateScroller * top
Definition: qcombobox_p.h:257
QStyle::SubControl hoverControl
Definition: qcombobox_p.h:404
QWidget * viewport() const
Returns the viewport widget.
QComboBoxPrivateContainer * container
Definition: qcombobox_p.h:387
void mouseMoveEvent(QMouseEvent *e)
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events ...
Definition: qcombobox_p.h:180
QStyle::StateFlag arrowState
Definition: qcombobox_p.h:403
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void hideEvent(QHideEvent *)
This event handler can be reimplemented in a subclass to receive widget hide events.
Definition: qcombobox_p.h:176
The QStyleOptionViewItemV3 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:590
Qt::CaseSensitivity autoCompletionCaseSensitivity
Definition: qcombobox_p.h:408
void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qframe.cpp:574
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
QComboBox::InsertPolicy insertPolicy
Definition: qcombobox_p.h:388
QComboBoxPrivateScroller * bottom
Definition: qcombobox_p.h:258
static bool init
int width() const
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
void resizeContents(int width, int height)
Resize the internal contents to width and height and set the scroll bar ranges accordingly.
Definition: qlistview.cpp:750
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
#define emit
Definition: qobjectdefs.h:76
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
This pure abstract function must be reimplemented if you want to provide custom rendering.
Definition: qcombobox_p.h:280
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition: qevent.h:388
const QPalette & palette() const
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
QComboBox * combo
Definition: qcombobox_p.h:129
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
void leaveEvent(QEvent *)
This event handler can be reimplemented in a subclass to receive widget leave events which are passed...
Definition: qcombobox_p.h:164
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346
bool showDecorationSelected
whether the decoration should be highlighted on selected items
Definition: qstyleoption.h:553
static void setSeparator(QAbstractItemModel *model, const QModelIndex &index)
Definition: qcombobox_p.h:304
unsigned int uint
Definition: qglobal.h:996
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
This pure abstract function must be reimplemented if you want to provide custom rendering.
Definition: qcombobox_p.h:271
void timerEvent(QTimerEvent *e)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qcombobox_p.h:167
static bool isSeparator(register char c)
MenuItemType menuItemType
the type of menu item
Definition: qstyleoption.h:445
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
QComboBoxPrivateScroller(QAbstractSlider::SliderAction action, QWidget *parent)
Definition: qcombobox_p.h:140
QAbstractItemView * view
Definition: qcombobox_p.h:256
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
Definition: qcombobox_p.h:389
QRect rect() const
#define Q_OBJECT
Definition: qobjectdefs.h:157
QAbstractSlider::SliderAction sliderAction
Definition: qcombobox_p.h:213
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
The QAbstractItemModel class provides the abstract interface for item model classes.
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qcombobox_p.h:192
QPersistentModelIndex currentIndex
Definition: qcombobox_p.h:406
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
CaseSensitivity
Definition: qnamespace.h:1451
void paintEvent(QPaintEvent *e)
Reimplemented Function
Definition: qcombobox_p.h:105
The QAbstractItemView class provides the basic functionality for item view classes.
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
The QListView class provides a list or icon view onto a model.
Definition: qlistview.h:57
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
The QPersistentModelIndex class is used to locate data in a data model.
virtual void hideEvent(QHideEvent *)
This event handler can be reimplemented in a subclass to receive widget hide events.
Definition: qwidget.cpp:9864
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
The QItemDelegate class provides display and editing facilities for data items from a model...
Definition: qitemdelegate.h:61
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
Definition: qpainter.cpp:7332
int tabWidth
the tab width for the menu item
Definition: qstyleoption.h:453
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QModelIndex class is used to locate data in a data model.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the size needed by the delegate to display the item specified by index, taking into account t...
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
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
static QPalette viewContainerPalette(QComboBox *cmb)
Definition: qcombobox_p.h:413
State state() const
Returns the item view&#39;s state.
CheckType checkType
the type of checkmark of the menu item
Definition: qstyleoption.h:446
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
quint16 index
QPointer< QCompleter > completer
Definition: qcombobox_p.h:411
void enterEvent(QEvent *)
This event handler can be reimplemented in a subclass to receive widget enter events which are passed...
Definition: qcombobox_p.h:160
The QBasicTimer class provides timer events for objects.
Definition: qbasictimer.h:55
const QFont & font() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QComboBox * mCombo
Definition: qcombobox_p.h:337
QComboBoxListView(QComboBox *cmb=0)
Definition: qcombobox_p.h:87
QComboBoxDelegate(QObject *parent, QComboBox *cmb)
Definition: qcombobox_p.h:299
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the size needed by the delegate to display the item specified by index, taking into account t...
Definition: qcombobox_p.h:328
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
Definition: qstyleoption.h:539
The QStandardItem class provides an item for use with the QStandardItemModel class.
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
void resizeEvent(QResizeEvent *e)
Reimplemented Function
Definition: qlistview.cpp:862
bool isEditable() const
Definition: qcombobox.cpp:1723
const QRect & rect() const
Returns the rectangle that needs to be updated.
Definition: qevent.h:305
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
QAbstractItemModel * model() const
Returns the model that this view is presenting.
static const KeyPair *const end
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55
StateFlag
This enum describes flags that are used when drawing primitive elements.
Definition: qstyle.h:103
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Renders the delegate using the given painter and style option for the item specified by index...
void mousePressEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is pressed while the cursor is insid...
void mouseReleaseEvent(QMouseEvent *e)
Reimplemented Function
Definition: qlistview.cpp:832
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
QStyleOptionViewItem viewOptions() const
Reimplemented Function
Definition: qlistview.cpp:967
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
#define text
Definition: qobjectdefs.h:80
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:60