summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-06-17 09:10:38 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-06-17 09:10:38 (GMT)
commit9fb3b6c953228023eb735c31b8610f2171999015 (patch)
tree75008f8b454990a0ba463026dd8c10a5672d138f
parent89e6d626f1e23858735659a1596408cd7a521c02 (diff)
parent368c3c936fc12ef5249d72ffa5541df3b8558e4d (diff)
downloadQt-9fb3b6c953228023eb735c31b8610f2171999015.zip
Qt-9fb3b6c953228023eb735c31b8610f2171999015.tar.gz
Qt-9fb3b6c953228023eb735c31b8610f2171999015.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp15
-rw-r--r--src/corelib/statemachine/qabstracttransition.h6
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h1
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp1
-rw-r--r--src/opengl/qglframebufferobject.cpp6
-rw-r--r--src/opengl/qpixmapdata_gl.cpp7
-rw-r--r--src/opengl/qwindowsurface_gl.cpp7
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp11
8 files changed, 46 insertions, 8 deletions
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 3be3b73..670aa7d 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE
targetStates() function returns the targets of the transition. The machine()
function returns the state machine that the transition is part of.
+ The triggered() signal is emitted when the transition has been triggered.
+
Transitions can cause animations to be played. Use the addAnimation()
function to add an animation to the transition.
@@ -139,6 +141,12 @@ QState *QAbstractTransitionPrivate::sourceState() const
return qobject_cast<QState*>(parent);
}
+void QAbstractTransitionPrivate::emitTriggered()
+{
+ Q_Q(QAbstractTransition);
+ emit q->triggered();
+}
+
/*!
Constructs a new QAbstractTransition object with the given \a sourceState.
*/
@@ -333,6 +341,13 @@ QList<QAbstractAnimation*> QAbstractTransition::animations() const
*/
/*!
+ \fn QAbstractTransition::triggered()
+
+ This signal is emitted when the transition has been triggered (after
+ onTransition() has been called).
+*/
+
+/*!
\reimp
*/
bool QAbstractTransition::event(QEvent *e)
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 83899ce..9ba1f11 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -89,6 +89,12 @@ public:
QList<QAbstractAnimation*> animations() const;
#endif
+Q_SIGNALS:
+#if !defined(Q_MOC_RUN) && !defined(qdoc)
+private: // can only be emitted by QAbstractTransition
+#endif
+ void triggered();
+
protected:
virtual bool eventTest(QEvent *event) = 0;
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index f0b9bb3..784832d 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -78,6 +78,7 @@ public:
void callOnTransition(QEvent *e);
QState *sourceState() const;
QStateMachine *machine() const;
+ void emitTriggered();
QList<QPointer<QAbstractState> > targetStates;
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 7a34e4b..04cce50 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -498,6 +498,7 @@ void QStateMachinePrivate::executeTransitionContent(QEvent *event, const QList<Q
qDebug() << q_func() << ": triggering" << t;
#endif
QAbstractTransitionPrivate::get(t)->callOnTransition(event);
+ QAbstractTransitionPrivate::get(t)->emitTriggered();
}
}
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 7f229e2..eacf5bb 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -935,8 +935,7 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
{
- if (!QGLContext::currentContext())
- QGLWidget dmy; // needed to detect and init the QGLExtensions object
+ QGLExtensions::init();
return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
}
@@ -1098,8 +1097,7 @@ bool QGLFramebufferObject::isBound() const
*/
bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
{
- if (!QGLContext::currentContext())
- QGLWidget dmy; // needed to detect and init the QGLExtensions object
+ QGLExtensions::init();
return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit);
}
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 5e73ef5..f745aae 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -114,8 +114,11 @@ QGLPixmapData::~QGLPixmapData()
QGLWidget *shareWidget = qt_gl_share_widget();
if (!shareWidget)
return;
- QGLShareContextScope ctx(shareWidget->context());
- glDeleteTextures(1, &m_textureId);
+
+ if (m_textureId) {
+ QGLShareContextScope ctx(shareWidget->context());
+ glDeleteTextures(1, &m_textureId);
+ }
}
bool QGLPixmapData::isValid() const
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 50d0ae7..3a7a07e 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -184,11 +184,13 @@ QGLGraphicsSystem::QGLGraphicsSystem()
class QGLGlobalShareWidget
{
public:
- QGLGlobalShareWidget() : widget(0) {}
+ QGLGlobalShareWidget() : widget(0), initializing(false) {}
QGLWidget *shareWidget() {
- if (!widget && !cleanedUp) {
+ if (!initializing && !widget && !cleanedUp) {
+ initializing = true;
widget = new QGLWidget;
+ initializing = false;
}
return widget;
}
@@ -204,6 +206,7 @@ public:
private:
QGLWidget *widget;
+ bool initializing;
};
bool QGLGlobalShareWidget::cleanedUp = false;
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 963b6b9..9bccb97 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -1155,6 +1155,11 @@ void tst_QStateMachine::stateEntryAndExit()
QVERIFY(machine.configuration().isEmpty());
globalTick = 0;
QVERIFY(!machine.isRunning());
+ QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
+ QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
+ QSignalSpy tTriggeredSpy(t, SIGNAL(triggered()));
+ QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
+ QSignalSpy s2ExitedSpy(s2, SIGNAL(exited()));
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -1180,6 +1185,12 @@ void tst_QStateMachine::stateEntryAndExit()
// s2 is exited
QCOMPARE(s2->events.at(1).first, 4);
QCOMPARE(s2->events.at(1).second, TestState::Exit);
+
+ QCOMPARE(s1EnteredSpy.count(), 1);
+ QCOMPARE(s1ExitedSpy.count(), 1);
+ QCOMPARE(tTriggeredSpy.count(), 1);
+ QCOMPARE(s2EnteredSpy.count(), 1);
+ QCOMPARE(s2ExitedSpy.count(), 1);
}
// Two top-level states, one has two child states
{