56 #include "QtGui/qcombobox.h" 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" 141 :
QWidget(parent), sliderAction(action)
156 timer.start(100,
this);
169 emit doScroll(sliderAction);
171 emit doScroll(sliderAction);
172 emit doScroll(sliderAction);
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;
189 fast = horizontallyInside && verticallyOutside;
210 void doScroll(
int action);
227 void updateTopBottomMargin();
234 void scrollItemView(
int action);
235 void updateScrollers();
236 void viewDestroyed();
259 #ifdef QT_SOFTKEYS_ENABLED 283 return mCombo->style()->sizeFromContents(
318 if (
const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(v3->widget))
319 rect.
setWidth(view->viewport()->width());
332 return QSize(pm, pm);
348 void updateLineEditGeometry();
349 Qt::MatchFlags matchFlags()
const;
350 void _q_editingFinished();
351 void _q_returnPressed();
358 void _q_modelDestroyed();
359 void _q_modelReset();
360 #ifdef QT_KEYPAD_NAVIGATION 361 void _q_completerActivated();
363 void _q_resetButton();
365 void _q_updateIndexBeforeChange();
367 void _q_rowsRemoved(
const QModelIndex & parent,
int start,
int end);
369 bool updateHoverControl(
const QPoint &
pos);
370 QRect popupGeometry(
int screen = -1)
const;
372 int computeWidthHint()
const;
374 void adjustComboBoxSize();
377 int itemRole()
const;
378 void updateLayoutDirection();
380 void updateDelegate(
bool force =
false);
381 void keyboardSearchString(
const QString &text);
383 void updateViewContainerPaletteAndOpacity();
410 #ifndef QT_NO_COMPLETER 414 {
return cmb->d_func()->viewContainer()->
palette(); }
419 #endif // QT_NO_COMBOBOX 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...
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
The QPainter class performs low-level painting on widgets and other paint devices.
QStyleOptionViewItem viewOptions() const
Reimplemented Function
QAbstractItemModel * model
The QAbstractItemDelegate class is used to display and edit data items from a model.
SubControl
This enum describes the available sub controls.
QFont font
the font used for the item
#define QT_END_NAMESPACE
This macro expands to.
QPersistentModelIndex root
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
void resizeEvent(QResizeEvent *event)
Reimplemented Function
void timerEvent(QTimerEvent *e)
Reimplemented Function
const QBrush & background() const
Use window() instead.
QSize contentsSize() const
SizeAdjustPolicy
This enum specifies how the size hint of the QComboBox should adjust when new content is added or con...
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
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.
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
The QStandardItemModel class provides a generic model for storing custom data.
bool editable
whether or not the combobox is editable or not
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user...
static bool isSeparator(const QModelIndex &index)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
QTimer blockMouseReleaseTimer
bool event(QEvent *e)
Reimplemented Function
QComboBoxPrivateScroller * top
QStyle::SubControl hoverControl
QComboBoxPrivateContainer * container
QStyle::StateFlag arrowState
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QStyleOptionViewItemV3 class is used to describe the parameters necessary for drawing a frame in ...
Qt::CaseSensitivity autoCompletionCaseSensitivity
void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
The QStyleOption class stores the parameters used by QStyle functions.
QComboBox::InsertPolicy insertPolicy
QComboBoxPrivateScroller * bottom
void initFrom(const QWidget *w)
void resizeContents(int width, int height)
Resize the internal contents to width and height and set the scroll bar ranges accordingly.
QSize size() const
Returns the size of the rectangle.
The QHideEvent class provides an event which is sent after a widget is hidden.
The QComboBox widget is a combined button and popup list.
The QResizeEvent class contains event parameters for resize events.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
bool showDecorationSelected
whether the decoration should be highlighted on selected items
static void setSeparator(QAbstractItemModel *model, const QModelIndex &index)
static bool isSeparator(register char c)
The QShowEvent class provides an event that is sent when a widget is shown.
QComboBox::SizeAdjustPolicy sizeAdjustPolicy
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
The QAbstractItemModel class provides the abstract interface for item model classes.
The QMouseEvent class contains parameters that describe a mouse event.
QPersistentModelIndex currentIndex
QPalette palette
the palette that should be used when painting the control
void paintEvent(QPaintEvent *e)
Reimplemented Function
The QAbstractItemView class provides the basic functionality for item view classes.
#define Q_DECLARE_PUBLIC(Class)
The QListView class provides a list or icon view onto a model.
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QTimerEvent class contains parameters that describe a timer event.
The QPersistentModelIndex class is used to locate data in a data model.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
The QItemDelegate class provides display and editing facilities for data items from a model...
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
QObject * parent() const
Returns a pointer to the parent object.
int minimumContentsLength
The QPoint class defines a point in the plane using integer precision.
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.
void setWidth(int w)
Sets the width of the rectangle to the given width.
The QRect class defines a rectangle in the plane using integer precision.
#define Q_AUTOTEST_EXPORT
static QPalette viewContainerPalette(QComboBox *cmb)
State state() const
Returns the item view's state.
int y() const
Returns the y coordinate of this point.
The QLineEdit widget is a one-line text editor.
QPointer< QCompleter > completer
The QBasicTimer class provides timer events for objects.
The QSize class defines the size of a two-dimensional object using integer point precision.
QComboBoxListView(QComboBox *cmb=0)
QComboBoxDelegate(QObject *parent, QComboBox *cmb)
int x() const
Returns the x coordinate of this point.
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 QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
The QStandardItem class provides an item for use with the QStandardItemModel class.
The QTimer class provides repetitive and single-shot timers.
void resizeEvent(QResizeEvent *e)
Reimplemented Function
const QRect & rect() const
Returns the rectangle that needs to be updated.
QPoint initialClickPosition
The QPaintEvent class contains event parameters for paint events.
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.
The QFrame class is the base class of widgets that can have a frame.
StateFlag
This enum describes flags that are used when drawing primitive elements.
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
QRect rect
the area that should be used for various calculations and painting
QStyleOptionViewItem viewOptions() const
Reimplemented Function
The QAction class provides an abstract user interface action that can be inserted into widgets...
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
The QPalette class contains color groups for each widget state.
QBasicTimer adjustSizeTimer
The QIcon class provides scalable icons in different modes and states.