From 54e74c515c74e3e0bc0c147e69a45cbe34bcb8e0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Thu, 18 Oct 2018 20:56:06 +0200 Subject: Itemviews: mark some functions as deprecated Mark some long deprecated functions as deprecated so they can be removed with Qt6. Change-Id: I2ccd21c829c954b6a3662799070682dbe71fd693 Reviewed-by: Shawn Rutledge Reviewed-by: Luca Beldi --- src/widgets/itemviews/qlistwidget.h | 16 ++++++++++++---- src/widgets/itemviews/qtablewidget.h | 16 ++++++++++++---- src/widgets/itemviews/qtreewidget.h | 16 ++++++++++++---- 3 files changed, 36 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index 947fdb1a2f..d3b27d201a 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -114,20 +114,28 @@ public: inline void setTextAlignment(int alignment) { setData(Qt::TextAlignmentRole, alignment); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QListWidgetItem::background() instead") inline QColor backgroundColor() const - { return qvariant_cast(data(Qt::BackgroundColorRole)); } + { return qvariant_cast(data(Qt::BackgroundRole)); } + QT_DEPRECATED_X ("Use QListWidgetItem::setBackground() instead") virtual void setBackgroundColor(const QColor &color) - { setData(Qt::BackgroundColorRole, color); } + { setData(Qt::BackgroundRole, color); } +#endif inline QBrush background() const { return qvariant_cast(data(Qt::BackgroundRole)); } inline void setBackground(const QBrush &brush) { setData(Qt::BackgroundRole, brush); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QListWidgetItem::foreground() instead") inline QColor textColor() const - { return qvariant_cast(data(Qt::TextColorRole)); } + { return qvariant_cast(data(Qt::ForegroundRole)); } + QT_DEPRECATED_X ("Use QListWidgetItem::setForeground() instead") inline void setTextColor(const QColor &color) - { setData(Qt::TextColorRole, color); } + { setData(Qt::ForegroundRole, color); } +#endif inline QBrush foreground() const { return qvariant_cast(data(Qt::ForegroundRole)); } diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 9de27d164f..be629264f8 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -131,20 +131,28 @@ public: inline void setTextAlignment(int alignment) { setData(Qt::TextAlignmentRole, alignment); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QTableWidgetItem::background() instead") inline QColor backgroundColor() const - { return qvariant_cast(data(Qt::BackgroundColorRole)); } + { return qvariant_cast(data(Qt::BackgroundRole)); } + QT_DEPRECATED_X ("Use QTableWidgetItem::setBackground() instead") inline void setBackgroundColor(const QColor &color) - { setData(Qt::BackgroundColorRole, color); } + { setData(Qt::BackgroundRole, color); } +#endif inline QBrush background() const { return qvariant_cast(data(Qt::BackgroundRole)); } inline void setBackground(const QBrush &brush) { setData(Qt::BackgroundRole, brush); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QTableWidgetItem::foreground() instead") inline QColor textColor() const - { return qvariant_cast(data(Qt::TextColorRole)); } + { return qvariant_cast(data(Qt::ForegroundRole)); } + QT_DEPRECATED_X ("Use QTableWidgetItem::setForeground() instead") inline void setTextColor(const QColor &color) - { setData(Qt::TextColorRole, color); } + { setData(Qt::ForegroundRole, color); } +#endif inline QBrush foreground() const { return qvariant_cast(data(Qt::ForegroundRole)); } diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 975f208702..5044ec9e02 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -134,20 +134,28 @@ public: inline void setTextAlignment(int column, int alignment) { setData(column, Qt::TextAlignmentRole, alignment); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QTreeWidgetItem::background() instead") inline QColor backgroundColor(int column) const - { return qvariant_cast(data(column, Qt::BackgroundColorRole)); } + { return qvariant_cast(data(column, Qt::BackgroundRole)); } + QT_DEPRECATED_X ("Use QTreeWidgetItem::setBackground() instead") inline void setBackgroundColor(int column, const QColor &color) - { setData(column, Qt::BackgroundColorRole, color); } + { setData(column, Qt::BackgroundRole, color); } +#endif inline QBrush background(int column) const { return qvariant_cast(data(column, Qt::BackgroundRole)); } inline void setBackground(int column, const QBrush &brush) { setData(column, Qt::BackgroundRole, brush); } +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use QTreeWidgetItem::foreground() instead") inline QColor textColor(int column) const - { return qvariant_cast(data(column, Qt::TextColorRole)); } + { return qvariant_cast(data(column, Qt::ForegroundRole)); } + QT_DEPRECATED_X ("Use QTreeWidgetItem::setForeground() instead") inline void setTextColor(int column, const QColor &color) - { setData(column, Qt::TextColorRole, color); } + { setData(column, Qt::ForegroundRole, color); } +#endif inline QBrush foreground(int column) const { return qvariant_cast(data(column, Qt::ForegroundRole)); } -- cgit v1.2.3