diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-09-10 18:09:55 +0400 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-09-15 10:05:25 +0200 |
commit | 256df2484c62aebb9062dd2559399a136678a430 (patch) | |
tree | 4cce109a6ac65a53b9b981a2339ffd0b8bf5d1d4 /src/widgets/styles | |
parent | 0c748fb7b109244c03eebbceb400db53af95974c (diff) |
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 <marc.mutz@kdab.com>
Reviewed-by: Adam Majer <adamm@zombino.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.h | 1 |
3 files changed, 7 insertions, 0 deletions
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 |