diff --git a/examples/quick/controls/basiclayouts/basiclayouts.pro b/examples/quick/controls/basiclayouts/basiclayouts.pro
index 144ad0fe4fec493d46c13c655b0be085427f5614..a5586fe62ffc6e8478f7572a6381c503b4be03f1 100644
--- a/examples/quick/controls/basiclayouts/basiclayouts.pro
+++ b/examples/quick/controls/basiclayouts/basiclayouts.pro
@@ -3,6 +3,7 @@ TARGET = basiclayouts
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     main.qml
diff --git a/examples/quick/controls/basiclayouts/main.qml b/examples/quick/controls/basiclayouts/main.qml
index fe573aa6c98bcb6ed6cab041ba268926e2806201..18883d9a9fd9a6aa4e80e38b96fff4afa4505e4a 100644
--- a/examples/quick/controls/basiclayouts/main.qml
+++ b/examples/quick/controls/basiclayouts/main.qml
@@ -47,6 +47,7 @@ import QtQuick.Controls 1.1
 import QtQuick.Layouts 1.0
 
 ApplicationWindow {
+    visible: true
     title: "Basic layouts"
     property int margin: 11
     width: mainLayout.implicitWidth + 2 * margin
diff --git a/examples/quick/controls/basiclayouts/src/main.cpp b/examples/quick/controls/basiclayouts/src/main.cpp
index 57ba57e3599d62d98f994b107bc6f5aacb60ad72..a757f4853bfbf9bcd6469529cfbc00854b38de47 100644
--- a/examples/quick/controls/basiclayouts/src/main.cpp
+++ b/examples/quick/controls/basiclayouts/src/main.cpp
@@ -38,5 +38,12 @@
 **
 ****************************************************************************/
 
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QtQuickControlsApplication app(argc, argv);
+    QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+    return app.exec();
+}
diff --git a/examples/quick/controls/gallery/gallery.pro b/examples/quick/controls/gallery/gallery.pro
index 09358658d9376cbb172134cd1487336224ad81be..68ed0c161e9b7cdc28958546cfff236f014a8ad2 100644
--- a/examples/quick/controls/gallery/gallery.pro
+++ b/examples/quick/controls/gallery/gallery.pro
@@ -3,6 +3,7 @@ TARGET = gallery
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     main.qml \
diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml
index 43b6776ea81d80e18dc5418c566ebfdc126b62f2..61e77ef81e2f497043b212c56fb29732978afa77 100644
--- a/examples/quick/controls/gallery/main.qml
+++ b/examples/quick/controls/gallery/main.qml
@@ -49,6 +49,7 @@ import QtQuick.Dialogs 1.0
 import "content"
 
 ApplicationWindow {
+    visible: true
     title: "Component Gallery"
 
     width: 640
diff --git a/examples/quick/controls/gallery/src/main.cpp b/examples/quick/controls/gallery/src/main.cpp
index 57ba57e3599d62d98f994b107bc6f5aacb60ad72..a757f4853bfbf9bcd6469529cfbc00854b38de47 100644
--- a/examples/quick/controls/gallery/src/main.cpp
+++ b/examples/quick/controls/gallery/src/main.cpp
@@ -38,5 +38,12 @@
 **
 ****************************************************************************/
 
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QtQuickControlsApplication app(argc, argv);
+    QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+    return app.exec();
+}
diff --git a/examples/quick/controls/shared/qt_quick_controls_examplemain.h b/examples/quick/controls/shared/qtquickcontrolsapplication.h
similarity index 73%
rename from examples/quick/controls/shared/qt_quick_controls_examplemain.h
rename to examples/quick/controls/shared/qtquickcontrolsapplication.h
index 7f73a6d182e6942565019a91f863c052680ad00f..171de6c671f8455b8bc1a3a81fcd8fb2cdbcea56 100644
--- a/examples/quick/controls/shared/qt_quick_controls_examplemain.h
+++ b/examples/quick/controls/shared/qtquickcontrolsapplication.h
@@ -39,12 +39,8 @@
 **
 ****************************************************************************/
 
-#ifndef QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-#define QT_QUICK_CONTROLS_EXAMPLEMAIN_H
-
-#include <QtQml>
-#include <QtQuick/QQuickView>
-#include <QtCore/QString>
+#ifndef QTQUICKCONTROLSAPPLICATION_H
+#define QTQUICKCONTROLSAPPLICATION_H
 
 #ifdef QT_WIDGETS_LIB
 #include <QtWidgets/QApplication>
@@ -55,26 +51,11 @@
 QT_BEGIN_NAMESPACE
 
 #ifdef QT_WIDGETS_LIB
