diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/animation/stickman/lifecycle.cpp | 6 | ||||
-rw-r--r-- | examples/gestures/imageviewer/main.cpp | 3 | ||||
-rw-r--r-- | examples/graphicsview/collidingmice/mouse.cpp | 4 | ||||
-rw-r--r-- | examples/ipc/ipc.pro | 3 | ||||
-rw-r--r-- | examples/itemviews/chart/chart.pro | 2 | ||||
-rw-r--r-- | examples/network/network.pro | 3 | ||||
-rw-r--r-- | examples/painting/painterpaths/painterpaths.pro | 4 | ||||
-rw-r--r-- | examples/phonon/musicplayer/mainwindow.cpp | 5 | ||||
-rw-r--r-- | examples/qws/qws.pro | 4 | ||||
-rw-r--r-- | examples/script/customclass/bytearrayclass.cpp | 9 | ||||
-rw-r--r-- | examples/script/customclass/main.cpp | 4 | ||||
-rw-r--r-- | examples/threads/mandelbrot/mandelbrot.pro | 2 |
12 files changed, 34 insertions, 15 deletions
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index c761d87..700916d 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -56,8 +56,9 @@ public: { } KeyPressTransition(GraphicsView *receiver, Qt::Key key, QAbstractState *target) - : QSignalTransition(receiver, SIGNAL(keyPressed(int)), QList<QAbstractState*>() << target), m_key(key) + : QSignalTransition(receiver, SIGNAL(keyPressed(int))), m_key(key) { + setTargetState(target); } virtual bool eventTest(QEvent *e) @@ -78,8 +79,9 @@ class LightningStrikesTransition: public QEventTransition { public: LightningStrikesTransition(QAbstractState *target) - : QEventTransition(this, QEvent::Timer, QList<QAbstractState*>() << target) + : QEventTransition(this, QEvent::Timer) { + setTargetState(target); qsrand((uint)QDateTime::currentDateTime().toTime_t()); startTimer(1000); } diff --git a/examples/gestures/imageviewer/main.cpp b/examples/gestures/imageviewer/main.cpp index 6bda418..cd1928b 100644 --- a/examples/gestures/imageviewer/main.cpp +++ b/examples/gestures/imageviewer/main.cpp @@ -81,6 +81,9 @@ int main(int argc, char *argv[]) if (QApplication::arguments().size() > 1) w.openDirectory(QApplication::arguments().at(1)); + else + w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder")); + return app.exec(); } diff --git a/examples/graphicsview/collidingmice/mouse.cpp b/examples/graphicsview/collidingmice/mouse.cpp index c6a67b1..4cc29dd 100644 --- a/examples/graphicsview/collidingmice/mouse.cpp +++ b/examples/graphicsview/collidingmice/mouse.cpp @@ -64,7 +64,7 @@ Mouse::Mouse() : angle(0), speed(0), mouseEyeDirection(0), color(qrand() % 256, qrand() % 256, qrand() % 256) { - rotate(qrand() % (360 * 16)); + setRotation(qrand() % (360 * 16)); } //! [0] @@ -195,7 +195,7 @@ void Mouse::advance(int step) qreal dx = ::sin(angle) * 10; mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5; - rotate(dx); + setRotation(rotation() + dx); setPos(mapToParent(0, -(3 + sin(speed) * 3))); } //! [11] diff --git a/examples/ipc/ipc.pro b/examples/ipc/ipc.pro index b758fc4..e70fc38 100644 --- a/examples/ipc/ipc.pro +++ b/examples/ipc/ipc.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs -SUBDIRS = sharedmemory +# no QSharedMemory +!vxworks:!qnx:SUBDIRS = sharedmemory !wince*: SUBDIRS += localfortuneserver localfortuneclient # install diff --git a/examples/itemviews/chart/chart.pro b/examples/itemviews/chart/chart.pro index 3556de0..3290170 100644 --- a/examples/itemviews/chart/chart.pro +++ b/examples/itemviews/chart/chart.pro @@ -4,7 +4,7 @@ RESOURCES = chart.qrc SOURCES = main.cpp \ mainwindow.cpp \ pieview.cpp -unix:!mac:!symbian:LIBS+= -lm +unix:!mac:!symbian:!vxworks:LIBS+= -lm TARGET.EPOCHEAPSIZE = 0x200000 0x800000 diff --git a/examples/network/network.pro b/examples/network/network.pro index 9e48e9a..69b460e 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -2,7 +2,6 @@ TEMPLATE = subdirs SUBDIRS = blockingfortuneclient \ broadcastreceiver \ broadcastsender \ - network-chat \ download \ downloadmanager \ fortuneclient \ @@ -15,6 +14,8 @@ SUBDIRS = blockingfortuneclient \ torrent symbian: SUBDIRS = ftp +# no QProcess +!vxworks:!qnx:SUBDIRS += network-chat contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro index 6c9ba95..fbf2ba9 100644 --- a/examples/painting/painterpaths/painterpaths.pro +++ b/examples/painting/painterpaths/painterpaths.pro @@ -3,7 +3,7 @@ HEADERS = renderarea.h \ SOURCES = main.cpp \ renderarea.cpp \ window.cpp -unix:!mac:!symbian:LIBS += -lm +unix:!mac:!symbian:!vxworks:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/painting/painterpaths @@ -13,4 +13,4 @@ INSTALLS += target sources include($$QT_SOURCE_TREE/examples/examplebase.pri) -symbian:TARGET.UID3 = 0xA000A64C
\ No newline at end of file +symbian:TARGET.UID3 = 0xA000A64C diff --git a/examples/phonon/musicplayer/mainwindow.cpp b/examples/phonon/musicplayer/mainwindow.cpp index ee97c7a..f123d29 100644 --- a/examples/phonon/musicplayer/mainwindow.cpp +++ b/examples/phonon/musicplayer/mainwindow.cpp @@ -157,9 +157,12 @@ void MainWindow::tableClicked(int row, int /* column */) mediaObject->stop(); mediaObject->clearQueue(); + if (row >= sources.size()) + return; + mediaObject->setCurrentSource(sources[row]); - if (wasPlaying) + if (wasPlaying) mediaObject->play(); else mediaObject->stop(); diff --git a/examples/qws/qws.pro b/examples/qws/qws.pro index e9f310f..34b1d2c 100644 --- a/examples/qws/qws.pro +++ b/examples/qws/qws.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs -SUBDIRS = framebuffer mousecalibration simpledecoration +# no /dev/fbX +!qnx:!vxworks:SUBDIRS = framebuffer +SUBDIRS += mousecalibration simpledecoration # install sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS README *.pro diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp index 81a0b8a..2044a16 100644 --- a/examples/script/customclass/bytearrayclass.cpp +++ b/examples/script/customclass/bytearrayclass.cpp @@ -100,7 +100,7 @@ ByteArrayClass::ByteArrayClass(QScriptEngine *engine) QScriptValue global = engine->globalObject(); proto.setPrototype(global.property("Object").property("prototype")); - ctor = engine->newFunction(construct); + ctor = engine->newFunction(construct, proto); ctor.setData(qScriptValueFromValue(engine, this)); } //! [0] @@ -224,7 +224,10 @@ QScriptValue ByteArrayClass::construct(QScriptContext *ctx, QScriptEngine *) ByteArrayClass *cls = qscriptvalue_cast<ByteArrayClass*>(ctx->callee().data()); if (!cls) return QScriptValue(); - int size = ctx->argument(0).toInt32(); + QScriptValue arg = ctx->argument(0); + if (arg.instanceOf(ctx->callee())) + return cls->newInstance(qscriptvalue_cast<QByteArray>(arg)); + int size = arg.toInt32(); return cls->newInstance(size); } //! [2] @@ -240,7 +243,7 @@ QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray void ByteArrayClass::fromScriptValue(const QScriptValue &obj, QByteArray &ba) { - ba = qscriptvalue_cast<QByteArray>(obj.data()); + ba = qvariant_cast<QByteArray>(obj.data().toVariant()); } diff --git a/examples/script/customclass/main.cpp b/examples/script/customclass/main.cpp index 05aefd5..3b98f5c 100644 --- a/examples/script/customclass/main.cpp +++ b/examples/script/customclass/main.cpp @@ -52,6 +52,7 @@ int main(int argc, char **argv) eng.globalObject().setProperty("ByteArray", baClass->constructor()); qDebug() << "ba = new ByteArray(4):" << eng.evaluate("ba = new ByteArray(4)").toString(); + qDebug() << "ba instanceof ByteArray:" << eng.evaluate("ba instanceof ByteArray").toBool(); qDebug() << "ba.length:" << eng.evaluate("ba.length").toNumber(); qDebug() << "ba[1] = 123; ba[1]:" << eng.evaluate("ba[1] = 123; ba[1]").toNumber(); qDebug() << "ba[7] = 224; ba.length:" << eng.evaluate("ba[7] = 224; ba.length").toNumber(); @@ -65,6 +66,9 @@ int main(int argc, char **argv) qDebug() << "ba.toBase64().toLatin1String():" << eng.evaluate("b64.toLatin1String()").toString(); qDebug() << "ba.valueOf():" << eng.evaluate("ba.valueOf()").toString(); qDebug() << "ba.chop(2); ba.length:" << eng.evaluate("ba.chop(2); ba.length").toNumber(); + qDebug() << "ba2 = new ByteArray(ba):" << eng.evaluate("ba2 = new ByteArray(ba)").toString(); + qDebug() << "ba2.equals(ba):" << eng.evaluate("ba2.equals(ba)").toBool(); + qDebug() << "ba2.equals(new ByteArray()):" << eng.evaluate("ba2.equals(new ByteArray())").toBool(); return 0; } diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/threads/mandelbrot/mandelbrot.pro index 8f552a8..cf95ea0 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/threads/mandelbrot/mandelbrot.pro @@ -4,7 +4,7 @@ SOURCES = main.cpp \ mandelbrotwidget.cpp \ renderthread.cpp -unix:!mac:!symbian:LIBS += -lm +unix:!mac:!symbian:!vxworks:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot |