summaryrefslogtreecommitdiffstats
path: root/demos/embedded/anomaly
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-05-17 18:00:03 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-17 18:00:03 (GMT)
commit91a1f7a1c408052b1d284d6b901819964e338fe5 (patch)
treedf7103f0ea0cb9d98f4b641d72c0f8b0ebdf2498 /demos/embedded/anomaly
parent94a3356d5eb7b255d439efe2699bf3a9b025e8eb (diff)
parent509ef11ab4ba6165c16d9d311c4a1bf7cdfd2528 (diff)
downloadQt-91a1f7a1c408052b1d284d6b901819964e338fe5.zip
Qt-91a1f7a1c408052b1d284d6b901819964e338fe5.tar.gz
Qt-91a1f7a1c408052b1d284d6b901819964e338fe5.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: demos/demos.pro mkspecs/features/resources.prf mkspecs/features/uic.prf src/corelib/io/qurl.cpp src/corelib/tools/qlocale_symbian.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/graphicsview/qgraphicswidget_p.cpp src/gui/graphicsview/qgraphicswidget_p.h src/gui/util/qsystemtrayicon_win.cpp src/multimedia/audio/qaudioinput.cpp tests/auto/qhostinfo/qhostinfo.pro
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();
}