From: Martin Jones Date: Fri, 1 Jun 2012 04:53:26 +0000 (+1000) Subject: Allow qtdeclarative to compile with -no-widgets X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=805c30e809a86cc1feabeb3bdbee943a7bbf8796;p=konrad%2Fqtdeclarative.git Allow qtdeclarative to compile with -no-widgets We have no hard requirement for QtWidgets library, so we should build without it. Change-Id: I85c85cc1a52bf9daa7ab7916f19bf7cc3ad5845f Reviewed-by: Damian Jansen --- diff --git a/examples/qml/cppextensions/referenceexamples/referenceexamples.pro b/examples/qml/cppextensions/referenceexamples/referenceexamples.pro index 505cefd..4bfbd48 100644 --- a/examples/qml/cppextensions/referenceexamples/referenceexamples.pro +++ b/examples/qml/cppextensions/referenceexamples/referenceexamples.pro @@ -6,9 +6,10 @@ SUBDIRS += \ binding \ coercion \ default \ - extended \ grouped \ properties \ signal \ valuesource \ methods + +!contains(QT_CONFIG, no-widgets): SUBDIRS += extended diff --git a/sync.profile b/sync.profile index f7a74f2..d4f22c7 100644 --- a/sync.profile +++ b/sync.profile @@ -13,7 +13,6 @@ ); %mastercontent = ( "gui" => "#include \n", - "script" => "#include \n", "network" => "#include \n", "testlib" => "#include \n", "qml" => "#include \n", diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index d99d18c..dc6c0de 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -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 diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro index 42c7bd9..8de609d 100644 --- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro +++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro @@ -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 + diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index fba6cb3..8fd1605 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -39,8 +39,10 @@ ** ****************************************************************************/ #include "testtypes.h" -#include -#include +#ifndef QT_NO_WIDGETS +# include +# include +#endif #include #include #include @@ -201,8 +203,10 @@ void registerTypes() // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 qmlRegisterType("Qt.test",1,1,"MyRevisionedSubclass"); +#ifndef QT_NO_WIDGETS qmlRegisterExtendedType("Qt.test",1,0,"QWidget"); qmlRegisterType("Qt.test",1,0,"QPlainTextEdit"); +#endif qRegisterMetaType("MyQmlObject::MyType"); diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 45005e6..18743ac 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -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() diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro index 5c0bd3a..fa8ec3f 100644 --- a/tests/auto/quick/qquickanimations/qquickanimations.pro +++ b/tests/auto/quick/qquickanimations/qquickanimations.pro @@ -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 diff --git a/tests/auto/quick/qquickpathview/qquickpathview.pro b/tests/auto/quick/qquickpathview/qquickpathview.pro index 02ce905..4326ef5 100644 --- a/tests/auto/quick/qquickpathview/qquickpathview.pro +++ b/tests/auto/quick/qquickpathview/qquickpathview.pro @@ -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 diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index ef9a404..5c0df16 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include #include "../../shared/util.h" @@ -65,6 +64,8 @@ using namespace QQuickVisualTestUtil; Q_DECLARE_METATYPE(QQuickPathView::HighlightRangeMode) +#ifndef QT_NO_WIDGETS +#include 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() { diff --git a/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro index c8825c0..f422d26 100644 --- a/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro +++ b/tests/auto/quick/qquicksystempalette/qquicksystempalette.pro @@ -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 diff --git a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp index 3b74dfd..6764128 100644 --- a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp +++ b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp @@ -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) diff --git a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro index 4ae6781..f5d72ff 100644 --- a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro +++ b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro @@ -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 diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 50c1e35..82c8d44 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -61,6 +60,8 @@ using namespace QQuickVisualTestUtil; template int lengthOf(const T (&)[N]) { return N; } +#ifndef QT_NO_WIDGETS +#include 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(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(); qmlRegisterType("tst_qquickvisualdatamodel", 1, 0, "SingleRoleModel"); + qmlRegisterType("tst_qquickvisualdatamodel", 1, 0, "DataObject"); +#ifndef QT_NO_WIDGETS qmlRegisterType("tst_qquickvisualdatamodel", 1, 0, "StandardItem"); qmlRegisterType("tst_qquickvisualdatamodel", 1, 0, "StandardItemModel"); - qmlRegisterType("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("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] diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index b018fbf..1c73a3b 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -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