summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qcombobox_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-03 10:51:40 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-10 03:15:49 +0200
commitd49a7412f55390e461773f4ffc36a82958d59b6d (patch)
tree20e860fa351f8e52ad8bb332793248a735d7e3bc /src/widgets/widgets/qcombobox_p.h
parentae7442a4e93d4a63f28c1c2692be80a3d87f54a9 (diff)
Derive some item delegates from QStyledItemDelegate
Address a ### Qt6 comment from change 283008e123e5eacb83869682528b2024186634f8, and start using QStyledItemDelegate in more places, so those get proper look and feel. Change-Id: I39767ba99b7942faada1fba0ac241deb35563b63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/widgets/widgets/qcombobox_p.h')
-rw-r--r--src/widgets/widgets/qcombobox_p.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index a7e7af64a1..16ded8f1a4 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -56,7 +56,7 @@
#include "QtWidgets/qabstractslider.h"
#include "QtWidgets/qapplication.h"
-#include "QtWidgets/qitemdelegate.h"
+#include "QtWidgets/qstyleditemdelegate.h"
#include "QtGui/qstandarditemmodel.h"
#include "QtWidgets/qlineedit.h"
#include "QtWidgets/qlistview.h"
@@ -293,14 +293,13 @@ private:
int pressedIndex;
};
-// ### Qt6: QStyledItemDelegate ?
-// Note that this class is intentionally not using QStyledItemDelegate
-// Vista does not use the new theme for combo boxes and there might
-// be other side effects from using the new class
-class Q_AUTOTEST_EXPORT QComboBoxDelegate : public QItemDelegate
-{ Q_OBJECT
+class Q_AUTOTEST_EXPORT QComboBoxDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
public:
- QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {}
+ QComboBoxDelegate(QObject *parent, QComboBox *cmb)
+ : QStyledItemDelegate(parent), mCombo(cmb)
+ {}
static bool isSeparator(const QModelIndex &index) {
return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator");
@@ -324,7 +323,7 @@ protected:
opt.rect = rect;
mCombo->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, mCombo);
} else {
- QItemDelegate::paint(painter, option, index);
+ QStyledItemDelegate::paint(painter, option, index);
}
}
@@ -334,7 +333,7 @@ protected:
int pm = mCombo->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, mCombo);
return QSize(pm, pm);
}
- return QItemDelegate::sizeHint(option, index);
+ return QStyledItemDelegate::sizeHint(option, index);
}
private:
QComboBox *mCombo;