File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed
tests/auto/declarative/qdeclarativestates Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,8 @@ class QDeclarativeReplaceSignalHandler : public QDeclarativeActionEvent
171
171
reverseExpression = rewindExpression;
172
172
}
173
173
174
- /* virtual void copyOriginals(QDeclarativeActionEvent *other)
174
+ virtual bool needsCopy () { return true ; }
175
+ virtual void copyOriginals (QDeclarativeActionEvent *other)
175
176
{
176
177
QDeclarativeReplaceSignalHandler *rsh = static_cast <QDeclarativeReplaceSignalHandler*>(other);
177
178
saveCurrentValues ();
@@ -182,7 +183,7 @@ class QDeclarativeReplaceSignalHandler : public QDeclarativeActionEvent
182
183
ownedExpression = rsh->ownedExpression ;
183
184
rsh->ownedExpression = 0 ;
184
185
}
185
- }*/
186
+ }
186
187
187
188
virtual void rewind () {
188
189
ownedExpression = QDeclarativePropertyPrivate::setSignalExpression (property, rewindExpression);
Original file line number Diff line number Diff line change
1
+ import QtQuick 1.0
2
+
3
+ Rectangle {
4
+ id: myRect
5
+ width: 400
6
+ height: 400
7
+
8
+ onHeightChanged: console .log (" base state" )
9
+
10
+ states: [
11
+ State {
12
+ name: " state1"
13
+ PropertyChanges {
14
+ target: myRect
15
+ onHeightChanged: console .log (" state1" )
16
+ color: " green"
17
+ }
18
+ },
19
+ State {
20
+ name: " state2" ;
21
+ PropertyChanges {
22
+ target: myRect
23
+ onHeightChanged: console .log (" state2" )
24
+ color: " red"
25
+ }
26
+ }]
27
+ }
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ private slots:
113
113
void signalOverride ();
114
114
void signalOverrideCrash ();
115
115
void signalOverrideCrash2 ();
116
+ void signalOverrideCrash3 ();
116
117
void parentChange ();
117
118
void parentChangeErrors ();
118
119
void anchorChanges ();
@@ -520,6 +521,22 @@ void tst_qdeclarativestates::signalOverrideCrash2()
520
521
delete rect;
521
522
}
522
523
524
+ void tst_qdeclarativestates::signalOverrideCrash3 ()
525
+ {
526
+ QDeclarativeEngine engine;
527
+
528
+ QDeclarativeComponent rectComponent (&engine, SRCDIR " /data/signalOverrideCrash3.qml" );
529
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create ());
530
+ QVERIFY (rect != 0 );
531
+
532
+ QDeclarativeItemPrivate::get (rect)->setState (" state1" );
533
+ QDeclarativeItemPrivate::get (rect)->setState (" " );
534
+ QDeclarativeItemPrivate::get (rect)->setState (" state2" );
535
+ QDeclarativeItemPrivate::get (rect)->setState (" " );
536
+
537
+ delete rect;
538
+ }
539
+
523
540
void tst_qdeclarativestates::parentChange ()
524
541
{
525
542
QDeclarativeEngine engine;
You can’t perform that action at this time.
0 commit comments