From 256df2484c62aebb9062dd2559399a136678a430 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 10 Sep 2014 18:09:55 +0400 Subject: Make the default value of QTreeView::indentation() be style dependent Add a new PM_TreeViewIndentaion enum value to QStyle and get the corresponding pixel metric in QTreeView. [ChangeLog][QtWidgets][QTreeView] Indentation is now style-dependent by default. [ChangeLog][QtWidgets][QTreeView] Added resetIndentation(). Change-Id: Ifad7987b8f3c6cd32987b89d95390f33043d8f19 Reviewed-by: Marc Mutz Reviewed-by: Adam Majer --- src/widgets/styles/qcommonstyle.cpp | 3 +++ src/widgets/styles/qstyle.cpp | 3 +++ src/widgets/styles/qstyle.h | 1 + 3 files changed, 7 insertions(+) (limited to 'src/widgets/styles') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index ce6d3d708f..ec289e896b 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4695,6 +4695,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_SubMenuOverlap: ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); break; + case PM_TreeViewIndentation: + ret = int(QStyleHelper::dpiScaled(20.)); + break; default: ret = 0; break; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index fb5a5c9003..c3be177732 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1470,6 +1470,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_TabCloseIndicatorWidth The default width of a close button on a tab in a tab bar. \value PM_TabCloseIndicatorHeight The default height of a close button on a tab in a tab bar. + \value PM_TreeViewIndentation The indentation of items in a tree view. + This enum value has been introduced in Qt 5.4. + \value PM_CustomBase Base value for custom pixel metrics. Custom values must be greater than this value. diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index a2de839404..c647513dca 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -556,6 +556,7 @@ public: PM_ScrollView_ScrollBarSpacing, PM_ScrollView_ScrollBarOverlap, PM_SubMenuOverlap, + PM_TreeViewIndentation, // do not add any values below/greater than this PM_CustomBase = 0xf0000000 -- cgit v1.2.3