diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-11-12 17:13:22 +0300 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-12-11 10:26:41 +0100 |
commit | 53022e04bb578c12cdc9460d7ce4eedefbc8c2e4 (patch) | |
tree | 8c70e70662ee3cb7e7922bb121f42119d570b195 /src/widgets/styles | |
parent | 6386bafb40f9d172f80d20cac824b7018e0a37a4 (diff) |
Make the defaultSectionSize property of QHeaderView style dependent
Add new enum items PM_HeaderDefaultSectionSizeHorizontal and
PM_HeaderDefaultSectionSizeVertical to QStyle and get corresponding
values in QHeaderView. This way we get rid of some magic constants in
QHeaderView and we can have reasonable values for the default section
size for high-DPI displays.
[ChangeLog][QtWidgets][QHeaderView] Default section size is now style-dependent by default.
[ChangeLog][QtWidgets][QHeaderView] Added resetDefaultSectionSize().
Change-Id: I44e152c5cf0bec1e5d78e1e62f47a2d1f761dfbf
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 6 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.h | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 6b8cba1b18..29df1c6387 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4592,6 +4592,12 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_HeaderGripMargin: ret = int(QStyleHelper::dpiScaled(4.)); break; + case PM_HeaderDefaultSectionSizeHorizontal: + ret = int(QStyleHelper::dpiScaled(100.)); + break; + case PM_HeaderDefaultSectionSizeVertical: + ret = int(QStyleHelper::dpiScaled(30.)); + break; case PM_TabBarScrollButtonWidth: ret = int(QStyleHelper::dpiScaled(16.)); break; diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 2d5f676b65..5999ba5431 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1472,6 +1472,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_TreeViewIndentation The indentation of items in a tree view. This enum value has been introduced in Qt 5.4. + \value PM_HeaderDefaultSectionSizeHorizontal The default size of sections + in a horizontal header. This enum value has been introduced in Qt 5.5. + \value PM_HeaderDefaultSectionSizeVertical The default size of sections + in a vertical header. This enum value has been introduced in Qt 5.5. + \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 fa15a0d4c4..225146c5bb 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -550,6 +550,9 @@ public: PM_SubMenuOverlap, PM_TreeViewIndentation, + PM_HeaderDefaultSectionSizeHorizontal, + PM_HeaderDefaultSectionSizeVertical, + // do not add any values below/greater than this PM_CustomBase = 0xf0000000 }; |