Allow qtdeclarative to compile with -no-widgets
authorMartin Jones <martin.jones@nokia.com>
Fri, 1 Jun 2012 04:53:26 +0000 (14:53 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 5 Jun 2012 02:35:50 +0000 (04:35 +0200)
We have no hard requirement for QtWidgets library, so we should
build without it.

Change-Id: I85c85cc1a52bf9daa7ab7916f19bf7cc3ad5845f
Reviewed-by: Damian Jansen <damian.jansen@nokia.com>
14 files changed:
examples/qml/cppextensions/referenceexamples/referenceexamples.pro
sync.profile
tests/auto/qml/qml.pro
tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
tests/auto/qml/qqmlecmascript/testtypes.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/quick/qquickanimations/qquickanimations.pro
tests/auto/quick/qquickpathview/qquickpathview.pro
tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
tests/auto/quick/qquicksystempalette/qquicksystempalette.pro
tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp
tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
tests/auto/quick/quick.pro

index 505cefd..4bfbd48 100644 (file)
@@ -6,9 +6,10 @@ SUBDIRS += \
     binding \
     coercion \
     default \
-    extended \
     grouped \
     properties \
     signal \
     valuesource \
     methods
+
+!contains(QT_CONFIG, no-widgets): SUBDIRS += extended
index f7a74f2..d4f22c7 100644 (file)
@@ -13,7 +13,6 @@
 );
 %mastercontent = (
     "gui" => "#include <QtGui/QtGui>\n",
-    "script" => "#include <QtScript/QtScript>\n",
     "network" => "#include <QtNetwork/QtNetwork>\n",
     "testlib" => "#include <QtTest/QtTest>\n",
     "qml" => "#include <QtQml/QtQml>\n",
index d99d18c..dc6c0de 100644 (file)
@@ -5,8 +5,6 @@ METATYPETESTS += \
 
 PUBLICTESTS += \
     parserstress \
-    qjsengine \
-    qjsvalue \
     qjsvalueiterator \
     qjsonbinding \
     qmlmin \
@@ -50,6 +48,15 @@ PRIVATETESTS += \
     qqmlbundle \
     v4
 
+!contains(QT_CONFIG, no-widgets) {
+    PUBLICTESTS += \
+        qjsengine \
+        qjsvalue
+
+    PRIVATETESTS += \
+        qqmlecmascript
+}
+
 SUBDIRS += $$PUBLICTESTS
 SUBDIRS += $$METATYPETESTS
 SUBDIRS += debugger
index 42c7bd9..8de609d 100644 (file)
@@ -16,4 +16,6 @@ include (../../shared/util.pri)
 
 TESTDATA = data/*
 
-QT += core-private gui-private v8-private qml-private network widgets testlib
+QT += core-private gui-private v8-private qml-private network testlib
+!contains(QT_CONFIG, no-widgets): QT += widgets
+
index fba6cb3..8fd1605 100644 (file)
 **
 ****************************************************************************/
 #include "testtypes.h"
-#include <QWidget>
-#include <QPlainTextEdit>
+#ifndef QT_NO_WIDGETS
+# include <QWidget>
+# include <QPlainTextEdit>
+#endif
 #include <QQmlEngine>
 #include <QJSEngine>
 #include <QThread>
@@ -201,8 +203,10 @@ void registerTypes()
     // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
     qmlRegisterType<MyRevisionedSubclass,1>("Qt.test",1,1,"MyRevisionedSubclass");
 
+#ifndef QT_NO_WIDGETS
     qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget");
     qmlRegisterType<QPlainTextEdit>("Qt.test",1,0,"QPlainTextEdit");
+#endif
 
     qRegisterMetaType<MyQmlObject::MyType>("MyQmlObject::MyType");
 
index 45005e6..18743ac 100644 (file)
@@ -190,7 +190,9 @@ private slots:
     void qtbug_21580();
     void singleV8BindingDestroyedDuringEvaluation();
     void bug1();
+#ifndef QT_NO_WIDGETS
     void bug2();
+#endif
     void dynamicCreationCrash();
     void dynamicCreationOwnership();
     void regExpBug();
@@ -2042,6 +2044,7 @@ void tst_qqmlecmascript::bug1()
     delete object;
 }
 
+#ifndef QT_NO_WIDGETS
 void tst_qqmlecmascript::bug2()
 {
     QQmlComponent component(&engine);
@@ -2052,6 +2055,7 @@ void tst_qqmlecmascript::bug2()
 
     delete object;
 }
+#endif
 
 // Don't crash in createObject when the component has errors.
 void tst_qqmlecmascript::dynamicCreationCrash()
