From 21caabc486fb594a29af9b84f172657093e4d662 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 27 Apr 2011 19:16:41 +0200 Subject: Squashed commit of the changes from the mobile-examples repository (4.7-generated-declarative branch). (cherry picked from commit 539311f7b2687e3148ea695ce06fee768abe7b44) --- examples/script/calculator/calculator.pro | 3 + examples/script/calculator/calculator.ui | 770 +++++++++++---------- examples/script/context2d/context2d.pro | 2 + examples/script/context2d/main.cpp | 4 + examples/script/context2d/qcontext2dcanvas.cpp | 4 +- examples/script/customclass/customclass.pro | 3 + examples/script/defaultprototypes/code.js | 2 - .../script/defaultprototypes/defaultprototypes.pro | 1 + examples/script/defaultprototypes/main.cpp | 5 + examples/script/defaultprototypes/prototypes.cpp | 7 + examples/script/helloscript/helloscript.pro | 1 + examples/script/helloscript/main.cpp | 4 + examples/script/marshal/marshal.pro | 3 + examples/script/qscript/qscript.pro | 3 + examples/script/qsdbg/qsdbg.pro | 4 +- examples/script/qstetrix/qstetrix.pro | 5 + examples/script/script.pro | 1 + 17 files changed, 437 insertions(+), 385 deletions(-) (limited to 'examples') diff --git a/examples/script/calculator/calculator.pro b/examples/script/calculator/calculator.pro index 196d3fc..14d3e9a 100644 --- a/examples/script/calculator/calculator.pro +++ b/examples/script/calculator/calculator.pro @@ -13,3 +13,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/calculator INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/calculator/calculator.ui b/examples/script/calculator/calculator.ui index bb519ba..42e612d 100644 --- a/examples/script/calculator/calculator.ui +++ b/examples/script/calculator/calculator.ui @@ -1,7 +1,8 @@ - + + Calculator - - + + 0 0 @@ -9,397 +10,406 @@ 301 - - + + 0 0 - + 314 301 - + - 314 - 301 + 1024 + 768 - + Calculator - - - - 10 - 50 - 91 - 41 - - - - Backspace - - - - - - 110 - 50 - 91 - 41 - - - - Clear - - - - - - 210 - 50 - 91 - 41 - - - - Clear All - - - - - - 10 - 100 - 41 - 41 - - - - MC - - - - - - 10 - 150 - 41 - 41 - - - - MR - - - - - - 10 - 200 - 41 - 41 - - - - MS - - - - - - 10 - 250 - 41 - 41 - - - - M+ - - - - - - 60 - 100 - 41 - 41 - - - - 7 - - - - - - 110 - 100 - 41 - 41 - - - - 8 - - - - - - 160 - 100 - 41 - 41 - - - - 9 - - - - - - 60 - 150 - 41 - 41 - - - - 4 - - - - - - 110 - 150 - 41 - 41 - - - - 5 - - - - - - 160 - 150 - 41 - 41 - - - - 6 - - - - - - 60 - 200 - 41 - 41 - - - - 1 - - - - - - 110 - 200 - 41 - 41 - - - - 2 - - - - - - 160 - 200 - 41 - 41 - - - - 3 - - - - - - 60 - 250 - 41 - 41 - - - - 0 - - - - - - 110 - 250 - 41 - 41 - - - - . - - - - - - 160 - 250 - 41 - 41 - - - - +- - - - - - - 210 - 250 - 41 - 41 - - - - + - - - - - - 210 - 100 - 41 - 41 - - - - / - - - - - - 210 - 150 - 41 - 41 - - - - * - - - - - - 210 - 200 - 41 - 41 - - - - - - - - - - - 260 - 100 - 41 - 41 - - - - Sqrt - - - - - - 260 - 150 - 41 - 41 - - - - x^2 - - - - - - 260 - 200 - 41 - 41 - - - - 1/x - - - - - - 260 - 250 - 41 - 41 - - - - = - - - - - - 10 - 10 - 291 - 31 - - - - 15 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - + + + + + 10 + + + + + + 0 + 0 + + + + Backspace + + + + + + + + 0 + 0 + + + + MC + + + + + + + + 0 + 0 + + + + 7 + + + + + + + + 0 + 0 + + + + 8 + + + + + + + + 0 + 0 + + + + 9 + + + + + + + + 0 + 0 + + + + / + + + + + + + + 0 + 0 + + + + Sqrt + + + + + + + + 0 + 0 + + + + Clear + + + + + + + + 0 + 0 + + + + Clear All + + + + + + + + 0 + 0 + + + + 15 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + + 0 + 0 + + + + MR + + + + + + + + 0 + 0 + + + + 4 + + + + + + + + 0 + 0 + + + + 5 + + + + + + + + 0 + 0 + + + + 6 + + + + + + + + 0 + 0 + + + + * + + + + + + + + 0 + 0 + + + + x^2 + + + + + + + + 0 + 0 + + + + MS + + + + + + + + 0 + 0 + + + + 1 + + + + + + + + 0 + 0 + + + + 2 + + + + + + + + 0 + 0 + + + + 3 + + + + + + + + 0 + 0 + + + + - + + + + + + + + 0 + 0 + + + + 1/x + + + + + + + + 0 + 0 + + + + M+ + + + + + + + + 0 + 0 + + + + 0 + + + + + + + + 0 + 0 + + + + . + + + + + + + + 0 + 0 + + + + +- + + + + + + + + 0 + 0 + + + + + + + + + + + + + 0 + 0 + + + + = + + + + + + diff --git a/examples/script/context2d/context2d.pro b/examples/script/context2d/context2d.pro index 58bc6ab..de1287a 100644 --- a/examples/script/context2d/context2d.pro +++ b/examples/script/context2d/context2d.pro @@ -30,3 +30,5 @@ symbian:{ contextScripts.files = scripts DEPLOYMENT += contextScripts } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/script/context2d/main.cpp b/examples/script/context2d/main.cpp index 3d56910..b646869 100644 --- a/examples/script/context2d/main.cpp +++ b/examples/script/context2d/main.cpp @@ -49,11 +49,15 @@ int main(int argc, char **argv) Window win; bool smallScreen = QApplication::arguments().contains("-small-screen"); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + win.showMaximized(); +#else if (!smallScreen) { win.show(); } else { win.showFullScreen(); } +#endif return app.exec(); } diff --git a/examples/script/context2d/qcontext2dcanvas.cpp b/examples/script/context2d/qcontext2dcanvas.cpp index bb08b79..f6799e8 100644 --- a/examples/script/context2d/qcontext2dcanvas.cpp +++ b/examples/script/context2d/qcontext2dcanvas.cpp @@ -84,8 +84,8 @@ void QContext2DCanvas::contentsChanged(const QImage &image) void QContext2DCanvas::paintEvent(QPaintEvent *e) { QPainter p(this); -#ifdef Q_WS_S60 -// Draw white rect first since in with some themes the js-file content will produce black-on-black. +#ifdef Q_OS_SYMBIAN + // Draw white rect first since in with some themes the js-file content will produce black-on-black. QBrush whiteBgBrush(Qt::white); p.fillRect(e->rect(), whiteBgBrush); #endif diff --git a/examples/script/customclass/customclass.pro b/examples/script/customclass/customclass.pro index f094074..612456b 100644 --- a/examples/script/customclass/customclass.pro +++ b/examples/script/customclass/customclass.pro @@ -13,3 +13,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/customclass INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/defaultprototypes/code.js b/examples/script/defaultprototypes/code.js index 048e131..5f776fb 100644 --- a/examples/script/defaultprototypes/code.js +++ b/examples/script/defaultprototypes/code.js @@ -16,5 +16,3 @@ listWidget.currentItemChanged.connect( } ); //! [1] - -listWidget.show(); diff --git a/examples/script/defaultprototypes/defaultprototypes.pro b/examples/script/defaultprototypes/defaultprototypes.pro index 483188c..590ae8d 100644 --- a/examples/script/defaultprototypes/defaultprototypes.pro +++ b/examples/script/defaultprototypes/defaultprototypes.pro @@ -10,3 +10,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/defaultprototypes INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example diff --git a/examples/script/defaultprototypes/main.cpp b/examples/script/defaultprototypes/main.cpp index 688bcd3..8fc17e3 100644 --- a/examples/script/defaultprototypes/main.cpp +++ b/examples/script/defaultprototypes/main.cpp @@ -79,5 +79,10 @@ int main(int argc, char **argv) qWarning() << "line" << lineNo << ":" << result.toString(); } +#if defined(Q_OS_SYMBIAN) + listWidget.showMaximized(); +#else + listWidget.show(); +#endif return app.exec(); } diff --git a/examples/script/defaultprototypes/prototypes.cpp b/examples/script/defaultprototypes/prototypes.cpp index 5a3065b..15c2661 100644 --- a/examples/script/defaultprototypes/prototypes.cpp +++ b/examples/script/defaultprototypes/prototypes.cpp @@ -43,6 +43,7 @@ #include #include #include +#include Q_DECLARE_METATYPE(QListWidgetItem*) Q_DECLARE_METATYPE(QListWidget*) @@ -100,10 +101,16 @@ void ListWidgetPrototype::setBackgroundColor(const QString &colorName) { QListWidget *widget = qscriptvalue_cast(thisObject()); if (widget) { +#ifdef Q_WS_MAEMO_5 + QString style = QString("QListWidget::item {background-color: %1;}").arg(colorName); + style += "QListWidget::item {selection-color: black;}"; + widget->setStyleSheet(style); +#else QPalette palette = widget->palette(); QColor color(colorName); palette.setBrush(QPalette::Base, color); widget->setPalette(palette); +#endif } } //! [1] diff --git a/examples/script/helloscript/helloscript.pro b/examples/script/helloscript/helloscript.pro index fde0876..5bfbc86 100644 --- a/examples/script/helloscript/helloscript.pro +++ b/examples/script/helloscript/helloscript.pro @@ -9,3 +9,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/helloscript INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example diff --git a/examples/script/helloscript/main.cpp b/examples/script/helloscript/main.cpp index 3bf91a0..9c5b631 100644 --- a/examples/script/helloscript/main.cpp +++ b/examples/script/helloscript/main.cpp @@ -78,6 +78,10 @@ int main(int argc, char *argv[]) scriptFile.close(); //! [3] +#ifdef Q_OS_SYMBIAN + contents.replace("button.show()", "button.showMaximized()"); +#endif + //! [4] QScriptValue result = engine.evaluate(contents, fileName); //! [4] diff --git a/examples/script/marshal/marshal.pro b/examples/script/marshal/marshal.pro index adcd249..8519d9f 100644 --- a/examples/script/marshal/marshal.pro +++ b/examples/script/marshal/marshal.pro @@ -9,3 +9,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/marshal INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/qscript/qscript.pro b/examples/script/qscript/qscript.pro index 8a6aeb4..8005751 100644 --- a/examples/script/qscript/qscript.pro +++ b/examples/script/qscript/qscript.pro @@ -14,3 +14,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/qscript INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/qsdbg/qsdbg.pro b/examples/script/qsdbg/qsdbg.pro index cb5c1ca..3b06661 100644 --- a/examples/script/qsdbg/qsdbg.pro +++ b/examples/script/qsdbg/qsdbg.pro @@ -1,5 +1,4 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . QT += script @@ -17,3 +16,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/qsdbg INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/qstetrix/qstetrix.pro b/examples/script/qstetrix/qstetrix.pro index c88635e..4a99a0a 100644 --- a/examples/script/qstetrix/qstetrix.pro +++ b/examples/script/qstetrix/qstetrix.pro @@ -14,3 +14,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/qstetrix sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qstetrix.pro *.js sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script/qstetrix INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example does not work on Symbian platform) diff --git a/examples/script/script.pro b/examples/script/script.pro index faf24d6..69e3726 100644 --- a/examples/script/script.pro +++ b/examples/script/script.pro @@ -15,3 +15,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtscript/script INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example -- cgit v1.2.1