18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "QtWidgets/qcombobox.h"
21#include "QtWidgets/qabstractslider.h"
22#include "QtWidgets/qapplication.h"
23#include "QtWidgets/qstyleditemdelegate.h"
24#include "QtGui/qstandarditemmodel.h"
25#include "QtWidgets/qlineedit.h"
26#include "QtWidgets/qlistview.h"
27#include "QtGui/qpainter.h"
28#include "QtWidgets/qstyle.h"
29#include "QtWidgets/qstyleoption.h"
30#include "QtCore/qtimer.h"
31#include "private/qwidget_p.h"
32#include "QtCore/qpointer.h"
33#if QT_CONFIG(completer)
34#include "QtWidgets/qcompleter.h"
36#include "QtGui/qevent.h"
37#include "QtCore/qdebug.h"
54 setScreen(cmb->screen());
67 option->showDecorationSelected =
true;
85 menuOpt.menuRect = e->
rect();
86 menuOpt.maxIconWidth = 0;
87 menuOpt.reservedShortcutWidth = 0;
105 :
QWidget(parent), sliderAction(action)
133 emit doScroll(sliderAction);
135 emit doScroll(sliderAction);
136 emit doScroll(sliderAction);
149 const bool horizontallyInside =
pos().
x() < mouseX && mouseX <
rect().
right() + 1;
153 fast = horizontallyInside && verticallyOutside;
161 menuOpt.menuRect =
rect();
162 menuOpt.maxIconWidth = 0;
163 menuOpt.reservedShortcutWidth = 0;
190 int topMargin()
const;
192 void updateTopBottomMargin();
193 void updateStyleSettings();
200 void scrollItemView(
int action);
201 void hideScrollers();
202 void updateScrollers();
203 void viewDestroyed();
206 void changeEvent(
QEvent *e)
override;
227 bool maybeIgnoreMouseButtonRelease =
false;
243 const QStyleOptionViewItem &
option,
252 return mCombo->style()->sizeFromContents(
286 const QStyleOptionViewItem &
option,
304 return QSize(pm, pm);
320 void updateLineEditGeometry();
321 Qt::MatchFlags matchFlags()
const;
322 void editingFinished();
323 void returnPressed();
330 void modelDestroyed();
333#if QT_CONFIG(completer)
338 void updateIndexBeforeChange();
342 bool updateHoverControl(
const QPoint &
pos);
343 void trySetValidIndex();
344 QRect popupGeometry(
const QPoint &globalPos)
const;
346 int computeWidthHint()
const;
348 void adjustComboBoxSize();
351 int itemRole()
const;
352 void updateLayoutDirection();
354 void updateDelegate(
bool force =
false);
357 void updateViewContainerPaletteAndOpacity();
358 void updateFocusPolicy();
363 void disconnectModel();
366 void cleanupNativePopup();
367 bool showNativePopup();
372 void operator()(
void)
375 cb->d_func()->emitActivated(
cb->d_func()->currentIndex);
399 int minimumContentsLength = 0;
400 int indexBeforeChange = -1;
401 int maxVisibleItems = 10;
404 int placeholderIndex = -1;
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual Q_INVOKABLE bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets the role data for the item at index to value.
The QAbstractItemView class provides the basic functionality for item view classes.
SliderAction
\value SliderNoAction \value SliderSingleStepAdd \value SliderSingleStepSub \value SliderPageStepAdd ...
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
static bool isSeparator(const QModelIndex &index)
QComboBoxDelegate(QObject *parent, QComboBox *cmb)
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
static void setSeparator(QAbstractItemModel *model, const QModelIndex &index)
void resizeEvent(QResizeEvent *event) override
QComboBoxListView(QComboBox *cmb=nullptr)
void initViewItemOption(QStyleOptionViewItem *option) const override
void paintEvent(QPaintEvent *e) override
QPoint initialClickPosition
QBasicTimer adjustSizeTimer
void itemSelected(const QModelIndex &)
QTimer blockMouseReleaseTimer
QPointer< QComboBoxPrivateContainer > container
QPersistentModelIndex currentIndex
QPersistentModelIndex root
std::array< QMetaObject::Connection, 8 > modelConnections
bool contains(const QString &text, int role)
The QComboBox widget combines a button with a dropdown list.
InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user.
SizeAdjustPolicy
This enum specifies how the size hint of the QComboBox should adjust when new content is added or con...
@ AdjustToContentsOnFirstShow
The QFrame class is the base class of widgets that can have a frame.
void setFlags(GraphicsItemFlags flags)
Sets the item flags to flags.
GraphicsItemFlags flags() const
Returns this item's flags.
The QHideEvent class provides an event which is sent after a widget is hidden.
The QIcon class provides scalable icons in different modes and states.
The QLineEdit widget is a one-line text editor.
The QListView class provides a list or icon view onto a model.
void resizeEvent(QResizeEvent *e) override
\reimp
void initViewItemOption(QStyleOptionViewItem *option) const override
\reimp
QSize contentsSize() const
void resizeContents(int width, int height)
void paintEvent(QPaintEvent *e) override
\reimp
int startTimer(int interval, Qt::TimerType timerType=Qt::CoarseTimer)
This is an overloaded function that will start a timer of type timerType and a timeout of interval mi...
The QPaintEvent class contains event parameters for paint events.
const QRect & rect() const
Returns the rectangle that needs to be updated.
The QPainter class performs low-level painting on widgets and other paint devices.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
const QBrush & window() const
Returns the window (general background) brush of the current color group.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QResizeEvent class contains event parameters for resize events.
The QShowEvent class provides an event that is sent when a widget is shown.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
The QStandardItemModel class provides a generic model for storing custom data.
The QStandardItem class provides an item for use with the QStandardItemModel class.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\variable QStyleOptionToolButton::features
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
StateFlag
This enum describes flags that are used when drawing primitive elements.
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
@ PE_IndicatorToolBarSeparator
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given element with the provided painter with the style options specified by option.
SubControl
This enum describes the available sub controls.
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the size needed by the delegate to display the item specified by index, taking into account t...
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Renders the delegate using the given painter and style option for the item specified by index.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
int timerId() const
Returns the ID of the timer if the timer is running; otherwise returns -1.
void stop()
Stops the timer.
int width
the width of the window's geometry
Combined button and popup list for selecting options.
@ AccessibleDescriptionRole
static bool isSeparator(char c)
GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble GLdouble top
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define Q_AUTOTEST_EXPORT
#define QT_REQUIRE_CONFIG(feature)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
QSqlQueryModel * model
[16]
view viewport() -> scroll(dx, dy, deviceRect)