diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-18 23:07:53 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-18 23:07:53 (GMT) |
commit | de300d7a41b0e428ba11e6061c39580c54012dc9 (patch) | |
tree | 1c03abb47596da09841087e3b3cf7408b65bfb50 | |
parent | abf09f87af8f57f670904ff25a626d19ec11120b (diff) | |
parent | e884829f23fad15086f07aa92e1d92bcb71d53ba (diff) | |
download | Qt-de300d7a41b0e428ba11e6061c39580c54012dc9.zip Qt-de300d7a41b0e428ba11e6061c39580c54012dc9.tar.gz Qt-de300d7a41b0e428ba11e6061c39580c54012dc9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix bug when resetting QSortFilterProxyModel
Fix the QSplitter not showing correctly in QGraphicsView
Remove ; after Q_PROPERTY declaration
Fix compilation issues of autotest on solaris
fix a crash when registering 2 metatype name for the same actual type
Fixed problem in painting of QTreeView
17 files changed, 225 insertions, 147 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 30af6fa..ce9ed58 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -518,19 +518,15 @@ int QMetaType::registerTypedef(const char* typeName, int aliasId) idx = qMetaTypeCustomType_unlocked(normalizedTypeName.constData(), normalizedTypeName.size()); - if (idx) { - Q_ASSERT(idx == aliasId); + if (idx) return idx; - } - if (!idx) { - QCustomTypeInfo inf; - inf.typeName = normalizedTypeName; - inf.alias = aliasId; - inf.constr = 0; - inf.destr = 0; - ct->append(inf); - } + QCustomTypeInfo inf; + inf.typeName = normalizedTypeName; + inf.alias = aliasId; + inf.constr = 0; + inf.destr = 0; + ct->append(inf); return aliasId; } diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index c6ad345..dce5c6a 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1217,13 +1217,13 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset() { Q_Q(QSortFilterProxyModel); q->beginResetModel(); - invalidatePersistentIndexes(); - clear_mapping(); } void QSortFilterProxyModelPrivate::_q_sourceReset() { Q_Q(QSortFilterProxyModel); + invalidatePersistentIndexes(); + clear_mapping(); // All internal structures are deleted in clear() q->endResetModel(); update_source_sort_column(); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 101dafe..61ad79d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1232,17 +1232,17 @@ bool QTreeView::viewportEvent(QEvent *event) int oldBranch = d->hoverBranch; d->hoverBranch = d->itemDecorationAt(he->pos()); if (oldBranch != d->hoverBranch) { - QModelIndex oldIndex = d->modelIndex(oldBranch), - newIndex = d->modelIndex(d->hoverBranch); - if (oldIndex != newIndex) { - QRect oldRect = visualRect(oldIndex); - QRect newRect = visualRect(newIndex); - oldRect.setLeft(oldRect.left() - d->indent); - newRect.setLeft(newRect.left() - d->indent); - //we need to paint the whole items (including the decoration) so that when the user - //moves the mouse over those elements they are updated - viewport()->update(oldRect); - viewport()->update(newRect); + //we need to paint the whole items (including the decoration) so that when the user + //moves the mouse over those elements they are updated + if (oldBranch >= 0) { + int y = d->coordinateForItem(oldBranch); + int h = d->itemHeight(oldBranch); + viewport()->update(QRect(0, y, viewport()->width(), h)); + } + if (d->hoverBranch >= 0) { + int y = d->coordinateForItem(d->hoverBranch); + int h = d->itemHeight(d->hoverBranch); + viewport()->update(QRect(0, y, viewport()->width(), h)); } } break; } diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 965094e..f4076eb 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1276,7 +1276,6 @@ void QSplitter::childEvent(QChildEvent *c) if (!c->child()->isWidgetType()) return; QWidget *w = static_cast<QWidget*>(c->child()); - if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) { d->insertWidget_helper(d->list.count(), w, false); } else if (c->polished() && !d->blockChildAdd) { @@ -1313,18 +1312,16 @@ void QSplitter::setRubberBand(int pos) const int rBord = 3; // customizable? int hw = handleWidth(); if (!d->rubberBand) { - d->rubberBand = new QRubberBand(QRubberBand::Line); + QBoolBlocker b(d->blockChildAdd); + d->rubberBand = new QRubberBand(QRubberBand::Line, this); // For accessibility to identify this special widget. d->rubberBand->setObjectName(QLatin1String("qt_rubberband")); } - if (d->orient == Qt::Horizontal) - d->rubberBand->setGeometry(QRect(QPoint(pos + hw / 2 - rBord, r.y()), - QSize(2 * rBord, r.height())).translated(mapToGlobal(QPoint()))); - else - d->rubberBand->setGeometry(QRect(QPoint(r.x(), pos + hw / 2 - rBord), - QSize(r.width(), 2 * rBord)).translated(mapToGlobal(QPoint()))); - if (!d->rubberBand->isVisible()) - d->rubberBand->show(); + + const QRect newGeom = d->orient == Qt::Horizontal ? QRect(QPoint(pos + hw / 2 - rBord, r.y()), QSize(2 * rBord, r.height())) + : QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord)); + d->rubberBand->setGeometry(newGeom); + d->rubberBand->show(); } /*! @@ -1555,16 +1552,14 @@ QSize QSplitter::sizeHint() const ensurePolished(); int l = 0; int t = 0; - QObjectList childList = children(); - for (int i = 0; i < childList.size(); ++i) { - if (QWidget *w = qobject_cast<QWidget *>(childList.at(i))) { - if (w->isHidden()) - continue; - QSize s = w->sizeHint(); - if (s.isValid()) { - l += d->pick(s); - t = qMax(t, d->trans(s)); - } + for (int i = 0; i < d->list.size(); ++i) { + QWidget *w = d->list.at(i)->widget; + if (w->isHidden()) + continue; + QSize s = w->sizeHint(); + if (s.isValid()) { + l += d->pick(s); + t = qMax(t, d->trans(s)); } } return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l); diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 6a04704..064e458 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -43,7 +43,7 @@ class BaseExtensionObject : public QObject { Q_OBJECT - Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); + Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged) public: BaseExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} @@ -59,7 +59,7 @@ private: class ExtensionObject : public QObject { Q_OBJECT - Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); + Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged) public: ExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index a283e3f..5dc5bdf 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -205,8 +205,8 @@ public slots: class MyDefaultObject1 : public QObject { Q_OBJECT - Q_PROPERTY(int horseLegs READ horseLegs CONSTANT); - Q_PROPERTY(int antLegs READ antLegs CONSTANT); + Q_PROPERTY(int horseLegs READ horseLegs CONSTANT) + Q_PROPERTY(int antLegs READ antLegs CONSTANT) public: int horseLegs() const { return 4; } int antLegs() const { return 6; } @@ -215,8 +215,8 @@ public: class MyDefaultObject2 : public QObject { Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); + Q_PROPERTY(int antLegs READ antLegs CONSTANT) + Q_PROPERTY(int emuLegs READ emuLegs CONSTANT) public: int antLegs() const { return 5; } // Had an accident int emuLegs() const { return 2; } @@ -225,8 +225,8 @@ public: class MyDefaultObject3 : public QObject { Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int humanLegs READ humanLegs CONSTANT); + Q_PROPERTY(int antLegs READ antLegs CONSTANT) + Q_PROPERTY(int humanLegs READ humanLegs CONSTANT) public: int antLegs() const { return 7; } // Mutant int humanLegs() const { return 2; } @@ -237,9 +237,9 @@ class MyDeferredObject : public QObject { Q_OBJECT Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2); - Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2"); + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2) + Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2") public: MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {} @@ -266,7 +266,7 @@ QML_DECLARE_TYPE(MyDeferredObject); class MyBaseExtendedObject : public QObject { Q_OBJECT -Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty); +Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty) public: MyBaseExtendedObject() : m_value(0) {} @@ -281,7 +281,7 @@ QML_DECLARE_TYPE(MyBaseExtendedObject); class MyExtendedObject : public MyBaseExtendedObject { Q_OBJECT -Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty); +Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty) public: MyExtendedObject() : m_value(0) {} @@ -299,34 +299,34 @@ class MyTypeObject : public QObject Q_ENUMS(MyEnum) Q_FLAGS(MyFlags) - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); + Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty) + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty) + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty) + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty) + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty) + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty) + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty) + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty) + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty) + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty) + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty) + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty) + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2) + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty) + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty) + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty) + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty) public: MyTypeObject() diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index df93dc8..4963e2e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -106,8 +106,8 @@ class MyQmlObject : public QObject, public MyInterface, public QDeclarativeParse Q_PROPERTY(QRect rect READ rect WRITE setRect) Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface) - Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal); - Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType); + Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal) + Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) @@ -135,7 +135,7 @@ public: static MyAttachedObject *qmlAttachedProperties(QObject *other) { return new MyAttachedObject(other); } - Q_CLASSINFO("DefaultMethod", "basicSlot()"); + Q_CLASSINFO("DefaultMethod", "basicSlot()") int onLiteralSignal() const { return m_value; } void setOnLiteralSignal(int v) { m_value = v; } @@ -171,8 +171,8 @@ QML_DECLARE_TYPE(MyQmlObject); class MyGroupedObject : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript); - Q_PROPERTY(int value READ value WRITE setValue); + Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript) + Q_PROPERTY(int value READ value WRITE setValue) public: QDeclarativeScriptString script() const { return m_script; } void setScript(const QDeclarativeScriptString &s) { m_script = s; } @@ -194,36 +194,36 @@ class MyTypeObject : public QObject Q_ENUMS(MyEnum) Q_FLAGS(MyFlags) - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); - Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT); - Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT); + Q_PROPERTY(QString id READ id WRITE setId) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty) + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty) + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty) + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty) + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty) + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty) + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty) + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty) + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty) + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty) + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty) + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty) + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty) + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2) + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty) + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty) + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty) + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty) + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty) + Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT) + Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT) public: MyTypeObject() @@ -467,7 +467,7 @@ class MyContainer : public QObject Q_OBJECT Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children) Q_PROPERTY(QDeclarativeListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) - Q_CLASSINFO("DefaultProperty", "children"); + Q_CLASSINFO("DefaultProperty", "children") public: MyContainer() {} @@ -549,7 +549,7 @@ namespace MyNamespace { class MySecondNamespacedType : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty<MyNamespace::MyNamespacedType> list READ list); + Q_PROPERTY(QDeclarativeListProperty<MyNamespace::MyNamespacedType> list READ list) public: QDeclarativeListProperty<MyNamespacedType> list() { return QDeclarativeListProperty<MyNamespacedType>(this, m_list); } diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 1b7af19..bb7a7ce 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -91,8 +91,8 @@ private slots: class TestType : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty<TestType> data READ dataProperty); - Q_PROPERTY(int intProperty READ intProperty); + Q_PROPERTY(QDeclarativeListProperty<TestType> data READ dataProperty) + Q_PROPERTY(int intProperty READ intProperty) public: TestType() : property(this, data) {} diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 818f108..1857b0e 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -77,9 +77,9 @@ private slots: class TestType : public QObject { Q_OBJECT - Q_PROPERTY(int foo READ foo); + Q_PROPERTY(int foo READ foo) - Q_CLASSINFO("DefaultProperty", "foo"); + Q_CLASSINFO("DefaultProperty", "foo") public: int foo() { return 0; } }; @@ -88,7 +88,7 @@ QML_DECLARE_TYPE(TestType); class ParserStatusTestType : public QObject, public QDeclarativeParserStatus { Q_OBJECT - Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property + Q_CLASSINFO("DefaultProperty", "foo") // Missing default property }; QML_DECLARE_TYPE(ParserStatusTestType); diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 9b8a643..2288462 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -183,15 +183,15 @@ void tst_qdeclarativeproperty::qmlmetaproperty() class PropertyObject : public QObject { Q_OBJECT - Q_PROPERTY(int defaultProperty READ defaultProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty); - Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty); - Q_PROPERTY(QUrl url READ url WRITE setUrl); - Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty); + Q_PROPERTY(int defaultProperty READ defaultProperty) + Q_PROPERTY(QRect rectProperty READ rectProperty) + Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty) + Q_PROPERTY(QUrl url READ url WRITE setUrl) + Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) - Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject); + Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject) - Q_CLASSINFO("DefaultProperty", "defaultProperty"); + Q_CLASSINFO("DefaultProperty", "defaultProperty") public: PropertyObject() : m_resetProperty(9) {} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index dfc2829..0ad8449 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -59,14 +59,14 @@ class MyTypeObject : public QObject { Q_OBJECT - Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed); - Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed); - Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed); - Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed); - Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed); - Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed); - Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed); - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed); + Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed) + Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed) + Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed) + Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed) + Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) + Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) + Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) + Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) public: MyTypeObject() : diff --git a/tests/auto/qdbuscontext/tst_qdbuscontext.cpp b/tests/auto/qdbuscontext/tst_qdbuscontext.cpp index be62d5b..2b7ac06 100644 --- a/tests/auto/qdbuscontext/tst_qdbuscontext.cpp +++ b/tests/auto/qdbuscontext/tst_qdbuscontext.cpp @@ -47,7 +47,7 @@ const char errorMsg[] = "A generic error"; class TestObject: public QObject, protected QDBusContext { Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.tst_QDBusContext.TestObject"); + Q_CLASSINFO("D-Bus Interface", "com.trolltech.tst_QDBusContext.TestObject") public: inline TestObject(QObject *parent) : QObject(parent) { } public Q_SLOTS: diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 901099d..7138905 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -405,7 +405,7 @@ void tst_QFileSystemWatcher::removePaths() #if 0 class SignalTest : public QObject { - Q_OBJECT; + Q_OBJECT public slots: void fileSlot(const QString &file) { qDebug() << "file " << file;} void dirSlot(const QString &dir) { qDebug() << "dir" << dir;} diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 16a621a..fa3e0f9 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -48,7 +48,7 @@ #include <QtGui/qwindowsstyle.h> class tst_QGraphicsAnchorLayout : public QObject { - Q_OBJECT; + Q_OBJECT public: tst_QGraphicsAnchorLayout() : QObject() { diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp index a813110..99d775d 100644 --- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -62,7 +62,7 @@ private slots: class DownloadCheckWidget : public QWidget { - Q_OBJECT; + Q_OBJECT public: DownloadCheckWidget(QWidget *parent = 0) : QWidget(parent) , progressDlg(this), netmanager(this) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 76e69c5..e11900e 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -3952,7 +3952,7 @@ void tst_QNetworkReply::httpReUsingConnectionSequential() } class HttpReUsingConnectionFromFinishedSlot : public QObject { - Q_OBJECT; + Q_OBJECT public: QNetworkReply* reply1; QNetworkReply* reply2; diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 56eaf25..2339b21 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -139,6 +139,8 @@ private slots: void taskQTBUG_7537_appearsAndSort(); void taskQTBUG_7716_unnecessaryDynamicSorting(); + void testMultipleProxiesWithSelection(); + protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); void checkHierarchy(const QStringList &data, const QAbstractItemModel *model); @@ -2951,5 +2953,90 @@ void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting() } } +class SelectionProxyModel : QAbstractProxyModel +{ + Q_OBJECT +public: + SelectionProxyModel() + : QAbstractProxyModel(), selectionModel(0) + { + } + + QModelIndex mapFromSource(QModelIndex const&) const + { return QModelIndex(); } + + QModelIndex mapToSource(QModelIndex const&) const + { return QModelIndex(); } + + QModelIndex index(int, int, const QModelIndex&) const + { return QModelIndex(); } + + QModelIndex parent(const QModelIndex&) const + { return QModelIndex(); } + + int rowCount(const QModelIndex&) const + { return 0; } + + int columnCount(const QModelIndex&) const + { return 0; } + + void setSourceModel( QAbstractItemModel *sourceModel ) + { + beginResetModel(); + disconnect( sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(sourceModelAboutToBeReset()) ); + QAbstractProxyModel::setSourceModel( sourceModel ); + connect( sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(sourceModelAboutToBeReset()) ); + endResetModel(); + } + + void setSelectionModel( QItemSelectionModel *_selectionModel ) + { + selectionModel = _selectionModel; + } + +private slots: + void sourceModelAboutToBeReset() + { + QVERIFY( selectionModel->selectedIndexes().size() == 1 ); + beginResetModel(); + } + + void sourceModelReset() + { + endResetModel(); + } + +private: + QItemSelectionModel *selectionModel; + +}; + +void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() +{ + QStringListModel model; + const QStringList initial = QString("bravo charlie delta echo").split(" "); + model.setStringList(initial); + + QSortFilterProxyModel proxy; + proxy.setSourceModel( &model ); + + SelectionProxyModel proxy1; + QSortFilterProxyModel proxy2; + + // Note that the order here matters. The order of the sourceAboutToBeReset + // exposes the bug in QSortFilterProxyModel. + proxy2.setSourceModel( &proxy ); + proxy1.setSourceModel( &proxy ); + + QItemSelectionModel selectionModel(&proxy2); + proxy1.setSelectionModel( &selectionModel ); + + selectionModel.select( proxy2.index( 0, 0 ), QItemSelectionModel::Select ); + + // trick the proxy into emitting begin/end reset signals. + proxy.setSourceModel(0); + +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" |