summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-07 13:19:27 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-09-07 13:19:27 (GMT)
commit4339c8e87f66a5d42439bca574e92ceef473d433 (patch)
tree2cb4fe97bdc06dc298237af5312123c940582c6b
parent7f37724eff30c858dcec1a4a94422feaa6a9ab4f (diff)
parentd724c91a0ae9ed38fd2dc33bcdd4edbe6aa69085 (diff)
downloadQt-4339c8e87f66a5d42439bca574e92ceef473d433.zip
Qt-4339c8e87f66a5d42439bca574e92ceef473d433.tar.gz
Qt-4339c8e87f66a5d42439bca574e92ceef473d433.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
-rw-r--r--demos/qtdemo/xml/examples.xml2
-rw-r--r--doc/src/examples/animatedtiles.qdoc50
-rw-r--r--doc/src/examples/appchooser.qdoc52
-rw-r--r--doc/src/examples/easing.qdoc51
-rw-r--r--doc/src/examples/rogue.qdoc16
-rw-r--r--doc/src/examples/states.qdoc50
-rw-r--r--doc/src/frameworks-technologies/plugins-howto.qdoc14
-rw-r--r--doc/src/getting-started/examples.qdoc4
-rw-r--r--doc/src/images/animatedtiles-example.pngbin0 -> 148019 bytes
-rw-r--r--doc/src/images/appchooser-example.pngbin0 -> 29447 bytes
-rw-r--r--doc/src/images/easing-example.pngbin0 -> 23843 bytes
-rw-r--r--doc/src/images/states-example.pngbin0 -> 34844 bytes
-rw-r--r--doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp15
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp8
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp42
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/opengl/qglframebufferobject.cpp35
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp20
19 files changed, 283 insertions, 80 deletions
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 77006c2..b545e1d 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -25,7 +25,7 @@
<example filename="appchooser" name="Appchooser" />
<example filename="easing" name="Easing Curves" />
<example filename="moveblocks" name="Moving Blocks" />
- <example filename="states" name="UI States" />
+ <example filename="states" name="States" />
<example filename="stickman" name="Stickman" />
</category>
<category dirname="qtconcurrent" name="Concurrent Programming">
diff --git a/doc/src/examples/animatedtiles.qdoc b/doc/src/examples/animatedtiles.qdoc
new file mode 100644
index 0000000..87f1f95
--- /dev/null
+++ b/doc/src/examples/animatedtiles.qdoc
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example animation/animatedtiles
+ \title Animated Tiles Example
+
+ The Animated Tiles example animates items in a graphics scene.
+
+ \image animatedtiles-example.png
+*/
+
diff --git a/doc/src/examples/appchooser.qdoc b/doc/src/examples/appchooser.qdoc
new file mode 100644
index 0000000..540291e
--- /dev/null
+++ b/doc/src/examples/appchooser.qdoc
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example animation/appchooser
+ \title Application Chooser Example
+
+ The Application Chooser example shows how to use the Qt state
+ machine and the animation framework to select between
+ applications.
+
+ \image appchooser-example.png
+
+*/
diff --git a/doc/src/examples/easing.qdoc b/doc/src/examples/easing.qdoc
new file mode 100644
index 0000000..20cccd2
--- /dev/null
+++ b/doc/src/examples/easing.qdoc
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example animation/easing
+ \title Easing Curves Example
+
+ The Easing Curves example shows how to use easing curves to
+ control the speed of an animation.
+
+ \image easing-example.png
+
+*/
diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc
index 8f97696..1327df6 100644
--- a/doc/src/examples/rogue.qdoc
+++ b/doc/src/examples/rogue.qdoc
@@ -52,8 +52,8 @@
\c{@} in the screenshot? That's you, the rogue. The \c{#}
characters are walls, and the dots represent floor. In a real
game, other ASCII characters would represent all kinds of objects
- and creatures. For instance, ancient dragons (\c{D}'s) or food
- rations (\c{%}'s). But let's not get carried away. In this game,
+ and creatures, for instance, ancient dragons (\c{D}s) or food
+ rations (\c{%}s). But let's not get carried away. In this game,
the rogue is simply running around in an empty room.
The rogue is moved with the keypad (2, 4, 8, 6). That aside, we
@@ -61,12 +61,12 @@
types \c {q}. The player is then asked if he/she really wants to
quit.
- Most games have commands that need more than one key press and
- that may require a different sequence of keys based on questions
- asked the user. In this game, only the \c quit command falls under
- this category, but for the sake of argument, let's imagine a
- fully-fledged game with a rich set of commands. If we were to
- implement these by catching key events in
+ Most games have commands that need more than one key press (we
+ think of consecutive presses, i.e., not of several keys being
+ pressed at the same time). In this game, only the \c quit command
+ falls under this category, but for the sake of argument, let's
+ imagine a fully-fledged game with a rich set of commands. If we
+ were to implement these by catching key events in
\l{QWidget::}{keyPressEvent()}, we would have to keep a lot of
class member variables to track the sequence of keys already typed
(or find some other way of deducing the current state of a
diff --git a/doc/src/examples/states.qdoc b/doc/src/examples/states.qdoc
new file mode 100644
index 0000000..c17abd0
--- /dev/null
+++ b/doc/src/examples/states.qdoc
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example animation/states
+ \title States Example
+
+ The States example shows how to use the Qt state machine to play
+ animations.
+
+ \image states-example.png
+*/
diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc
index 78e5c20..43bc695 100644
--- a/doc/src/frameworks-technologies/plugins-howto.qdoc
+++ b/doc/src/frameworks-technologies/plugins-howto.qdoc
@@ -226,6 +226,20 @@
located to your applications root folder (i.e., do not include the
\c plugins directory).
+ \note In Symbian all binaries must be located in the directory \\sys\\bin,
+ so each Qt plugin has a stub with the same basename as the plugin dll
+ and suffix ".qtplugin" to make Qt extension plugins work similarly to
+ other platforms.
+ When trying to locate the plugin, Qt actually looks for the stub
+ instead of the plugin binary. While plugin stub files have the
+ suffix ".qtplugin", they can still be loaded also by specifying a filename
+ with the normal library suffix ".dll" for QPluginLoader, so normally application
+ developer doesn't need to care about the different suffix of the stub.
+ Because of the way applications can be installed
+ on ROM or various other drives in Symbian, Qt looks for the stub from
+ the same directory on all available drives if it is not located in the given
+ directory when loading a plugin.
+
For more information about deployment,
see the \l {Deploying Qt Applications} and \l {Deploying Plugins}
documentation.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index b2a9997..0639bf0 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -1045,7 +1045,11 @@
\image animation-examples.png Animation
\list
+ \o \l{animation/animatedtiles}{Animated Tiles}
+ \o \l{animation/appchooser}{Application Chooser}
+ \o \l{animation/easing}{Easing Curves}
\o \l{animation/moveblocks}{Move Blocks}\raisedaster
+ \o \l{animation/states}{States}
\o \l{animation/stickman}{Stick man}\raisedaster
\endlist
*/
diff --git a/doc/src/images/animatedtiles-example.png b/doc/src/images/animatedtiles-example.png
new file mode 100644
index 0000000..082ac57
--- /dev/null
+++ b/doc/src/images/animatedtiles-example.png
Binary files differ
diff --git a/doc/src/images/appchooser-example.png b/doc/src/images/appchooser-example.png
new file mode 100644
index 0000000..885476e
--- /dev/null
+++ b/doc/src/images/appchooser-example.png
Binary files differ
diff --git a/doc/src/images/easing-example.png b/doc/src/images/easing-example.png
new file mode 100644
index 0000000..de48667
--- /dev/null
+++ b/doc/src/images/easing-example.png
Binary files differ
diff --git a/doc/src/images/states-example.png b/doc/src/images/states-example.png
new file mode 100644
index 0000000..f87b99b
--- /dev/null
+++ b/doc/src/images/states-example.png
Binary files differ
diff --git a/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp
new file mode 100644
index 0000000..128799f
--- /dev/null
+++ b/doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp
@@ -0,0 +1,15 @@
+//! [simple state machine]
+QPushButton button;
+
+QStateMachine machine;
+QState *s1 = new QState();
+s1->assignProperty(&button, "text", "Click me");
+
+QFinalState *s2 = new QFinalState();
+s1->addTransition(&button, SIGNAL(clicked()), s2);
+
+machine.addState(s1);
+machine.addState(s2);
+machine.setInitialState(s1);
+machine.start();
+//! [simple state machine]
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
index dab6682..da541c5 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITOpcodes.cpp
@@ -287,6 +287,7 @@ void JIT::emit_op_ret(Instruction* currentInstruction)
{
#ifdef QT_BUILD_SCRIPT_LIB
JITStubCall stubCall(this, JITStubs::cti_op_debug_return);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
stubCall.call();
#endif
// We could JIT generate the deref, only calling out to C when the refcount hits zero.
@@ -690,6 +691,7 @@ void JIT::emit_op_catch(Instruction* currentInstruction)
emitPutVirtualRegister(currentInstruction[1].u.operand);
#ifdef QT_BUILD_SCRIPT_LIB
JITStubCall stubCall(this, JITStubs::cti_op_debug_catch);
+ stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
stubCall.call();
#endif
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
index 1d39ba4..0a5eb07 100644
--- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
@@ -2747,7 +2747,9 @@ DEFINE_STUB_FUNCTION(void, op_debug_catch)
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) {
- debugger->exceptionCatch(DebuggerCallFrame(callFrame), callFrame->codeBlock()->ownerNode()->sourceID());
+ JSValue exceptionValue = callFrame->r(stackFrame.args[0].int32()).jsValue();
+ DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
+ debugger->exceptionCatch(debuggerCallFrame, callFrame->codeBlock()->ownerNode()->sourceID());
}
}
@@ -2756,7 +2758,9 @@ DEFINE_STUB_FUNCTION(void, op_debug_return)
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
if (JSC::Debugger* debugger = callFrame->lexicalGlobalObject()->debugger() ) {
- debugger->functionExit(JSValue(), callFrame->codeBlock()->ownerNode()->sourceID());
+ JSValue returnValue = callFrame->r(stackFrame.args[0].int32()).jsValue();
+ intptr_t sourceID = callFrame->codeBlock()->ownerNode()->sourceID();
+ debugger->functionExit(returnValue, sourceID);
}
}
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index f562fb3..a5cdd45 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -78,13 +78,13 @@
QT_BEGIN_NAMESPACE
/*!
- \class QStateMachine
- \reentrant
+ \class QStateMachine
+ \reentrant
- \brief The QStateMachine class provides a hierarchical finite state machine.
+ \brief The QStateMachine class provides a hierarchical finite state machine.
- \since 4.6
- \ingroup statemachine
+ \since 4.6
+ \ingroup statemachine
QStateMachine is based on the concepts and notation of
\l{Statecharts: A visual formalism for complex
@@ -128,21 +128,7 @@ QT_BEGIN_NAMESPACE
The following snippet shows a state machine that will finish when a button
is clicked:
- \code
- QPushButton button;
-
- QStateMachine machine;
- QState *s1 = new QState();
- s1->assignProperty(&button, "text", "Click me");
-
- QFinalState *s2 = new QFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.setInitialState(s1);
- machine.start();
- \endcode
+ \snippet doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp simple state machine
This code example uses QState, which inherits QAbstractState. The
QState class provides a state that you can use to set properties
@@ -160,17 +146,7 @@ QT_BEGIN_NAMESPACE
no error state applies to the erroneous state, the machine will stop
executing and an error message will be printed to the console.
- \omit This stuff will be moved elsewhere
-This is
- typically used in conjunction with \l{Signals and Slots}{signals}; the
- signals determine the flow of the state graph, whereas the states' property
- assignments and method invocations are the actions.
-
- The postEvent() function posts an event to the state machine. This is useful
- when you are using custom events to trigger transitions.
- \endomit
-
- \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
+ \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
*/
/*!
@@ -1748,6 +1724,10 @@ bool QStateMachine::isRunning() const
transition to the initial state. When a final top-level state (QFinalState)
is entered, the machine will emit the finished() signal.
+ \note A state machine will not run without a running event loop, such as
+ the main application event loop started with QCoreApplication::exec() or
+ QApplication::exec().
+
\sa started(), finished(), stop(), initialState()
*/
void QStateMachine::start()
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index eae3e63..7023e9e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -934,7 +934,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
}
QGraphicsItem *lastSubFocusItem = subFocusItem;
- if (subFocusItem) {
+ if (subFocusItem && !inDestructor) {
// Update the child focus chain; when reparenting an item that has a
// focus child, ensure that that focus child clears its focus child
// chain from our parents before it's reparented.
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 94e3930..c50608c 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
-#define QGL_FUNC_CONTEXT QGLContext *ctx = d_ptr->ctx;
+#define QGL_FUNC_CONTEXT QGLContextGroup *ctx = d_ptr->ctx;
#define QT_CHECK_GLERROR() \
{ \
@@ -288,7 +288,7 @@ public:
QGLFramebufferObjectFormat format;
uint valid : 1;
QGLFramebufferObject::Attachment fbo_attachment;
- QGLContext *ctx; // for Windows extension ptrs
+ QGLContextGroup *ctx; // for Windows extension ptrs
GLuint previous_fbo;
mutable QPaintEngine *engine;
};
@@ -340,9 +340,10 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::Attachment attachment,
GLenum texture_target, GLenum internal_format, GLint samples)
{
- ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+ QGLContext *currentContext = const_cast<QGLContext *>(QGLContext::currentContext());
+ ctx = QGLContextPrivate::contextGroup(currentContext);
bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
- if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
+ if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(currentContext)))
return;
size = sz;
@@ -466,7 +467,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At
fbo_attachment = QGLFramebufferObject::NoAttachment;
}
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, currentContext->d_ptr->current_fbo);
if (!valid) {
if (color_buffer)
glDeleteRenderbuffers(1, &color_buffer);
@@ -736,16 +737,19 @@ QGLFramebufferObject::~QGLFramebufferObject()
delete d->engine;
- if (isValid()
- && (d->ctx == QGLContext::currentContext()
- || qgl_share_reg()->checkSharing(d->ctx, QGLContext::currentContext())))
- {
+ if (isValid()) {
+ const QGLContext *oldContext = QGLContext::currentContext();
+ bool switchContext = !oldContext || QGLContextPrivate::contextGroup(oldContext) != ctx;
+ if (switchContext)
+ const_cast<QGLContext *>(ctx->context())->makeCurrent();
glDeleteTextures(1, &d->texture);
if (d->color_buffer)
glDeleteRenderbuffers(1, &d->color_buffer);
if (d->depth_stencil_buffer)
glDeleteRenderbuffers(1, &d->depth_stencil_buffer);
glDeleteFramebuffers(1, &d->fbo);
+ if (oldContext && switchContext)
+ const_cast<QGLContext *>(oldContext)->makeCurrent();
}
}
@@ -897,7 +901,7 @@ QImage QGLFramebufferObject::toImage() const
bool wasBound = isBound();
if (!wasBound)
const_cast<QGLFramebufferObject *>(this)->bind();
- QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true);
+ QImage image = qt_gl_read_framebuffer(d->size, format().textureTarget() != GL_RGB, true);
if (!wasBound)
const_cast<QGLFramebufferObject *>(this)->release();
@@ -969,16 +973,14 @@ bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
*/
void QGLFramebufferObject::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget)
{
- Q_D(QGLFramebufferObject);
- d->ctx->drawTexture(target, textureId, textureTarget);
+ const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget);
}
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
/*! \internal */
void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget)
{
- Q_D(QGLFramebufferObject);
- d->ctx->drawTexture(target, textureId, textureTarget);
+ const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget);
}
#endif
@@ -994,8 +996,7 @@ void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint te
*/
void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget)
{
- Q_D(QGLFramebufferObject);
- d->ctx->drawTexture(point, textureId, textureTarget);
+ const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget);
}
#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
@@ -1100,7 +1101,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const
bool QGLFramebufferObject::isBound() const
{
Q_D(const QGLFramebufferObject);
- return d->ctx->d_ptr->current_fbo == d->fbo;
+ return QGLContext::currentContext()->d_ptr->current_fbo == d->fbo;
}
/*!
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index 3d1cbe8..75f7a12 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -589,11 +589,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionCall()
// anonymous function exit
QCOMPARE(spy->at(2).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(2).value.isNumber());
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(2).value.toNumber(), qsreal(123));
// evaluate() exit
@@ -670,11 +666,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_functionDefinition()
// foo() exit
QCOMPARE(spy->at(4).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(4).value.isNumber());
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(4).value.toNumber(), qsreal(456));
// evaluate() exit
@@ -1059,11 +1051,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_call()
// exit
QCOMPARE(spy->at(1).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(1).value.isNumber());
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QCOMPARE(spy->at(1).value.toNumber(), qsreal(123));
}
delete spy;
@@ -1619,8 +1607,6 @@ void tst_QScriptEngineAgent::exceptionThrowAndCatch()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::ExceptionCatch);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue);
QVERIFY(spy->at(1).value.strictlyEquals(spy->at(0).value));
}
}
@@ -1764,8 +1750,6 @@ void tst_QScriptEngineAgent::eventOrder_throwAndCatch()
QVERIFY(spy->at(7).hasExceptionHandler);
// catch
QCOMPARE(spy->at(8).type, ScriptEngineEvent::ExceptionCatch);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "Exception value is not passed in exceptionCatch event when JIT is enabled", Continue);
QVERIFY(spy->at(8).value.isError());
// void(e)
QCOMPARE(spy->at(9).type, ScriptEngineEvent::PositionChange);
@@ -1816,16 +1800,12 @@ void tst_QScriptEngineAgent::eventOrder_functions()
// bar() exit
QCOMPARE(spy->at(15).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(15).scriptId, spy->at(3).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(15).value.isNumber());
// restore context
QCOMPARE(spy->at(16).type, ScriptEngineEvent::ContextPop);
// foo() exit
QCOMPARE(spy->at(17).type, ScriptEngineEvent::FunctionExit);
QCOMPARE(spy->at(17).scriptId, spy->at(0).scriptId);
- if (qt_script_isJITEnabled())
- QEXPECT_FAIL("", "function return value is not reported when JIT is enabled", Continue);
QVERIFY(spy->at(17).value.isNumber());
// restore context
QCOMPARE(spy->at(18).type, ScriptEngineEvent::ContextPop);