diff options
author | Peng Wenhao <pengwenhao@uniontech.com> | 2020-08-26 20:36:06 +0800 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-08-26 17:33:45 +0000 |
commit | 4073d3a10e6ea8faf893b5c6faba98a06a5851cc (patch) | |
tree | 1347274a6d49a89c3d3e92ca0124315e1f7fc5ae /src/widgets/itemviews | |
parent | 02d44951154e93bb05e63f25e770ea67f4bd6bcd (diff) |
QColumnView: replace QItemDelegate with QStyledItemDelegate
Resolve remaining Qt6 TODOs
Change-Id: Ida72cbb58dafe4bde5da82996de7434c767bbe63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qcolumnview.cpp | 8 | ||||
-rw-r--r-- | src/widgets/itemviews/qcolumnview_p.h | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 5ad7b5d78c..c09563c375 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1126,14 +1126,12 @@ void QColumnViewPrivate::doLayout() Draws a delegate with a > if an object has children. - \sa {Model/View Programming}, QItemDelegate + \sa {Model/View Programming}, QStyledItemDelegate */ void QColumnViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - drawBackground(painter, option, index ); - bool reverse = (option.direction == Qt::RightToLeft); int width = ((option.rect.height() * 2) / 3); // Modify the options to give us room to add an arrow @@ -1148,7 +1146,7 @@ void QColumnViewDelegate::paint(QPainter *painter, opt.state |= QStyle::State_Selected; } - QItemDelegate::paint(painter, opt, index); + QStyledItemDelegate::paint(painter, opt, index); if (reverse) opt.rect = QRect(option.rect.x(), option.rect.y(), width, option.rect.height()); diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h index 4fa523fd67..25170251f5 100644 --- a/src/widgets/itemviews/qcolumnview_p.h +++ b/src/widgets/itemviews/qcolumnview_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -62,7 +62,7 @@ #endif #include <QtWidgets/qabstractitemdelegate.h> #include <QtWidgets/qabstractitemview.h> -#include <QtWidgets/qitemdelegate.h> +#include <QtWidgets/qstyleditemdelegate.h> #include <qlistview.h> #include <qevent.h> #include <qscrollbar.h> @@ -181,12 +181,11 @@ public: /*! * This is a delegate that will paint the triangle */ -// ### Qt6: QStyledItemDelegate -class QColumnViewDelegate : public QItemDelegate +class QColumnViewDelegate : public QStyledItemDelegate { public: - explicit QColumnViewDelegate(QObject *parent = nullptr) : QItemDelegate(parent) {} + explicit QColumnViewDelegate(QObject *parent = nullptr) : QStyledItemDelegate(parent) {} ~QColumnViewDelegate() {} void paint(QPainter *painter, |