summaryrefslogtreecommitdiffstats
path: root/demos/embedded/anomaly
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-05-14 09:59:55 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-05-14 10:08:13 (GMT)
commitaa3dc5ac75505285f7501eb75935414d309c077f (patch)
tree5a317df15526adcadda27ddad918e79819f39e89 /demos/embedded/anomaly
parent2914a47085a30b9f3eaed7d7919a2830ad886f23 (diff)
downloadQt-aa3dc5ac75505285f7501eb75935414d309c077f.zip
Qt-aa3dc5ac75505285f7501eb75935414d309c077f.tar.gz
Qt-aa3dc5ac75505285f7501eb75935414d309c077f.tar.bz2
Fix anomaly demo control strip icon placement
Some icons overlapped in very small screens, so make icon placement little bit smarter. Task-number: QTBUG-10635 Reviewed-by: Janne Anttila
Diffstat (limited to 'demos/embedded/anomaly')
-rw-r--r--demos/embedded/anomaly/src/ControlStrip.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/demos/embedded/anomaly/src/ControlStrip.cpp b/demos/embedded/anomaly/src/ControlStrip.cpp
index dc6d5c2..c9c81c0 100644
--- a/demos/embedded/anomaly/src/ControlStrip.cpp
+++ b/demos/embedded/anomaly/src/ControlStrip.cpp
@@ -66,6 +66,7 @@ QSize ControlStrip::minimumSizeHint() const
void ControlStrip::mousePressEvent(QMouseEvent *event)
{
int h = height();
+ int spacing = qMin(h, (width() - h * 4) / 3);
int x = event->pos().x();
if (x < h) {
@@ -80,13 +81,13 @@ void ControlStrip::mousePressEvent(QMouseEvent *event)
return;
}
- if ((x < width() - 2 * h) && (x > width() - 3 * h)) {
+ if ((x < width() - (h + spacing)) && (x > width() - (h * 2 + spacing))) {
emit forwardClicked();
event->accept();
return;
}
- if ((x < width() - 3 * h) && (x > width() - 5 * h)) {
+ if ((x < width() - (h * 2 + spacing * 2)) && (x > width() - (h * 3 + spacing * 2))) {
emit backClicked();
event->accept();
return;
@@ -96,15 +97,16 @@ void ControlStrip::mousePressEvent(QMouseEvent *event)
void ControlStrip::paintEvent(QPaintEvent *event)
{
int h = height();
- int s = (h - menuPixmap.height()) / 2;
+ int spacing = qMin(h, (width() - h * 4) / 3);
+ int s = (height() - menuPixmap.height()) / 2;
QPainter p(this);
p.fillRect(event->rect(), QColor(32, 32, 32, 192));
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.drawPixmap(s, s, menuPixmap);
p.drawPixmap(width() - h + s, s, closePixmap);
- p.drawPixmap(width() - 3 * h + s, s, forwardPixmap);
- p.drawPixmap(width() - 5 * h + s, s, backPixmap);
+ p.drawPixmap(width() - (h * 2 + spacing) + s, s, forwardPixmap);
+ p.drawPixmap(width() - (h * 3 + spacing * 2) + s, s, backPixmap);
p.end();
}