12#if QT_CONFIG(textedit)
29#include <private/qitemeditorfactory_p.h>
32#include <private/qabstractitemdelegate_p.h>
33#include <private/qabstractitemmodel_p.h>
34#include <private/qtextengine_p.h>
35#include <private/qlayoutengine_p.h>
38#if QT_CONFIG(tableview)
259 index.multiData(modelRoleDataSpan);
264 option->font = qvariant_cast<QFont>(*value).resolve(
option->font);
270 option->displayAlignment = QtPrivate::legacyFlagValueFromModelData<Qt::Alignment>(*
value);
278 option->features |= QStyleOptionViewItem::HasCheckIndicator;
279 option->checkState = QtPrivate::legacyEnumValueFromModelData<Qt::CheckState>(*
value);
284 option->features |= QStyleOptionViewItem::HasDecoration;
285 switch (
value->userType()) {
286 case QMetaType::QIcon: {
288 if (
option->icon.isNull()) {
289 option->features &= ~QStyleOptionViewItem::HasDecoration;
306 case QMetaType::QColor: {
312 case QMetaType::QImage: {
315 option->decorationSize =
image.deviceIndependentSize().toSize();
318 case QMetaType::QPixmap: {
321 option->decorationSize =
pixmap.deviceIndependentSize().toSize();
331 option->features |= QStyleOptionViewItem::HasDisplay;
336 option->backgroundBrush = qvariant_cast<QBrush>(*
value);
339 option->styleObject =
nullptr;
392 return qvariant_cast<QSize>(
value);
409 const QStyleOptionViewItem &
option,
414 if (!
index.isValid())
431 QByteArray n = editor->metaObject()->userProperty().name();
436 editor->setProperty(
n,
v);
457 QByteArray n = editor->metaObject()->userProperty().name();
459 n =
d->editorFactory()->valuePropertyName(
470 const QStyleOptionViewItem &
option,
483#if QT_CONFIG(tableview) && QT_CONFIG(lineedit)
484 if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(
widget))
488 opt.showDecorationSelected =
true;
492 editor->setGeometry(geom);
555 return d->editorEventFilter(
object,
event);
563 const QStyleOptionViewItem &
option,
577 if (!
value.isValid())
587 QStyleOptionViewItem viewOpt(
option);
616#include "moc_qstyleditemdelegate.cpp"
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.
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
static QStyle * style()
Returns the application's style object.
\reentrant \inmodule QtGui
The QIcon class provides scalable icons in different modes and states.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
State
This enum describes the state for which a pixmap is intended to be used.
The QItemEditorFactory class provides widgets for editing item data in views and delegates.
static const QItemEditorFactory * defaultFactory()
Returns the default item editor factory.
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
constexpr QVariant * dataForRole(int role) const
Returns the data associated with the first QModelRoleData in the span that has its role equal to role...
QObject * parent() const
Returns a pointer to the parent object.
The QPainter class performs low-level painting on widgets and other paint devices.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
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
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
Qt::MouseButton button() const
Returns the button that caused the event.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
QVariant data(const QModelIndex &item, int role=Qt::DisplayRole) const override
Returns the value for the specified item and role.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_ItemView_ShowDecorationSelected
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const =0
Returns the sub-area for the given element as described in the provided style option.
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.
@ SE_ItemViewItemCheckIndicator
QItemEditorFactory * factory
static const QWidget * widget(const QStyleOptionViewItem &option)
QStyledItemDelegatePrivate()
std::array< QModelRoleData, 7 > modelRoleData
const QItemEditorFactory * editorFactory() const
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Sets the data to be displayed and edited by the editor from the data model item specified by the mode...
virtual QString displayText(const QVariant &value, const QLocale &locale) const
This function returns the string that the delegate will use to display the Qt::DisplayRole of the mod...
QStyledItemDelegate(QObject *parent=nullptr)
Constructs an item delegate with the given parent.
~QStyledItemDelegate()
Destroys the item delegate.
void setItemEditorFactory(QItemEditorFactory *factory)
Sets the editor factory to be used by the item delegate to be the factory specified.
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
\reimp
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Gets data from the editor widget and stores it in the specified model at the item index.
virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
Initialize option with the values using the index index.
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Updates the editor for the item specified by index according to the style option given.
QItemEditorFactory * itemEditorFactory() const
Returns the editor factory used by the item delegate.
bool eventFilter(QObject *object, QEvent *event) override
Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns...
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the widget used to edit the item specified by index for editing.
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.
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
QSqlQueryModel * model
[16]
QItemEditorFactory * factory
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent