diff options
author | David Boddie <david.boddie@nokia.com> | 2011-04-28 17:39:11 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-04-28 17:39:11 (GMT) |
commit | 3abaecc3aec4e46f1c5969c33875fd45aa542385 (patch) | |
tree | 58613c5d2b765018c31d0b189e9c5a34d8adde69 /examples/effects | |
parent | ddb22795641253a026b72f752ebc769745dd41be (diff) | |
download | Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.zip Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.gz Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.bz2 |
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
Diffstat (limited to 'examples/effects')
-rw-r--r-- | examples/effects/blurpicker/blurpicker.cpp | 32 | ||||
-rw-r--r-- | examples/effects/blurpicker/blurpicker.desktop | 11 | ||||
-rw-r--r-- | examples/effects/blurpicker/blurpicker.h | 2 | ||||
-rw-r--r-- | examples/effects/blurpicker/blurpicker.pro | 3 | ||||
-rw-r--r-- | examples/effects/blurpicker/main.cpp | 5 | ||||
-rw-r--r-- | examples/effects/fademessage/fademessage.cpp | 11 | ||||
-rw-r--r-- | examples/effects/fademessage/fademessage.desktop | 11 | ||||
-rw-r--r-- | examples/effects/fademessage/fademessage.pro | 4 | ||||
-rw-r--r-- | examples/effects/fademessage/main.cpp | 4 | ||||
-rw-r--r-- | examples/effects/lighting/lighting.cpp | 6 | ||||
-rw-r--r-- | examples/effects/lighting/lighting.desktop | 11 | ||||
-rw-r--r-- | examples/effects/lighting/lighting.h | 3 | ||||
-rw-r--r-- | examples/effects/lighting/lighting.pro | 4 | ||||
-rw-r--r-- | examples/effects/lighting/main.cpp | 5 |
14 files changed, 104 insertions, 8 deletions
diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp index 26e53aa..362ec43 100644 --- a/examples/effects/blurpicker/blurpicker.cpp +++ b/examples/effects/blurpicker/blurpicker.cpp @@ -131,8 +131,34 @@ void BlurPicker::keyPressEvent(QKeyEvent *event) break; } if (m_animation.state() == QAbstractAnimation::Stopped && delta) { - m_animation.setEndValue(m_index + delta); - m_animation.start(); - event->accept(); + m_animation.setEndValue(m_index + delta); + m_animation.start(); + event->accept(); + } +} + +void BlurPicker::resizeEvent(QResizeEvent */*event*/) +{ +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + fitInView(sceneRect(), Qt::KeepAspectRatio); +#endif +} + +void BlurPicker::mousePressEvent(QMouseEvent *event) +{ + int delta = 0; + if(event->x() > (width() / 2)) + { + delta = 1; + } + else + { + delta = -1; + } + + if (m_animation.state() == QAbstractAnimation::Stopped && delta) { + m_animation.setEndValue(m_index + delta); + m_animation.start(); + event->accept(); } } diff --git a/examples/effects/blurpicker/blurpicker.desktop b/examples/effects/blurpicker/blurpicker.desktop new file mode 100644 index 0000000..0863ef7 --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Blur Picker Effect +Exec=/opt/usr/bin/blurpicker +Icon=blurpicker +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/blurpicker/blurpicker.h b/examples/effects/blurpicker/blurpicker.h index fa5743c..af367b9 100644 --- a/examples/effects/blurpicker/blurpicker.h +++ b/examples/effects/blurpicker/blurpicker.h @@ -60,6 +60,8 @@ public: protected: void keyPressEvent(QKeyEvent *event); + void resizeEvent(QResizeEvent *event); + void mousePressEvent(QMouseEvent *event); private: void setupScene(); diff --git a/examples/effects/blurpicker/blurpicker.pro b/examples/effects/blurpicker/blurpicker.pro index 76537a9..f3868c0 100644 --- a/examples/effects/blurpicker/blurpicker.pro +++ b/examples/effects/blurpicker/blurpicker.pro @@ -7,3 +7,6 @@ target.path = $$[QT_INSTALL_EXAMPLES]/effects/blurpicker sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro sources.path = $$[QT_INSTALL_EXAMPLES]/effects/blurpicker INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/effects/blurpicker/main.cpp b/examples/effects/blurpicker/main.cpp index e95b7e0..5138fcc 100644 --- a/examples/effects/blurpicker/main.cpp +++ b/examples/effects/blurpicker/main.cpp @@ -47,8 +47,13 @@ int main(int argc, char **argv) BlurPicker blurPicker; blurPicker.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Application Picker")); + +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + blurPicker.showMaximized(); +#else blurPicker.setFixedSize(400, 300); blurPicker.show(); +#endif return app.exec(); } diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp index 88f9f89..158f049 100644 --- a/examples/effects/fademessage/fademessage.cpp +++ b/examples/effects/fademessage/fademessage.cpp @@ -56,7 +56,6 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent) m_animation->setStartValue(0); m_animation->setEndValue(1); - setRenderHint(QPainter::Antialiasing, true); setFrameStyle(QFrame::NoFrame); } @@ -75,7 +74,7 @@ void FadeMessage::togglePopup() void FadeMessage::setupScene() { - QGraphicsRectItem *parent = m_scene.addRect(0, 0, 400, 600); + QGraphicsRectItem *parent = m_scene.addRect(0, 0, 800, 600); parent->setPen(Qt::NoPen); parent->setZValue(0); @@ -85,7 +84,7 @@ void FadeMessage::setupScene() for (int i = 1; i < 5; ++i) for (int j = 2; j < 5; ++j) { - QGraphicsRectItem *item = m_scene.addRect(i * 50, j * 50, 38, 38); + QGraphicsRectItem *item = m_scene.addRect(i * 50, (j - 1) * 50, 38, 38); item->setParentItem(parent); item->setZValue(1); int hue = 12 * (i * 5 + j); @@ -124,6 +123,10 @@ void FadeMessage::setupScene() press->setText(tr("Press me")); connect(press, SIGNAL(clicked()), SLOT(togglePopup())); m_scene.addWidget(press); + +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + press->move(200, 210); +#else press->move(300, 500); +#endif } - diff --git a/examples/effects/fademessage/fademessage.desktop b/examples/effects/fademessage/fademessage.desktop new file mode 100644 index 0000000..aa22ad7 --- /dev/null +++ b/examples/effects/fademessage/fademessage.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fade Message Effect +Exec=/opt/usr/bin/fademessage +Icon=fademessage +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/fademessage/fademessage.pro b/examples/effects/fademessage/fademessage.pro index cb1fda7..439477d 100644 --- a/examples/effects/fademessage/fademessage.pro +++ b/examples/effects/fademessage/fademessage.pro @@ -12,5 +12,7 @@ sources.files = $$SOURCES \ fademessage.pro sources.path = $$[QT_INSTALL_EXAMPLES]/effects/fademessage -DEPLOYMENT_PLUGIN += qjpeg +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/effects/fademessage/main.cpp b/examples/effects/fademessage/main.cpp index 83d6d8e..8c72a45 100644 --- a/examples/effects/fademessage/main.cpp +++ b/examples/effects/fademessage/main.cpp @@ -48,8 +48,12 @@ int main(int argc, char **argv) FadeMessage widget; widget.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Popup Message with Effect")); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + widget.showMaximized(); +#else widget.setFixedSize(400, 600); widget.show(); +#endif return app.exec(); } diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp index a988ffb..bd23a2d 100644 --- a/examples/effects/lighting/lighting.cpp +++ b/examples/effects/lighting/lighting.cpp @@ -134,3 +134,9 @@ void Lighting::animate() m_scene.update(); } +void Lighting::resizeEvent(QResizeEvent */*event*/) +{ +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + fitInView(sceneRect(), Qt::KeepAspectRatio); +#endif +} diff --git a/examples/effects/lighting/lighting.desktop b/examples/effects/lighting/lighting.desktop new file mode 100644 index 0000000..806b3de --- /dev/null +++ b/examples/effects/lighting/lighting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Lighting Effect +Exec=/opt/usr/bin/lighting +Icon=lighting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/lighting/lighting.h b/examples/effects/lighting/lighting.h index 6a6bc56..5099653 100644 --- a/examples/effects/lighting/lighting.h +++ b/examples/effects/lighting/lighting.h @@ -57,6 +57,9 @@ private slots: private: void setupScene(); +protected: + void resizeEvent(QResizeEvent *event); + private: qreal angle; QGraphicsScene m_scene; diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro index 432d1b5..b816673 100644 --- a/examples/effects/lighting/lighting.pro +++ b/examples/effects/lighting/lighting.pro @@ -6,3 +6,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro sources.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/effects/lighting/main.cpp b/examples/effects/lighting/main.cpp index c75d841..fff3d73 100644 --- a/examples/effects/lighting/main.cpp +++ b/examples/effects/lighting/main.cpp @@ -47,8 +47,13 @@ int main(int argc, char **argv) Lighting lighting; lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows")); + +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + lighting.showMaximized(); +#else lighting.resize(640, 480); lighting.show(); +#endif return app.exec(); } |