diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-10-28 06:05:49 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-10-28 06:05:49 (GMT) |
commit | d14b406afb2286583c4efdd32522a82f9c130d52 (patch) | |
tree | d1b3f6cb442d01c27212df60d8c0e3ede79b7ebb | |
parent | 06ea501e617ec04b786906ca1bc15db452d03d0a (diff) | |
parent | a168b0308b9977f01ae49b4c831d120df0dea951 (diff) | |
download | Qt-d14b406afb2286583c4efdd32522a82f9c130d52.zip Qt-d14b406afb2286583c4efdd32522a82f9c130d52.tar.gz Qt-d14b406afb2286583c4efdd32522a82f9c130d52.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
54 files changed, 227 insertions, 95 deletions
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index f1b7df0..e71ce90 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -96,7 +96,7 @@ Item { properties: "angle" } ScriptAction{ - script: "if(modelData.hasMine && modelData.flipped){expl.explode = true;}" + script: if(modelData.hasMine && modelData.flipped){expl.explode = true;} } } } diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 3d1451c..482d1b7 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -15,6 +15,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index f004a6c..80a762b 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -13,6 +13,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/pics/face.png b/examples/declarative/aspectratio/pics/face.png Binary files differindex 9623b1a..3d66d72 100644 --- a/examples/declarative/aspectratio/pics/face.png +++ b/examples/declarative/aspectratio/pics/face.png diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 2c9477e..283e24b 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -11,6 +11,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml index 434e98e..e720ce7 100644 --- a/examples/declarative/aspectratio/scale_and_crop_simple.qml +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -12,6 +12,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" fillMode: Image.PreserveAspectCrop anchors.fill: parent diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index 67c7e29..c3ef859 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -12,6 +12,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index c4efc29..961ac04 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -12,6 +12,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index 83909ef..7389581 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -12,6 +12,7 @@ Rectangle { Image { id: face + smooth: true source: "pics/face.png" fillMode: Image.PreserveAspectFit anchors.fill: parent diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index e083a5b..885e037 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -68,14 +68,12 @@ Item { Text{ text: "Drag an item into the scene." } Row{ id: toolRow spacing: 8; - height: childrenRect.height//TODO: Put bug in JIRA when it comes back up PaletteItem{ anchors.verticalCenter: parent.verticalCenter file: "Sun.qml"; image: "images/sun.png" } PaletteItem{ - anchors.verticalCenter: parent.verticalCenter file: "GenericItem.qml" image: "images/moon.png" } diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp index 2537ec0..5a8cda0 100644 --- a/src/declarative/debugger/qmldebug.cpp +++ b/src/declarative/debugger/qmldebug.cpp @@ -67,26 +67,30 @@ int QmlEngineDebugPrivate::getId() void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugEnginesQuery *q) { QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->enginesQuery.remove(q->m_queryId); + if (p && q) + p->enginesQuery.remove(q->m_queryId); } void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugRootContextQuery *q) { QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->rootContextQuery.remove(q->m_queryId); + if (p && q) + p->rootContextQuery.remove(q->m_queryId); } void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugObjectQuery *q) { QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->objectQuery.remove(q->m_queryId); + if (p && q) + p->objectQuery.remove(q->m_queryId); } void QmlEngineDebugPrivate::remove(QmlEngineDebug *c, QmlDebugExpressionQuery *q) { QmlEngineDebugPrivate *p = (QmlEngineDebugPrivate *)QObjectPrivate::get(c); - p->expressionQuery.remove(q->m_queryId); + if (p && q) + p->expressionQuery.remove(q->m_queryId); } Q_DECLARE_METATYPE(QmlDebugObjectReference); @@ -118,9 +122,10 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o, prop.m_binding = data.binding; prop.m_hasNotifySignal = data.hasNotifySignal; prop.m_valueTypeName = data.valueTypeName; - if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic) + if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic + || data.type == QmlEngineDebugServer::QmlObjectProperty::List) { prop.m_value = data.value; - else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) { + } else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) { QmlDebugObjectReference obj; obj.m_debugId = prop.m_value.toInt(); prop.m_value = qVariantFromValue(obj); diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index cc385e0..86a069d 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -375,6 +375,10 @@ Column { \endqml \endtable + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. */ /*! @@ -539,6 +543,11 @@ Row { \endqml \image horizontalpositioner_example.png + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. + */ /*! \qmlproperty Transition Row::remove @@ -659,7 +668,7 @@ void QFxRow::doPositioning() child->setX(hoffset); setMovingItem(0); } - if(!child->width() || !child->height()){//don't advance for invisible children + if(child->width() && child->height()){//don't advance for invisible children hoffset += child->width(); hoffset += spacing(); } @@ -707,6 +716,11 @@ Grid { } \endqml \endtable + + Note that the positioner assumes that the x and y positions of its children + will not change. If you manually change the x or y properties in script, bind + the x or y properties, or use anchors on a child of a positioner, then the + positioner may exhibit strange behaviour. */ /*! \qmlproperty Transition Grid::remove diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 664ca3f..63be6b0 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -57,8 +57,8 @@ QmlEngineDebugServer::QmlEngineDebugServer(QObject *parent) : QmlDebugService(QLatin1String("QmlEngine"), parent), m_watch(new QmlWatcher(this)) { - QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QByteArray,QVariant)), - this, SLOT(propertyChanged(int,int,QByteArray,QVariant))); + QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)), + this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant))); } QDataStream &operator<<(QDataStream &ds, @@ -110,9 +110,11 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx) if (binding) rv.binding = binding->expression(); + QVariant value = prop.read(obj); + rv.value = valueContents(value); + if (prop.type() < QVariant::UserType) { rv.type = QmlObjectProperty::Basic; - rv.value = prop.read(obj); } else if (QmlMetaType::isObject(prop.userType())) { rv.type = QmlObjectProperty::Object; } else if (QmlMetaType::isList(prop.userType()) || @@ -123,6 +125,32 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx) return rv; } +QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const +{ + if (value.type() < QVariant::UserType) + return value; + + int userType = value.userType(); + + if (QmlMetaType::isList(userType) || QmlMetaType::isQmlList(userType)) { + int count = QmlMetaType::listCount(value); + QVariantList contents; + for (int i=0; i<count; i++) + contents << valueContents(QmlMetaType::listAt(value, i)); + return contents; + } else if (QmlMetaType::isObject(userType)) { + QObject *o = QmlMetaType::toQObject(value); + if (o) { + QString name = o->objectName(); + if (name.isEmpty()) + name = QLatin1String("<unnamed>"); + return name; + } + } + + return QLatin1String("<unknown value>"); +} + void QmlEngineDebugServer::buildObjectDump(QDataStream &message, QObject *object, bool recur) { @@ -188,32 +216,6 @@ void QmlEngineDebugServer::buildObjectList(QDataStream &message, } } -QVariant QmlEngineDebugServer::serializableVariant(const QVariant &value) -{ - if (value.type() < QVariant::UserType) - return value; - - if (!value.toString().isEmpty()) - return value.toString(); - - QVariant v; - if (value.type() == QVariant::UserType || QmlMetaType::isObject(value.userType())) { - QObject *o = QmlMetaType::toQObject(value); - if (o) { - QString objectName = o->objectName(); - if (objectName.isEmpty()) - objectName = QLatin1String("<unnamed>"); - v = QString::fromUtf8(o->metaObject()->className()) + - QLatin1String(": ") + objectName; - } - } - - if (v.isNull()) - v = QString::fromUtf8(value.typeName()); - - return v; -} - QmlEngineDebugServer::QmlObjectData QmlEngineDebugServer::objectData(QObject *object) { @@ -357,7 +359,7 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message) if (undefined) result = QLatin1String("<undefined>"); else - result = serializableVariant(value); + result = valueContents(value); delete exprObj; } else { result = QLatin1String("<unknown context>"); @@ -371,13 +373,12 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message) } } -void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value) +void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) { QByteArray reply; - QVariant v = serializableVariant(value); QDataStream rs(&reply, QIODevice::WriteOnly); - rs << QByteArray("UPDATE_WATCH") << id << objectId << property << v; + rs << QByteArray("UPDATE_WATCH") << id << objectId << QString::fromUtf8(property.name()) << valueContents(value); sendMessage(reply); } diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h index 075a711..a8572eb 100644 --- a/src/declarative/qml/qmlenginedebug_p.h +++ b/src/declarative/qml/qmlenginedebug_p.h @@ -97,14 +97,14 @@ protected: virtual void messageReceived(const QByteArray &); private Q_SLOTS: - void propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value); + void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); private: void buildObjectList(QDataStream &, QmlContext *); void buildObjectDump(QDataStream &, QObject *, bool); QmlObjectData objectData(QObject *); QmlObjectProperty propertyData(QObject *, int); - QVariant serializableVariant(const QVariant &value); + QVariant valueContents(const QVariant &defaultValue) const; static QList<QmlEngine *> m_engines; QmlWatcher *m_watch; diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp index ca99472..8cd51e0 100644 --- a/src/declarative/qml/qmlwatcher.cpp +++ b/src/declarative/qml/qmlwatcher.cpp @@ -112,7 +112,7 @@ void QmlWatchProxy::notifyValueChanged() else v = m_property.read(m_object); - emit m_watch->propertyChanged(m_id, m_debugId, QByteArray(m_property.name()), v); + emit m_watch->propertyChanged(m_id, m_debugId, m_property, v); } diff --git a/src/declarative/qml/qmlwatcher_p.h b/src/declarative/qml/qmlwatcher_p.h index 99cae88..0bfcd71 100644 --- a/src/declarative/qml/qmlwatcher_p.h +++ b/src/declarative/qml/qmlwatcher_p.h @@ -65,6 +65,7 @@ QT_BEGIN_NAMESPACE class QmlWatchProxy; class QmlExpression; class QmlContext; +class QMetaProperty; class QmlWatcher : public QObject { @@ -79,7 +80,7 @@ public: void removeWatch(int id); Q_SIGNALS: - void propertyChanged(int id, int objectId, const QByteArray &property, const QVariant &value); + void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); private: friend class QmlWatchProxy; diff --git a/tests/auto/declarative/anchors/anchors.pro b/tests/auto/declarative/anchors/anchors.pro index 7b22cfb..1e25a90 100644 --- a/tests/auto/declarative/anchors/anchors.pro +++ b/tests/auto/declarative/anchors/anchors.pro @@ -1,5 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_anchors.cpp +macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/animatedimage/animatedimage.pro b/tests/auto/declarative/animatedimage/animatedimage.pro index 8a92863..4ff9db4 100644 --- a/tests/auto/declarative/animatedimage/animatedimage.pro +++ b/tests/auto/declarative/animatedimage/animatedimage.pro @@ -1,5 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_animatedimage.cpp +macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/animations/animations.pro b/tests/auto/declarative/animations/animations.pro index 419da4e..e13ecb9 100644 --- a/tests/auto/declarative/animations/animations.pro +++ b/tests/auto/declarative/animations/animations.pro @@ -1,5 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_animations.cpp +macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/behaviors/behaviors.pro b/tests/auto/declarative/behaviors/behaviors.pro index c96d2c0..8886b0c 100644 --- a/tests/auto/declarative/behaviors/behaviors.pro +++ b/tests/auto/declarative/behaviors/behaviors.pro @@ -1,5 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_behaviors.cpp +macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/datetimeformatter/datetimeformatter.pro b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro index e3d6cd0..62eb303 100644 --- a/tests/auto/declarative/datetimeformatter/datetimeformatter.pro +++ b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_datetimeformatter.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index b51e285..b9ab3ca 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,12 +1,14 @@ TEMPLATE = subdirs SUBDIRS += anchors \ + animatedimage \ animations \ + behaviors \ datetimeformatter \ + examples \ layouts \ listview \ numberformatter \ pathview \ - qbindablemap \ qfxloader \ qfxpixmapcache \ qfxtext \ @@ -19,6 +21,7 @@ SUBDIRS += anchors \ qmllist \ qmllistaccessor \ qmlmetaproperty \ + qmlpropertymap \ qmltimer \ repeater \ sql \ diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index c50018e..b9bcd28 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -1,4 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_examples.cpp macx:CONFIG -= app_bundle + +SOURCES += tst_examples.cpp diff --git a/tests/auto/declarative/layouts/layouts.pro b/tests/auto/declarative/layouts/layouts.pro index f7e7622..f38e155 100644 --- a/tests/auto/declarative/layouts/layouts.pro +++ b/tests/auto/declarative/layouts/layouts.pro @@ -1,6 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_layouts.cpp +macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/listview/listview.pro b/tests/auto/declarative/listview/listview.pro index bf68268..23b0706 100644 --- a/tests/auto/declarative/listview/listview.pro +++ b/tests/auto/declarative/listview/listview.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_listview.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/numberformatter/numberformatter.pro b/tests/auto/declarative/numberformatter/numberformatter.pro index ba391ed..ed7ef22 100644 --- a/tests/auto/declarative/numberformatter/numberformatter.pro +++ b/tests/auto/declarative/numberformatter/numberformatter.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_numberformatter.cpp diff --git a/tests/auto/declarative/pathview/pathview.pro b/tests/auto/declarative/pathview/pathview.pro index 28bbe49..bddd1e6 100644 --- a/tests/auto/declarative/pathview/pathview.pro +++ b/tests/auto/declarative/pathview/pathview.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_pathview.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/qfxloader/qfxloader.pro b/tests/auto/declarative/qfxloader/qfxloader.pro index 643c18c..aee52cc 100644 --- a/tests/auto/declarative/qfxloader/qfxloader.pro +++ b/tests/auto/declarative/qfxloader/qfxloader.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + SOURCES += tst_qfxloader.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro index e9b0417..218eeff 100644 --- a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro +++ b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro @@ -1,9 +1,9 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative QT += network -SOURCES += tst_qfxpixmapcache.cpp -HEADERS = macx:CONFIG -= app_bundle +SOURCES += tst_qfxpixmapcache.cpp + # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qfxtext/qfxtext.pro b/tests/auto/declarative/qfxtext/qfxtext.pro index f705334..1f3fe37 100644 --- a/tests/auto/declarative/qfxtext/qfxtext.pro +++ b/tests/auto/declarative/qfxtext/qfxtext.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + SOURCES += tst_qfxtext.cpp diff --git a/tests/auto/declarative/qfxtextedit/qfxtextedit.pro b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro index 90546a4..b5e0464 100644 --- a/tests/auto/declarative/qfxtextedit/qfxtextedit.pro +++ b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + SOURCES += tst_qfxtextedit.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro index 396e66d..fe2e3e3 100644 --- a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro +++ b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + SOURCES += tst_qfxtextinput.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro index ee78950..b75e057 100644 --- a/tests/auto/declarative/qfxwebview/qfxwebview.pro +++ b/tests/auto/declarative/qfxwebview/qfxwebview.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qfxwebview.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/qmldom/qmldom.pro b/tests/auto/declarative/qmldom/qmldom.pro index d566354..7ff317d 100644 --- a/tests/auto/declarative/qmldom/qmldom.pro +++ b/tests/auto/declarative/qmldom/qmldom.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmldom.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro b/tests/auto/declarative/qmlecmascript/qmlecmascript.pro index ff4d20f..46ae045 100644 --- a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro +++ b/tests/auto/declarative/qmlecmascript/qmlecmascript.pro @@ -1,6 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle + SOURCES += tst_qmlecmascript.cpp \ testtypes.cpp HEADERS += testtypes.h diff --git a/tests/auto/declarative/qmllanguage/qmllanguage.pro b/tests/auto/declarative/qmllanguage/qmllanguage.pro index 4e4be9c..80228a9 100644 --- a/tests/auto/declarative/qmllanguage/qmllanguage.pro +++ b/tests/auto/declarative/qmllanguage/qmllanguage.pro @@ -1,9 +1,10 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmllanguage.cpp \ testtypes.cpp HEADERS += testtypes.h -macx:CONFIG -= app_bundle # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro index e5558f1..b2145ed 100644 --- a/tests/auto/declarative/qmllist/qmllist.pro +++ b/tests/auto/declarative/qmllist/qmllist.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmllist.cpp diff --git a/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro index 4aa0450..ce2915e 100644 --- a/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro +++ b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmllistaccessor.cpp diff --git a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro index af67373..542c14e 100644 --- a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro +++ b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmlmetaproperty.cpp diff --git a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro b/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro index 94f138f..967ab76 100644 --- a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro +++ b/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_qmlpropertymap.cpp diff --git a/tests/auto/declarative/qmltimer/qmltimer.pro b/tests/auto/declarative/qmltimer/qmltimer.pro index e7edd96..2b244ed 100644 --- a/tests/auto/declarative/qmltimer/qmltimer.pro +++ b/tests/auto/declarative/qmltimer/qmltimer.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + SOURCES += tst_qmltimer.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/repeater/repeater.pro b/tests/auto/declarative/repeater/repeater.pro index 1d30b7b..968904b 100644 --- a/tests/auto/declarative/repeater/repeater.pro +++ b/tests/auto/declarative/repeater/repeater.pro @@ -1,7 +1,8 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_repeater.cpp macx:CONFIG -= app_bundle +SOURCES += tst_repeater.cpp + # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/sql/sql.pro b/tests/auto/declarative/sql/sql.pro index 36a867f..48e06a2 100644 --- a/tests/auto/declarative/sql/sql.pro +++ b/tests/auto/declarative/sql/sql.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_sql.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/states/states.pro b/tests/auto/declarative/states/states.pro index 0474ea5..a1f3b02 100644 --- a/tests/auto/declarative/states/states.pro +++ b/tests/auto/declarative/states/states.pro @@ -1,5 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + SOURCES += tst_states.cpp # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/visual/visual.pro b/tests/auto/declarative/visual/visual.pro index a06fa21..7ae2bed 100644 --- a/tests/auto/declarative/visual/visual.pro +++ b/tests/auto/declarative/visual/visual.pro @@ -1,6 +1,7 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_visual.cpp macx:CONFIG -= app_bundle +SOURCES += tst_visual.cpp + DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" diff --git a/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp index aec661c..a90ca2c 100644 --- a/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp +++ b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp @@ -168,10 +168,17 @@ void QmlInspectorMode::connectionStateChanged() switch (m_conn->state()) { default: case QAbstractSocket::UnconnectedState: + { emit statusMessage(tr("[Inspector] disconnected.\n\n")); m_addressEdit->setEnabled(true); m_portSpinBox->setEnabled(true); + + delete m_engineQuery; + m_engineQuery = 0; + delete m_contextQuery; + m_contextQuery = 0; break; + } case QAbstractSocket::HostLookupState: emit statusMessage(tr("[Inspector] resolving host...")); break; @@ -378,7 +385,7 @@ void QmlInspectorMode::initWidgets() m_propertiesWidget = new ObjectPropertiesView; m_watchTableView = new WatchTableView(m_watchTableModel); m_frameRateWidget = new CanvasFrameRate; - m_expressionWidget = new ExpressionQueryWidget; + m_expressionWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode); // FancyMainWindow uses widgets' window titles for tab labels m_objectTreeWidget->setWindowTitle(tr("Object Tree")); diff --git a/tools/qmldebugger/standalone/engine.cpp b/tools/qmldebugger/standalone/engine.cpp index a1fd009..f1eada8 100644 --- a/tools/qmldebugger/standalone/engine.cpp +++ b/tools/qmldebugger/standalone/engine.cpp @@ -86,7 +86,7 @@ EnginePane::EnginePane(QmlDebugConnection *conn, QWidget *parent) connect(m_watchTableView, SIGNAL(objectActivated(int)), m_objTree, SLOT(setCurrentObject(int))); - m_exprQueryWidget = new ExpressionQueryWidget(m_client); + m_exprQueryWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode, m_client); connect(m_objTree, SIGNAL(currentObjectChanged(QmlDebugObjectReference)), m_exprQueryWidget, SLOT(setCurrentObject(QmlDebugObjectReference))); diff --git a/tools/qmldebugger/standalone/expressionquerywidget.cpp b/tools/qmldebugger/standalone/expressionquerywidget.cpp index f8f5aef..3c4296d 100644 --- a/tools/qmldebugger/standalone/expressionquerywidget.cpp +++ b/tools/qmldebugger/standalone/expressionquerywidget.cpp @@ -11,9 +11,9 @@ #include "expressionquerywidget.h" -ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *parent) +ExpressionQueryWidget::ExpressionQueryWidget(Mode mode, QmlEngineDebug *client, QWidget *parent) : QWidget(parent), - m_style(Compact), + m_mode(mode), m_client(client), m_query(0), m_textEdit(new QTextEdit), @@ -28,7 +28,7 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa updateTitle(); - if (m_style == Compact) { + if (m_mode == SeparateEntryMode) { m_lineEdit = new QLineEdit; connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression())); QHBoxLayout *hbox = new QHBoxLayout; @@ -53,7 +53,8 @@ void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client) void ExpressionQueryWidget::clear() { m_textEdit->clear(); - m_lineEdit->clear(); + if (m_lineEdit) + m_lineEdit->clear(); } void ExpressionQueryWidget::updateTitle() @@ -73,7 +74,7 @@ void ExpressionQueryWidget::appendPrompt() { m_textEdit->moveCursor(QTextCursor::End); - if (m_style == Compact) { + if (m_mode == SeparateEntryMode) { m_textEdit->insertPlainText("\n"); } else { m_textEdit->setTextColor(Qt::gray); @@ -111,7 +112,7 @@ void ExpressionQueryWidget::executeExpression() if (!m_client) return; - if (m_style == Compact) + if (m_mode == SeparateEntryMode) m_expr = m_lineEdit->text().trimmed(); else m_expr = m_expr.trimmed(); @@ -136,20 +137,31 @@ void ExpressionQueryWidget::showResult() { if (m_query) { m_textEdit->moveCursor(QTextCursor::End); + QVariant value = m_query->result(); QString result; - if (m_query->result().isNull()) + + if (value.isNull()) { result = QLatin1String("<no value>"); - else - result = m_query->result().toString(); + } else { + if (value.canConvert(QVariant::String)) { + result = value.toString(); + } else { + QDebug debug(&result); + debug << value; + } + } - if (m_style == Compact) { + if (m_mode == SeparateEntryMode) { m_textEdit->setTextColor(Qt::black); m_textEdit->setFontWeight(QFont::Bold); m_textEdit->insertPlainText(m_expr + " : "); m_textEdit->setFontWeight(QFont::Normal); m_textEdit->insertPlainText(result); } else { - m_textEdit->append(result); + m_textEdit->setTextColor(Qt::darkGreen); + m_textEdit->insertPlainText(" => "); + m_textEdit->setTextColor(Qt::black); + m_textEdit->insertPlainText(result); } appendPrompt(); m_expr.clear(); diff --git a/tools/qmldebugger/standalone/expressionquerywidget.h b/tools/qmldebugger/standalone/expressionquerywidget.h index 6fab059..3fe0295 100644 --- a/tools/qmldebugger/standalone/expressionquerywidget.h +++ b/tools/qmldebugger/standalone/expressionquerywidget.h @@ -16,12 +16,12 @@ class ExpressionQueryWidget : public QWidget { Q_OBJECT public: - enum Style { - Compact, - Shell + enum Mode { + SeparateEntryMode, + ShellMode }; - ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0); + ExpressionQueryWidget(Mode mode = SeparateEntryMode, QmlEngineDebug *client = 0, QWidget *parent = 0); void setEngineDebug(QmlEngineDebug *client); void clear(); @@ -42,7 +42,7 @@ private: void showCurrentContext(); void updateTitle(); - Style m_style; + Mode m_mode; QmlEngineDebug *m_client; QmlDebugExpressionQuery *m_query; diff --git a/tools/qmldebugger/standalone/objectpropertiesview.cpp b/tools/qmldebugger/standalone/objectpropertiesview.cpp index f86a69e..d6fefa0 100644 --- a/tools/qmldebugger/standalone/objectpropertiesview.cpp +++ b/tools/qmldebugger/standalone/objectpropertiesview.cpp @@ -16,19 +16,25 @@ class PropertiesViewItem : public QObject, public QTreeWidgetItem { Q_OBJECT public: - PropertiesViewItem(QTreeWidget *widget); - PropertiesViewItem(QTreeWidgetItem *parent); + enum Type { + BindingType, + OtherType + }; + + PropertiesViewItem(QTreeWidget *widget, Type type = OtherType); + PropertiesViewItem(QTreeWidgetItem *parent, Type type = OtherType); QmlDebugPropertyReference property; + Type type; }; -PropertiesViewItem::PropertiesViewItem(QTreeWidget *widget) - : QTreeWidgetItem(widget) +PropertiesViewItem::PropertiesViewItem(QTreeWidget *widget, Type type) + : QTreeWidgetItem(widget), type(type) { } -PropertiesViewItem::PropertiesViewItem(QTreeWidgetItem *parent) - : QTreeWidgetItem(parent) +PropertiesViewItem::PropertiesViewItem(QTreeWidgetItem *parent, Type type) + : QTreeWidgetItem(parent), type(type) { } @@ -109,6 +115,42 @@ void ObjectPropertiesView::queryFinished() setObject(obj); } +void ObjectPropertiesView::setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray) +{ + if (value.type() == QVariant::List || value.type() == QVariant::StringList) { + PropertiesViewItem *bindingItem = static_cast<PropertiesViewItem*>(item->takeChild(item->childCount() - 1)); + if (bindingItem && bindingItem->type != PropertiesViewItem::BindingType) { + delete bindingItem; + bindingItem = 0; + } + + qDeleteAll(item->takeChildren()); + + QVariantList variants = value.toList(); + item->setText(1, tr("<%1 items>", "%1 = number of items").arg(variants.count())); + item->setText(2, QString::fromUtf8(value.typeName())); + + PropertiesViewItem *child; + for (int i=0; i<variants.count(); i++) { + child = new PropertiesViewItem(item); + setPropertyValue(child, variants[i], makeGray); + } + + if (bindingItem) + item->addChild(bindingItem); + + item->setExpanded(false); + } else { + item->setText(1, (value.isNull() ? QLatin1String("<null>") : value.toString())); + item->setExpanded(true); + } + + if (makeGray) { + for (int i=0; i<m_tree->columnCount(); i++) + item->setForeground(i, Qt::gray); + } +} + void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object) { m_object = object; @@ -123,20 +165,17 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object) item->setText(0, p.name()); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - if (!p.hasNotifySignal()) { - item->setForeground(0, Qt::gray); - item->setForeground(1, Qt::gray); - } + + setPropertyValue(item, p.value(), !p.hasNotifySignal()); + item->setText(2, p.valueTypeName()); + // binding is set after property value to ensure it is added to the end of the + // list, if the value is a list if (!p.binding().isEmpty()) { - PropertiesViewItem *binding = new PropertiesViewItem(item); + PropertiesViewItem *binding = new PropertiesViewItem(item, PropertiesViewItem::BindingType); binding->setText(1, p.binding()); binding->setForeground(1, Qt::darkGreen); } - - item->setText(2, p.valueTypeName()); - - item->setExpanded(true); } } @@ -177,11 +216,8 @@ void ObjectPropertiesView::valueChanged(const QByteArray &name, const QVariant & for (int i=0; i<m_tree->topLevelItemCount(); i++) { PropertiesViewItem *item = static_cast<PropertiesViewItem *>(m_tree->topLevelItem(i)); if (item->property.name() == name) { - if (value.isNull()) { - item->setText(1, QLatin1String("<null>")); - } else { - item->setText(1, value.toString()); - } + setPropertyValue(item, value, !item->property.hasNotifySignal()); + return; } } } diff --git a/tools/qmldebugger/standalone/objectpropertiesview.h b/tools/qmldebugger/standalone/objectpropertiesview.h index 6a1fc03..306e5b9 100644 --- a/tools/qmldebugger/standalone/objectpropertiesview.h +++ b/tools/qmldebugger/standalone/objectpropertiesview.h @@ -10,6 +10,7 @@ QT_BEGIN_NAMESPACE class QTreeWidget; class QTreeWidgetItem; class QmlDebugConnection; +class PropertiesViewItem; class ObjectPropertiesView : public QWidget { @@ -36,6 +37,7 @@ private slots: private: void setObject(const QmlDebugObjectReference &object); void setWatched(const QString &property, bool watched); + void setPropertyValue(PropertiesViewItem *item, const QVariant &value, bool makeGray); QmlEngineDebug *m_client; QmlDebugObjectQuery *m_query; diff --git a/tools/qmldebugger/standalone/objecttree.cpp b/tools/qmldebugger/standalone/objecttree.cpp index 4059e77..6c132b6 100644 --- a/tools/qmldebugger/standalone/objecttree.cpp +++ b/tools/qmldebugger/standalone/objecttree.cpp @@ -61,6 +61,7 @@ void ObjectTree::objectFetched() { dump(m_query->object(), 0); buildTree(m_query->object(), 0); + setCurrentItem(topLevelItem(0)); delete m_query; m_query = 0; diff --git a/tools/qmldebugger/standalone/objecttree.h b/tools/qmldebugger/standalone/objecttree.h index 95820f3..ba2e78f 100644 --- a/tools/qmldebugger/standalone/objecttree.h +++ b/tools/qmldebugger/standalone/objecttree.h @@ -27,8 +27,8 @@ signals: void expressionWatchRequested(const QmlDebugObjectReference &, const QString &); public slots: - void reload(int objectDebugId); - void setCurrentObject(int debugId); + void reload(int objectDebugId); // set the root object + void setCurrentObject(int debugId); // select an object in the tree protected: virtual void mousePressEvent(QMouseEvent *); diff --git a/tools/qmldebugger/standalone/watchtable.cpp b/tools/qmldebugger/standalone/watchtable.cpp index a7fd052..19f034e 100644 --- a/tools/qmldebugger/standalone/watchtable.cpp +++ b/tools/qmldebugger/standalone/watchtable.cpp @@ -265,7 +265,8 @@ void WatchTableModel::removeAllWatches() for (int i=0; i<m_columns.count(); i++) { if (m_client) m_client->removeWatch(m_columns[i].watch); - delete m_columns[i].watch; + else + delete m_columns[i].watch; } m_columns.clear(); m_values.clear(); |