From f54e97726f36c56d9f51f2243493c55ab8cf7bef Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 30 Oct 2019 10:50:41 +0100 Subject: Doc: Add notes about Qt Style Sheets taking precedence ...over setting properties on individual widgets. Task-number: QTBUG-28675 Change-Id: Ic7bfd723ed8970112a9892727170d3bacaa1903f Reviewed-by: Frederik Gladhorn --- src/widgets/itemviews/qtreewidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/widgets/itemviews/qtreewidget.cpp') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index be7ddd8b30..6da5ca0f4c 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1284,6 +1284,9 @@ bool QTreeWidgetItem::isFirstColumnSpanned() const Sets the background brush of the label in the given \a column to the specified \a brush. + \note If \l{Qt Style Sheets} are used on the same widget as setBackground(), + style sheets will take precedence if the settings conflict. + \sa setForeground() */ -- cgit v1.2.3 From 96c27eb710a37780e79e09df2ebce1d5e4922c9d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 25 Jun 2019 20:47:13 +0200 Subject: QList/Table/TreeWidgetItem: Allow reseting values by passing the default value The convenience functions setBackground(), setForeground() and setSizeHint() a default constructed value as 'reset'. This means a default constructed QBrush or QSize is returned in the data() function which leads to an unexpected background or forground color or size hint. Therefore check if the passed value is a default constructed value and set an empty QVariant instead which. [ChangeLog][QtWidgets][ItemViews] The convenience views QList/Table/TreeWidgetItem now treat a default constructed QBrush or QSize as an empty QVariant which allows to reset the values set to it's default values. Task-number: QTBUG-76423 Change-Id: I840570bbad3e5fd8c5b4b58903b4fd0066dbdeb7 Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qtreewidget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/widgets/itemviews/qtreewidget.cpp') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 6d0909108b..cce0773fec 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1285,6 +1285,8 @@ bool QTreeWidgetItem::isFirstColumnSpanned() const Sets the background brush of the label in the given \a column to the specified \a brush. + Setting a default-constructed brush will let the view use the + default color from the style. \note If \l{Qt Style Sheets} are used on the same widget as setBackground(), style sheets will take precedence if the settings conflict. @@ -1314,6 +1316,8 @@ bool QTreeWidgetItem::isFirstColumnSpanned() const Returns the brush used to render the foreground (e.g. text) of the specified \a column. + Setting a default-constructed brush will let the view use the + default color from the style. \sa background() */ @@ -1357,8 +1361,8 @@ bool QTreeWidgetItem::isFirstColumnSpanned() const \since 4.1 Sets the size hint for the tree item in the given \a column to be \a size. - If no size hint is set, the item delegate will compute the size hint based - on the item data. + If no size hint is set or \a size is invalid, the item + delegate will compute the size hint based on the item data. */ /*! -- cgit v1.2.3