summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/boxes/glbuffers.h2
-rw-r--r--demos/boxes/scene.cpp2
-rw-r--r--demos/boxes/scene.h3
-rw-r--r--examples/opengl/hellogl_es2/glwidget.cpp8
-rw-r--r--examples/statemachine/eventtransitions/main.cpp5
-rw-r--r--examples/statemachine/factorial/main.cpp6
-rw-r--r--examples/statemachine/pingpong/main.cpp5
-rw-r--r--examples/statemachine/trafficlight/main.cpp5
-rw-r--r--examples/statemachine/twowaybutton/main.cpp4
-rw-r--r--src/corelib/animation/qabstractanimation.cpp4
-rw-r--r--src/corelib/animation/qanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qpauseanimation.cpp4
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp6
-rw-r--r--src/corelib/animation/qvariantanimation.cpp4
-rw-r--r--src/corelib/global/qfeatures.txt7
-rw-r--r--src/corelib/kernel/qvariant_p.h20
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp5
-rw-r--r--src/corelib/statemachine/qabstractstate.h4
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp5
-rw-r--r--src/corelib/statemachine/qabstracttransition.h4
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp5
-rw-r--r--src/corelib/statemachine/qeventtransition.h4
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp5
-rw-r--r--src/corelib/statemachine/qfinalstate.h4
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp5
-rw-r--r--src/corelib/statemachine/qhistorystate.h4
-rw-r--r--src/corelib/statemachine/qsignalevent.h4
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp5
-rw-r--r--src/corelib/statemachine/qsignaltransition.h4
-rw-r--r--src/corelib/statemachine/qstate.cpp5
-rw-r--r--src/corelib/statemachine/qstate.h4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp5
-rw-r--r--src/corelib/statemachine/qstatemachine.h4
-rw-r--r--src/corelib/statemachine/qwrappedevent.h4
-rw-r--r--src/corelib/tools/qvector.h9
-rw-r--r--src/gui/animation/qguivariantanimation.cpp4
-rw-r--r--src/gui/image/qpixmapcache.cpp5
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition_p.h5
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition_p.h5
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp5
-rw-r--r--src/gui/statemachine/qkeyeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qkeyeventtransition.h4
-rw-r--r--src/gui/statemachine/qmouseeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qmouseeventtransition.h4
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp30
-rw-r--r--src/gui/styles/qgtkstyle.cpp1
-rw-r--r--src/gui/styles/qmacstyle_mac.mm14
-rw-r--r--src/gui/styles/qplastiquestyle.cpp57
-rw-r--r--src/gui/styles/qstyle_p.h2
-rw-r--r--src/gui/styles/qstylehelper.cpp1
-rw-r--r--src/gui/styles/qstylehelper_p.h1
-rw-r--r--src/gui/widgets/qstatusbar.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp3
-rw-r--r--src/opengl/qglshaderprogram.cpp186
-rw-r--r--src/opengl/qglshaderprogram.h16
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qtestbasicstreamer.h6
-rw-r--r--src/testlib/qtestcoreelement.h10
-rw-r--r--src/testlib/qtestcorelist.h6
-rw-r--r--src/testlib/qtestelement.h8
-rw-r--r--src/testlib/qtestelementattribute.h8
-rw-r--r--src/testlib/qtestfilelogger.h6
-rw-r--r--src/testlib/qtestlightxmlstreamer.h8
-rw-r--r--src/testlib/qtestxmlstreamer.h8
-rw-r--r--src/testlib/qtestxunitstreamer.h8
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/headers/tst_headers.cpp3
-rw-r--r--tests/auto/qstringbuilder/qstringbuilder.pro5
-rw-r--r--tests/auto/qstringbuilder/scenario1.cpp1
-rw-r--r--tests/auto/qstringbuilder/scenario1.pro8
-rw-r--r--tests/auto/qstringbuilder/scenario2.cpp1
-rw-r--r--tests/auto/qstringbuilder/scenario2.pro7
-rw-r--r--tests/auto/qstringbuilder/scenario3.cpp1
-rw-r--r--tests/auto/qstringbuilder/scenario3.pro7
-rw-r--r--tests/auto/qstringbuilder/scenario4.cpp1
-rw-r--r--tests/auto/qstringbuilder/scenario4.pro7
-rw-r--r--tests/auto/qstringbuilder/tst_qstringbuilder.cpp182
-rw-r--r--tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp4
-rw-r--r--tests/benchmarks/qstringbuilder/main.cpp86
-rw-r--r--tools/qdoc3/htmlgenerator.cpp47
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rw-r--r--tools/qdoc3/qdoc3.pro2
-rw-r--r--tools/qdoc3/test/classic.css2
88 files changed, 718 insertions, 273 deletions
diff --git a/demos/boxes/glbuffers.h b/demos/boxes/glbuffers.h
index 392924e..9e05fad 100644
--- a/demos/boxes/glbuffers.h
+++ b/demos/boxes/glbuffers.h
@@ -58,7 +58,9 @@ if (m_failed || !(assertion)) {
returnStatement; \
}
+QT_BEGIN_NAMESPACE
class QMatrix4x4;
+QT_END_NAMESPACE
class GLTexture
{
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index e2aa16b..2376782 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -559,7 +559,7 @@ void Scene::initGL()
<< ":/res/boxes/cubemap_negy.jpg" << ":/res/boxes/cubemap_posz.jpg" << ":/res/boxes/cubemap_negz.jpg";
m_environment = new GLTextureCube(list, qMin(1024, m_maxTextureSize));
m_environmentShader = new QGLShader(QGLShader::FragmentShader);
- m_environmentShader->setSourceCode(environmentShaderText);
+ m_environmentShader->compile(environmentShaderText);
m_environmentProgram = new QGLShaderProgram;
m_environmentProgram->addShader(m_vertexShader);
m_environmentProgram->addShader(m_environmentShader);
diff --git a/demos/boxes/scene.h b/demos/boxes/scene.h
index 48ecaba..9f8d2af 100644
--- a/demos/boxes/scene.h
+++ b/demos/boxes/scene.h
@@ -56,7 +56,10 @@
#define PI 3.14159265358979
+QT_BEGIN_NAMESPACE
class QMatrix4x4;
+QT_END_NAMESPACE
+
class ParameterEdit : public QWidget
{
public:
diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp
index ee50670..cb4a48d 100644
--- a/examples/opengl/hellogl_es2/glwidget.cpp
+++ b/examples/opengl/hellogl_es2/glwidget.cpp
@@ -190,7 +190,7 @@ void GLWidget::initializeGL ()
" color = clamp(color, 0.0, 1.0);\n"
" gl_Position = matrix * vertex;\n"
"}\n";
- vshader1->setSourceCode(vsrc1);
+ vshader1->compile(vsrc1);
QGLShader *fshader1 = new QGLShader(QGLShader::FragmentShader, this);
const char *fsrc1 =
@@ -199,7 +199,7 @@ void GLWidget::initializeGL ()
"{\n"
" gl_FragColor = color;\n"
"}\n";
- fshader1->setSourceCode(fsrc1);
+ fshader1->compile(fsrc1);
program1.addShader(vshader1);
program1.addShader(fshader1);
@@ -224,7 +224,7 @@ void GLWidget::initializeGL ()
" gl_Position = matrix * vertex;\n"
" texc = texCoord;\n"
"}\n";
- vshader2->setSourceCode(vsrc2);
+ vshader2->compile(vsrc2);
QGLShader *fshader2 = new QGLShader(QGLShader::FragmentShader);
const char *fsrc2 =
@@ -237,7 +237,7 @@ void GLWidget::initializeGL ()
" color = color * 0.2 + color * 0.8 * angle;\n"
" gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n"
"}\n";
- fshader2->setSourceCode(fsrc2);
+ fshader2->compile(fsrc2);
program2.addShader(vshader2);
program2.addShader(fshader2);
diff --git a/examples/statemachine/eventtransitions/main.cpp b/examples/statemachine/eventtransitions/main.cpp
index aba0c73..5959016 100644
--- a/examples/statemachine/eventtransitions/main.cpp
+++ b/examples/statemachine/eventtransitions/main.cpp
@@ -40,11 +40,6 @@
****************************************************************************/
#include <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qeventtransition.h>
-#endif
//! [0]
class Window : public QWidget
diff --git a/examples/statemachine/factorial/main.cpp b/examples/statemachine/factorial/main.cpp
index 1065eb8..bf3f80e 100644
--- a/examples/statemachine/factorial/main.cpp
+++ b/examples/statemachine/factorial/main.cpp
@@ -41,12 +41,6 @@
#include <QtCore>
#include <stdio.h>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstatemachine.h>
-#include <qstate.h>
-#include <qsignaltransition.h>
-#include <qfinalstate.h>
-#endif
//! [0]
class Factorial : public QObject
diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp
index 331627e..586b422 100644
--- a/examples/statemachine/pingpong/main.cpp
+++ b/examples/statemachine/pingpong/main.cpp
@@ -41,11 +41,6 @@
#include <QtCore>
#include <stdio.h>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstate.h>
-#include <qstatemachine.h>
-#include <qabstracttransition.h>
-#endif
//! [0]
class PingEvent : public QEvent
diff --git a/examples/statemachine/trafficlight/main.cpp b/examples/statemachine/trafficlight/main.cpp
index 8a46fff..23f4bed 100644
--- a/examples/statemachine/trafficlight/main.cpp
+++ b/examples/statemachine/trafficlight/main.cpp
@@ -40,11 +40,6 @@
****************************************************************************/
#include <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstate.h>
-#include <qstatemachine.h>
-#include <qfinalstate.h>
-#endif
//! [0]
class LightWidget : public QWidget
diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp
index a2c6e45..f5afeca 100644
--- a/examples/statemachine/twowaybutton/main.cpp
+++ b/examples/statemachine/twowaybutton/main.cpp
@@ -40,10 +40,6 @@
****************************************************************************/
#include <QtGui>
-#ifdef QT_STATEMACHINE_SOLUTION
-#include <qstate.h>
-#include <qstatemachine.h>
-#endif
//! [0]
int main(int argc, char **argv)
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 61d61df..fcc63a4 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -142,8 +142,6 @@
\sa direction
*/
-#ifndef QT_NO_ANIMATION
-
#include "qabstractanimation.h"
#include "qanimationgroup.h"
#include <QtCore/qdebug.h>
@@ -155,6 +153,8 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qpointer.h>
+#ifndef QT_NO_ANIMATION
+
#define DEFAULT_TIMER_INTERVAL 16
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index 839b522..e192a6c 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -89,13 +89,13 @@
\sa QAbstractAnimation, QVariantAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qanimationgroup.h"
#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include "qanimationgroup_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 13f6073..c148cb5d 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -68,11 +68,13 @@
\sa QAnimationGroup, QPropertyAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
#include "qparallelanimationgroup.h"
#include "qparallelanimationgroup_p.h"
//#define QANIMATION_DEBUG
+
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index b175f0c..93043c2 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -62,12 +62,12 @@
\sa QSequentialAnimationGroup
*/
-#ifndef QT_NO_ANIMATION
-
#include "qpauseanimation.h"
#include "qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QPauseAnimationPrivate : public QAbstractAnimationPrivate
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 357a6ac..65f1361 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -87,8 +87,6 @@
\sa QVariantAnimation, QAnimationGroup, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qpropertyanimation.h"
#include "qanimationgroup.h"
#include "qpropertyanimation_p.h"
@@ -97,6 +95,8 @@
#include <QtCore/qmutex.h>
#include <private/qmutexpool_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 14814a7..25db52f 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -77,8 +77,6 @@
\sa QAnimationGroup, QAbstractAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qsequentialanimationgroup.h"
#include "qsequentialanimationgroup_p.h"
@@ -86,9 +84,9 @@
#include <QtCore/qdebug.h>
-QT_BEGIN_NAMESPACE
-
+#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
bool QSequentialAnimationGroupPrivate::atEnd() const
{
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index a3fa93a..ab73373 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -39,8 +39,6 @@
**
****************************************************************************/
-#ifndef QT_NO_ANIMATION
-
#include "qvariantanimation.h"
#include "qvariantanimation_p.h"
@@ -49,6 +47,8 @@
#include <QtCore/qmutex.h>
#include <private/qmutexpool_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 23ec7b0..9408a5b 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -1164,6 +1164,13 @@ Requires: PROPERTIES
Name: Animation
SeeAlso: ???
+Feature: STATEMACHINE
+Description: Provides hierarchical finite state machines.
+Section: Utilities
+Requires: PROPERTIES
+Name: State machine
+SeeAlso: ???
+
# SVG
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 033b760..02b507e 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -105,28 +105,28 @@ private:
// constructs a new variant if copy is 0, otherwise copy-constructs
template <class T>
-inline void v_construct(QVariant::Private *x, const T &t)
+inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
{
if (sizeof(T) > sizeof(QVariant::Private::Data)) {
- x->data.shared = new QVariantPrivateSharedEx<T>(t);
+ x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
+ : new QVariantPrivateSharedEx<T>;
x->is_shared = true;
} else {
- new (&x->data.ptr) T(t);
+ if (copy)
+ new (&x->data.ptr) T(*static_cast<const T *>(copy));
+ else
+ new (&x->data.ptr) T;
}
}
template <class T>
-inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
+inline void v_construct(QVariant::Private *x, const T &t)
{
if (sizeof(T) > sizeof(QVariant::Private::Data)) {
- x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
- : new QVariantPrivateSharedEx<T>;
+ x->data.shared = new QVariantPrivateSharedEx<T>(t);
x->is_shared = true;
} else {
- if (copy)
- new (&x->data.ptr) T(*static_cast<const T *>(copy));
- else
- new (&x->data.ptr) T;
+ new (&x->data.ptr) T(t);
}
}
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 942722f..b9a50a2 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qabstractstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstractstate_p.h"
#include "qstate.h"
#include "qstate_p.h"
@@ -200,3 +203,5 @@ bool QAbstractState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index d0ebb52..ee55541 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QState;
class QStateMachine;
@@ -83,6 +85,8 @@ private:
Q_DECLARE_PRIVATE(QAbstractState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index dfcafeb..f582b8c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qabstracttransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstracttransition_p.h"
#include "qabstractstate.h"
#include "qstate.h"
@@ -340,3 +343,5 @@ bool QAbstractTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index c63d55a..a1a62c9 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEvent;
class QAbstractState;
class QState;
@@ -104,6 +106,8 @@ private:
Q_DECLARE_PRIVATE(QAbstractTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index f25d821..4c40256 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qeventtransition_p.h"
#include "qwrappedevent.h"
#include "qstate.h"
@@ -283,3 +286,5 @@ bool QEventTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 3530bdd..40ffecf 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEventTransitionPrivate;
class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
{
@@ -89,6 +91,8 @@ private:
Q_DECLARE_PRIVATE(QEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index 0980336..0eb531f 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qfinalstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstractstate_p.h"
QT_BEGIN_NAMESPACE
@@ -132,3 +135,5 @@ bool QFinalState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index fa68394..865f333 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QFinalStatePrivate;
class Q_CORE_EXPORT QFinalState : public QAbstractState
{
@@ -69,6 +71,8 @@ private:
Q_DECLARE_PRIVATE(QFinalState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index 517faa8..4304da3 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qhistorystate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qhistorystate_p.h"
QT_BEGIN_NAMESPACE
@@ -221,3 +224,5 @@ bool QHistoryState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index a0682bd..eee43d1 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QHistoryStatePrivate;
class Q_CORE_EXPORT QHistoryState : public QAbstractState
{
@@ -84,6 +86,8 @@ private:
Q_DECLARE_PRIVATE(QHistoryState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h
index 8221f68..79d1053 100644
--- a/src/corelib/statemachine/qsignalevent.h
+++ b/src/corelib/statemachine/qsignalevent.h
@@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class Q_CORE_EXPORT QSignalEvent : public QEvent
{
public:
@@ -70,6 +72,8 @@ private:
QList<QVariant> m_arguments;
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 9ffcb9c..2e150a7 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qsignaltransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qsignaltransition_p.h"
#include "qsignalevent.h"
#include "qstate.h"
@@ -258,3 +261,5 @@ bool QSignalTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index b485785..02b1de9 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QSignalTransitionPrivate;
class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
{
@@ -82,6 +84,8 @@ private:
Q_DECLARE_PRIVATE(QSignalTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index ebb0b47..5dd56c0 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qstate_p.h"
#include "qhistorystate.h"
#include "qhistorystate_p.h"
@@ -482,3 +485,5 @@ bool QState::event(QEvent *e)
*/
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 6729c69..c98bb64 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QAbstractTransition;
class QSignalTransition;
@@ -106,6 +108,8 @@ private:
Q_DECLARE_PRIVATE(QState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index d5f6b76..64b33ac 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qstatemachine.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine_p.h"
@@ -2207,3 +2210,5 @@ QWrappedEvent::~QWrappedEvent()
QT_END_NAMESPACE
#include "moc_qstatemachine.cpp"
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 2a98a9a..0b3c728 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEvent;
class QAbstractState;
class QState;
@@ -159,6 +161,8 @@ private:
#endif
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qwrappedevent.h b/src/corelib/statemachine/qwrappedevent.h
index b01c608..cb4261b 100644
--- a/src/corelib/statemachine/qwrappedevent.h
+++ b/src/corelib/statemachine/qwrappedevent.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QObject;
class Q_CORE_EXPORT QWrappedEvent : public QEvent
@@ -69,6 +71,8 @@ private:
Q_DISABLE_COPY(QWrappedEvent)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 7bdcba0..38254cd 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -94,7 +94,14 @@ template <typename T>
class QVector
{
typedef QVectorTypedData<T> Data;
- union { QVectorData *d; Data *p; };
+ union {
+ QVectorData *d;
+#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550)
+ QVectorTypedData<T> *p;
+#else
+ Data *p;
+#endif
+ };
public:
inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); }
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index 37ca6a1..bcffb85 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -65,7 +65,9 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator)
static int qUnregisterGuiGetInterpolator()
{
- qRegisterAnimationInterpolator<QColor>(0);
+ qRegisterAnimationInterpolator<QColor>(
+ (QVariant (*)(const QColor &, const QColor &, qreal))0); // cast required by Sun CC 5.5
+
return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator)
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 82b42b4..bdcddfd 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -65,7 +65,10 @@ QT_BEGIN_NAMESPACE
object for caching the pixmaps.
The cache associates a pixmap with a string as a key or with a QPixmapCache::Key.
- The QPixmapCache::Key is faster than using strings as key.
+ The QPixmapCache::Key is faster than using strings as key. The string API is
+ very convenient for complex keys but the QPixmapCache::Key API will be very efficient
+ and convenient for a 1 object <-> 1 pixmap mapping (then you can store the key as
+ a member).
If two pixmaps are inserted into the cache using equal keys, then the
last pixmap will hide the first pixmap. The QHash and QCache classes do
exactly the same.
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a9424db..f2a3498 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -838,9 +838,11 @@ void QApplicationPrivate::initialize()
// trigger registering of QVariant's GUI types
extern int qRegisterGuiVariant();
qRegisterGuiVariant();
+#ifndef QT_NO_STATEMACHINE
// trigger registering of QStateMachine's GUI types
extern int qRegisterGuiStateMachine();
qRegisterGuiStateMachine();
+#endif
is_app_running = true; // no longer starting up
@@ -1062,9 +1064,11 @@ QApplication::~QApplication()
QApplicationPrivate::fade_tooltip = false;
QApplicationPrivate::widgetCount = false;
+#ifndef QT_NO_STATEMACHINE
// trigger unregistering of QStateMachine's GUI types
extern int qUnregisterGuiStateMachine();
qUnregisterGuiStateMachine();
+#endif
// trigger unregistering of QVariant's GUI types
extern int qUnregisterGuiVariant();
qUnregisterGuiVariant();
diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp
index f7f1eb6..61362b2 100644
--- a/src/gui/statemachine/qbasickeyeventtransition.cpp
+++ b/src/gui/statemachine/qbasickeyeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qbasickeyeventtransition_p.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
#include <qdebug.h>
#include <private/qabstracttransition_p.h>
@@ -201,3 +204,5 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h
index 39fa6ad..aef1f99 100644
--- a/src/gui/statemachine/qbasickeyeventtransition_p.h
+++ b/src/gui/statemachine/qbasickeyeventtransition_p.h
@@ -54,6 +54,9 @@
//
#include <QtCore/qabstracttransition.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
@@ -90,4 +93,6 @@ private:
QT_END_NAMESPACE
+#endif //QT_NO_STATEMACHINE
+
#endif
diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp
index 20dd792..0304e28 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qbasicmouseeventtransition_p.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
#include <QtGui/qpainterpath.h>
#include <qdebug.h>
@@ -206,3 +209,5 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h
index 6c0afe4..ed0022a 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h
@@ -54,6 +54,9 @@
//
#include <QtCore/qabstracttransition.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
@@ -93,6 +96,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
+#endif //QT_NO_STATEMACHINE
#endif
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 612e43e..69155a9 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include <QtCore/qstatemachine.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtGui/qgraphicssceneevent.h>
@@ -557,3 +560,5 @@ int qUnregisterGuiStateMachine()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp
index f803711..fee9f81 100644
--- a/src/gui/statemachine/qkeyeventtransition.cpp
+++ b/src/gui/statemachine/qkeyeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qkeyeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qbasickeyeventtransition_p.h"
#include <QtCore/qwrappedevent.h>
#include <private/qeventtransition_p.h>
@@ -184,3 +187,5 @@ void QKeyEventTransition::onTransition(QEvent *event)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h
index d9c7760..c9e06f5 100644
--- a/src/gui/statemachine/qkeyeventtransition.h
+++ b/src/gui/statemachine/qkeyeventtransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#ifndef QT_NO_STATEMACHINE
+
class QKeyEventTransitionPrivate;
class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition
{
@@ -80,6 +82,8 @@ private:
Q_DECLARE_PRIVATE(QKeyEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp
index e4e18eb..6ae3d36 100644
--- a/src/gui/statemachine/qmouseeventtransition.cpp
+++ b/src/gui/statemachine/qmouseeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qmouseeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qbasicmouseeventtransition_p.h"
#include <QtCore/qwrappedevent.h>
#include <QtGui/qpainterpath.h>
@@ -214,3 +217,5 @@ void QMouseEventTransition::onTransition(QEvent *event)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h
index 9c7af5b..557b2c3 100644
--- a/src/gui/statemachine/qmouseeventtransition.h
+++ b/src/gui/statemachine/qmouseeventtransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#ifndef QT_NO_STATEMACHINE
+
class QMouseEventTransitionPrivate;
class QPainterPath;
class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition
@@ -85,6 +87,8 @@ private:
Q_DECLARE_PRIVATE(QMouseEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 5c37794..b33dfc1 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1664,7 +1664,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
}
painter->fillRect(r, gradient);
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(r.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, r.width(), r.height());
@@ -1683,8 +1683,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 3), pixmapRect.bottomRight() + QPoint(-1, -3)); cachePainter.setPen(QPen(option->palette.light().color()));
cachePainter.drawLine(pixmapRect.topRight() + QPoint(0, 3), pixmapRect.bottomRight() + QPoint(0, -3)); }
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(r.topLeft(), cache);
}
@@ -2438,7 +2437,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QPixmap cache;
QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(spinBox->rect.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
@@ -2655,8 +2654,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.fillRect(downRect.adjusted(1, 0, 0, 0), disabledColor);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(spinBox->rect.topLeft(), cache);
}
@@ -3187,7 +3185,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (isEnabled)
pixmapName += QLatin1String("-enabled");
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(comboBox->rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -3314,8 +3312,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(comboBox->rect.topLeft(), cache);
}
@@ -3406,7 +3403,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QRect pixmapRect(0, 0, groove.width(), groove.height());
// draw background groove
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3433,15 +3430,14 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(groove.topLeft(), cache);
// draw blue groove highlight
QRect clipRect;
groovePixmapName += QLatin1String("_blue");
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3460,8 +3456,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
if (horizontal) {
if (slider->upsideDown)
@@ -3483,7 +3478,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// draw handle
if ((option->subControls & SC_SliderHandle) ) {
QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3564,8 +3559,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
}
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 151dab0..1fe4627 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -176,7 +176,6 @@ public:
static const int groupBoxBottomMargin = 2; // space below the groupbox
static const int groupBoxTitleMargin = 6; // space between contents and title
static const int groupBoxTopMargin = 2;
-static bool UsePixmapCache = true;
// Get size of the arrow controls in a GtkSpinButton
static int spinboxArrowSize()
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 43efedf..99894ad 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -4339,7 +4339,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
tdi.enableState = kThemeTrackDisabled;
else
tdi.enableState = kThemeTrackActive;
- HIThemeDrawTrack(&tdi, 0, cg, kHIThemeOrientationNormal);
+ HIThemeOrientation drawOrientation = kHIThemeOrientationNormal;
+ if (reverse) {
+ if (vertical) {
+ drawOrientation = kHIThemeOrientationInverted;
+ } else {
+ CGContextSaveGState(cg);
+ CGContextTranslateCTM(cg, pb->rect.width(), 0);
+ CGContextScaleCTM(cg, -1, 1);
+ }
+ }
+ HIThemeDrawTrack(&tdi, 0, cg, drawOrientation);
+ if (reverse && !vertical)
+ CGContextRestoreGState(cg);
}
break;
case CE_ProgressBarLabel:
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 91ad64e..01c0e44 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -43,7 +43,6 @@
#if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN)
-static bool UsePixmapCache = true;
static const bool AnimateBusyProgressBar = true;
static const bool AnimateProgressBar = false;
// #define QPlastique_MaskButtons
@@ -491,7 +490,7 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
QPixmap texture = brush->texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -552,7 +551,7 @@ static QBrush qBrushLight(QBrush brush, int light)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -611,7 +610,7 @@ static QBrush qBrushDark(QBrush brush, int dark)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -750,8 +749,7 @@ static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, con
QPainter *p = painter;
QRect r = rect;
- bool doPixmapCache = UsePixmapCache
- && painter->deviceTransform().isIdentity()
+ bool doPixmapCache = painter->deviceTransform().isIdentity()
&& painter->worldMatrix().isIdentity();
if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
painter->drawPixmap(rect, cache);
@@ -1006,8 +1004,6 @@ QPlastiqueStylePrivate::QPlastiqueStylePrivate() :
, progressBarAnimateTimer(0)
#endif
{
- if (!qgetenv("QT_STYLE_NO_PIXMAPCACHE").isNull())
- UsePixmapCache = false;
}
/*!
@@ -1517,7 +1513,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
}
#endif
QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -1547,8 +1543,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
handle);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(rect.topLeft(), cache);
break;
@@ -2786,7 +2781,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
option, rect.size());
QPixmap cache;
- if ((!UsePixmapCache || !QPixmapCache::find(progressBarName, cache)) && rect.height() > 7) {
+ if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
QSize size = rect.size();
cache = QPixmap(QSize(size.width() - 6 + 30, size.height() - 6));
cache.fill(Qt::white);
@@ -2819,8 +2814,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
leftEdge += 10;
}
- if (UsePixmapCache)
- QPixmapCache::insert(progressBarName, cache);
+ QPixmapCache::insert(progressBarName, cache);
}
painter->setClipRect(progressBar.adjusted(1, 0, -1, -1));
@@ -2848,7 +2842,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
pixmapName += QString::number(- int(header->position));
pixmapName += QString::number(- int(header->orientation));
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -2892,8 +2886,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
@@ -3093,7 +3086,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if ((option->state & State_Selected)) {
QPixmap cache;
QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -3143,8 +3136,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
lines[1] = QLine(rect.right() - 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 2);
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
} else {
@@ -3458,7 +3450,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(addLinePixmapName, cache)) {
+ if (!QPixmapCache::find(addLinePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3517,8 +3509,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
addLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
addLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(addLinePixmapName, cache);
+ QPixmapCache::insert(addLinePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3536,7 +3527,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
groovePixmapName += QLatin1String("-addpage");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(option->palette.background().color());
QPainter groovePainter(&cache);
@@ -3562,8 +3553,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3591,7 +3581,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(subLinePixmapName, cache)) {
+ if (!QPixmapCache::find(subLinePixmapName, cache)) {
cache = QPixmap(button1.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3651,8 +3641,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
subLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
subLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(subLinePixmapName, cache);
+ QPixmapCache::insert(subLinePixmapName, cache);
}
painter->drawPixmap(button1.topLeft(), cache);
painter->drawPixmap(button2.topLeft(), cache);
@@ -3670,7 +3659,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
sliderPixmapName += QLatin1String("-horizontal");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(sliderPixmapName, cache)) {
+ if (!QPixmapCache::find(sliderPixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3741,8 +3730,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
sliderPainter.end();
// insert the slider into the cache
- if (UsePixmapCache)
- QPixmapCache::insert(sliderPixmapName, cache);
+ QPixmapCache::insert(sliderPixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3892,7 +3880,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if ((option->activeSubControls & SC_SliderHandle) && (option->state & State_Sunken))
handlePixmapName += QLatin1String("-sunken");
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3975,8 +3963,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
handlePainter.drawImage(pixmapRect, image);
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h
index 848bad6..154321a 100644
--- a/src/gui/styles/qstyle_p.h
+++ b/src/gui/styles/qstyle_p.h
@@ -77,7 +77,7 @@ public:
QPainter *p = painter; \
QString unique = uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = UsePixmapCache && txType <= QTransform::TxTranslate; \
+ bool doPixmapCache = txType <= QTransform::TxTranslate; \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 69f8cd2..20de892 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -51,7 +51,6 @@
QT_BEGIN_NAMESPACE
namespace QStyleHelper {
-const bool UsePixmapCache = true;
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 5385d9f..ef6e66c 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -66,7 +66,6 @@ class QStyleOption;
namespace QStyleHelper
{
- extern const bool UsePixmapCache;
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
#ifndef QT_NO_DIAL
qreal angle(const QPointF &p1, const QPointF &p2);
diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp
index 3829bcb..a248346 100644
--- a/src/gui/widgets/qstatusbar.cpp
+++ b/src/gui/widgets/qstatusbar.cpp
@@ -728,7 +728,7 @@ void QStatusBar::paintEvent(QPaintEvent *event)
QStatusBarPrivate::SBItem* item = d->items.at(i);
if (item && item->w->isVisible() && (!haveMessage || item->p)) {
QRect ir = item->w->geometry().adjusted(-2, -1, 2, 1);
- if (event->rect().contains(ir)) {
+ if (event->rect().intersects(ir)) {
QStyleOption opt(0);
opt.rect = ir;
opt.palette = palette();
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index 3159cbb..ea57fdf 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -481,8 +481,7 @@ void QGLEngineShaderManager::compileNamedShader(QGLEngineShaderManager::ShaderNa
return;
QGLShader *newShader = new QGLShader(type, ctx, this);
- newShader->setSourceCode(qglEngineShaderSourceCode[name]);
- // newShader->compile(); ### does not exist?
+ newShader->compile(qglEngineShaderSourceCode[name]);
#if defined(QT_DEBUG)
// Name the shader for easier debugging
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index d74b930..37732dd 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE
\code
QGLShader shader(QGLShader::VertexShader);
- shader.setSourceCode(code);
+ shader.compile(code);
QGLShaderProgram program(context);
program.addShader(shader);
@@ -245,14 +245,14 @@ class QGLShaderPrivate
{
public:
QGLShaderPrivate(QGLShader::ShaderType type, const QGLContext *ctx)
+ : context(ctx)
+ , shader(0)
+ , shaderType(type)
+ , compiled(false)
+ , isPartial(type == QGLShader::PartialVertexShader ||
+ type == QGLShader::PartialFragmentShader)
+ , hasPartialSource(false)
{
- context = ctx;
- shader = 0;
- shaderType = type;
- compiled = false;
- isPartial = (type == QGLShader::PartialVertexShader ||
- type == QGLShader::PartialFragmentShader);
- hasPartialSource = false;
}
const QGLContext *context;
@@ -265,7 +265,7 @@ public:
QByteArray partialSource;
bool create();
- bool compile();
+ bool compile(QGLShader *q);
};
#define ctx context
@@ -293,7 +293,7 @@ bool QGLShaderPrivate::create()
}
}
-bool QGLShaderPrivate::compile()
+bool QGLShaderPrivate::compile(QGLShader *q)
{
// Partial shaders are compiled during QGLShaderProgram::link().
if (isPartial && hasPartialSource) {
@@ -313,7 +313,11 @@ bool QGLShaderPrivate::compile()
GLint len;
glGetShaderInfoLog(shader, value, &len, logbuf);
log = QString::fromLatin1(logbuf);
- qWarning() << "QGLShader::compile:" << log;
+ QString name = q->objectName();
+ if (name.isEmpty())
+ qWarning() << "QGLShader::compile:" << log;
+ else
+ qWarning() << "QGLShader::compile[" << name << "]:" << log;
delete [] logbuf;
}
return compiled;
@@ -325,14 +329,14 @@ bool QGLShaderPrivate::compile()
/*!
Constructs a new QGLShader object of the specified \a type
and attaches it to \a parent. If shader programs are not supported,
- then isValid() will return false.
+ QGLShaderProgram::hasShaderPrograms() will return false.
- This constructor is normally followed by a call to setSourceCode()
- or setSourceCodeFile().
+ This constructor is normally followed by a call to compile()
+ or compileFile().
The shader will be associated with the current QGLContext.
- \sa setSourceCode(), setSourceCodeFile(), isValid()
+ \sa compile(), compileFile()
*/
QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent)
: QObject(parent)
@@ -346,11 +350,11 @@ QGLShader::QGLShader(QGLShader::ShaderType type, QObject *parent)
and attaches it to \a parent. If the filename ends in \c{.fsh},
it is assumed to be a fragment shader, otherwise it is assumed to
be a vertex shader (normally the extension is \c{.vsh} for vertex shaders).
- If the shader could not be loaded, then isValid() will return false.
+ If the shader could not be loaded, then isCompiled() will return false.
The shader will be associated with the current QGLContext.
- \sa isValid()
+ \sa isCompiled()
*/
QGLShader::QGLShader(const QString& fileName, QObject *parent)
: QObject(parent)
@@ -359,7 +363,7 @@ QGLShader::QGLShader(const QString& fileName, QObject *parent)
d = new QGLShaderPrivate(QGLShader::FragmentShader, QGLContext::currentContext());
else
d = new QGLShaderPrivate(QGLShader::VertexShader, QGLContext::currentContext());
- if (d->create() && !setSourceCodeFile(fileName)) {
+ if (d->create() && !compileFile(fileName)) {
if (d->shader)
glDeleteShader(d->shader);
d->shader = 0;
@@ -369,18 +373,18 @@ QGLShader::QGLShader(const QString& fileName, QObject *parent)
/*!
Constructs a new QGLShader object of the specified \a type from the
source code in \a fileName and attaches it to \a parent.
- If the shader could not be loaded, then isValid() will return false.
+ If the shader could not be loaded, then isCompiled() will return false.
The shader will be associated with the current QGLContext.
- \sa isValid()
+ \sa isCompiled()
*/
QGLShader::QGLShader
(const QString& fileName, QGLShader::ShaderType type, QObject *parent)
: QObject(parent)
{
d = new QGLShaderPrivate(type, QGLContext::currentContext());
- if (d->create() && !setSourceCodeFile(fileName)) {
+ if (d->create() && !compileFile(fileName)) {
if (d->shader)
glDeleteShader(d->shader);
d->shader = 0;
@@ -390,14 +394,14 @@ QGLShader::QGLShader
/*!
Constructs a new QGLShader object of the specified \a type
and attaches it to \a parent. If shader programs are not supported,
- then isValid() will return false.
+ then QGLShaderProgram::hasShaderPrograms() will return false.
- This constructor is normally followed by a call to setSourceCode()
- or setSourceCodeFile().
+ This constructor is normally followed by a call to compile()
+ or compileFile().
The shader will be associated with \a context.
- \sa setSourceCode(), setSourceCodeFile(), isValid()
+ \sa compile(), compileFile()
*/
QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent)
: QObject(parent)
@@ -411,11 +415,11 @@ QGLShader::QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObj
and attaches it to \a parent. If the filename ends in \c{.fsh},
it is assumed to be a fragment shader, otherwise it is assumed to
be a vertex shader (normally the extension is \c{.vsh} for vertex shaders).
- If the shader could not be loaded, then isValid() will return false.
+ If the shader could not be loaded, then isCompiled() will return false.
The shader will be associated with \a context.
- \sa isValid()
+ \sa isCompiled()
*/
QGLShader::QGLShader(const QString& fileName, const QGLContext *context, QObject *parent)
: QObject(parent)
@@ -424,7 +428,7 @@ QGLShader::QGLShader(const QString& fileName, const QGLContext *context, QObject
d = new QGLShaderPrivate(QGLShader::FragmentShader, context);
else
d = new QGLShaderPrivate(QGLShader::VertexShader, context);
- if (d->create() && !setSourceCodeFile(fileName)) {
+ if (d->create() && !compileFile(fileName)) {
if (d->shader)
glDeleteShader(d->shader);
d->shader = 0;
@@ -434,18 +438,18 @@ QGLShader::QGLShader(const QString& fileName, const QGLContext *context, QObject
/*!
Constructs a new QGLShader object of the specified \a type from the
source code in \a fileName and attaches it to \a parent.
- If the shader could not be loaded, then isValid() will return false.
+ If the shader could not be loaded, then isCompiled() will return false.
The shader will be associated with \a context.
- \sa isValid()
+ \sa isCompiled()
*/
QGLShader::QGLShader
(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent)
: QObject(parent)
{
d = new QGLShaderPrivate(type, context);
- if (d->create() && !setSourceCodeFile(fileName)) {
+ if (d->create() && !compileFile(fileName)) {
if (d->shader)
glDeleteShader(d->shader);
d->shader = 0;
@@ -465,24 +469,6 @@ QGLShader::~QGLShader()
}
/*!
- Returns true if this shader is valid. Shaders become invalid
- when they are destroyed and no longer attached to a QGLShaderProgram.
-*/
-bool QGLShader::isValid() const
-{
- if (d->isPartial && d->hasPartialSource)
- return true;
- if (!d->shader)
- return false;
-#if defined(QT_OPENGL_ES_2)
- return glIsShader(d->shader);
-#else
- // glIsShader() may not exist on some systems.
- return (!glIsShader || glIsShader(d->shader));
-#endif
-}
-
-/*!
Returns the type of this shader.
*/
QGLShader::ShaderType QGLShader::shaderType() const
@@ -509,13 +495,15 @@ static const char qualifierDefines[] =
then this function will always return true, even if the source code
is invalid. Partial shaders are compiled when QGLShaderProgram::link()
is called.
+
+ \sa compileFile()
*/
-bool QGLShader::setSourceCode(const char *source)
+bool QGLShader::compile(const char *source)
{
if (d->isPartial) {
d->partialSource = QByteArray(source);
d->hasPartialSource = true;
- return d->compile();
+ return d->compile(this);
} else if (d->shader) {
QVarLengthArray<const char *> src;
#ifdef QGL_DEFINE_QUALIFIERS
@@ -523,7 +511,7 @@ bool QGLShader::setSourceCode(const char *source)
#endif
src.append(source);
glShaderSource(d->shader, src.size(), src.data(), 0);
- return d->compile();
+ return d->compile(this);
} else {
return false;
}
@@ -539,10 +527,12 @@ bool QGLShader::setSourceCode(const char *source)
then this function will always return true, even if the source code
is invalid. Partial shaders are compiled when QGLShaderProgram::link()
is called.
+
+ \sa compileFile()
*/
-bool QGLShader::setSourceCode(const QByteArray& source)
+bool QGLShader::compile(const QByteArray& source)
{
- return setSourceCode(source.constData());
+ return compile(source.constData());
}
/*!
@@ -555,10 +545,12 @@ bool QGLShader::setSourceCode(const QByteArray& source)
then this function will always return true, even if the source code
is invalid. Partial shaders are compiled when QGLShaderProgram::link()
is called.
+
+ \sa compileFile()
*/
-bool QGLShader::setSourceCode(const QString& source)
+bool QGLShader::compile(const QString& source)
{
- return setSourceCode(source.toLatin1().constData());
+ return compile(source.toLatin1().constData());
}
/*!
@@ -570,8 +562,10 @@ bool QGLShader::setSourceCode(const QString& source)
then this function will always return true, even if the source code
is invalid. Partial shaders are compiled when QGLShaderProgram::link()
is called.
+
+ \sa compile()
*/
-bool QGLShader::setSourceCodeFile(const QString& fileName)
+bool QGLShader::compileFile(const QString& fileName)
{
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
@@ -580,7 +574,7 @@ bool QGLShader::setSourceCodeFile(const QString& fileName)
}
QByteArray contents = file.readAll();
- return setSourceCode(contents.constData());
+ return compile(contents.constData());
}
/*!
@@ -592,9 +586,11 @@ bool QGLShader::setSourceCodeFile(const QString& fileName)
This function cannot be used with PartialVertexShader or
PartialFragmentShader.
+ If this function succeeds, then the shader will be considered compiled.
+
\sa shaderBinaryFormats()
*/
-bool QGLShader::setBinaryCode(GLenum format, const void *binary, int length)
+bool QGLShader::setShaderBinary(GLenum format, const void *binary, int length)
{
#if !defined(QT_OPENGL_ES_2)
if (!glShaderBinary)
@@ -604,7 +600,8 @@ bool QGLShader::setBinaryCode(GLenum format, const void *binary, int length)
return false;
glGetError(); // Clear error state.
glShaderBinary(1, &(d->shader), format, binary, length);
- return (glGetError() == GL_NO_ERROR);
+ d->compiled = (glGetError() == GL_NO_ERROR);
+ return d->compiled;
}
/*!
@@ -620,9 +617,11 @@ bool QGLShader::setBinaryCode(GLenum format, const void *binary, int length)
This function cannot be used with PartialVertexShader or
PartialFragmentShader.
+ If this function succeeds, then the shader will be considered compiled.
+
\sa shaderBinaryFormats()
*/
-bool QGLShader::setBinaryCode
+bool QGLShader::setShaderBinary
(QGLShader& otherShader, GLenum format, const void *binary, int length)
{
#if !defined(QT_OPENGL_ES_2)
@@ -638,14 +637,16 @@ bool QGLShader::setBinaryCode
shaders[0] = d->shader;
shaders[1] = otherShader.d->shader;
glShaderBinary(2, shaders, format, binary, length);
- return (glGetError() == GL_NO_ERROR);
+ d->compiled = (glGetError() == GL_NO_ERROR);
+ otherShader.d->compiled = d->compiled;
+ return d->compiled;
}
/*!
Returns a list of all binary formats that are supported by
- setBinaryCode() on this system.
+ setShaderBinary() on this system.
- \sa setBinaryCode()
+ \sa setShaderBinary()
*/
QList<GLenum> QGLShader::shaderBinaryFormats()
{
@@ -665,7 +666,7 @@ QList<GLenum> QGLShader::shaderBinaryFormats()
/*!
Returns the source code for this shader.
- \sa setSourceCode()
+ \sa compile()
*/
QByteArray QGLShader::sourceCode() const
{
@@ -688,7 +689,7 @@ QByteArray QGLShader::sourceCode() const
/*!
Returns true if this shader has been compiled; false otherwise.
- \sa setSourceCode()
+ \sa compile()
*/
bool QGLShader::isCompiled() const
{
@@ -698,7 +699,7 @@ bool QGLShader::isCompiled() const
/*!
Returns the errors and warnings that occurred during the last compile.
- \sa setSourceCode()
+ \sa compile()
*/
QString QGLShader::log() const
{
@@ -726,14 +727,14 @@ class QGLShaderProgramPrivate
{
public:
QGLShaderProgramPrivate(const QGLContext *ctx)
+ : context(ctx)
+ , program(0)
+ , linked(false)
+ , inited(false)
+ , hasPartialShaders(false)
+ , vertexShader(0)
+ , fragmentShader(0)
{
- context = ctx;
- program = 0;
- linked = false;
- inited = false;
- hasPartialShaders = false;
- vertexShader = 0;
- fragmentShader = 0;
}
~QGLShaderProgramPrivate()
{
@@ -762,7 +763,7 @@ public:
The shader program will be associated with the current QGLContext.
- \sa isValid(), addShader()
+ \sa addShader()
*/
QGLShaderProgram::QGLShaderProgram(QObject *parent)
: QObject(parent)
@@ -776,7 +777,7 @@ QGLShaderProgram::QGLShaderProgram(QObject *parent)
The shader program will be associated with \a context.
- \sa isValid(), addShader()
+ \sa addShader()
*/
QGLShaderProgram::QGLShaderProgram(const QGLContext *context, QObject *parent)
: QObject(parent)
@@ -815,21 +816,6 @@ bool QGLShaderProgram::init()
}
/*!
- Returns true if this shader program object is valid, false otherwise.
-*/
-bool QGLShaderProgram::isValid() const
-{
- if (!d->program)
- return false;
-#if defined(QT_OPENGL_ES_2)
- return glIsProgram(d->program);
-#else
- // glIsProgram() may not exist on some systems.
- return (!glIsProgram || glIsProgram(d->program));
-#endif
-}
-
-/*!
Adds a compiled \a shader to this shader program. Returns true
if the shader could be added, or false otherwise.
@@ -881,7 +867,7 @@ bool QGLShaderProgram::addShader(QGLShader::ShaderType type, const char *source)
if (!init())
return false;
QGLShader *shader = new QGLShader(type, this);
- if (!shader->setSourceCode(source)) {
+ if (!shader->compile(source)) {
d->log = shader->log();
delete shader;
return false;
@@ -1058,7 +1044,11 @@ bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary)
GLint len;
glGetProgramInfoLog(d->program, value, &len, logbuf);
d->log = QString::fromLatin1(logbuf);
- qWarning() << "QGLShaderProgram::setProgramBinary:" << d->log;
+ QString name = objectName();
+ if (name.isEmpty())
+ qWarning() << "QGLShader::setProgramBinary:" << d->log;
+ else
+ qWarning() << "QGLShader::setProgramBinary[" << name << "]:" << d->log;
delete [] logbuf;
}
return d->linked;
@@ -1130,7 +1120,7 @@ bool QGLShaderProgram::link()
d->vertexShader =
new QGLShader(QGLShader::VertexShader, this);
}
- if (!d->vertexShader->setSourceCode(vertexSource)) {
+ if (!d->vertexShader->compile(vertexSource)) {
d->log = d->vertexShader->log();
return false;
}
@@ -1147,7 +1137,7 @@ bool QGLShaderProgram::link()
d->fragmentShader =
new QGLShader(QGLShader::FragmentShader, this);
}
- if (!d->fragmentShader->setSourceCode(fragmentSource)) {
+ if (!d->fragmentShader->compile(fragmentSource)) {
d->log = d->fragmentShader->log();
return false;
}
@@ -1166,7 +1156,11 @@ bool QGLShaderProgram::link()
GLint len;
glGetProgramInfoLog(d->program, value, &len, logbuf);
d->log = QString::fromLatin1(logbuf);
- qWarning() << "QGLShaderProgram::link:" << d->log;
+ QString name = objectName();
+ if (name.isEmpty())
+ qWarning() << "QGLShader::link:" << d->log;
+ else
+ qWarning() << "QGLShader::link[" << name << "]:" << d->log;
delete [] logbuf;
}
return d->linked;
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index b69d28e..ab30c32 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -79,17 +79,15 @@ public:
QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0);
virtual ~QGLShader();
- bool isValid() const;
-
QGLShader::ShaderType shaderType() const;
- bool setSourceCode(const char *source);
- bool setSourceCode(const QByteArray& source);
- bool setSourceCode(const QString& source);
- bool setSourceCodeFile(const QString& fileName);
+ bool compile(const char *source);
+ bool compile(const QByteArray& source);
+ bool compile(const QString& source);
+ bool compileFile(const QString& fileName);
- bool setBinaryCode(GLenum format, const void *binary, int length);
- bool setBinaryCode(QGLShader& otherShader, GLenum format, const void *binary, int length);
+ bool setShaderBinary(GLenum format, const void *binary, int length);
+ bool setShaderBinary(QGLShader& otherShader, GLenum format, const void *binary, int length);
static QList<GLenum> shaderBinaryFormats();
@@ -118,8 +116,6 @@ public:
explicit QGLShaderProgram(const QGLContext *context, QObject *parent = 0);
virtual ~QGLShaderProgram();
- bool isValid() const;
-
bool addShader(QGLShader *shader);
void removeShader(QGLShader *shader);
QList<QGLShader *> shaders() const;
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index b6340f8..f3cd094 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if defined(Q_OS_LINUX) && !defined(QT_NO_PROCESS)
+#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND
diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h
index 527b1d4..61cdfd5 100644
--- a/src/testlib/qtestbasicstreamer.h
+++ b/src/testlib/qtestbasicstreamer.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
class QTestLogger;
@@ -81,4 +85,6 @@ class QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h
index 4cf8fcb..907041f 100644
--- a/src/testlib/qtestcoreelement.h
+++ b/src/testlib/qtestcoreelement.h
@@ -42,11 +42,15 @@
#ifndef QTESTCOREELEMENT_H
#define QTESTCOREELEMENT_H
-#include "qtestcorelist.h"
-#include "qtestelementattribute.h"
+#include <QtTest/qtestcorelist.h>
+#include <QtTest/qtestelementattribute.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
template <class ElementType>
class QTestCoreElement: public QTestCoreList<ElementType>
{
@@ -163,4 +167,6 @@ const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::Att
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestcorelist.h b/src/testlib/qtestcorelist.h
index 686e157..9983b27 100644
--- a/src/testlib/qtestcorelist.h
+++ b/src/testlib/qtestcorelist.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
template <class T>
class QTestCoreList
{
@@ -127,4 +131,6 @@ int QTestCoreList<T>::count()
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestelement.h b/src/testlib/qtestelement.h
index c1932da..e75689a 100644
--- a/src/testlib/qtestelement.h
+++ b/src/testlib/qtestelement.h
@@ -42,10 +42,14 @@
#ifndef QTESTELEMENT_H
#define QTESTELEMENT_H
-#include "qtestcoreelement.h"
+#include <QtTest/qtestcoreelement.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement: public QTestCoreElement<QTestElement>
{
public:
@@ -66,4 +70,6 @@ class QTestElement: public QTestCoreElement<QTestElement>
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestelementattribute.h b/src/testlib/qtestelementattribute.h
index 261f3f7..944d9c0 100644
--- a/src/testlib/qtestelementattribute.h
+++ b/src/testlib/qtestelementattribute.h
@@ -42,10 +42,14 @@
#ifndef QTESTELEMENTATTRIBUTE_H
#define QTESTELEMENTATTRIBUTE_H
-#include "qtestcorelist.h"
+#include <QtTest/qtestcorelist.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
namespace QTest {
enum AttributeIndex
@@ -102,4 +106,6 @@ class QTestElementAttribute: public QTestCoreList<QTestElementAttribute>
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestfilelogger.h b/src/testlib/qtestfilelogger.h
index 892657d..f6a993d 100644
--- a/src/testlib/qtestfilelogger.h
+++ b/src/testlib/qtestfilelogger.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestFileLogger
{
public:
@@ -58,4 +62,6 @@ class QTestFileLogger
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif // QTESTFILELOGGER_H
diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h
index 382a14a..3f564a8 100644
--- a/src/testlib/qtestlightxmlstreamer.h
+++ b/src/testlib/qtestlightxmlstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTLIGHTXMLSTREAMER_H
#define QTESTLIGHTXMLSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
@@ -63,4 +67,6 @@ class QTestLightXmlStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h
index 58544a4..814bffc 100644
--- a/src/testlib/qtestxmlstreamer.h
+++ b/src/testlib/qtestxmlstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTXMLSTREAMER_H
#define QTESXMLSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
@@ -63,4 +67,6 @@ class QTestXmlStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h
index b4b82f0..0e48b2c 100644
--- a/src/testlib/qtestxunitstreamer.h
+++ b/src/testlib/qtestxunitstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTXUNITSTREAMER_H
#define QTESTXUNITSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestLogger;
class QTestXunitStreamer: public QTestBasicStreamer
@@ -68,4 +72,6 @@ class QTestXunitStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 27e3c74..a65c172 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -349,7 +349,6 @@ SUBDIRS += _networkselftest \
qtranslator \
qtransform \
qtransformedscreen \
- qtransition \
qtreeview \
qtreewidget \
qtreewidgetitemiterator \
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 607d655..7e32deb 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -135,6 +135,9 @@ void tst_Headers::licenseCheck()
QByteArray data = f.readAll();
QStringList content = QString::fromLocal8Bit(data.replace('\r',"")).split("\n");
+ if (content.first().contains("generated"))
+ content.takeFirst();
+
QVERIFY(licensePattern.exactMatch(content.at(7)) ||
licensePattern.exactMatch(content.at(4)));
QString licenseType = licensePattern.cap(1);
diff --git a/tests/auto/qstringbuilder/qstringbuilder.pro b/tests/auto/qstringbuilder/qstringbuilder.pro
new file mode 100644
index 0000000..c5a26d3
--- /dev/null
+++ b/tests/auto/qstringbuilder/qstringbuilder.pro
@@ -0,0 +1,5 @@
+
+TEMPLATE = subdirs
+SUBDIRS = scenario1.pro scenario2.pro scenario3.pro scenario4.pro
+
+
diff --git a/tests/auto/qstringbuilder/scenario1.cpp b/tests/auto/qstringbuilder/scenario1.cpp
new file mode 100644
index 0000000..26b4ed3
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario1.cpp
@@ -0,0 +1 @@
+#include "tst_qstringbuilder.cpp"
diff --git a/tests/auto/qstringbuilder/scenario1.pro b/tests/auto/qstringbuilder/scenario1.pro
new file mode 100644
index 0000000..4ce7156
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario1.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+
+QT = core
+
+SOURCES += scenario1.cpp
+
+DEFINES += SCENARIO=1
+
diff --git a/tests/auto/qstringbuilder/scenario2.cpp b/tests/auto/qstringbuilder/scenario2.cpp
new file mode 100644
index 0000000..26b4ed3
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario2.cpp
@@ -0,0 +1 @@
+#include "tst_qstringbuilder.cpp"
diff --git a/tests/auto/qstringbuilder/scenario2.pro b/tests/auto/qstringbuilder/scenario2.pro
new file mode 100644
index 0000000..64c46e2
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario2.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+QT = core
+
+SOURCES += scenario2.cpp
+
+DEFINES += SCENARIO=2
diff --git a/tests/auto/qstringbuilder/scenario3.cpp b/tests/auto/qstringbuilder/scenario3.cpp
new file mode 100644
index 0000000..26b4ed3
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario3.cpp
@@ -0,0 +1 @@
+#include "tst_qstringbuilder.cpp"
diff --git a/tests/auto/qstringbuilder/scenario3.pro b/tests/auto/qstringbuilder/scenario3.pro
new file mode 100644
index 0000000..beedffd
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario3.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+QT = core
+
+SOURCES += scenario3.cpp
+
+DEFINES += SCENARIO=3
diff --git a/tests/auto/qstringbuilder/scenario4.cpp b/tests/auto/qstringbuilder/scenario4.cpp
new file mode 100644
index 0000000..26b4ed3
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario4.cpp
@@ -0,0 +1 @@
+#include "tst_qstringbuilder.cpp"
diff --git a/tests/auto/qstringbuilder/scenario4.pro b/tests/auto/qstringbuilder/scenario4.pro
new file mode 100644
index 0000000..1c45a70
--- /dev/null
+++ b/tests/auto/qstringbuilder/scenario4.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+
+QT = core
+
+SOURCES += scenario4.cpp
+
+DEFINES += SCENARIO=4
diff --git a/tests/auto/qstringbuilder/tst_qstringbuilder.cpp b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
new file mode 100644
index 0000000..f5df79e
--- /dev/null
+++ b/tests/auto/qstringbuilder/tst_qstringbuilder.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This is included in various .cpp files as a compile test for various scenarios
+// depending on NO_CAST_* and QT_USE_FAST_OPERATOR_PLUS and QT_USE_FAST_CONCATENATION
+
+#if SCENARIO == 1
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+#endif
+
+
+#if SCENARIO == 2
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * defined
+#define P +
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+#endif
+
+#if SCENARIO == 3
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * _not_ defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+#endif
+
+#if SCENARIO == 4
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * _not_ defined
+#define P +
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+#endif
+
+
+#include <QtTest/QtTest>
+
+//TESTED_CLASS=QStringBuilder
+//TESTED_FILES=qstringbuilder.cpp
+
+#include <qtest.h>
+
+#define LITERAL "some literal"
+
+#ifndef QT_NO_CAST_FROM_ASCII
+
+// Plan is to move the QConcatenable specialications below
+// to qstringbuilder.h as soon as the QByteArray builder is
+// implemented.
+
+QT_BEGIN_NAMESPACE
+
+template <int N> struct QConcatenable<char[N]>
+{
+ typedef char type[N];
+ static int size(const char *) { return N - 1; }
+ static inline void appendTo(const type &a, QChar *&out)
+ {
+ memcpy(out, a, N - 1);
+ out += N - 1;
+ }
+};
+
+template <int N> struct QConcatenable<const char[N]>
+{
+ typedef char type[N];
+ static int size(const char *) { return N - 1; }
+ static inline void appendTo(const type &a, QChar *&out)
+ {
+ memcpy(out, a, N - 1);
+ out += N - 1;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif
+
+
+class tst_QStringBuilder : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QStringBuilder() {}
+ ~tst_QStringBuilder() {}
+
+public slots:
+ void init() {}
+ void cleanup() {}
+
+ void scenario();
+};
+
+void tst_QStringBuilder::scenario()
+{
+ QLatin1Literal l1literal(LITERAL);
+ QLatin1String l1string(LITERAL);
+ QString string(l1string);
+ QStringRef stringref(&string, 2, 10);
+ QLatin1Char achar('c');
+ QString r2(QLatin1String(LITERAL LITERAL));
+ QString r;
+
+ r = l1literal P l1literal;
+ QCOMPARE(r, r2);
+ r = string P string;
+ QCOMPARE(r, r2);
+ r = stringref P stringref;
+ QCOMPARE(r, QString(stringref.toString() + stringref.toString()));
+ r = string P l1literal;
+ QCOMPARE(r, r2);
+ r = string P l1string;
+ QCOMPARE(r, r2);
+ r = string + achar;
+ QCOMPARE(r, QString(string P achar));
+ r = achar + string;
+ QCOMPARE(r, QString(achar P string));
+#ifndef QT_NO_CAST_FROM_ASCII
+ r = string P LITERAL;
+ QCOMPARE(r, r2);
+ r = LITERAL P string;
+ QCOMPARE(r, r2);
+#endif
+}
+
+QTEST_APPLESS_MAIN(tst_QStringBuilder)
+
+#include "tst_qstringbuilder.moc"
diff --git a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp
index f3c1134..9dafff5 100644
--- a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp
@@ -156,9 +156,9 @@ struct styleStruct {
int height;
bool operator==(const styleStruct &str) const
{
- return str.key == key && str.state == state && str.direction == direction
+ return str.state == state && str.direction == direction
&& str.complex == complex && str.palette == palette && str.width == width
- && str.height == height;
+ && str.height == height && str.key == key;
}
};
diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp
index d4e2fa0..8b769a6 100644
--- a/tests/benchmarks/qstringbuilder/main.cpp
+++ b/tests/benchmarks/qstringbuilder/main.cpp
@@ -1,6 +1,6 @@
// Select one of the scenarios below
-#define SCENARIO 3
+#define SCENARIO 1
#if SCENARIO == 1
// this is the "no harm done" version. Only operator% is active,
@@ -17,7 +17,7 @@
// this is the "full" version. Operator+ is replaced by a QStringBuilder
// based version
// with NO_CAST * defined
-#define P %
+#define P +
#define QT_USE_FAST_OPERATOR_PLUS
#define QT_USE_FAST_CONCATENATION
#define QT_NO_CAST_FROM_ASCII
@@ -38,7 +38,7 @@
// this is the "full" version. Operator+ is replaced by a QStringBuilder
// based version
// with NO_CAST * _not_ defined
-#define P %
+#define P +
#define QT_USE_FAST_OPERATOR_PLUS
#define QT_USE_FAST_CONCATENATION
#undef QT_NO_CAST_FROM_ASCII
@@ -53,6 +53,8 @@
#include <qtest.h>
+#include <string>
+
#define COMPARE(a, b) QCOMPARE(a, b)
//#define COMPARE(a, b)
@@ -70,6 +72,7 @@ public:
l1string(LITERAL),
ba(LITERAL),
string(l1string),
+ stdstring(LITERAL),
stringref(&string, 2, 10),
achar('c'),
r2(QLatin1String(LITERAL LITERAL)),
@@ -115,8 +118,9 @@ public:
private slots:
void separator_0() {
- qDebug() << "\nIn each block the QStringBuilder based result appear first, "
- "QStringBased second.\n";
+ qDebug() << "\nIn each block the QStringBuilder based result appear first "
+ "(with a 'b_' prefix), QStringBased second ('q_' prefix), std::string "
+ "last ('s_' prefix)\n";
}
void separator_1() { SEP("literal + literal (builder first)"); }
@@ -131,7 +135,7 @@ private slots:
COMPARE(r, r2);
}
#endif
- void s_2_l1string() {
+ void q_2_l1string() {
QBENCHMARK { r = l1string + l1string; }
COMPARE(r, r2);
}
@@ -143,10 +147,14 @@ private slots:
QBENCHMARK { r = string P string; }
COMPARE(r, r2);
}
- void s_2_string() {
+ void q_2_string() {
QBENCHMARK { r = string + string; }
COMPARE(r, r2);
}
+ void s_2_string() {
+ QBENCHMARK { stdr = stdstring + stdstring; }
+ COMPARE(stdr, stdstring + stdstring);
+ }
void separator_2c() { SEP("2 string refs"); }
@@ -155,7 +163,7 @@ private slots:
QBENCHMARK { r = stringref % stringref; }
COMPARE(r, QString(stringref.toString() + stringref.toString()));
}
- void s_2_stringref() {
+ void q_2_stringref() {
QBENCHMARK { r = stringref.toString() + stringref.toString(); }
COMPARE(r, QString(stringref % stringref));
}
@@ -167,10 +175,30 @@ private slots:
QBENCHMARK { r = string P string P string; }
COMPARE(r, r3);
}
- void s_3_string() {
+ void q_3_string() {
QBENCHMARK { r = string + string + string; }
COMPARE(r, r3);
}
+ void s_3_string() {
+ QBENCHMARK { stdr = stdstring + stdstring + stdstring; }
+ COMPARE(stdr, stdstring + stdstring + stdstring);
+ }
+
+ void separator_2e() { SEP("4 strings"); }
+
+ void b_4_string() {
+ QBENCHMARK { r = string P string P string P string; }
+ COMPARE(r, r4);
+ }
+ void q_4_string() {
+ QBENCHMARK { r = string + string + string + string; }
+ COMPARE(r, r4);
+ }
+ void s_4_string() {
+ QBENCHMARK { stdr = stdstring + stdstring + stdstring + stdstring; }
+ COMPARE(stdr, stdstring + stdstring + stdstring + stdstring);
+ }
+
void separator_2a() { SEP("string + literal (builder first)"); }
@@ -193,14 +221,18 @@ private slots:
QBENCHMARK { r = string P l1string; }
COMPARE(r, r2);
}
- void s_string_l1literal() {
+ void q_string_l1literal() {
QBENCHMARK { r = string + l1string; }
COMPARE(r, r2);
}
- void s_string_l1string() {
+ void q_string_l1string() {
QBENCHMARK { r = string + l1string; }
COMPARE(r, r2);
}
+ void s_LITERAL_string() {
+ QBENCHMARK { stdr = LITERAL + stdstring; }
+ COMPARE(stdr, stdstring + stdstring);
+ }
void separator_3() { SEP("3 literals"); }
@@ -209,10 +241,14 @@ private slots:
QBENCHMARK { r = l1literal P l1literal P l1literal; }
COMPARE(r, r3);
}
- void s_3_l1string() {
+ void q_3_l1string() {
QBENCHMARK { r = l1string + l1string + l1string; }
COMPARE(r, r3);
}
+ void s_3_l1string() {
+ QBENCHMARK { stdr = stdstring + LITERAL + LITERAL; }
+ COMPARE(stdr, stdstring + stdstring + stdstring);
+ }
void separator_4() { SEP("4 literals"); }
@@ -221,7 +257,7 @@ private slots:
QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal; }
COMPARE(r, r4);
}
- void s_4_l1string() {
+ void q_4_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string; }
COMPARE(r, r4);
}
@@ -234,7 +270,7 @@ private slots:
COMPARE(r, r5);
}
- void s_5_l1string() {
+ void q_5_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string + l1string; }
COMPARE(r, r5);
}
@@ -247,11 +283,16 @@ private slots:
COMPARE(r, QString(string P achar P achar P achar P achar));
}
- void s_string_4_char() {
+ void q_string_4_char() {
QBENCHMARK { r = string + achar + achar + achar + achar; }
COMPARE(r, QString(string P achar P achar P achar P achar));
}
+ void s_string_4_char() {
+ QBENCHMARK { stdr = stdstring + 'c' + 'c' + 'c' + 'c'; }
+ COMPARE(stdr, stdstring + 'c' + 'c' + 'c' + 'c');
+ }
+
void separator_7() { SEP("char + string + char"); }
@@ -260,11 +301,17 @@ private slots:
COMPARE(r, QString(achar P string P achar));
}
- void s_char_string_char() {
+ void q_char_string_char() {
QBENCHMARK { r = achar + string + achar; }
COMPARE(r, QString(achar P string P achar));
}
+ void s_char_string_char() {
+ QBENCHMARK { stdr = 'c' + stdstring + 'c'; }
+ COMPARE(stdr, 'c' + stdstring + 'c');
+ }
+
+
void separator_8() { SEP("string.arg"); }
void b_string_arg() {
@@ -273,13 +320,13 @@ private slots:
COMPARE(r, r3);
}
- void s_string_arg() {
+ void q_string_arg() {
const QString pattern = l1string + QLatin1String("%1") + l1string;
QBENCHMARK { r = pattern.arg(string); }
COMPARE(r, r3);
}
- void s_bytearray_arg() {
+ void q_bytearray_arg() {
QByteArray result;
QBENCHMARK { result = ba + ba + ba; }
}
@@ -331,11 +378,14 @@ private:
const QLatin1String l1string;
const QByteArray ba;
const QString string;
+ const std::string stdstring;
const QStringRef stringref;
const QLatin1Char achar;
const QString r2, r3, r4, r5;
+ // short cuts for results
QString r;
+ std::string stdr;
};
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 422e956..ab26d08 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -447,21 +447,24 @@ int HtmlGenerator::generateAtom(const Atom *atom,
out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE];
break;
case Atom::Code:
- out() << "<pre>" << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()),
- marker, relative))
+ out() << "<pre>"
+ << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+ marker,relative))
<< "</pre>\n";
break;
#ifdef QDOC_QML
case Atom::Qml:
- out() << "<pre>" << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()),
- marker, relative))
+ out() << "<pre>"
+ << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+ marker,relative))
<< "</pre>\n";
break;
#endif
case Atom::CodeNew:
out() << "<p>you can rewrite it as</p>\n"
- << "<pre>" << trimmedTrailing(highlightedCode(indent(codeIndent, atom->string()),
- marker, relative))
+ << "<pre>"
+ << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+ marker,relative))
<< "</pre>\n";
break;
case Atom::CodeOld:
@@ -469,7 +472,7 @@ int HtmlGenerator::generateAtom(const Atom *atom,
// fallthrough
case Atom::CodeBad:
out() << "<pre><font color=\"#404040\">"
- << trimmedTrailing(protect(plainCode(indent(codeIndent, atom->string()))))
+ << trimmedTrailing(protect(plainCode(indent(codeIndent,atom->string()))))
<< "</font></pre>\n";
break;
case Atom::FootnoteLeft:
@@ -1533,17 +1536,19 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker,
void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker)
{
if (!inner->includes().isEmpty()) {
- out() << "<pre>" << trimmedTrailing(highlightedCode(indent(codeIndent,
- marker->markedUpIncludes(
- inner->includes())),
- marker, inner))
+ out() << "<pre>"
+ << trimmedTrailing(highlightedCode(indent(codeIndent,
+ marker->markedUpIncludes(inner->includes())),
+ marker,inner))
<< "</pre>";
}
}
-void HtmlGenerator::generateTableOfContents(const Node *node, CodeMarker *marker,
+void HtmlGenerator::generateTableOfContents(const Node *node,
+ CodeMarker *marker,
Doc::SectioningUnit sectioningUnit,
- int numColumns, const Node *relative)
+ int numColumns,
+ const Node *relative)
{
if (!node->doc().hasTableOfContents())
@@ -2302,12 +2307,13 @@ void HtmlGenerator::generateSynopsis(const Node *node,
marked.replace("<@type>", "");
marked.replace("</@type>", "");
}
- out() << highlightedCode(marked, marker, relative, nameAlignment);
+ out() << highlightedCode(marked, marker, relative, style, nameAlignment);
}
QString HtmlGenerator::highlightedCode(const QString& markedCode,
CodeMarker *marker,
const Node *relative,
+ CodeMarker::SynopsisStyle style,
bool nameAlignment)
{
QString src = markedCode;
@@ -2320,15 +2326,24 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
// replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
static const QString linkTag("link");
+ if (src.contains("setAcceptDrops"))
+ qDebug() << "SRC:" << src;
+ bool done = false;
for (int i = 0, n = src.size(); i < n;) {
if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') {
- if (nameAlignment) // && (i != 0)) Why was this here?
- html += "&nbsp;</td><td class=\"memItemRight\" valign=\"bottom\">";
+ if (nameAlignment && !done) {// && (i != 0)) Why was this here?
+ html += "</td><td class=\"memItemRight\" valign=\"bottom\">";
+ done = true;
+ }
i += 2;
if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
+ if (style == CodeMarker::Accessors)
+ html += "<b>";
QString link = linkForNode(
CodeMarker::nodeForString(par1.toString()), relative);
addLink(link, arg, &html);
+ if (style == CodeMarker::Accessors)
+ html += "</b>";
}
else {
html += charLangle;
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index ec9532f..36a2e30 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -158,6 +158,7 @@ class HtmlGenerator : public PageGenerator
QString highlightedCode(const QString& markedCode,
CodeMarker *marker,
const Node *relative,
+ CodeMarker::SynopsisStyle style = CodeMarker::Accessors,
bool nameAlignment = false);
#else
void generateSynopsis(const Node *node,
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index 2bba8fb..ead7b88 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -1,5 +1,5 @@
DEFINES += QDOC2_COMPAT
-#DEFINES += QT_NO_CAST_TO_ASCII
+DEFINES += QT_NO_CAST_TO_ASCII
#DEFINES += QT_NO_CAST_FROM_ASCII
QT = core xml
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index 5239856..fa0167b 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -66,7 +66,7 @@ body
}
table td.memItemLeft {
- width: 100px;
+ width: 200px;
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;