Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qstyleditemdelegate.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSTYLEDITEMDELEGATE_H
5#define QSTYLEDITEMDELEGATE_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractitemdelegate.h>
9#include <QtCore/qstring.h>
10#include <QtGui/qpixmap.h>
11#include <QtCore/qvariant.h>
12
14
15QT_BEGIN_NAMESPACE
16
17class QStyledItemDelegatePrivate;
18class QItemEditorFactory;
19
20class Q_WIDGETS_EXPORT QStyledItemDelegate : public QAbstractItemDelegate
21{
22 Q_OBJECT
23
24public:
25 explicit QStyledItemDelegate(QObject *parent = nullptr);
26 ~QStyledItemDelegate();
27
28 // painting
29 void paint(QPainter *painter,
30 const QStyleOptionViewItem &option, const QModelIndex &index) const override;
31 QSize sizeHint(const QStyleOptionViewItem &option,
32 const QModelIndex &index) const override;
33
34 // editing
35 QWidget *createEditor(QWidget *parent,
36 const QStyleOptionViewItem &option,
37 const QModelIndex &index) const override;
38
39 void setEditorData(QWidget *editor, const QModelIndex &index) const override;
40 void setModelData(QWidget *editor,
41 QAbstractItemModel *model,
42 const QModelIndex &index) const override;
43
44 void updateEditorGeometry(QWidget *editor,
45 const QStyleOptionViewItem &option,
46 const QModelIndex &index) const override;
47
48 // editor factory
49 QItemEditorFactory *itemEditorFactory() const;
50 void setItemEditorFactory(QItemEditorFactory *factory);
51
52 virtual QString displayText(const QVariant &value, const QLocale &locale) const;
53
54protected:
55 virtual void initStyleOption(QStyleOptionViewItem *option,
56 const QModelIndex &index) const;
57
58 bool eventFilter(QObject *object, QEvent *event) override;
59 bool editorEvent(QEvent *event, QAbstractItemModel *model,
60 const QStyleOptionViewItem &option, const QModelIndex &index) override;
61
62private:
63 Q_DECLARE_PRIVATE(QStyledItemDelegate)
64 Q_DISABLE_COPY(QStyledItemDelegate)
65};
66
67QT_END_NAMESPACE
68
69#endif // QSTYLEDITEMDELEGATE_H
The QComboBox widget combines a button with a dropdown list.
Definition qcombobox.h:24
QFileDialogComboBox(QWidget *parent=nullptr)
QStringList history() const
void setHistory(const QStringList &paths)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
void showPopup() override
Displays the list of items in the combobox.
void paintEvent(QPaintEvent *) override
\reimp
void keyPressEvent(QKeyEvent *e) override
FIXME: this is a hack to avoid propagating key press events to the dialog and from there to the "Ok" ...
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
QFileDialogLineEdit(QWidget *parent=nullptr)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
QSize sizeHint() const override
QFileDialogListView(QWidget *parent=nullptr)
void keyPressEvent(QKeyEvent *e) override
void keyPressEvent(QKeyEvent *e) override
QSize sizeHint() const override
QFileDialogTreeView(QWidget *parent)
void setFileDialogPrivate(QFileDialogPrivate *d_pointer)
The QFileDialog class provides a dialog that allows users to select files or directories.
Definition qfiledialog.h:28
\inmodule QtWidgets
The QListView class provides a list or icon view onto a model.
Definition qlistview.h:17
Definition qlist.h:80
\inmodule QtCore
QSideBarDelegate(QWidget *parent=nullptr)
Definition qsidebar_p.h:34
The QStackedWidget class provides a stack of widgets where only one widget is visible at a time.
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
The QToolButton class provides a quick-access button to commands or options, usually used inside a QT...
Definition qtoolbutton.h:20
The QTreeView class provides a default model/view implementation of a tree view.
Definition qtreeview.h:20
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(animation)
static QUrl _qt_get_directory(const QUrl &url, const QFileInfo &local)
static void _qt_init_lastVisited()
QStringList qt_strip_filters(const QStringList &filters)
QStringList qt_make_filter_list(const QString &filter)
static QString fileFromPath(const QString &rootPath, QString path)
static bool isCaseSensitiveFileSystem(const QString &path)
QT_REQUIRE_CONFIG(filedialog)
QT_REQUIRE_CONFIG(itemmodel)
QT_REQUIRE_CONFIG(treeview)
QFileDialogArgs(const QUrl &url={})