index 5c0bd3a..fa8ec3f 100644 (file)
@@ -10,7 +10,7 @@ TESTDATA = data/*
 
 CONFIG += parallel_test
 
-QT += core-private gui-private v8-private qml-private quick-private testlib widgets
+QT += core-private gui-private v8-private qml-private quick-private testlib
 
 # QTBUG-23385 - color mixing tests failing on Ubuntu 11.10 x64
 linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC
index 02ce905..4326ef5 100644 (file)
@@ -9,4 +9,5 @@ include (../shared/util.pri)
 
 TESTDATA = data/*
 
-QT += core-private gui-private v8-private qml-private quick-private widgets testlib
+QT += core-private gui-private v8-private qml-private quick-private testlib
+!contains(QT_CONFIG, no-widgets): QT += widgets
index ef9a404..5c0df16 100644 (file)
@@ -53,7 +53,6 @@
 #include <QtQml/private/qquicklistmodel_p.h>
 #include <QtQml/private/qqmlvaluetype_p.h>
 #include <QStringListModel>
-#include <QStandardItemModel>
 #include <QFile>
 
 #include "../../shared/util.h"
@@ -65,6 +64,8 @@ using namespace QQuickVisualTestUtil;
 
 Q_DECLARE_METATYPE(QQuickPathView::HighlightRangeMode)
 
+#ifndef QT_NO_WIDGETS
+#include <QStandardItemModel>
 static void initStandardTreeModel(QStandardItemModel *model)
 {
     QStandardItem *item;
@@ -82,6 +83,7 @@ static void initStandardTreeModel(QStandardItemModel *model)
     item->setIcon(QIcon());
     model->insertRow(2, item);
 }
+#endif
 
 
 class tst_QQuickPathView : public QQmlDataTest
@@ -120,7 +122,9 @@ private slots:
     void visualDataModel();
     void undefinedPath();
     void mouseDrag();
+#ifndef QT_NO_WIDGETS
     void treeModel();
+#endif
     void changePreferredHighlight();
     void missingPercent();
     void creationContext();
@@ -1415,6 +1419,7 @@ void tst_QQuickPathView::mouseDrag()
     delete canvas;
 }
 
+#ifndef QT_NO_WIDGETS
 void tst_QQuickPathView::treeModel()
 {
     QQuickView *canvas = createView();
@@ -1442,6 +1447,7 @@ void tst_QQuickPathView::treeModel()
 
     delete canvas;
 }
+#endif
 
 void tst_QQuickPathView::changePreferredHighlight()
 {
index c8825c0..f422d26 100644 (file)
@@ -5,4 +5,5 @@ macx:CONFIG -= app_bundle
 SOURCES += tst_qquicksystempalette.cpp
 
 CONFIG += parallel_test
-QT += core-private gui-private qml-private quick-private widgets testlib
+QT += core-private gui-private qml-private quick-private testlib
+!contains(QT_CONFIG, no-widgets): QT += widgets
index 3b74dfd..6764128 100644 (file)
@@ -56,7 +56,9 @@ private slots:
     void activePalette();
     void inactivePalette();
     void disabledPalette();
+#ifndef QT_NO_WIDGETS
     void paletteChanged();
+#endif
 
 private:
     QQmlEngine engine;
@@ -155,6 +157,7 @@ void tst_qquicksystempalette::disabledPalette()
     delete object;
 }
 
+#ifndef QT_NO_WIDGETS
 void tst_qquicksystempalette::paletteChanged()
 {
     QString componentStr = "import QtQuick 2.0\nSystemPalette { }";
@@ -179,6 +182,7 @@ void tst_qquicksystempalette::paletteChanged()
 
     delete object;
 }
+#endif
 
 QTEST_MAIN(tst_qquicksystempalette)
 
index 4ae6781..f5d72ff 100644 (file)
@@ -11,4 +11,5 @@ TESTDATA = data/*
 
 CONFIG += parallel_test
 
-QT += core-private gui-private v8-private qml-private quick-private widgets testlib
+QT += core-private gui-private v8-private qml-private quick-private testlib
+!contains(QT_CONFIG, no-widgets): QT += widgets
index 50c1e35..82c8d44 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <qtest.h>
 #include <QtTest/QSignalSpy>
-#include <QStandardItemModel>
 #include <QtQml/qqmlengine.h>
 #include <QtQml/qqmlcomponent.h>
 #include <QtQml/qqmlcontext.h>
@@ -61,6 +60,8 @@ using namespace QQuickVisualTestUtil;
 
 template <typename T, int N> int lengthOf(const T (&)[N]) { return N; }
 
+#ifndef QT_NO_WIDGETS
+#include <QStandardItemModel>
 static void initStandardTreeModel(QStandardItemModel *model)
 {
     QStandardItem *item;
@@ -78,6 +79,7 @@ static void initStandardTreeModel(QStandardItemModel *model)
     item->setIcon(QIcon());
     model->insertRow(2, item);
 }
+#endif
 
 class SingleRoleModel : public QAbstractListModel
 {
@@ -120,6 +122,7 @@ protected:
     }
 };
 
+#ifndef QT_NO_WIDGETS
 class StandardItem : public QObject, public QStandardItem
 {
     Q_OBJECT
@@ -143,6 +146,7 @@ public:
         static_cast<QStandardItemModel *>(property->object)->appendRow(item);
     }
 };
+#endif
 
 class DataObject : public QObject
 {
@@ -183,9 +187,11 @@ private:
 };
 
 QML_DECLARE_TYPE(SingleRoleModel)
+QML_DECLARE_TYPE(DataObject)
+#ifndef QT_NO_WIDGETS
 QML_DECLARE_TYPE(StandardItem)
 QML_DECLARE_TYPE(StandardItemModel)
-QML_DECLARE_TYPE(DataObject)
+#endif
 
 class tst_qquickvisualdatamodel : public QQmlDataTest
 {
@@ -196,18 +202,20 @@ public:
 private slots:
     void initTestCase();
     void cleanupTestCase();
+#ifndef QT_NO_WIDGETS
     void rootIndex();
     void updateLayout_data();
     void updateLayout();
     void childChanged_data();
     void childChanged();
-    void objectListModel();
-    void singleRole();
-    void modelProperties();
     void noDelegate_data();
     void noDelegate();
     void itemsDestroyed_data();
     void itemsDestroyed();
+#endif
+    void objectListModel();
+    void singleRole();
+    void modelProperties();
     void packagesDestroyed();
     void qaimRowsMoved();
     void qaimRowsMoved_data();
@@ -283,9 +291,11 @@ void tst_qquickvisualdatamodel::initTestCase()
     qRegisterMetaType<QQuickChangeSet>();
 
     qmlRegisterType<SingleRoleModel>("tst_qquickvisualdatamodel", 1, 0, "SingleRoleModel");
+    qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
+#ifndef QT_NO_WIDGETS
     qmlRegisterType<StandardItem>("tst_qquickvisualdatamodel", 1, 0, "StandardItem");
     qmlRegisterType<StandardItemModel>("tst_qquickvisualdatamodel", 1, 0, "StandardItemModel");
-    qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
+#endif
 }
 
 void tst_qquickvisualdatamodel::cleanupTestCase()
@@ -296,6 +306,7 @@ tst_qquickvisualdatamodel::tst_qquickvisualdatamodel()
 {
 }
 
+#ifndef QT_NO_WIDGETS
 void tst_qquickvisualdatamodel::rootIndex()
 {
     QQmlEngine engine;
@@ -437,6 +448,7 @@ void tst_qquickvisualdatamodel::childChanged()
     QVERIFY(name);
     QCOMPARE(name->text(), QString("Row 3 Item"));
 }
+#endif
 
 void tst_qquickvisualdatamodel::objectListModel()
 {
@@ -603,6 +615,7 @@ void tst_qquickvisualdatamodel::modelProperties()
         QCOMPARE(delegate->property("test8").toInt(),1);
     }
 
+#ifndef QT_NO_WIDGETS
     {
         QQuickView view;
 
@@ -644,10 +657,11 @@ void tst_qquickvisualdatamodel::modelProperties()
         QCOMPARE(delegate->property("test7").toInt(),1);
         QCOMPARE(delegate->property("test8").toInt(),1);
     }
-
+#endif
     //### should also test QStringList and QVariantList
 }
 
+#ifndef QT_NO_WIDGETS
 void tst_qquickvisualdatamodel::noDelegate_data()
 {
     QTest::addColumn<QUrl>("source");
@@ -711,6 +725,7 @@ void tst_qquickvisualdatamodel::itemsDestroyed()
     QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
     QVERIFY(!delegate);
 }
+#endif
 
 void tst_qquickvisualdatamodel::packagesDestroyed()
 {
@@ -2368,7 +2383,7 @@ void tst_qquickvisualdatamodel::insert_data()
                 << 4 << 5 << 0 << true << true << false << false << true
                 << QString("name")
                 << (QStringList() << "seven" << "one" << "two" << "three" << "four");
-
+#ifndef QT_NO_WIDGETS
         // AbstractItemModel (Multiple Roles).
         QTest::newRow("StandardItemModel.items prepend")
                 << multipleRoleSource[i]
@@ -2449,7 +2464,7 @@ void tst_qquickvisualdatamodel::insert_data()
                 << 4 << 5 << 0 << true << true << false << false << false
                 << QString("display")
                 << (QStringList() << "Row 7 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
-
+#endif
         // StringList.
         QTest::newRow("StringList.items prepend")
                 << stringListSource[i]
@@ -2949,6 +2964,7 @@ void tst_qquickvisualdatamodel::resolve_data()
                 << QString("name")
                 << (QStringList() << "one" << "two" << "three" << "four");
 
+#ifndef QT_NO_WIDGETS
         // AbstractItemModel (Multiple Roles)
         QTest::newRow("StandardItemModel.items prepend, resolve prepended")
                 << multipleRoleSource[i]
@@ -2973,7 +2989,7 @@ void tst_qquickvisualdatamodel::resolve_data()
                 << 5 << 4 << 4 << 2 << true << false << true << false << false
                 << QString("display")
                 << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
-
+#endif
         // StringList
         QTest::newRow("StringList.items prepend, resolve prepended")
                 << stringListSource[i]
index b018fbf..1c73a3b 100644 (file)
@@ -2,10 +2,11 @@ TEMPLATE = subdirs
 
 PUBLICTESTS += \
     geometry \
-    nodes \
     rendernode \
     qquickpixmapcache
 
+!contains(QT_CONFIG, no-widgets): PUBLICTESTS += nodes
+
 !cross_compile: PUBLICTESTS += examples
 
 # This test requires the qtconcurrent module