summaryrefslogtreecommitdiffstats
path: root/examples/threads/mandelbrot/mandelbrotwidget.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-25 01:11:52 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-25 01:11:52 +1000
commit6bd691dc5402f22840a3354b08cb6bdc99b01006 (patch)
tree6ef3847a93f501d52fcb01927c6c9f36a94570e5 /examples/threads/mandelbrot/mandelbrotwidget.cpp
parente60f05201f5bc412ec8c02625bcbbca5ba50812c (diff)
parent4d10065c54f9b277f44ed042f4e18858dafdd1df (diff)
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging: (21 commits) Fixed line endings. Update licenseheader text in source files for qtbase Qt module New configure.exe binary Add -qpa option on Windows Use qglobal.h's VERSION number instead of hardcoded current version More examples adjusted to Symbian and Maemo5. (cherry picked from commit a97b9620a584c9b1a2e006873183526b3d7e001e) Doc: Added some details to the accessibility events API documentation. Doc: Fixed qdoc warnings. Doc: Fixed qdoc warnings. Doc: Made an additional change for clarity. Doc: Noted that the example will not work as expected with a mouse. Doc: Fixed qdoc warnings. Doc: Applying a pending change from previous merges. Doc: Fixed qdoc warning. Doc: Fixed qdoc warnings. Doc: Applied pending fixes to API documentation. Doc: Various fixes to documentation, some based on changes in master. Doc: Added missing project and desktop files. Doc: Documented the value returned when no field can be found. Squashed commit of changes from the 4.8-temp branch. ...
Diffstat (limited to 'examples/threads/mandelbrot/mandelbrotwidget.cpp')
-rw-r--r--examples/threads/mandelbrot/mandelbrotwidget.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/threads/mandelbrot/mandelbrotwidget.cpp
index 8dc1f5d811..47eb473425 100644
--- a/examples/threads/mandelbrot/mandelbrotwidget.cpp
+++ b/examples/threads/mandelbrot/mandelbrotwidget.cpp
@@ -44,6 +44,7 @@
#include "mandelbrotwidget.h"
+
//! [0]
const double DefaultCenterX = -0.637011f;
const double DefaultCenterY = -0.0395159f;
@@ -72,6 +73,21 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent)
setCursor(Qt::CrossCursor);
#endif
resize(550, 400);
+
+#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+ ZoomButton *zoomIn = new ZoomButton(tr("Zoom In"), ZoomInFactor, this);
+ ZoomButton *zoomOut = new ZoomButton(tr("Zoom Out"), ZoomOutFactor, this);
+
+ QGridLayout *layout = new QGridLayout(this);
+ layout->addWidget(zoomIn, 0, 1);
+ layout->addWidget(zoomOut, 1, 1);
+ layout->setColumnStretch(0, 10);
+ layout->setRowStretch(2, 10);
+ setLayout(layout);
+
+ connect(zoomIn, SIGNAL(zoom(double)), this, SLOT(zoom(double)));
+ connect(zoomOut, SIGNAL(zoom(double)), this, SLOT(zoom(double)));
+#endif
}
//! [1]
@@ -113,6 +129,7 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
}
//! [8] //! [9]
+#if !defined(Q_WS_S60) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
QString text = tr("Use mouse wheel or the '+' and '-' keys to zoom. "
"Press and hold left mouse button to scroll.");
QFontMetrics metrics = painter.fontMetrics();
@@ -125,6 +142,7 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
painter.setPen(Qt::white);
painter.drawText((width() - textWidth) / 2,
metrics.leading() + metrics.ascent(), text);
+#endif
}
//! [9]