Default: cleanup and test internal IDs

Remove the undesired internal IDs where easily possible, and
add expected failures for the harder ones for now.

Task-number: QTBUG-65341
Change-Id: I5964b2cb59652661c90141259c68b95c721cf6ca
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
J-P Nurmi 2017-12-19 14:47:09 +01:00
parent 4367be99cc
commit b94cb52c8b
4 changed files with 18 additions and 9 deletions

View File

@ -54,7 +54,6 @@ T.Dial {
}
handle: Image {
id: handleItem
x: background.x + background.width / 2 - handle.width / 2
y: background.y + background.height / 2 - handle.height / 2
width: 14

View File

@ -51,8 +51,6 @@ T.ScrollBar {
visible: control.policy !== T.ScrollBar.AlwaysOff
contentItem: Rectangle {
id: handle
implicitWidth: control.interactive ? 6 : 2
implicitHeight: control.interactive ? 6 : 2
@ -63,14 +61,14 @@ T.ScrollBar {
states: State {
name: "active"
when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
PropertyChanges { target: handle; opacity: 0.75 }
PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: Transition {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 450 }
NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 }
NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
}
}
}

View File

@ -50,8 +50,6 @@ T.ScrollIndicator {
padding: 2
contentItem: Rectangle {
id: indicator
implicitWidth: 2
implicitHeight: 2
@ -62,7 +60,7 @@ T.ScrollIndicator {
states: State {
name: "active"
when: control.active
PropertyChanges { target: indicator; opacity: 0.75 }
PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: [
@ -70,7 +68,7 @@ T.ScrollIndicator {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 450 }
NumberAnimation { target: indicator; duration: 200; property: "opacity"; to: 0.0 }
NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
}
}
]

View File

@ -131,6 +131,7 @@ typedef QHash<QObject *, QString> QObjectNameHash;
Q_GLOBAL_STATIC(QObjectNameHash, qt_objectNames)
Q_GLOBAL_STATIC(QStringList, qt_createdQObjects)
Q_GLOBAL_STATIC(QStringList, qt_destroyedQObjects)
Q_GLOBAL_STATIC(QStringList, qt_destroyedParentQObjects)
extern "C" Q_DECL_EXPORT void qt_addQObject(QObject *object)
{
@ -152,6 +153,13 @@ extern "C" Q_DECL_EXPORT void qt_removeQObject(QObject *object)
if (!objectName.isEmpty())
qt_destroyedQObjects()->append(objectName);
qt_objectNames()->remove(object);
QObject *parent = object->parent();
if (parent) {
QString parentName = parent->objectName();
if (!parentName.isEmpty())
qt_destroyedParentQObjects()->append(parentName);
}
}
void tst_customization::init()
@ -179,6 +187,7 @@ void tst_customization::reset()
{
qt_createdQObjects()->clear();
qt_destroyedQObjects()->clear();
qt_destroyedParentQObjects()->clear();
}
QObject* tst_customization::createControl(const QString &name, QString *error)
@ -247,6 +256,11 @@ void tst_customization::creation()
QVERIFY2(qt_createdQObjects()->isEmpty(), qPrintable("unexpectedly created: " + qt_createdQObjects->join(", ")));
QVERIFY2(qt_destroyedQObjects()->isEmpty(), qPrintable("unexpectedly destroyed: " + qt_destroyedQObjects->join(", ") + " were unexpectedly destroyed"));
QEXPECT_FAIL("Default:BusyIndicator", "TODO: remove internal IDs", Abort);
QEXPECT_FAIL("Default:DelayButton", "TODO: remove internal IDs", Abort);
QVERIFY2(qt_destroyedParentQObjects()->isEmpty(), qPrintable("delegates/children of: " + qt_destroyedParentQObjects->join(", ") + " were unexpectedly destroyed"));
}
void tst_customization::comboPopup()