-#define Application QApplication
+#define QtQuickControlsApplication QApplication
 #else
-#define Application QGuiApplication
+#define QtQuickControlsApplication QGuiApplication
 #endif
 
-#define QT_QUICK_CONTROLS_EXAMPLE_MAIN(url) \
-    int main(int argc, char *argv[]) \
-    { \
-        Application app(argc, argv); \
-        QQmlApplicationEngine engine(QUrl(#url)); \
-        QObject *topLevel = engine.rootObjects().value(0); \
-        QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); \
-        if ( !window ) { \
-            qWarning("Error: Your root item has to be a Window."); \
-            return -1; \
-        } \
-        window->show(); \
-        return app.exec(); \
-    }
-
 QT_END_NAMESPACE
 
-#endif // QT_QUICK_CONTROLS_EXAMPLEMAIN_H
+#endif // QTQUICKCONTROLSAPPLICATION_H
diff --git a/examples/quick/controls/shared/shared.pri b/examples/quick/controls/shared/shared.pri
new file mode 100644
index 0000000000000000000000000000000000000000..8ca347371def1dd256b14cf2fe0d5ef4615160e7
--- /dev/null
+++ b/examples/quick/controls/shared/shared.pri
@@ -0,0 +1,4 @@
+INCLUDEPATH += $$PWD
+
+SOURCES += \
+    $$PWD/qtquickcontrolsapplication.h
diff --git a/examples/quick/controls/splitview/main.qml b/examples/quick/controls/splitview/main.qml
index 992607d622d04767791f7750c03c72081ee6f344..395188ce71a4c9f62476b0ed8af6657f292ccf04 100644
--- a/examples/quick/controls/splitview/main.qml
+++ b/examples/quick/controls/splitview/main.qml
@@ -47,6 +47,7 @@ import QtQuick.Controls 1.1
 import QtQuick.Layouts 1.0
 
 ApplicationWindow {
+    visible: true
     width: 600
     height: 400
 
diff --git a/examples/quick/controls/splitview/splitview.pro b/examples/quick/controls/splitview/splitview.pro
index 066e578c3f80d9ba461824650cfa4ea77e13381d..11c55f745d0e43e7cb8eb9c4c5657fb0db8847a1 100644
--- a/examples/quick/controls/splitview/splitview.pro
+++ b/examples/quick/controls/splitview/splitview.pro
@@ -3,6 +3,7 @@ TARGET = splitview
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     main.qml
diff --git a/examples/quick/controls/splitview/src/main.cpp b/examples/quick/controls/splitview/src/main.cpp
index 57ba57e3599d62d98f994b107bc6f5aacb60ad72..a757f4853bfbf9bcd6469529cfbc00854b38de47 100644
--- a/examples/quick/controls/splitview/src/main.cpp
+++ b/examples/quick/controls/splitview/src/main.cpp
@@ -38,5 +38,12 @@
 **
 ****************************************************************************/
 
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QtQuickControlsApplication app(argc, argv);
+    QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+    return app.exec();
+}
diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml
index 37ab383ee5f862602993f27f94140db78ef83d87..e613e42eccd260d5f55e2a5f8c4ceb103640264d 100644
--- a/examples/quick/controls/tableview/main.qml
+++ b/examples/quick/controls/tableview/main.qml
@@ -48,7 +48,7 @@ import QtQuick.Controls 1.1
 import QtQuick.XmlListModel 2.0
 
 Window {
-
+    visible: true
     width: 538 + frame.margins * 2
     height: 360 + frame.margins * 2
 
diff --git a/examples/quick/controls/tableview/src/main.cpp b/examples/quick/controls/tableview/src/main.cpp
index 57ba57e3599d62d98f994b107bc6f5aacb60ad72..a757f4853bfbf9bcd6469529cfbc00854b38de47 100644
--- a/examples/quick/controls/tableview/src/main.cpp
+++ b/examples/quick/controls/tableview/src/main.cpp
@@ -38,5 +38,12 @@
 **
 ****************************************************************************/
 
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QtQuickControlsApplication app(argc, argv);
+    QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+    return app.exec();
+}
diff --git a/examples/quick/controls/tableview/tableview.pro b/examples/quick/controls/tableview/tableview.pro
index f3d7d7e6d37feb46178490fcd74d01a276354c2c..7238d007bd9ef713bebff5c627fef65db2512536 100644
--- a/examples/quick/controls/tableview/tableview.pro
+++ b/examples/quick/controls/tableview/tableview.pro
@@ -3,6 +3,7 @@ TARGET = tableview
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     main.qml
diff --git a/examples/quick/controls/texteditor/qml/main.qml b/examples/quick/controls/texteditor/qml/main.qml
index 50cbed5653824f1d4ba0a1972e0cd5a74efd07af..89120094d24cb4975a46a96cb1474a939ddabc9d 100644
--- a/examples/quick/controls/texteditor/qml/main.qml
+++ b/examples/quick/controls/texteditor/qml/main.qml
@@ -46,6 +46,7 @@ import QtQuick.Window 2.1
 import org.qtproject.example 1.0
 
 ApplicationWindow {
+    visible: true
     width: 640
     height: 480
     minimumWidth: 400
diff --git a/examples/quick/controls/texteditor/src/main.cpp b/examples/quick/controls/texteditor/src/main.cpp
index a096f70d1d72644029365064bf399ac2463cb65e..ea7d22de39fb87b3a63446ff17c1f6d67e6d009d 100644
--- a/examples/quick/controls/texteditor/src/main.cpp
+++ b/examples/quick/controls/texteditor/src/main.cpp
@@ -38,32 +38,14 @@
 **
 ****************************************************************************/
 
-#ifdef QT_WIDGETS_LIB
-#include <QtWidgets/QApplication>
-#else
-#include <QtGui/QGuiApplication>
-#endif
-#include <QtQml>
-#include <QtQuick/QQuickView>
-#include <QtCore/QString>
-
+#include "qtquickcontrolsapplication.h"
 #include "documenthandler.h"
+#include <QtQml/QQmlApplicationEngine>
 
 int main(int argc, char *argv[])
 {
-#ifdef QT_WIDGETS_LIB
-    QApplication app(argc, argv);
-#else
-    QGuiApplication app(argc, argv);
-#endif
+    QtQuickControlsApplication app(argc, argv);
     qmlRegisterType<DocumentHandler>("org.qtproject.example", 1, 0, "DocumentHandler");
     QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
-    QObject *topLevel = engine.rootObjects().value(0);
-    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
-    if ( !window ) {
-        qWarning("Error: Your root item has to be a Window.");
-        return -1;
-    }
-    window->show();
     return app.exec();
 }
diff --git a/examples/quick/controls/texteditor/texteditor.pro b/examples/quick/controls/texteditor/texteditor.pro
index d9b6c8a33c1f8145af4cf261a89280538d2eee27..06e669d914f743918f43a8b76986c6f5fe3460a6 100644
--- a/examples/quick/controls/texteditor/texteditor.pro
+++ b/examples/quick/controls/texteditor/texteditor.pro
@@ -3,6 +3,7 @@ TARGET = texteditor
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     qml/main.qml \
diff --git a/examples/quick/controls/touch/main.qml b/examples/quick/controls/touch/main.qml
index a6de8910e4e73089f98197f9eaba046905d08771..ab5d534f7058a5ff87e1dddd159faf6e26c65ddc 100644
--- a/examples/quick/controls/touch/main.qml
+++ b/examples/quick/controls/touch/main.qml
@@ -43,6 +43,7 @@ import QtQuick.Controls 1.1
 import "content"
 
 ApplicationWindow {
+    visible: true
     width: 800
     height: 1280
 
diff --git a/examples/quick/controls/touch/src/main.cpp b/examples/quick/controls/touch/src/main.cpp
index 57ba57e3599d62d98f994b107bc6f5aacb60ad72..a757f4853bfbf9bcd6469529cfbc00854b38de47 100644
--- a/examples/quick/controls/touch/src/main.cpp
+++ b/examples/quick/controls/touch/src/main.cpp
@@ -38,5 +38,12 @@
 **
 ****************************************************************************/
 
-#include "../../shared/qt_quick_controls_examplemain.h"
-QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml)
+#include "qtquickcontrolsapplication.h"
+#include <QtQml/QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+    QtQuickControlsApplication app(argc, argv);
+    QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
+    return app.exec();
+}
diff --git a/examples/quick/controls/touch/touch.pro b/examples/quick/controls/touch/touch.pro
index 1e5d12f3c70fc03a0fbc32679d82fc233f65e4b1..6afca140455a2c8ee0517bc7ef7c6a7dc23e1875 100644
--- a/examples/quick/controls/touch/touch.pro
+++ b/examples/quick/controls/touch/touch.pro
@@ -3,6 +3,7 @@ TARGET = touch
 !android: !ios: !blackberry: qtHaveModule(widgets): QT += widgets
 
 include(src/src.pri)
+include(../shared/shared.pri)
 
 OTHER_FILES += \
     main.qml \