summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrey Chichinov <sysdos286@yahoo.com>2015-03-17 22:30:09 -0400
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-03-21 22:08:57 +0000
commitce835b743d8b9f899af30e0b77edb30e62d1475f (patch)
tree7c24c0ef1e9df9a27dd66e819e9fd102d47b5ed3 /src
parent53df9279c0d798d7e7ff4a33863ce341af410200 (diff)
Draw right number of the ticks on a vertical non-styled Slider.
There is a condition to have at least 5 pixels between ticks. The change calculates right amount of the pixels based on the slider orientation. Task-number: QTBUG-45007 Change-Id: I7baac5d5f040653d27d48167f01fea0f245c3253 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/Private/qquickstyleitem.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 2ac692afc..ea7696613 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -679,8 +679,9 @@ void QQuickStyleItem::initStyleOption()
if (opt->singleStep) {
qreal numOfSteps = (opt->maximum - opt->minimum) / opt->singleStep;
// at least 5 pixels between tick marks
- if (numOfSteps && (width() / numOfSteps < 5))
- opt->tickInterval = qRound((5 * numOfSteps / width()) + 0.5) * step();
+ qreal extent = horizontal() ? width() : height();
+ if (numOfSteps && (extent / numOfSteps < 5))
+ opt->tickInterval = qRound((5 * numOfSteps / extent) + 0.5) * step();
else
opt->tickInterval = opt->singleStep;