Use the shared boilerplate code in the tweetsearch demo
authorJan Kundrát <jkt@flaska.net>
Tue, 16 Oct 2012 17:41:16 +0000 (19:41 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 16 Oct 2012 18:17:36 +0000 (20:17 +0200)
Without the shared boilerplate code, the demo will not run unless the
application is launched from the directory containing the QML files. Also, it
improves consistency to use the same code as with the other examples.

Change-Id: Ic3bc358c13cdee4310aaaf7daf4c645c4709027e
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
examples/demos/tweetsearch/main.cpp

index 211d3eb..8b1d596 100644 (file)
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
-
-#include <QGuiApplication>
-#include <QStringList>
-#include <QQuickView>
-#include <QQmlEngine>
-
-void usage()
-{
-    exit(0);
-}
-
-int main(int argc, char* argv[])
-{
-    QGuiApplication app(argc,argv);
-    QQuickView view;
-    QUrl launchFile = QUrl::fromLocalFile(QLatin1String("tweetsearch.qml"));
-    if (app.arguments().contains(QLatin1String("-help")))
-        usage();
-    view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
-    view.setSource(launchFile);
-    view.show();
-    return app.exec();
-}
-
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(tweetsearch)