summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--config.tests/x11/xsync/xsync.cpp2
-rw-r--r--demos/sub-attaq/animationmanager.cpp7
-rw-r--r--demos/sub-attaq/animationmanager.h3
-rw-r--r--demos/sub-attaq/boat.cpp6
-rw-r--r--demos/sub-attaq/graphicsscene.cpp1
-rw-r--r--examples/effects/blurpicker/blurpicker.cpp53
-rw-r--r--examples/effects/blurpicker/blurpicker.h12
-rw-r--r--examples/effects/customshader/blurpicker.cpp53
-rw-r--r--examples/effects/customshader/blurpicker.h12
-rw-r--r--examples/effects/fademessage/fademessage.cpp18
-rw-r--r--examples/effects/fademessage/fademessage.h5
-rw-r--r--examples/graphicsview/weatheranchorlayout/main.cpp34
-rw-r--r--mkspecs/symbian-sbsv2/flm/qt/qmake_generate_temp_dirs.flm22
-rw-r--r--mkspecs/symbian-sbsv2/flm/qt/qt.xml5
-rw-r--r--qmake/generators/symbian/symmake.cpp11
-rw-r--r--qmake/generators/symbian/symmake.h1
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp14
-rw-r--r--qmake/generators/symbian/symmake_abld.h1
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp40
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.h1
-rw-r--r--src/3rdparty/phonon/mmf/abstractaudioeffect.cpp4
-rw-r--r--src/3rdparty/phonon/mmf/ancestormovemonitor.cpp7
-rw-r--r--src/3rdparty/phonon/mmf/utils.cpp16
-rw-r--r--src/3rdparty/phonon/phonon/audiooutput.cpp6
-rw-r--r--src/3rdparty/phonon/phonon/backendcapabilities.cpp2
-rw-r--r--src/3rdparty/phonon/phonon/effectwidget.cpp5
-rw-r--r--src/3rdparty/phonon/phonon/globalconfig.cpp10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp5
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp10
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp8
-rw-r--r--src/corelib/arch/armv6/qatomic_generic_armv6.cpp260
-rw-r--r--src/corelib/arch/qatomic_armv6.h304
-rw-r--r--src/corelib/arch/qatomic_symbian.h235
-rw-r--r--src/corelib/arch/symbian/arch.pri2
-rw-r--r--src/corelib/arch/symbian/qatomic_symbian.cpp167
-rw-r--r--src/corelib/global/qglobal.h7
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp6
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp5
-rw-r--r--src/gui/dialogs/qfiledialog.cpp55
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp3
-rw-r--r--src/gui/image/qpixmap_s60.cpp12
-rw-r--r--src/gui/image/qpixmap_s60_p.h2
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h6
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp68
-rw-r--r--src/gui/itemviews/qtreewidget.cpp9
-rw-r--r--src/gui/kernel/qaction.cpp26
-rw-r--r--src/gui/kernel/qaction_p.h2
-rw-r--r--src/gui/kernel/qapplication.cpp3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp26
-rw-r--r--src/gui/kernel/qgesturemanager.cpp1
-rw-r--r--src/gui/kernel/qkeysequence.cpp20
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp13
-rw-r--r--src/gui/kernel/qt_s60_p.h7
-rw-r--r--src/gui/kernel/qt_x11_p.h2
-rw-r--r--src/gui/kernel/qwidget_s60.cpp5
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qblendfunctions.cpp24
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/styles/qplastiquestyle.cpp10
-rw-r--r--src/gui/styles/qs60style.cpp7
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qtextformat.cpp76
-rw-r--r--src/gui/text/qtextformat_p.h4
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp11
-rw-r--r--src/gui/widgets/qabstractslider.cpp2
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp14
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp28
-rw-r--r--src/gui/widgets/qdockarealayout.cpp9
-rw-r--r--src/gui/widgets/qdockwidget.cpp5
-rw-r--r--src/gui/widgets/qfontcombobox.cpp11
-rw-r--r--src/gui/widgets/qlabel.cpp38
-rw-r--r--src/gui/widgets/qlabel_p.h2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp2
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp3
-rw-r--r--src/gui/widgets/qmenu.cpp44
-rw-r--r--src/gui/widgets/qmenu_p.h1
-rw-r--r--src/gui/widgets/qmenubar.cpp4
-rw-r--r--src/gui/widgets/qtoolbar.cpp2
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp50
-rw-r--r--src/gui/widgets/qtoolbararealayout_p.h6
-rw-r--r--src/gui/widgets/qtoolbarlayout.cpp5
-rw-r--r--src/gui/widgets/qtoolbarlayout_p.h2
-rw-r--r--tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp63
-rw-r--r--tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp97
-rw-r--r--tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp70
-rw-r--r--tests/auto/qcoreapplication/tst_qcoreapplication.cpp36
-rw-r--r--tests/auto/qdockwidget/tst_qdockwidget.cpp42
-rw-r--r--tests/auto/qfont/tst_qfont.cpp7
-rw-r--r--tests/auto/qfontcombobox/tst_qfontcombobox.cpp6
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp16
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp58
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp6
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp72
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp27
-rw-r--r--tests/auto/qgridlayout/tst_qgridlayout.cpp36
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp45
-rw-r--r--tests/auto/qlabel/tst_qlabel.cpp51
102 files changed, 1988 insertions, 645 deletions
diff --git a/.gitignore b/.gitignore
index feb1ea4..33c9b7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -191,6 +191,7 @@ plugin_commonU.def
*.qtplugin
*.sis
*.sisx
+*.lst
# Generated by abldfast.bat from devtools.
.abldsteps.*
diff --git a/config.tests/x11/xsync/xsync.cpp b/config.tests/x11/xsync/xsync.cpp
index ed3ecf5..8eea850 100644
--- a/config.tests/x11/xsync/xsync.cpp
+++ b/config.tests/x11/xsync/xsync.cpp
@@ -41,7 +41,9 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+extern "C" {
#include <X11/extensions/sync.h>
+}
int main(int, char **)
{
diff --git a/demos/sub-attaq/animationmanager.cpp b/demos/sub-attaq/animationmanager.cpp
index eb5a125..b3fc8e1 100644
--- a/demos/sub-attaq/animationmanager.cpp
+++ b/demos/sub-attaq/animationmanager.cpp
@@ -62,11 +62,18 @@ AnimationManager *AnimationManager::self()
void AnimationManager::registerAnimation(QAbstractAnimation *anim)
{
+ QObject::connect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.append(anim);
}
+void AnimationManager::unregisterAnimation_helper(QObject *obj)
+{
+ unregisterAnimation(static_cast<QAbstractAnimation*>(obj));
+}
+
void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
{
+ QObject::disconnect(anim, SIGNAL(destroyed(QObject*)), this, SLOT(unregisterAnimation_helper(QObject*)));
animations.removeAll(anim);
}
diff --git a/demos/sub-attaq/animationmanager.h b/demos/sub-attaq/animationmanager.h
index 8db13eb..48d84d1 100644
--- a/demos/sub-attaq/animationmanager.h
+++ b/demos/sub-attaq/animationmanager.h
@@ -62,6 +62,9 @@ public slots:
void pauseAll();
void resumeAll();
+private slots:
+ void unregisterAnimation_helper(QObject *obj);
+
private:
static AnimationManager *instance;
QList<QAbstractAnimation *> animations;
diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp
index 0ad31b1..6fed9a9 100644
--- a/demos/sub-attaq/boat.cpp
+++ b/demos/sub-attaq/boat.cpp
@@ -62,7 +62,7 @@ static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
for (int i = 1; i <= 4; i++) {
PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat);
step->setZValue(6);
- step->setOpacity(0);
+ step->setOpacity(0);
//fade-in
QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity");
@@ -92,10 +92,10 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
//The movement animation used to animate the boat
movementAnimation = new QPropertyAnimation(this, "pos");
- //The movement animation used to animate the boat
+ //The destroy animation used to explode the boat
destroyAnimation = setupDestroyAnimation(this);
- //We setup the state machien of the boat
+ //We setup the state machine of the boat
machine = new QStateMachine(this);
QState *moving = new QState(machine);
StopState *stopState = new StopState(this, moving);
diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp
index e29095e..71d4fe7 100644
--- a/demos/sub-attaq/graphicsscene.cpp
+++ b/demos/sub-attaq/graphicsscene.cpp
@@ -278,4 +278,5 @@ void GraphicsScene::clearScene()
boat->stop();
boat->hide();
+ boat->setEnabled(true);
}
diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp
index 1f46444..4911c73 100644
--- a/examples/effects/blurpicker/blurpicker.cpp
+++ b/examples/effects/blurpicker/blurpicker.cpp
@@ -49,24 +49,29 @@
#define M_PI 3.14159265358979323846
#endif
-BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index")
{
setBackgroundBrush(QPixmap(":/images/background.jpg"));
- setScene(&m_scene);
+ setScene(new QGraphicsScene(this));
setupScene();
- updateIconPositions();
+ setIndex(0);
- connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions()));
- m_timeLine.setDuration(400);
+ m_animation.setDuration(400);
+ m_animation.setEasingCurve(QEasingCurve::InOutSine);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
}
-void BlurPicker::updateIconPositions()
+qreal BlurPicker::index() const
{
- m_index = m_timeLine.currentFrame() / 1000.0;
+ return m_index;
+}
+
+void BlurPicker::setIndex(qreal index)
+{
+ m_index = index;
qreal baseline = 0;
for (int i = 0; i < m_icons.count(); ++i) {
@@ -82,12 +87,12 @@ void BlurPicker::updateIconPositions()
static_cast<BlurEffect *>(icon->graphicsEffect())->setBaseLine(baseline);
}
- m_scene.update();
+ scene()->update();
}
void BlurPicker::setupScene()
{
- m_scene.setSceneRect(-200, -120, 400, 240);
+ scene()->setSceneRect(-200, -120, 400, 240);
QStringList names;
names << ":/images/accessories-calculator.png";
@@ -101,32 +106,34 @@ void BlurPicker::setupScene()
for (int i = 0; i < names.count(); i++) {
QPixmap pixmap(names[i]);
- QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap);
+ QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap);
icon->setZValue(1);
icon->setGraphicsEffect(new BlurEffect(icon));
m_icons << icon;
}
- QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg"));
+ QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg"));
bg->setZValue(0);
bg->setPos(-200, -150);
}
void BlurPicker::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Left) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000);
- m_timeLine.start();
- event->accept();
- }
+ int delta = 0;
+ switch (event->key())
+ {
+ case Qt::Key_Left:
+ delta = -1;
+ break;
+ case Qt::Key_Right:
+ delta = 1;
+ break;
+ default:
+ break;
}
-
- if (event->key() == Qt::Key_Right) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000);
- m_timeLine.start();
+ if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
+ m_animation.setEndValue(m_index + delta);
+ m_animation.start();
event->accept();
- }
}
}
diff --git a/examples/effects/blurpicker/blurpicker.h b/examples/effects/blurpicker/blurpicker.h
index b460df4..b302db4 100644
--- a/examples/effects/blurpicker/blurpicker.h
+++ b/examples/effects/blurpicker/blurpicker.h
@@ -44,31 +44,31 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "blureffect.h"
class BlurPicker: public QGraphicsView
{
Q_OBJECT
+ Q_PROPERTY(qreal index READ index WRITE setIndex);
public:
BlurPicker(QWidget *parent = 0);
+ qreal index() const;
+ void setIndex(qreal);
+
protected:
void keyPressEvent(QKeyEvent *event);
-private slots:
- void updateIconPositions();
-
private:
void setupScene();
private:
qreal m_index;
- QGraphicsScene m_scene;
QList<QGraphicsItem*> m_icons;
- QTimeLine m_timeLine;
+ QPropertyAnimation m_animation;
};
#endif // BLURPICKER_H
diff --git a/examples/effects/customshader/blurpicker.cpp b/examples/effects/customshader/blurpicker.cpp
index 6cda711..d38d99b 100644
--- a/examples/effects/customshader/blurpicker.cpp
+++ b/examples/effects/customshader/blurpicker.cpp
@@ -50,24 +50,29 @@
#define M_PI 3.14159265358979323846
#endif
-BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index")
{
setBackgroundBrush(QPixmap(":/images/background.jpg"));
- setScene(&m_scene);
+ setScene(new QGraphicsScene(this));
setupScene();
- updateIconPositions();
+ setIndex(0);
- connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions()));
- m_timeLine.setDuration(400);
+ m_animation.setDuration(400);
+ m_animation.setEasingCurve(QEasingCurve::InOutSine);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
}
-void BlurPicker::updateIconPositions()
+qreal BlurPicker::index() const
{
- m_index = m_timeLine.currentFrame() / 1000.0;
+ return m_index;
+}
+
+void BlurPicker::setIndex(qreal index)
+{
+ m_index = index;
qreal baseline = 0;
for (int i = 0; i < m_icons.count(); ++i) {
@@ -84,12 +89,12 @@ void BlurPicker::updateIconPositions()
static_cast<BlurEffect *>(icon->graphicsEffect())->setBaseLine(baseline);
}
- m_scene.update();
+ scene()->update();
}
void BlurPicker::setupScene()
{
- m_scene.setSceneRect(-200, -120, 400, 240);
+ scene()->setSceneRect(-200, -120, 400, 240);
QStringList names;
names << ":/images/accessories-calculator.png";
@@ -103,7 +108,7 @@ void BlurPicker::setupScene()
for (int i = 0; i < names.count(); i++) {
QPixmap pixmap(names[i]);
- QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap);
+ QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap);
icon->setZValue(1);
if (i == 3)
icon->setGraphicsEffect(new CustomShaderEffect());
@@ -112,26 +117,28 @@ void BlurPicker::setupScene()
m_icons << icon;
}
- QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg"));
+ QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg"));
bg->setZValue(0);
bg->setPos(-200, -150);
}
void BlurPicker::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Left) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000);
- m_timeLine.start();
- event->accept();
- }
+ int delta = 0;
+ switch (event->key())
+ {
+ case Qt::Key_Left:
+ delta = -1;
+ break;
+ case Qt::Key_Right:
+ delta = 1;
+ break;
+ default:
+ break;
}
-
- if (event->key() == Qt::Key_Right) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000);
- m_timeLine.start();
+ if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
+ m_animation.setEndValue(m_index + delta);
+ m_animation.start();
event->accept();
- }
}
}
diff --git a/examples/effects/customshader/blurpicker.h b/examples/effects/customshader/blurpicker.h
index b460df4..b302db4 100644
--- a/examples/effects/customshader/blurpicker.h
+++ b/examples/effects/customshader/blurpicker.h
@@ -44,31 +44,31 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "blureffect.h"
class BlurPicker: public QGraphicsView
{
Q_OBJECT
+ Q_PROPERTY(qreal index READ index WRITE setIndex);
public:
BlurPicker(QWidget *parent = 0);
+ qreal index() const;
+ void setIndex(qreal);
+
protected:
void keyPressEvent(QKeyEvent *event);
-private slots:
- void updateIconPositions();
-
private:
void setupScene();
private:
qreal m_index;
- QGraphicsScene m_scene;
QList<QGraphicsItem*> m_icons;
- QTimeLine m_timeLine;
+ QPropertyAnimation m_animation;
};
#endif // BLURPICKER_H
diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp
index 28dd3bd..4128a59 100644
--- a/examples/effects/fademessage/fademessage.cpp
+++ b/examples/effects/fademessage/fademessage.cpp
@@ -43,7 +43,7 @@
#include <QtGui>
-FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent)
{
setScene(&m_scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -51,9 +51,12 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
setupScene();
- m_timeLine = new QTimeLine(500, this);
- m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
- connect(m_timeLine, SIGNAL(valueChanged(qreal)), m_effect, SLOT(setStrength(qreal)));
+ m_animation = new QPropertyAnimation(m_effect, "strength", this);
+ m_animation->setDuration(500);
+ m_animation->setEasingCurve(QEasingCurve::InOutSine);
+ m_animation->setStartValue(0);
+ m_animation->setEndValue(1);
+
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
@@ -63,13 +66,12 @@ void FadeMessage::togglePopup()
{
if (m_message->isVisible()) {
m_message->setVisible(false);
- m_timeLine->setDirection(QTimeLine::Backward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Backward);
} else {
m_message->setVisible(true);
- m_timeLine->setDirection(QTimeLine::Forward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Forward);
}
+ m_animation->start();
}
void FadeMessage::setupScene()
diff --git a/examples/effects/fademessage/fademessage.h b/examples/effects/fademessage/fademessage.h
index 34e2fb8..e73ef6b 100644
--- a/examples/effects/fademessage/fademessage.h
+++ b/examples/effects/fademessage/fademessage.h
@@ -44,7 +44,7 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "fademessage.h"
@@ -62,11 +62,10 @@ private slots:
void togglePopup();
private:
- qreal m_index;
QGraphicsScene m_scene;
QGraphicsColorizeEffect *m_effect;
QGraphicsItem *m_message;
- QTimeLine *m_timeLine;
+ QPropertyAnimation *m_animation;
};
#endif // FADEMESSAGE_H
diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp
index 9002828..d835ae3 100644
--- a/examples/graphicsview/weatheranchorlayout/main.cpp
+++ b/examples/graphicsview/weatheranchorlayout/main.cpp
@@ -185,20 +185,12 @@ int main(int argc, char **argv)
QGraphicsScene scene;
scene.setSceneRect(0, 0, 800, 480);
-#ifdef DEBUG_MODE
- QGraphicsProxyWidget *title = createItem("Title");
- QGraphicsProxyWidget *place = createItem("Place");
- QGraphicsProxyWidget *sun = createItem("Sun");
- QGraphicsProxyWidget *details = createItem("Details");
- QGraphicsProxyWidget *tabbar = createItem("Tabbar");
-#else
- // pixmaps widgets
- PixmapWidget *title = new PixmapWidget(QPixmap(":/images/title.jpg"));
- PlaceWidget *place = new PlaceWidget(QPixmap(":/images/place.jpg"));
- PixmapWidget *details = new PixmapWidget(QPixmap(":/images/5days.jpg"));
- PixmapWidget *sun = new PixmapWidget(QPixmap(":/images/weather-few-clouds.png"));
- PixmapWidget *tabbar = new PixmapWidget(QPixmap(":/images/tabbar.jpg"));
-#endif
+ // pixmaps widgets
+ PixmapWidget *title = new PixmapWidget(QPixmap(":/images/title.jpg"));
+ PlaceWidget *place = new PlaceWidget(QPixmap(":/images/place.jpg"));
+ PixmapWidget *details = new PixmapWidget(QPixmap(":/images/5days.jpg"));
+ PixmapWidget *sunnyWeather = new PixmapWidget(QPixmap(":/images/weather-few-clouds.png"));
+ PixmapWidget *tabbar = new PixmapWidget(QPixmap(":/images/tabbar.jpg"));
// setup sizes
@@ -215,9 +207,9 @@ int main(int argc, char **argv)
tabbar->setPreferredSize(QSizeF(70, 24));
tabbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
- sun->setPreferredSize(QSizeF(128, 97));
- sun->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
- sun->setZValue(9999);
+ sunnyWeather->setPreferredSize(QSizeF(128, 97));
+ sunnyWeather->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ sunnyWeather->setZValue(9999);
// start anchor layout
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
@@ -238,8 +230,8 @@ int main(int argc, char **argv)
anchor = l->addAnchor(place, Qt::AnchorBottom, l, Qt::AnchorBottom);
anchor->setSpacing(12);
- anchor = l->addAnchor(sun, Qt::AnchorTop, title, Qt::AnchorTop);
- anchor = l->addAnchor(sun, Qt::AnchorBottom, l, Qt::AnchorVerticalCenter);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorTop, title, Qt::AnchorTop);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorBottom, l, Qt::AnchorVerticalCenter);
anchor = l->addAnchor(tabbar, Qt::AnchorTop, title, Qt::AnchorBottom);
anchor->setSpacing(5);
@@ -257,8 +249,8 @@ int main(int argc, char **argv)
anchor = l->addAnchor(place, Qt::AnchorRight, details, Qt::AnchorLeft);
anchor->setSpacing(35);
- anchor = l->addAnchor(sun, Qt::AnchorLeft, place, Qt::AnchorHorizontalCenter);
- anchor = l->addAnchor(sun, Qt::AnchorRight, l, Qt::AnchorHorizontalCenter);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorLeft, place, Qt::AnchorHorizontalCenter);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorRight, l, Qt::AnchorHorizontalCenter);
anchor = l->addAnchor(tabbar, Qt::AnchorHorizontalCenter, details, Qt::AnchorHorizontalCenter);
anchor = l->addAnchor(details, Qt::AnchorRight, l, Qt::AnchorRight);
diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_generate_temp_dirs.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_generate_temp_dirs.flm
deleted file mode 100644
index ca6cca9..0000000
--- a/mkspecs/symbian-sbsv2/flm/qt/qmake_generate_temp_dirs.flm
+++ /dev/null
@@ -1,22 +0,0 @@
-# /****************************************************************************
-# **
-# ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# ** Contact: Nokia Corporation (qt-info@nokia.com)
-# **
-# ** This file is part of symbian-sbsv2 mkspec.
-# **
-# ****************************************************************************/
-
-include $(FLMHOME)/metaflm.mk
-
-SINGLETON:=$(call sanitise,TEMP_DIRS_$(EXTENSION_ROOT))
-
-ifeq ($($(SINGLETON)),)
-$(SINGLETON):=1
-$(call makepath,$(DIRS))
-$(eval $(call GenerateStandardCleanTarget,'',$(DIRS)))
-endif
-
-
-
-
diff --git a/mkspecs/symbian-sbsv2/flm/qt/qt.xml b/mkspecs/symbian-sbsv2/flm/qt/qt.xml
index 5074e47..c99b5e2 100644
--- a/mkspecs/symbian-sbsv2/flm/qt/qt.xml
+++ b/mkspecs/symbian-sbsv2/flm/qt/qt.xml
@@ -35,11 +35,6 @@
<param name='LINK_TARGET' />
</interface>
- <interface name="qt.qmake_generate_temp_dirs" extends="Symbian.UserFLM"
- flm="qmake_generate_temp_dirs.flm">
- <param name='DIRS' />
- </interface>
-
<interface name="qt.qmake_store_build" extends="Symbian.UserFLM"
flm="qmake_store_build.flm">
</interface>
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 8ec4b3f..1326a49 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -610,19 +610,10 @@ void SymbianMakefileGenerator::initMmpVariables()
incpaths << project->values("UI_HEADERS_DIR");
incpaths << project->values("UI_DIR");
- QString epocPath("epoc32");
for (int j = 0; j < incpaths.size(); ++j) {
QString includepath = canonizePath(incpaths.at(j));
appendIfnotExist(sysincspaths, includepath);
- // As a workaround for Symbian toolchain insistence to treat include
- // statements as relative to source file rather than the file they appear in,
- // we generate extra temporary include directories to make
- // relative include paths used in various headers to work properly.
- // Note that this is not a fix-all solution; it's just a stop-gap measure
- // to make Qt itself build until toolchain can support relative includes in
- // a way that Qt expects.
- if (!includepath.contains(epocPath)) // No temp dirs for epoc includes
- appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR));
+ appendAbldTempDirs(sysincspaths, includepath);
}
// Remove duplicate include path entries
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 36f6e05..a3e2c17 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -147,6 +147,7 @@ protected:
virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0;
virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0;
virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0;
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath) = 0;
public:
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 4d1673b..1b5464f 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -450,3 +450,17 @@ void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool ad
t << "gnumakefile " << gnuMakefileName << endl;
}
}
+
+void SymbianAbldMakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath)
+{
+ // As a workaround for Symbian toolchain insistence to treat include
+ // statements as relative to source file rather than the file they appear in,
+ // we generate extra temporary include directories to make
+ // relative include paths used in various headers to work properly.
+ // Note that this is not a fix-all solution; it's just a stop-gap measure
+ // to make Qt itself build until toolchain can support relative includes in
+ // a way that Qt expects.
+ QString epocPath("epoc32");
+ if (!includepath.contains(epocPath)) // No temp dirs for epoc includes
+ appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR));
+}
diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h
index f844096..11b9cd1 100644
--- a/qmake/generators/symbian/symmake_abld.h
+++ b/qmake/generators/symbian/symmake_abld.h
@@ -55,6 +55,7 @@ protected:
virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension);
virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly);
virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile);
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
void writeStoreBuildTarget(QTextStream &t);
bool writeDeploymentTargets(QTextStream &t);
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index cad2736..5e624de 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -182,15 +182,22 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
}
t << endl;
+ QString winscw("winscw");
// For more specific builds, targets are in this form: build-platform, e.g. release-armv5
foreach(QString item, debugPlatforms) {
t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
+ else
+ t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
}
foreach(QString item, releasePlatforms) {
t << "release-" << item << ": " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+ if(QString::compare(item, winscw) == 0)
+ t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl;
+ else
+ t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
}
t << endl;
@@ -379,28 +386,6 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
t << "END" << endl;
}
- // Generate temp dirs
- QString tempDirs;
- for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) {
- QStringList values = it.value();
- for (int i = 0; i < values.size(); ++i) {
- QString value = values.at(i);
- if (value.endsWith("/" QT_EXTRA_INCLUDE_DIR)) {
- value = fileInfo(value).absoluteFilePath();
- tempDirs.append(value);
- tempDirs.append(" ");
- }
- }
- }
-
- if (tempDirs.size())
- tempDirs.chop(1); // Remove final space
-
- t << "START EXTENSION qt/qmake_generate_temp_dirs" << endl;
- t << "OPTION DIRS " << tempDirs << endl;
- t << "END" << endl;
- t << endl;
-
t << "START EXTENSION qt/qmake_store_build" << endl;
t << "END" << endl;
t << endl;
@@ -414,3 +399,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool a
Q_UNUSED(t);
Q_UNUSED(addDeploymentExtension);
}
+
+void SymbianSbsv2MakefileGenerator::appendAbldTempDirs(QStringList& sysincspaths, QString includepath)
+{
+ //Do nothing
+ Q_UNUSED(sysincspaths);
+ Q_UNUSED(includepath);
+}
diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h
index 1cbddb3..9472b68 100644
--- a/qmake/generators/symbian/symmake_sbsv2.h
+++ b/qmake/generators/symbian/symmake_sbsv2.h
@@ -55,6 +55,7 @@ protected:
virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension);
virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly);
virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile);
+ virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
public:
diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
index a793390..a559249 100644
--- a/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
+++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.cpp
@@ -29,6 +29,10 @@ using namespace Phonon::MMF;
\internal
*/
+/*! \namespace Phonon::MMF
+ \internal
+*/
+
AbstractAudioEffect::AbstractAudioEffect(QObject *parent,
const QList<EffectParameter> &params) : MediaNode::MediaNode(parent)
, m_params(params)
diff --git a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp
index 0447d57..18ced94 100644
--- a/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp
+++ b/src/3rdparty/phonon/mmf/ancestormovemonitor.cpp
@@ -26,7 +26,7 @@ QT_BEGIN_NAMESPACE
using namespace Phonon::MMF;
-/*! \class MMF::AncestorMoveMonitor
+/*! \class Phonon::MMF::AncestorMoveMonitor
\internal
\brief Class which installs a global event filter, and listens for move
events which may affect the absolute position of widgets registered with
@@ -34,6 +34,11 @@ using namespace Phonon::MMF;
See QTBUG-4956
*/
+
+/*! \class Phonon::MMF::VideoOutputObserver
+ \internal
+*/
+
//-----------------------------------------------------------------------------
// Constructor / destructor
//-----------------------------------------------------------------------------
diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp
index 58d1ece..d728fcf 100644
--- a/src/3rdparty/phonon/mmf/utils.cpp
+++ b/src/3rdparty/phonon/mmf/utils.cpp
@@ -24,16 +24,24 @@ QT_BEGIN_NAMESPACE
using namespace Phonon;
using namespace Phonon::MMF;
-/*! \namespace MMF::Utils
+/*! \namespace Phonon::MMF::Utils
\internal
*/
-/*! \class MMF::TTraceContext
+/*! \class Phonon::MMF::TTraceContext
\internal
*/
-/*! \class MMF::Utils
- \internal
+/*! \enum Phonon::MMF::PanicCode
+ \internal
+*/
+
+/*! \enum Phonon::MMF::TTraceCategory
+ \internal
+*/
+
+/*! \enum Phonon::MMF::MediaType
+ \internal
*/
_LIT(PanicCategory, "Phonon::MMF");
diff --git a/src/3rdparty/phonon/phonon/audiooutput.cpp b/src/3rdparty/phonon/phonon/audiooutput.cpp
index 3d03dc4..0f6a49b 100644
--- a/src/3rdparty/phonon/phonon/audiooutput.cpp
+++ b/src/3rdparty/phonon/phonon/audiooutput.cpp
@@ -259,6 +259,7 @@ void AudioOutputPrivate::setupBackendObject()
// set up attributes
pINTERFACE_CALL(setVolume(pow(volume, VOLTAGE_TO_LOUDNESS_EXPONENT)));
+#ifndef QT_NO_PHONON_SETTINGSGROUP
// if the output device is not available and the device was not explicitly set
if (!callSetOutputDevice(this, device) && !outputDeviceOverridden) {
// fall back in the preference list of output devices
@@ -278,6 +279,7 @@ void AudioOutputPrivate::setupBackendObject()
callSetOutputDevice(this, none);
handleAutomaticDeviceChange(none, FallbackChange);
}
+#endif //QT_NO_PHONON_SETTINGSGROUP
}
void AudioOutputPrivate::_k_volumeChanged(qreal newVolume)
@@ -307,6 +309,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed()
pDebug() << Q_FUNC_INFO;
// outputDeviceIndex identifies a failing device
// fall back in the preference list of output devices
+#ifndef QT_NO_PHONON_SETTINGSGROUP
const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings | GlobalConfig::HideUnavailableDevices);
for (int i = 0; i < deviceList.count(); ++i) {
const int devIndex = deviceList.at(i);
@@ -319,6 +322,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed()
}
}
}
+#endif //QT_NO_PHONON_SETTINGSGROUP
// if we get here there is no working output device. Tell the backend.
const AudioOutputDevice none;
callSetOutputDevice(this, none);
@@ -328,6 +332,7 @@ void AudioOutputPrivate::_k_audioDeviceFailed()
void AudioOutputPrivate::_k_deviceListChanged()
{
pDebug() << Q_FUNC_INFO;
+#ifndef QT_NO_PHONON_SETTINGSGROUP
// let's see if there's a usable device higher in the preference list
const QList<int> deviceList = GlobalConfig().audioOutputDeviceListFor(category, GlobalConfig::AdvancedDevicesFromSettings);
DeviceChangeType changeType = HigherPreferenceChange;
@@ -353,6 +358,7 @@ void AudioOutputPrivate::_k_deviceListChanged()
break; // found one with higher preference that works
}
}
+#endif //QT_NO_PHONON_SETTINGSGROUP
}
static struct
diff --git a/src/3rdparty/phonon/phonon/backendcapabilities.cpp b/src/3rdparty/phonon/phonon/backendcapabilities.cpp
index 0bcc76c..fbeb020 100644
--- a/src/3rdparty/phonon/phonon/backendcapabilities.cpp
+++ b/src/3rdparty/phonon/phonon/backendcapabilities.cpp
@@ -75,10 +75,12 @@ bool BackendCapabilities::isMimeTypeAvailable(const QString &mimeType)
QList<AudioOutputDevice> BackendCapabilities::availableAudioOutputDevices()
{
QList<AudioOutputDevice> ret;
+#ifndef QT_NO_PHONON_SETTINGSGROUP
const QList<int> deviceIndexes = GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory);
for (int i = 0; i < deviceIndexes.count(); ++i) {
ret.append(AudioOutputDevice::fromIndex(deviceIndexes.at(i)));
}
+#endif //QT_NO_PHONON_SETTINGSGROUP
return ret;
}
diff --git a/src/3rdparty/phonon/phonon/effectwidget.cpp b/src/3rdparty/phonon/phonon/effectwidget.cpp
index c5963eb..2334d7f 100644
--- a/src/3rdparty/phonon/phonon/effectwidget.cpp
+++ b/src/3rdparty/phonon/phonon/effectwidget.cpp
@@ -97,8 +97,9 @@ void EffectWidgetPrivate::autogenerateUi()
Q_Q(EffectWidget);
QVBoxLayout *mainLayout = new QVBoxLayout(q);
mainLayout->setMargin(0);
- for (int i = 0; i < effect->parameters().count(); ++i) {
- const EffectParameter &para = effect->parameters().at(i);
+ const QList<Phonon::EffectParameter> parameters = effect->parameters();
+ for (int i = 0; i < parameters.count(); ++i) {
+ const EffectParameter &para = parameters.at(i);
QVariant value = effect->parameterValue(para);
QHBoxLayout *pLayout = new QHBoxLayout;
mainLayout->addLayout(pLayout);
diff --git a/src/3rdparty/phonon/phonon/globalconfig.cpp b/src/3rdparty/phonon/phonon/globalconfig.cpp
index 6e6263a..3b77a18 100644
--- a/src/3rdparty/phonon/phonon/globalconfig.cpp
+++ b/src/3rdparty/phonon/phonon/globalconfig.cpp
@@ -178,13 +178,15 @@ QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, int
return listSortedByConfig(backendConfig, category, defaultList);
}
-#endif //QT_NO_SETTINGSGROUPS
+#endif //QT_NO_PHONON_SETTINGSGROUP
int GlobalConfig::audioOutputDeviceFor(Phonon::Category category, int override) const
{
+#ifndef QT_NO_PHONON_SETTINGSGROUP
QList<int> ret = audioOutputDeviceListFor(category, override);
- if (ret.isEmpty())
- return -1;
- return ret.first();
+ if (!ret.isEmpty())
+ return ret.first();
+#endif //QT_NO_PHONON_SETTINGSGROUP
+ return -1;
}
#ifndef QT_NO_PHONON_AUDIOCAPTURE
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
index 117393a..bbb676b 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -971,7 +971,10 @@ void tst_QWebElement::render()
QImage testImage(resource.width(), resource.height(), QImage::Format_ARGB32);
QPainter painter0(&testImage);
painter0.fillRect(imageRect, Qt::white);
- painter0.drawImage(0, 0, resource);
+ //render() uses pixmaps internally, and pixmaps might have bit depths
+ // other than 32, giving different pixel values due to rounding.
+ QPixmap pix = QPixmap::fromImage(resource);
+ painter0.drawPixmap(0, 0, pix);
painter0.end();
QImage image1(resource.width(), resource.height(), QImage::Format_ARGB32);
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 3065083..013ff7f 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -58,12 +58,12 @@
an example:
\code
- QPropertyAnimation animation(myWidget, "geometry");
- animation.setDuration(10000);
- animation.setStartValue(QRect(0, 0, 100, 30));
- animation.setEndValue(QRect(250, 250, 100, 30));
+ QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry");
+ animation->setDuration(10000);
+ animation->setStartValue(QRect(0, 0, 100, 30));
+ animation->setEndValue(QRect(250, 250, 100, 30));
- animation.start();
+ animation->start();
\endcode
The property name and the QObject instance of which property
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 861e26e..5dbb8c3 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -63,12 +63,12 @@
pause to a sequential animation group.
\code
- QSequentialAnimationGroup group;
+ QSequentialAnimationGroup *group = new QSequentialAnimationGroup;
- group.addAnimation(anim1);
- group.addAnimation(anim2);
+ group->addAnimation(anim1);
+ group->addAnimation(anim2);
- group.start();
+ group->start();
\endcode
In this example, \c anim1 and \c anim2 are two already set up
diff --git a/src/corelib/arch/armv6/qatomic_generic_armv6.cpp b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp
new file mode 100644
index 0000000..3078662
--- /dev/null
+++ b/src/corelib/arch/armv6/qatomic_generic_armv6.cpp
@@ -0,0 +1,260 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+** This file implements the generic atomics interface using ARMv6 assembly
+** instructions. It is more efficent than the inline versions when Qt is
+** built for the THUMB instruction set, as the required instructions are
+** only available in ARM state.
+****************************************************************************/
+
+#include <QtCore/qglobal.h>
+
+#ifdef QT_HAVE_ARMV6
+
+QT_BEGIN_NAMESPACE
+
+QT_USE_NAMESPACE
+
+#ifdef Q_CC_RVCT
+#pragma push
+#pragma arm
+Q_CORE_EXPORT asm
+bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue)
+{
+ CODE32
+ //R0 = _q_value
+ //R1 = expectedValue
+ //R2 = newValue
+retry_testAndSetOrdered
+ LDREX r3,[r0] //r3 = *_q_value
+ EORS r3,r3,r1 //if (r3 == expectedValue) {
+ STREXEQ r3,r2,[r0] //*_q_value = newvalue, r3 = error
+ TEQEQ r3,#1 //if error
+ BEQ retry_testAndSetOrdered //then goto retry }
+ RSBS r0,r3,#1 //return (r3 == 0)
+ MOVCC r0,#0
+ BX r14
+}
+
+Q_CORE_EXPORT asm
+int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue)
+{
+ CODE32
+//R0 = _q_value
+//R1 = newValue
+retry_fetchAndStoreOrdered
+ LDREX r3,[r0] //r3 = *_q_value
+ STREX r2,r1,[r0] //*_q_value = newValue, r2 = error
+ TEQ r2,#0 //if error
+ BNE retry_fetchAndStoreOrdered //then goto retry
+ MOV r0,r3 //return r3
+ BX r14
+}
+
+Q_CORE_EXPORT asm
+int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd)
+{
+ CODE32
+ //R0 = _q_value
+ //R1 = valueToAdd
+ STMDB sp!,{r12,lr}
+retry_fetchAndAddOrdered
+ LDREX r2,[r0] //r2 = *_q_value
+ ADD r3,r2,r1 //r3 = r2 + r1
+ STREX r12,r3,[r0] //*_q_value = r3, r12 = error
+ TEQ r12,#0 //if error
+ BNE retry_fetchAndAddOrdered //then retry
+ MOV r0,r2 //return r2
+ LDMIA sp!,{r12,pc}
+}
+
+Q_CORE_EXPORT asm
+bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value,
+ void *expectedValue,
+ void *newValue)
+{
+ CODE32
+ //R0 = _q_value
+ //R1 = expectedValue
+ //R2 = newValue
+retryPointer_testAndSetOrdered
+ LDREX r3,[r0] //r3 = *_q_value
+ EORS r3,r3,r1 //if (r3 == expectedValue) {
+ STREXEQ r3,r2,[r0] //*_q_value = newvalue, r3 = error
+ TEQEQ r3,#1 //if error
+ BEQ retryPointer_testAndSetOrdered //then goto retry }
+ RSBS r0,r3,#1 //return (r3 == 0)
+ MOVCC r0,#0
+ BX r14
+}
+
+Q_CORE_EXPORT asm
+void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue)
+{
+ CODE32
+ //R0 = _q_value
+ //R1 = newValue
+retryPointer_fetchAndStoreOrdered
+ LDREX r3,[r0] //r3 = *_q_value
+ STREX r2,r1,[r0] //*_q_value = newValue, r2 = error
+ TEQ r2,#0 //if error
+ BNE retryPointer_fetchAndStoreOrdered //then goto retry
+ MOV r0,r3 //return r3
+ BX r14
+}
+
+Q_CORE_EXPORT asm
+void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd)
+{
+ CODE32
+ //R0 = _q_value
+ //R1 = valueToAdd
+ STMDB sp!,{r12,lr}
+retryPointer_fetchAndAddOrdered
+ LDREX r2,[r0] //r2 = *_q_value
+ ADD r3,r2,r1 //r3 = r2 + r1
+ STREX r12,r3,[r0] //*_q_value = r3, r12 = error
+ TEQ r12,#0 //if error
+ BNE retryPointer_fetchAndAddOrdered //then retry
+ MOV r0,r2 //return r2
+ LDMIA sp!,{r12,pc}
+}
+
+#pragma pop
+#elif defined (Q_CC_GCCE)
+Q_CORE_EXPORT __declspec( naked )
+bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue)
+{
+ //R0 = _q_value
+ //R1 = expectedValue
+ //R2 = newValue
+ asm("retry_testAndSetOrdered:");
+ asm(" LDREX r3,[r0]"); //r3 = *_q_value
+ asm(" EORS r3,r3,r1"); //if (r3 == expectedValue) {
+ asm(" STREXEQ r3,r2,[r0]"); //*_q_value = newvalue, r3 = error
+ asm(" TEQEQ r3,#1"); //if error
+ asm(" BEQ retry_testAndSetOrdered"); //then goto retry }
+ asm(" RSBS r0,r3,#1"); //return (r3 == 0)
+ asm(" MOVCC r0,#0");
+ asm(" BX r14");
+}
+
+Q_CORE_EXPORT __declspec( naked )
+int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue)
+{
+//R0 = _q_value
+//R1 = newValue
+ asm("retry_fetchAndStoreOrdered:");
+ asm(" LDREX r3,[r0]"); //r3 = *_q_value
+ asm(" STREX r2,r1,[r0]"); //*_q_value = newValue, r2 = error
+ asm(" TEQ r2,#0"); //if error
+ asm(" BNE retry_fetchAndStoreOrdered"); //then goto retry
+ asm(" MOV r0,r3"); //return r3
+ asm(" BX r14");
+}
+
+Q_CORE_EXPORT __declspec( naked )
+int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd)
+{
+ //R0 = _q_value
+ //R1 = valueToAdd
+ asm(" STMDB sp!,{r12,lr}");
+ asm("retry_fetchAndAddOrdered:");
+ asm(" LDREX r2,[r0]"); //r2 = *_q_value
+ asm(" ADD r3,r2,r1 "); //r3 = r2 + r1
+ asm(" STREX r12,r3,[r0]"); //*_q_value = r3, r12 = error
+ asm(" TEQ r12,#0"); //if error
+ asm(" BNE retry_fetchAndAddOrdered"); //then retry
+ asm(" MOV r0,r2"); //return r2
+ asm(" LDMIA sp!,{r12,pc}");
+}
+
+Q_CORE_EXPORT __declspec( naked )
+bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value,
+ void *expectedValue,
+ void *newValue)
+{
+ //R0 = _q_value
+ //R1 = expectedValue
+ //R2 = newValue
+ asm("retryPointer_testAndSetOrdered:");
+ asm(" LDREX r3,[r0]"); //r3 = *_q_value
+ asm(" EORS r3,r3,r1"); //if (r3 == expectedValue) {
+ asm(" STREXEQ r3,r2,[r0]"); //*_q_value = newvalue, r3 = error
+ asm(" TEQEQ r3,#1"); //if error
+ asm(" BEQ retryPointer_testAndSetOrdered"); //then goto retry }
+ asm(" RSBS r0,r3,#1"); //return (r3 == 0)
+ asm(" MOVCC r0,#0");
+ asm(" BX r14");
+}
+
+Q_CORE_EXPORT __declspec( naked )
+void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue)
+{
+ //R0 = _q_value
+ //R1 = newValue
+ asm("retryPointer_fetchAndStoreOrdered:");
+ asm(" LDREX r3,[r0]"); //r3 = *_q_value
+ asm(" STREX r2,r1,[r0]"); //*_q_value = newValue, r2 = error
+ asm(" TEQ r2,#0"); //if error
+ asm(" BNE retryPointer_fetchAndStoreOrdered"); //then goto retry
+ asm(" MOV r0,r3"); //return r3
+ asm(" BX r14");
+}
+
+Q_CORE_EXPORT __declspec( naked )
+void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd)
+{
+ //R0 = _q_value
+ //R1 = valueToAdd
+ asm(" STMDB sp!,{r12,lr}");
+ asm("retryPointer_fetchAndAddOrdered:");
+ asm(" LDREX r2,[r0]"); //r2 = *_q_value
+ asm(" ADD r3,r2,r1"); //r3 = r2 + r1
+ asm(" STREX r12,r3,[r0]"); //*_q_value = r3, r12 = error
+ asm(" TEQ r12,#0"); //if error
+ asm(" BNE retryPointer_fetchAndAddOrdered"); //then retry
+ asm(" MOV r0,r2"); //return r2
+ asm(" LDMIA sp!,{r12,pc}");
+}
+#else
+#error unknown arm compiler
+#endif
+QT_END_NAMESPACE
+#endif
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 6862638..1e9f0c4 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -45,7 +45,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
inline bool QBasicAtomicInt::isReferenceCountingNative()
@@ -101,6 +100,8 @@ template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
{ return false; }
+#ifndef Q_CC_RVCT
+
inline bool QBasicAtomicInt::ref()
{
register int newValue;
@@ -155,21 +156,6 @@ inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
return result == 0;
}
-inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
-inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
-inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
register int originalValue;
@@ -188,21 +174,6 @@ inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
return originalValue;
}
-inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
-inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
-inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
{
register int originalValue;
@@ -224,21 +195,6 @@ inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
return originalValue;
}
-inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
-{
- return fetchAndAddOrdered(valueToAdd);
-}
-
-inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
-{
- return fetchAndAddOrdered(valueToAdd);
-}
-
-inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
-{
- return fetchAndAddOrdered(valueToAdd);
-}
-
template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
{
@@ -259,24 +215,6 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValu
}
template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue)
-{
- return testAndSetOrdered(expectedValue, newValue);
-}
-
-template <typename T>
Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
{
register T *originalValue;
@@ -296,24 +234,6 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
}
template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
-template <typename T>
-Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
-{
- return fetchAndStoreOrdered(newValue);
-}
-
-template <typename T>
Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
{
register T *originalValue;
@@ -335,6 +255,226 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo
return originalValue;
}
+#else
+// This is Q_CC_RVCT
+
+// RVCT inline assembly documentation:
+// http://www.keil.com/support/man/docs/armcc/armcc_chdcffdb.htm
+// RVCT embedded assembly documentation:
+// http://www.keil.com/support/man/docs/armcc/armcc_chddbeib.htm
+
+// save our pragma state and switch to ARM mode
+#pragma push
+#pragma arm
+
+inline bool QBasicAtomicInt::ref()
+{
+ register int newValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex newValue, [&_q_value]
+ add newValue, newValue, #1
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return newValue != 0;
+}
+
+inline bool QBasicAtomicInt::deref()
+{
+ register int newValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex newValue, [&_q_value]
+ sub newValue, newValue, #1
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return newValue != 0;
+}
+
+inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
+{
+ register int result;
+ retry:
+ __asm {
+ ldrex result, [&_q_value]
+ eors result, result, expectedValue
+ strexeq result, newValue, [&_q_value]
+ teqeq result, #1
+ beq retry
+ }
+ return result == 0;
+}
+
+inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
+{
+ register int originalValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex originalValue, [&_q_value]
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return originalValue;
+}
+
+inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
+{
+ register int originalValue;
+ register int newValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex originalValue, [&_q_value]
+ add newValue, originalValue, valueToAdd
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return originalValue;
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
+{
+ register T *result;
+ retry:
+ __asm {
+ ldrex result, [&_q_value]
+ eors result, result, expectedValue
+ strexeq result, newValue, [&_q_value]
+ teqeq result, #1
+ beq retry
+ }
+ return result == 0;
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
+{
+ register T *originalValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex originalValue, [&_q_value]
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return originalValue;
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
+{
+ register T *originalValue;
+ register T *newValue;
+ register int result;
+ retry:
+ __asm {
+ ldrex originalValue, [&_q_value]
+ add newValue, originalValue, valueToAdd * sizeof(T)
+ strex result, newValue, [&_q_value]
+ teq result, #0
+ bne retry
+ }
+ return originalValue;
+}
+
+// go back to the previous pragma state (probably Thumb mode)
+#pragma pop
+#endif
+
+// common code
+
+inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
template <typename T>
Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd)
{
diff --git a/src/corelib/arch/qatomic_symbian.h b/src/corelib/arch/qatomic_symbian.h
index 3721aca..92f6ef9 100644
--- a/src/corelib/arch/qatomic_symbian.h
+++ b/src/corelib/arch/qatomic_symbian.h
@@ -42,12 +42,8 @@
#ifndef QATOMIC_SYMBIAN_H
#define QATOMIC_SYMBIAN_H
-#if defined(Q_CC_RVCT)
-# define QT_NO_ARM_EABI
-# include <QtCore/qatomic_arm.h>
-#elif defined(Q_CC_NOKIAX86) || defined(Q_CC_GCCE)
-# include <QtCore/qatomic_generic.h>
-#endif
+#include <qglobal.h>
+#include <e32std.h>
QT_BEGIN_HEADER
@@ -55,7 +51,232 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
-// Empty, but needed to avoid warnings
+#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE
+
+inline bool QBasicAtomicInt::isReferenceCountingWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_INT_TEST_AND_SET_IS_SOMETIMES_NATIVE
+
+inline bool QBasicAtomicInt::isTestAndSetWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
+
+inline bool QBasicAtomicInt::isFetchAndStoreWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
+
+inline bool QBasicAtomicInt::isFetchAndAddWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE
+
+Q_CORE_EXPORT bool QBasicAtomicPointer_isTestAndSetNative();
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative()
+{ return QBasicAtomicPointer_isTestAndSetNative(); }
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE
+
+Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndStoreNative();
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative()
+{ return QBasicAtomicPointer_isFetchAndStoreNative(); }
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree()
+{ return false; }
+
+#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE
+
+Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndAddNative();
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative()
+{ return QBasicAtomicPointer_isFetchAndAddNative(); }
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree()
+{ return false; }
+
+Q_CORE_EXPORT bool QBasicAtomicInt_testAndSetOrdered(volatile int *, int, int);
+Q_CORE_EXPORT int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *, int);
+Q_CORE_EXPORT int QBasicAtomicInt_fetchAndAddOrdered(volatile int *, int);
+
+Q_CORE_EXPORT bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *, void *, void *);
+Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *, void *);
+Q_CORE_EXPORT void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *, qptrdiff);
+
+// Reference counting
+
+//LockedInc and LockedDec are machine coded for ARMv6 (and future proof)
+inline bool QBasicAtomicInt::ref()
+{
+ int original = User::LockedInc((TInt&)_q_value);
+ return original != -1;
+}
+
+inline bool QBasicAtomicInt::deref()
+{
+ int original = User::LockedDec((TInt&)_q_value);
+ return original != 1;
+}
+
+// Test and set for integers
+
+inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
+{
+ return QBasicAtomicInt_testAndSetOrdered(&_q_value, expectedValue, newValue);
+}
+
+inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+// Fetch and store for integers
+
+inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
+{
+ return QBasicAtomicInt_fetchAndStoreOrdered(&_q_value, newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+// Fetch and add for integers
+
+inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
+{
+ return QBasicAtomicInt_fetchAndAddOrdered(&_q_value, valueToAdd);
+}
+
+inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+// Test and set for pointers
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
+{
+ union { T * volatile * typed; void * volatile * voidp; } pointer;
+ pointer.typed = &_q_value;
+ return QBasicAtomicPointer_testAndSetOrdered(pointer.voidp, expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue)
+{
+ return testAndSetOrdered(expectedValue, newValue);
+}
+
+// Fetch and store for pointers
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
+{
+ union { T * volatile * typed; void * volatile * voidp; } pointer;
+ union { T *typed; void *voidp; } returnValue;
+ pointer.typed = &_q_value;
+ returnValue.voidp = QBasicAtomicPointer_fetchAndStoreOrdered(pointer.voidp, newValue);
+ return returnValue.typed;
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
+{
+ return fetchAndStoreOrdered(newValue);
+}
+
+// Fetch and add for pointers
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
+{
+ union { T * volatile *typed; void * volatile *voidp; } pointer;
+ union { T *typed; void *voidp; } returnValue;
+ pointer.typed = &_q_value;
+ returnValue.voidp = QBasicAtomicPointer_fetchAndAddOrdered(pointer.voidp, valueToAdd * sizeof(T));
+ return returnValue.typed;
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
+
+template <typename T>
+Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd)
+{
+ return fetchAndAddOrdered(valueToAdd);
+}
QT_END_NAMESPACE
diff --git a/src/corelib/arch/symbian/arch.pri b/src/corelib/arch/symbian/arch.pri
index deb94b1..3ef1c9e 100644
--- a/src/corelib/arch/symbian/arch.pri
+++ b/src/corelib/arch/symbian/arch.pri
@@ -2,4 +2,4 @@
# Symbian architecture
#
SOURCES += $$QT_ARCH_CPP/qatomic_symbian.cpp \
- $$QT_ARCH_CPP/../generic/qatomic_generic_unix.cpp
+ $$QT_ARCH_CPP/../armv6/qatomic_generic_armv6.cpp
diff --git a/src/corelib/arch/symbian/qatomic_symbian.cpp b/src/corelib/arch/symbian/qatomic_symbian.cpp
index 8f02155..91b49c7 100644
--- a/src/corelib/arch/symbian/qatomic_symbian.cpp
+++ b/src/corelib/arch/symbian/qatomic_symbian.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
// This way we can report on heap cells and handles that are really not owned by anything which still exists.
// This information can be used to detect whether memory leaks are happening, particularly if these numbers grow as the app is used more.
// This code is placed here as it happens to make it the very last static to be destroyed in a Qt app. The
-// reason assumed is that this file appears before any other file declaring static data in the generated
+// reason assumed is that this file appears before any other file declaring static data in the generated
// Symbian MMP file. This particular file was chosen as it is the earliest symbian specific file.
struct QSymbianPrintExitInfo
{
@@ -77,37 +77,158 @@ struct QSymbianPrintExitInfo
TInt initThreadHandleCount;
} symbian_printExitInfo;
-QT_END_NAMESPACE
+Q_CORE_EXPORT bool QBasicAtomicInt::isReferenceCountingNative()
+{
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
+}
+Q_CORE_EXPORT bool QBasicAtomicInt::isTestAndSetNative()
+{
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
+}
-#if defined(Q_CC_RVCT)
+Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndStoreNative()
+{
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
+}
-#include "../arm/qatomic_arm.cpp"
+Q_CORE_EXPORT bool QBasicAtomicInt::isFetchAndAddNative()
+{
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
+}
-QT_BEGIN_NAMESPACE
+Q_CORE_EXPORT bool QBasicAtomicPointer_isTestAndSetNative()
+{
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
+}
-Q_CORE_EXPORT __asm char q_atomic_swp(volatile char *ptr, char newval)
+Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndStoreNative()
{
- add r2, pc, #0
- bx r2
- arm
- swpb r2,r1,[r0]
- mov r0, r2
- bx lr
- thumb
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
}
-Q_CORE_EXPORT __asm int QBasicAtomicInt::fetchAndStoreOrdered(int newValue)
+Q_CORE_EXPORT bool QBasicAtomicPointer_isFetchAndAddNative()
{
- add r2, pc, #0
- bx r2
- arm
- swp r2,r1,[r0]
- mov r0, r2
- bx lr
- thumb
+#ifdef QT_HAVE_ARMV6
+ return true;
+#else
+ return false;
+#endif
}
-QT_END_NAMESPACE
+//For ARMv6, the generic atomics are machine coded
+#ifndef QT_HAVE_ARMV6
+
+class QCriticalSection
+{
+public:
+ QCriticalSection() { fastlock.CreateLocal(); }
+ ~QCriticalSection() { fastlock.Close(); }
+ void lock() { fastlock.Wait(); }
+ void unlock() { fastlock.Signal(); }
-#endif // Q_CC_RVCT
+private:
+ RFastLock fastlock;
+};
+
+QCriticalSection qAtomicCriticalSection;
+
+Q_CORE_EXPORT
+bool QBasicAtomicInt_testAndSetOrdered(volatile int *_q_value, int expectedValue, int newValue)
+{
+ bool returnValue = false;
+ qAtomicCriticalSection.lock();
+ if (*_q_value == expectedValue) {
+ *_q_value = newValue;
+ returnValue = true;
+ }
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+Q_CORE_EXPORT
+int QBasicAtomicInt_fetchAndStoreOrdered(volatile int *_q_value, int newValue)
+{
+ int returnValue;
+ qAtomicCriticalSection.lock();
+ returnValue = *_q_value;
+ *_q_value = newValue;
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+Q_CORE_EXPORT
+int QBasicAtomicInt_fetchAndAddOrdered(volatile int *_q_value, int valueToAdd)
+{
+ int returnValue;
+ qAtomicCriticalSection.lock();
+ returnValue = *_q_value;
+ *_q_value += valueToAdd;
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+Q_CORE_EXPORT
+bool QBasicAtomicPointer_testAndSetOrdered(void * volatile *_q_value,
+ void *expectedValue,
+ void *newValue)
+{
+ bool returnValue = false;
+ qAtomicCriticalSection.lock();
+ if (*_q_value == expectedValue) {
+ *_q_value = newValue;
+ returnValue = true;
+ }
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+Q_CORE_EXPORT
+void *QBasicAtomicPointer_fetchAndStoreOrdered(void * volatile *_q_value, void *newValue)
+{
+ void *returnValue;
+ qAtomicCriticalSection.lock();
+ returnValue = *_q_value;
+ *_q_value = newValue;
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+Q_CORE_EXPORT
+void *QBasicAtomicPointer_fetchAndAddOrdered(void * volatile *_q_value, qptrdiff valueToAdd)
+{
+ void *returnValue;
+ qAtomicCriticalSection.lock();
+ returnValue = *_q_value;
+ *_q_value = reinterpret_cast<char *>(returnValue) + valueToAdd;
+ qAtomicCriticalSection.unlock();
+ return returnValue;
+}
+
+#endif // QT_HAVE_ARMV6
+
+QT_END_NAMESPACE
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d113e02..9558256 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -437,13 +437,18 @@ namespace QT_NAMESPACE {}
#elif defined(__GCCE__)
# define Q_CC_GCCE
# define QT_VISIBILITY_AVAILABLE
+# if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
+# define QT_HAVE_ARMV6
+# endif
/* ARM Realview Compiler Suite
RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given),
so check for it before that */
#elif defined(__ARMCC__) || defined(__CC_ARM)
# define Q_CC_RVCT
-
+# if __TARGET_ARCH_ARM >= 6
+# define QT_HAVE_ARMV6
+# endif
#elif defined(__GNUC__)
# define Q_CC_GNU
# define Q_C_CALLBACKS
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 8e2273d..10a61ca 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2475,10 +2475,8 @@ void QAbstractItemModel::endRemoveRows()
bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation)
{
// Don't move the range within itself.
- if ( ( destinationParent == srcParent )
- && ( destinationStart >= start )
- && ( destinationStart <= end + 1) )
- return false;
+ if (destinationParent == srcParent)
+ return !(destinationStart >= start && destinationStart <= end + 1);
QModelIndex destinationAncestor = destinationParent;
int pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column();
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 3050b82..0518e24 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -675,6 +675,11 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
bool seenWM_QT_SENDPOSTEDEVENTS = false;
bool needWM_QT_SENDPOSTEDEVENTS = false;
do {
+ if (! (flags & QEventLoop::EventLoopExec)) {
+ // when called "manually", always send posted events
+ QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+ }
+
DWORD waitRet = 0;
HANDLE pHandles[MAXIMUM_WAIT_OBJECTS - 1];
QVarLengthArray<MSG> processedTimers;
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 6bc6b76..3b1befd 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -3022,12 +3022,6 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
case Qt::Key_Escape:
q->hide();
return true;
-#ifdef QT_KEYPAD_NAVIGATION
- case Qt::Key_Down:
- case Qt::Key_Up:
- return (QApplication::navigationMode() != Qt::NavigationModeKeypadTabOrder
- && QApplication::navigationMode() != Qt::NavigationModeKeypadDirectional);
-#endif
default:
break;
}
@@ -3145,20 +3139,16 @@ QSize QFileDialogListView::sizeHint() const
void QFileDialogListView::keyPressEvent(QKeyEvent *e)
{
- if (!d_ptr->itemViewKeyboardEvent(e)) {
- QListView::keyPressEvent(e);
- }
#ifdef QT_KEYPAD_NAVIGATION
- else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
- || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional)
- && !hasEditFocus()) {
- e->ignore();
- } else {
- e->accept();
+ if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
+ QListView::keyPressEvent(e);
+ return;
}
-#else
+#endif // QT_KEYPAD_NAVIGATION
+
+ if (!d_ptr->itemViewKeyboardEvent(e))
+ QListView::keyPressEvent(e);
e->accept();
-#endif
}
QFileDialogTreeView::QFileDialogTreeView(QWidget *parent) : QTreeView(parent)
@@ -3184,20 +3174,16 @@ void QFileDialogTreeView::init(QFileDialogPrivate *d_pointer)
void QFileDialogTreeView::keyPressEvent(QKeyEvent *e)
{
- if (!d_ptr->itemViewKeyboardEvent(e)) {
- QTreeView::keyPressEvent(e);
- }
#ifdef QT_KEYPAD_NAVIGATION
- else if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
- || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional)
- && !hasEditFocus()) {
- e->ignore();
- } else {
- e->accept();
+ if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
+ QTreeView::keyPressEvent(e);
+ return;
}
-#else
+#endif // QT_KEYPAD_NAVIGATION
+
+ if (!d_ptr->itemViewKeyboardEvent(e))
+ QTreeView::keyPressEvent(e);
e->accept();
-#endif
}
QSize QFileDialogTreeView::sizeHint() const
@@ -3213,13 +3199,16 @@ QSize QFileDialogTreeView::sizeHint() const
*/
void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
{
+#ifdef QT_KEYPAD_NAVIGATION
+ if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional) {
+ QLineEdit::keyPressEvent(e);
+ return;
+ }
+#endif // QT_KEYPAD_NAVIGATION
+
int key = e->key();
QLineEdit::keyPressEvent(e);
- if (key != Qt::Key_Escape
-#ifdef QT_KEYPAD_NAVIGATION
- && QApplication::navigationMode() == Qt::NavigationModeNone
-#endif
- )
+ if (key != Qt::Key_Escape)
e->accept();
if (hideOnEsc && (key == Qt::Key_Escape || key == Qt::Key_Return || key == Qt::Key_Enter)) {
e->accept();
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 182594e..594a205 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -903,7 +903,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
QStack<QPair<AnchorVertex *, AnchorVertex *> > stack;
stack.push(qMakePair(static_cast<AnchorVertex *>(0), layoutFirstVertex[orientation]));
QVector<AnchorVertex*> candidates;
- bool candidatesForward;
+ bool candidatesForward = true;
// Walk depth-first, in the stack we store start of the candidate sequence (beforeSequence)
// and the vertex to be visited.
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 9d495e9..4e5e5c8 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -9606,6 +9606,7 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col)
QPalette pal = c->palette();
pal.setColor(QPalette::Text, col);
c->setPalette(pal);
+ update();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 13f31b8..5b0643d 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4551,6 +4551,10 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
void QGraphicsScenePrivate::drawItems(QPainter *painter, const QTransform *const viewTransform,
QRegion *exposedRegion, QWidget *widget)
{
+ // Make sure we don't have unpolished items before we draw.
+ if (!unpolishedItems.isEmpty())
+ _q_polishItems();
+
QRectF exposedSceneRect;
if (exposedRegion && indexMethod != QGraphicsScene::NoIndex) {
exposedSceneRect = exposedRegion->boundingRect().adjusted(-1, -1, 1, 1);
@@ -5077,6 +5081,10 @@ void QGraphicsScene::drawItems(QPainter *painter,
const QStyleOptionGraphicsItem options[], QWidget *widget)
{
Q_D(QGraphicsScene);
+ // Make sure we don't have unpolished items before we draw.
+ if (!d->unpolishedItems.isEmpty())
+ d->_q_polishItems();
+
QTransform viewTransform = painter->worldTransform();
Q_UNUSED(options);
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 27fd09e..3ef311c 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -3275,13 +3275,10 @@ void QGraphicsView::paintEvent(QPaintEvent *event)
// Determine the exposed region
d->exposedRegion = event->region();
- if (d->exposedRegion.isEmpty())
- d->exposedRegion = viewport()->rect();
QRectF exposedSceneRect = mapToScene(d->exposedRegion.boundingRect()).boundingRect();
// Set up the painter
QPainter painter(viewport());
- painter.setClipRect(event->rect(), Qt::IntersectClip);
#ifndef QT_NO_RUBBERBAND
if (d->rubberBanding && !d->rubberBandRect.isEmpty())
painter.save();
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 9d783dd..17baa50 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -349,7 +349,8 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
bitmapDevice(0),
bitmapGc(0),
pengine(0),
- bytes(0)
+ bytes(0),
+ formatLocked(false)
{
}
@@ -425,11 +426,12 @@ void QS60PixmapData::release()
}
/*!
- * Takes ownership of bitmap
+ * Takes ownership of bitmap. Used by window surface
*/
void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap)
{
cfbsBitmap = bitmap;
+ formatLocked = true;
if(!initSymbianBitmapContext()) {
qWarning("Could not create CBitmapContext");
@@ -693,8 +695,10 @@ void QS60PixmapData::beginDataAccess()
bytes = newBytes;
TDisplayMode mode = cfbsBitmap->DisplayMode();
QImage::Format format = qt_TDisplayMode2Format(mode);
- //on S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type
- if (format == QImage::Format_ARGB32)
+ // On S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type.
+ // S60 window surface needs backing store pixmap for transparent window in ARGB32 format.
+ // In that case formatLocked is true.
+ if (!formatLocked && format == QImage::Format_ARGB32)
format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format
QVector<QRgb> savedColorTable;
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index b23961a..b1b5824 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -118,6 +118,8 @@ private:
QPaintEngine *pengine;
uchar* bytes;
+ bool formatLocked;
+
friend class QPixmap;
friend class QS60WindowSurface;
friend class QS60PaintEngine;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 2c65b4c..e24ee04 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -84,7 +84,7 @@ public:
bool filterEvent(const QEvent *event);
void mouseHandler( int x, QMouseEvent *event);
- bool isComposing() const { return m_isEditing; }
+ bool isComposing() const { return !m_preeditString.isEmpty(); }
void setFocusWidget(QWidget * w);
void widgetDestroyed(QWidget *w);
@@ -132,6 +132,7 @@ public:
// From MObjectProvider
public:
TTypeUid::Ptr MopSupplyObject(TTypeUid id);
+ MObjectProvider *MopNext();
private:
QSymbianControl *m_parent;
@@ -139,13 +140,14 @@ private:
QString m_preeditString;
Qt::InputMethodHints m_lastImHints;
TUint m_textCapabilities;
- bool m_isEditing;
bool m_inDestruction;
bool m_pendingInputCapabilitiesChanged;
int m_cursorVisibility;
int m_inlinePosition;
MFepInlineTextFormatRetriever *m_formatRetriever;
MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
+ int m_longPress;
+ int m_cursorPos;
};
QT_END_NAMESPACE
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 19f296c..bdff5e7 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -65,13 +65,14 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new
m_lastImHints(Qt::ImhNone),
m_textCapabilities(TCoeInputCapabilities::EAllText),
- m_isEditing(false),
m_inDestruction(false),
m_pendingInputCapabilitiesChanged(false),
m_cursorVisibility(1),
m_inlinePosition(0),
m_formatRetriever(0),
- m_pointerHandler(0)
+ m_pointerHandler(0),
+ m_longPress(0),
+ m_cursorPos(0)
{
m_fepState->SetObjectProvider(this);
m_fepState->SetFlags(EAknEditorFlagDefault);
@@ -79,7 +80,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_fepState->SetPermittedInputModes( EAknEditorAllInputModes );
m_fepState->SetDefaultCase( EAknEditorLowerCase );
m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase );
- m_fepState->SetSpecialCharacterTableResourceId( 0 );
+ m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap );
}
@@ -202,14 +203,26 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
const QKeyEvent *keyEvent = static_cast<const QKeyEvent *>(event);
- Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints());
- if (keyEvent->key() == Qt::Key_F20 && m_lastImHints & Qt::ImhHiddenText) {
- // Special case in Symbian. On editors with secret text, F20 is for some reason
- // considered to be a backspace.
- QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(),
- keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count());
- QApplication::sendEvent(focusWidget(), &modifiedEvent);
- return true;
+ switch (keyEvent->key()) {
+ case Qt::Key_F20:
+ Q_ASSERT(m_lastImHints == focusWidget()->inputMethodHints());
+ if (m_lastImHints & Qt::ImhHiddenText) {
+ // Special case in Symbian. On editors with secret text, F20 is for some reason
+ // considered to be a backspace.
+ QKeyEvent modifiedEvent(keyEvent->type(), Qt::Key_Backspace, keyEvent->modifiers(),
+ keyEvent->text(), keyEvent->isAutoRepeat(), keyEvent->count());
+ QApplication::sendEvent(focusWidget(), &modifiedEvent);
+ return true;
+ }
+ break;
+ case Qt::Key_Select:
+ if (!m_preeditString.isEmpty()) {
+ commitCurrentString(false);
+ return true;
+ }
+ break;
+ default:
+ break;
}
}
@@ -243,7 +256,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
{
- Q_ASSERT(m_isEditing);
Q_ASSERT(focusWidget());
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) {
@@ -407,6 +419,14 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
}
m_fepState->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(flags));
+ if (hints & ImhEmailCharactersOnly) {
+ m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG);
+ } else if (hints & ImhUrlCharactersOnly) {
+ m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG);
+ } else {
+ m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
+ }
+
if (hints & ImhHiddenText) {
m_textCapabilities = TCoeInputCapabilities::EAllText | TCoeInputCapabilities::ESecretText;
} else {
@@ -478,8 +498,8 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
if (!w)
return;
- m_isEditing = true;
-
+ m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
+
QList<QInputMethodEvent::Attribute> attributes;
m_cursorVisibility = aCursorVisibility ? 1 : 0;
@@ -543,8 +563,6 @@ void QCoeFepInputContext::CancelFepInlineEdit()
event.setCommitString(QLatin1String(""), 0, 0);
m_preeditString.clear();
sendEvent(event);
-
- m_isEditing = false;
}
TInt QCoeFepInputContext::DocumentLengthForFep() const
@@ -683,16 +701,22 @@ void QCoeFepInputContext::DoCommitFepInlineEditL()
void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian)
{
if (m_preeditString.size() == 0) {
+ QWidget *w = focusWidget();
+ if (triggeredBySymbian && w) {
+ // We must replace the last character only if the input box has already accepted one
+ if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos)
+ m_longPress = 1;
+ }
return;
}
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
- event.setCommitString(m_preeditString, 0, 0);//m_preeditString.size());
+ event.setCommitString(m_preeditString, 0-m_longPress, m_longPress);
m_preeditString.clear();
sendEvent(event);
- m_isEditing = false;
+ m_longPress = 0;
if (!triggeredBySymbian) {
CCoeFep* fep = CCoeEnv::Static()->Fep();
@@ -733,6 +757,14 @@ TTypeUid::Ptr QCoeFepInputContext::MopSupplyObject(TTypeUid /*id*/)
return TTypeUid::Null();
}
+MObjectProvider *QCoeFepInputContext::MopNext()
+{
+ QWidget *w = focusWidget();
+ if (w)
+ return w->effectiveWinId();
+ return 0;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_IM
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 040c498..c133ae4 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2851,7 +2851,14 @@ QTreeWidgetItem *QTreeWidget::itemAt(const QPoint &p) const
QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const
{
Q_D(const QTreeWidget);
- return visualRect(d->index(item));
+ //the visual rect for an item is across all columns. So we need to determine
+ //what is the first and last column and get their visual index rects
+ QModelIndex base = d->index(item);
+ const int firstVisiblesection = header()->logicalIndexAt(- header()->offset());
+ const int lastVisibleSection = header()->logicalIndexAt(header()->length() - header()->offset() - 1);
+ QModelIndex first = base.sibling(base.row(), header()->logicalIndex(firstVisiblesection));
+ QModelIndex last = base.sibling(base.row(), header()->logicalIndex(lastVisibleSection));
+ return visualRect(first) | visualRect(last);
}
/*!
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 6f3cbaf..3eaf2e1 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -100,6 +100,21 @@ QActionPrivate::~QActionPrivate()
{
}
+bool QActionPrivate::showStatusText(QWidget *widget, const QString &str)
+{
+#ifdef QT_NO_STATUSTIP
+ Q_UNUSED(widget);
+ Q_UNUSED(str);
+#else
+ if(QObject *object = widget ? widget : parent) {
+ QStatusTipEvent tip(str);
+ QApplication::sendEvent(object, &tip);
+ return true;
+ }
+#endif
+ return false;
+}
+
void QActionPrivate::sendDataChanged()
{
Q_Q(QAction);
@@ -1206,16 +1221,7 @@ QAction::setData(const QVariant &data)
bool
QAction::showStatusText(QWidget *widget)
{
-#ifdef QT_NO_STATUSTIP
- Q_UNUSED(widget);
-#else
- if(QObject *object = widget ? widget : parent()) {
- QStatusTipEvent tip(statusTip());
- QApplication::sendEvent(object, &tip);
- return true;
- }
-#endif
- return false;
+ return d_func()->showStatusText(widget, statusTip());
}
/*!
diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h
index 2527a02..f7b035b 100644
--- a/src/gui/kernel/qaction_p.h
+++ b/src/gui/kernel/qaction_p.h
@@ -75,6 +75,8 @@ public:
QActionPrivate();
~QActionPrivate();
+ bool showStatusText(QWidget *w, const QString &str);
+
QPointer<QActionGroup> group;
QString text;
QString iconText;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 987aa26..4b8f6a0 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -791,7 +791,8 @@ void QApplicationPrivate::construct(
}
//make sure the plugin is loaded
- qt_guiPlatformPlugin();
+ if (qt_is_gui_used)
+ qt_guiPlatformPlugin();
#endif
}
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index ec95d48..04e4b31 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -319,7 +319,12 @@ void QLongTapTimer::RunL()
}
QSymbianControl::QSymbianControl(QWidget *w)
- : CCoeControl(), qwidget(w), m_ignoreFocusChanged(false)
+ : CCoeControl()
+ , qwidget(w)
+ , m_longTapDetector(0)
+ , m_ignoreFocusChanged(0)
+ , m_previousEventLongTap(0)
+ , m_symbianPopupIsOpen(0)
{
}
@@ -911,6 +916,15 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
return;
if (IsFocused() && IsVisible()) {
+ if (m_symbianPopupIsOpen) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusIn, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = false;
+ }
+
QApplication::setActiveWindow(qwidget->window());
#ifdef Q_WS_S60
// If widget is fullscreen, hide status pane and button container
@@ -924,6 +938,16 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
buttonGroup->MakeVisible(!isFullscreen);
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = true;
+ return;
+ }
+
QApplication::setActiveWindow(0);
}
// else { We don't touch the active window unless we were explicitly activated or deactivated }
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 3d4bb8c..192f9ac 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -601,6 +601,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
Qt::GestureType gestureType = gesture->gestureType();
Q_ASSERT(gestureType != Qt::CustomGesture);
+ Q_UNUSED(gestureType);
if (target) {
if (gesture->state() == Qt::GestureStarted) {
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 1a76083..89c18fb 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1014,9 +1014,12 @@ bool QKeySequence::isEmpty() const
*/
QKeySequence QKeySequence::mnemonic(const QString &text)
{
+ QKeySequence ret;
+
if(qt_sequence_no_mnemonics)
- return QKeySequence();
+ return ret;
+ bool found = false;
int p = 0;
while (p >= 0) {
p = text.indexOf(QLatin1Char('&'), p) + 1;
@@ -1025,13 +1028,22 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
if (text.at(p) != QLatin1Char('&')) {
QChar c = text.at(p);
if (c.isPrint()) {
- c = c.toUpper();
- return QKeySequence(c.unicode() + Qt::ALT);
+ if (!found) {
+ c = c.toUpper();
+ ret = QKeySequence(c.unicode() + Qt::ALT);
+#ifdef QT_NO_DEBUG
+ return ret;
+#else
+ found = true;
+ } else {
+ qWarning(qPrintable(QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(text)));
+#endif
+ }
}
}
p++;
}
- return QKeySequence();
+ return ret;
}
/*!
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index ecad72f..22ac319 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -213,11 +213,15 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer();
nativeContainer->DrawableWindow()->SetOrdinalPosition(0);
nativeContainer->DrawableWindow()->SetPointerCapturePriority(1); //keep softkeys available in modal dialog
- QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS));
+ nativeContainer->DrawableWindow()->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren);
int position = -1;
- int command;
bool needsExitButton = true;
+ QT_TRAP_THROWING(
+ //Using -1 instead of EAknSoftkeyEmpty to avoid flickering.
+ nativeContainer->SetCommandL(0, -1, KNullDesC);
+ nativeContainer->SetCommandL(2, -1, KNullDesC);
+ );
for (int index = 0; index < softkeys.count(); index++) {
const QAction* softKeyAction = softkeys.at(index);
@@ -238,7 +242,7 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
break;
}
- command = (softKeyAction->objectName().contains("_q_menuSoftKeyAction"))
+ int command = (softKeyAction->objectName().contains("_q_menuSoftKeyAction"))
? EAknSoftkeyOptions
: s60CommandStart + index;
@@ -255,7 +259,8 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys)
: Qt::Widget;
if (needsExitButton && sourceWindowType != Qt::Dialog && sourceWindowType != Qt::Popup)
- QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit"))));
+ QT_TRAP_THROWING(
+ nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QSoftKeyManager::tr("Exit"))));
nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 333458b..ec8c9cb 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -175,7 +175,7 @@ public:
protected: // from MAknFadedComponent
TInt CountFadedComponents() {return 1;}
- CCoeControl* FadedComponent(TInt aIndex) {return this;}
+ CCoeControl* FadedComponent(TInt /*aIndex*/) {return this;}
#else
#warning No fallback implementation for QSymbianControl::FadeBehindPopup
void FadeBehindPopup(bool /*fade*/){ }
@@ -202,9 +202,10 @@ private:
private:
QWidget *qwidget;
- bool m_ignoreFocusChanged;
QLongTapTimer* m_longTapDetector;
- bool m_previousEventLongTap;
+ bool m_ignoreFocusChanged : 1;
+ bool m_previousEventLongTap : 1;
+ bool m_symbianPopupIsOpen : 1;
#ifdef Q_WS_S60
// Fader object used to fade everything except this menu and the CBA.
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 9f08dc6..9e4cf60 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -163,7 +163,9 @@ extern "C" {
#endif // QT_NO_XRENDER
#ifndef QT_NO_XSYNC
+extern "C" {
# include "X11/extensions/sync.h"
+}
#endif
// #define QT_NO_XKB
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 67bbd9f..629af8f 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -359,6 +359,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) );
QT_TRAP_THROWING(control->ConstructL(true, desktop));
+ control->SetMopParent(static_cast<CEikAppUi*>(S60->appUi()));
// Symbian windows are always created in an inactive state
// We perform this assignment for the case where the window is being re-created
@@ -1235,7 +1236,7 @@ void QWidget::releaseKeyboard()
void QWidget::grabMouse()
{
- if (!qt_nograb()) {
+ if (isVisible() && !qt_nograb()) {
if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
QWidgetPrivate::mouseGrabber->releaseMouse();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
@@ -1252,7 +1253,7 @@ void QWidget::grabMouse()
#ifndef QT_NO_CURSOR
void QWidget::grabMouse(const QCursor &cursor)
{
- if (!qt_nograb()) {
+ if (isVisible() && !qt_nograb()) {
if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this)
QWidgetPrivate::mouseGrabber->releaseMouse();
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index c35c33a..628a109 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -370,7 +370,6 @@ symbian {
SOURCES += painting/qwindowsurface_s60.cpp
armccIfdefBlock = \
"$${LITERAL_HASH}if defined(ARMV6)" \
- "MACRO QT_HAVE_ARMV6" \
"SOURCEPATH painting" \
"SOURCE qblendfunctions_armv6_rvct.s" \
"SOURCE qdrawhelper_armv6_rvct.s" \
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 8737f10..ba1b642 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -223,21 +223,25 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
int h = ty2 - ty1;
int w = tx2 - tx1;
+
quint32 basex;
quint32 srcy;
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
+
if (sx < 0) {
- int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
@@ -738,18 +742,22 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
quint32 basex;
quint32 srcy;
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
+
+
if (sx < 0) {
- int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index afe9986..7273c35 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -970,7 +970,7 @@ bool QBrush::operator==(const QBrush &b) const
QDebug operator<<(QDebug dbg, const QBrush &b)
{
#ifndef Q_BROKEN_DEBUG_STREAM
- const char *BRUSH_STYLES[] = {
+ static const char *BRUSH_STYLES[] = {
"NoBrush",
"SolidPattern",
"Dense1Pattern",
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index f880351..be4fff2 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -1094,8 +1094,6 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
QColor borderColor = option->palette.background().color().darker(178);
QColor gradientStartColor = option->palette.button().color().lighter(104);
QColor gradientStopColor = option->palette.button().color().darker(105);
- QColor baseGradientStartColor = option->palette.base().color().darker(101);
- QColor baseGradientStopColor = option->palette.base().color().darker(106);
QColor highlightedGradientStartColor = option->palette.button().color().lighter(101);
QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85);
QColor highlightedBaseGradientStartColor = option->palette.base().color();
@@ -1978,7 +1976,13 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
QRect gradientRect(adjustedRect.left() + 1, adjustedRect.top() + 1,
adjustedRect.right() - adjustedRect.left() - 1,
adjustedRect.bottom() - adjustedRect.top() - 1);
- qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor);
+ if (option->palette.base().style() == Qt::SolidPattern) {
+ QColor baseGradientStartColor = option->palette.base().color().darker(101);
+ QColor baseGradientStopColor = option->palette.base().color().darker(106);
+ qt_plastique_draw_gradient(painter, gradientRect, baseGradientStartColor, baseGradientStopColor);
+ } else {
+ painter->fillRect(gradientRect, option->palette.base());
+ }
// draw "+" or "-"
painter->setPen(alphaTextColor);
painter->drawLine(center.x() - 2, center.y(), center.x() + 2, center.y());
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index d33dc6a..df4b87e 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -473,7 +473,7 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
Q_UNUSED(app)
QPalette applicationPalette = QApplication::palette();
applicationPalette.setBrush(QPalette::Window, backgroundTexture());
- setThemePalette(app);
+ setThemePalette(&applicationPalette);
}
void QS60StylePrivate::deleteBackground()
@@ -799,6 +799,9 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafTabPassiveR:
case QS60StyleEnums::SP_QgnGrafTabPassiveL:
case QS60StyleEnums::SP_QgnGrafTabActiveL:
+ //Returned QSize for tabs must not be square, but narrow rectangle with width:height
+ //ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
+ result.setWidth(10);
break;
case QS60StyleEnums::SP_QgnIndiSliderEdit:
result.scale(pixelMetric(QStyle::PM_SliderLength),
@@ -809,7 +812,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
result.setWidth(pixelMetric(PM_Custom_FrameCornerWidth));
break;
-
+
case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index ce73fd8..59210c3 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1180,7 +1180,7 @@ void QRenderRule::drawBackgroundImage(QPainter *p, const QRect &rect, QPoint off
QRect r = originRect(rect, background()->origin);
QRect aligned = QStyle::alignedRect(Qt::LeftToRight, background()->position, bgp.size(), r);
- QRect inter = aligned.intersected(r);
+ QRect inter = aligned.translated(-off).intersected(r);
switch (background()->repeat) {
case Repeat_Y:
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 447087c..f1cd6bb 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1613,7 +1613,8 @@ bool QFont::operator==(const QFont &f) const
&& f.d->underline == d->underline
&& f.d->overline == d->overline
&& f.d->strikeOut == d->strikeOut
- && f.d->kerning == d->kerning));
+ && f.d->kerning == d->kerning
+ && f.d->capital == d->capital));
}
@@ -1645,6 +1646,7 @@ bool QFont::operator<(const QFont &f) const
#ifdef Q_WS_X11
if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle;
#endif // Q_WS_X11
+ if (f.d->capital != d->capital) return f.d->capital < d->capital;
int f1attrs = (f.d->underline << 3) + (f.d->overline << 2) + (f.d->strikeOut<<1) + f.d->kerning;
int f2attrs = (d->underline << 3) + (d->overline << 2) + (d->strikeOut<<1) + d->kerning;
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index d05d9e5..deda39f 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -265,21 +265,55 @@ private:
friend QDataStream &operator>>(QDataStream &, QTextFormat &);
};
-static uint variantHash(const QVariant &variant)
+// this is only safe if sizeof(int) == sizeof(float)
+static inline uint hash(float d)
{
- switch (variant.userType()) {
- case QVariant::Invalid: return 0;
- case QVariant::Bool: return variant.toBool();
- case QVariant::Int: return variant.toInt();
- case QMetaType::Float: return static_cast<int>(variant.toFloat());
- case QVariant::Double: return static_cast<int>(variant.toDouble());
+ return reinterpret_cast<uint&>(d);
+}
+
+static inline uint hash(const QColor &color)
+{
+ return (color.isValid()) ? color.rgba() : 0x234109;
+}
+
+static inline uint hash(const QPen &pen)
+{
+ return hash(pen.color()) + hash(pen.widthF());
+}
+
+static inline uint hash(const QBrush &brush)
+{
+ return hash(brush.color()) + (brush.style() << 3);
+}
+
+static inline uint variantHash(const QVariant &variant)
+{
+ // simple and fast hash functions to differentiate between type and value
+ switch (variant.userType()) { // sorted by occurrence frequency
case QVariant::String: return qHash(variant.toString());
- case QVariant::Color: return qHash(qvariant_cast<QColor>(variant).rgb());
+ case QVariant::Double: return hash(variant.toDouble());
+ case QVariant::Int: return 0x811890 + variant.toInt();
+ case QVariant::Brush:
+ return 0x01010101 + hash(qvariant_cast<QBrush>(variant));
+ case QVariant::Bool: return 0x371818 + variant.toBool();
+ case QVariant::Pen: return 0x02020202 + hash(qvariant_cast<QPen>(variant));
+ case QVariant::List:
+ return 0x8377 + qvariant_cast<QVariantList>(variant).count();
+ case QVariant::Color: return hash(qvariant_cast<QColor>(variant));
+ case QVariant::TextLength:
+ return 0x377 + hash(qvariant_cast<QTextLength>(variant).rawValue());
+ case QMetaType::Float: return hash(variant.toFloat());
+ case QVariant::Invalid: return 0;
default: break;
}
return qHash(variant.typeName());
}
+static inline int getHash(const QTextFormatPrivate *d, int format)
+{
+ return (d ? d->hash() : 0) + format;
+}
+
uint QTextFormatPrivate::recalcHash() const
{
hashValue = 0;
@@ -3033,13 +3067,15 @@ QTextFormatCollection::~QTextFormatCollection()
int QTextFormatCollection::indexForFormat(const QTextFormat &format)
{
- uint hash = format.d ? format.d->hash() : 0;
- if (hashes.contains(hash)) {
- for (int i = 0; i < formats.size(); ++i) {
- if (formats.at(i) == format)
- return i;
+ uint hash = getHash(format.d, format.format_type);
+ QMultiHash<uint, int>::const_iterator i = hashes.find(hash);
+ while (i != hashes.end() && i.key() == hash) {
+ if (formats.value(i.value()) == format) {
+ return i.value();
}
+ ++i;
}
+
int idx = formats.size();
formats.append(format);
@@ -3049,7 +3085,7 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
f.d = new QTextFormatPrivate;
f.d->resolveFont(defaultFnt);
- hashes.insert(hash);
+ hashes.insert(hash, idx);
} QT_CATCH(...) {
formats.pop_back();
@@ -3060,11 +3096,13 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format)
bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const
{
- uint hash = format.d ? format.d->hash() : 0;
- if (hashes.contains(hash)) {
- for (int i = 0; i < formats.size(); ++i)
- if (formats.at(i) == format)
- return true;
+ uint hash = getHash(format.d, format.format_type);
+ QMultiHash<uint, int>::const_iterator i = hashes.find(hash);
+ while (i != hashes.end() && i.key() == hash) {
+ if (formats.value(i.value()) == format) {
+ return true;
+ }
+ ++i;
}
return false;
}
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index c796343..73ca0ce 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -55,7 +55,7 @@
#include "QtGui/qtextformat.h"
#include "QtCore/qvector.h"
-#include "QtCore/qset.h"
+#include "QtCore/qhash.h"
QT_BEGIN_NAMESPACE
@@ -97,7 +97,7 @@ public:
FormatVector formats;
QVector<qint32> objFormats;
- QSet<uint> hashes;
+ QMultiHash<uint,int> hashes;
inline QFont defaultFont() const { return defaultFnt; }
void setDefaultFont(const QFont &f);
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index b0d0baf..35639b7 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -1130,10 +1130,13 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e)
void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
- if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
- QApplication::sendEvent(d->hbar, e);
- else
- QApplication::sendEvent(d->vbar, e);
+ QScrollBar *const bars[2] = { d->hbar, d->vbar };
+ int idx = (e->orientation() == Qt::Vertical) ? 1 : 0;
+ int other = (idx + 1) % 2;
+ if (!bars[idx]->isVisible() && bars[other]->isVisible())
+ idx = other; // If the scrollbar of the event orientation is hidden, fallback to the other.
+
+ QApplication::sendEvent(bars[idx], e);
}
#endif
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index fec9fab..e0db9c2 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -690,8 +690,6 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
{
Q_D(QAbstractSlider);
e->ignore();
- if (e->orientation() != d->orientation && !rect().contains(e->pos()))
- return;
int stepsToScroll = 0;
qreal offset = qreal(e->delta()) / 120;
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index 08ed7f6..ee536ee 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -2297,7 +2297,21 @@ int QCalendarWidget::monthShown() const
void QCalendarWidget::setCurrentPage(int year, int month)
{
Q_D(QCalendarWidget);
+ QDate currentDate = d->getCurrentDate();
+ int day = currentDate.day();
+ int daysInMonths = QDate(year, month, 1).daysInMonth();
+ if (day > daysInMonths)
+ day = daysInMonths;
+
d->showMonth(year, month);
+
+ QDate newDate(year, month, day);
+ int row = -1, col = -1;
+ d->m_model->cellForDate(newDate, &row, &col);
+ if (row != -1 && col != -1) {
+ d->m_view->selectionModel()->setCurrentIndex(d->m_model->index(row, col),
+ QItemSelectionModel::NoUpdate);
+ }
}
/*!
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index 2231b98..2ee5751 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -315,9 +315,9 @@ void QDialogButtonBoxPrivate::initLayout()
buttonLayout = new QVBoxLayout(q);
}
- int left, top, right, bottom;
+ int left, top, right, bottom;
setLayoutItemMargins(QStyle::SE_PushButtonLayoutItem);
- getLayoutItemMargins(&left, &top, &right, &bottom);
+ getLayoutItemMargins(&left, &top, &right, &bottom);
buttonLayout->setContentsMargins(-left, -top, -right, -bottom);
if (!q->testAttribute(Qt::WA_WState_OwnSizePolicy)) {
@@ -356,7 +356,7 @@ void QDialogButtonBoxPrivate::addButtonsToLayout(const QList<QAbstractButton *>
void QDialogButtonBoxPrivate::layoutButtons()
{
Q_Q(QDialogButtonBox);
- const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item
+ const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item
for (int i = buttonLayout->count() - 1; i >= 0; --i) {
QLayoutItem *item = buttonLayout->takeAt(i);
@@ -581,6 +581,22 @@ QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialog
}
QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked()));
action->setSoftKeyRole(softkeyRole);
+
+
+ QWidget *dialog = 0;
+ QWidget *p = q;
+ while (p && !p->isWindow()) {
+ p = p->parentWidget();
+ if ((dialog = qobject_cast<QDialog *>(p)))
+ break;
+ }
+
+ if (dialog) {
+ dialog->addAction(action);
+ } else {
+ q->addAction(action);
+ }
+
return action;
}
#endif
@@ -1193,12 +1209,8 @@ bool QDialogButtonBox::event(QEvent *event)
if (!hasDefault && firstAcceptButton)
firstAcceptButton->setDefault(true);
#ifdef QT_SOFTKEYS_ENABLED
- if (dialog) {
+ if (dialog)
setFixedSize(0,0);
- dialog->addActions(d->softKeyActions.values());
- } else {
- addActions(d->softKeyActions.values());
- }
#endif
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index dffec11..953edab 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1841,7 +1841,6 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const
}
}
-#ifdef Q_WS_MAC
static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos)
{
switch (pos) {
@@ -1853,7 +1852,6 @@ static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos)
}
return Qt::NoDockWidgetArea;
}
-#endif
static QRect constrainedRect(QRect rect, const QRect &desktop)
{
@@ -1933,6 +1931,9 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
item_list.append(item);
} else {
QDockAreaLayoutItem item(new QDockWidgetItem(widget));
+ if (!testing) {
+ item_list.append(item);
+ }
if (flags & StateFlagFloating) {
bool drawer = false;
#ifdef Q_WS_MAC // drawer support
@@ -1977,12 +1978,10 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
if (!testing) {
widget->setFloating(false);
widget->setVisible(flags & StateFlagVisible);
+ emit widget->dockLocationChanged(toDockWidgetArea(dockPos));
}
}
- if (!testing) {
- item_list.append(item);
- }
}
} else if (nextMarker == SequenceMarker) {
int dummy;
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index a8e2a37..9cf6af1 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1225,6 +1225,7 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features)
features &= DockWidgetFeatureMask;
if (d->features == features)
return;
+ const bool closableChanged = (d->features ^ features) & DockWidgetClosable;
d->features = features;
QDockWidgetLayout *layout
= qobject_cast<QDockWidgetLayout*>(this->layout());
@@ -1233,6 +1234,10 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features)
d->toggleViewAction->setEnabled((d->features & DockWidgetClosable) == DockWidgetClosable);
emit featuresChanged(d->features);
update();
+ if (closableChanged && layout->nativeWindowDeco()) {
+ //this ensures the native decoration is drawn
+ d->setWindowState(true /*floating*/, true /*unplug*/);
+ }
}
QDockWidget::DockWidgetFeatures QDockWidget::features() const
diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp
index 806db59..d601f81 100644
--- a/src/gui/widgets/qfontcombobox.cpp
+++ b/src/gui/widgets/qfontcombobox.cpp
@@ -247,7 +247,14 @@ void QFontComboBoxPrivate::_q_updateModel()
}
list = result;
+ //we need to block the signals so that the model doesn't emit reset
+ //this prevents the current index from changing
+ //it will be updated just after this
+ ///TODO: we should finda way to avoid blocking signals and have a real update of the model
+ const bool old = m->blockSignals(true);
m->setStringList(list);
+ m->blockSignals(old);
+
if (list.isEmpty()) {
if (currentFont != QFont()) {
currentFont = QFont();
@@ -420,8 +427,10 @@ void QFontComboBox::setCurrentFont(const QFont &font)
Q_D(QFontComboBox);
if (font != d->currentFont) {
d->currentFont = font;
- emit currentFontChanged(d->currentFont);
d->_q_updateModel();
+ if (d->currentFont == font) { //else the signal has already be emitted by _q_updateModel
+ emit currentFontChanged(d->currentFont);
+ }
}
}
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 3d908a1..ea711e8 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -1170,22 +1170,10 @@ void QLabelPrivate::updateShortcut()
// But then we do want to hide the ampersands, so we can't use shortcutId.
hasShortcut = false;
- if (control) {
- ensureTextPopulated();
- // Underline the first character that follows an ampersand
- shortcutCursor = control->document()->find(QLatin1String("&"));
- if (shortcutCursor.isNull())
- return;
- hasShortcut = true;
- shortcutId = q->grabShortcut(QKeySequence::mnemonic(text));
- shortcutCursor.deleteChar(); // remove the ampersand
- shortcutCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
- } else {
- if (!text.contains(QLatin1Char('&')))
- return;
- hasShortcut = true;
- shortcutId = q->grabShortcut(QKeySequence::mnemonic(text));
- }
+ if (!text.contains(QLatin1Char('&')))
+ return;
+ hasShortcut = true;
+ shortcutId = q->grabShortcut(QKeySequence::mnemonic(text));
}
#endif // QT_NO_SHORTCUT
@@ -1456,6 +1444,24 @@ void QLabelPrivate::ensureTextPopulated() const
doc->setPlainText(text);
#endif
doc->setUndoRedoEnabled(false);
+
+#ifndef QT_NO_SHORTCUT
+ if (hasShortcut) {
+ // Underline the first character that follows an ampersand (and remove the others ampersands)
+ int from = 0;
+ bool found = false;
+ QTextCursor cursor;
+ while (!(cursor = control->document()->find((QLatin1String("&")), from)).isNull()) {
+ cursor.deleteChar(); // remove the ampersand
+ cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
+ from = cursor.position();
+ if (!found && cursor.selectedText() != QLatin1String("&")) { //not a second &
+ found = true;
+ shortcutCursor = cursor;
+ }
+ }
+ }
+#endif
}
}
textDirty = false;
diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h
index c5a74e2..ca17a35 100644
--- a/src/gui/widgets/qlabel_p.h
+++ b/src/gui/widgets/qlabel_p.h
@@ -113,7 +113,7 @@ public:
mutable uint hasShortcut : 1;
Qt::TextFormat textformat;
mutable QTextControl *control;
- QTextCursor shortcutCursor;
+ mutable QTextCursor shortcutCursor;
Qt::TextInteractionFlags textInteractionFlags;
inline bool needTextControl() const {
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 2914164..300a2ea 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -414,7 +414,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
int c = m_cursor; // cursor position after insertion of commit string
- if (event->replacementStart() <= 0)
+ if (event->replacementStart() == 0)
c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength());
m_cursor += event->replacementStart();
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 027a5d6..fa6f7a1 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1641,6 +1641,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
savedState.clear();
currentGapPos.clear();
pluggingWidget = 0;
+ //applying the state will make sure that the currentGap is updated correctly
+ //and all the geometries (especially the one from the central widget) is correct
+ layoutState.apply(false);
}
if (!widgetAnimator.animating()) {
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index cc39b7f..54d1612 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -602,14 +602,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
}
#ifndef QT_NO_STATUSTIP
} else if (previousAction) {
- QWidget *w = causedPopup.widget;
- while (QMenu *m = qobject_cast<QMenu*>(w))
- w = m->d_func()->causedPopup.widget;
- if (w) {
- QString empty;
- QStatusTipEvent tip(empty);
- QApplication::sendEvent(w, &tip);
- }
+ previousAction->d_func()->showStatusText(topCausedWidget(), QString());
#endif
}
if (hideActiveMenu) {
@@ -623,6 +616,15 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
}
}
+//return the top causedPopup.widget that is not a QMenu
+QWidget *QMenuPrivate::topCausedWidget() const
+{
+ QWidget* top = causedPopup.widget;
+ while (QMenu* m = qobject_cast<QMenu *>(top))
+ top = m->d_func()->causedPopup.widget;
+ return top;
+}
+
QAction *QMenuPrivate::actionAt(QPoint p) const
{
if (!q_func()->rect().contains(p)) //sanity check
@@ -1094,10 +1096,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection);
}
#endif
- QWidget *w = causedPopup.widget;
- while (QMenu *m = qobject_cast<QMenu*>(w))
- w = m->d_func()->causedPopup.widget;
- action->showStatusText(w);
+ action->showStatusText(topCausedWidget());
} else {
actionAboutToTrigger = 0;
}
@@ -1801,10 +1800,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#ifndef QT_NO_MENUBAR
// if this menu is part of a chain attached to a QMenuBar, set the
// _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type
- QWidget* top = this;
- while (QMenu* m = qobject_cast<QMenu *>(top))
- top = m->d_func()->causedPopup.widget;
- setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(top) != 0);
+ setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0);
#endif
ensurePolished(); // Get the right font
@@ -2752,18 +2748,14 @@ void QMenu::keyPressEvent(QKeyEvent *e)
}
}
if (!key_consumed) {
- if (QWidget *caused = d->causedPopup.widget) {
- while(QMenu *m = qobject_cast<QMenu*>(caused))
- caused = m->d_func()->causedPopup.widget;
#ifndef QT_NO_MENUBAR
- if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) {
- QAction *oldAct = mb->d_func()->currentAction;
- QApplication::sendEvent(mb, e);
- if (mb->d_func()->currentAction != oldAct)
- key_consumed = true;
- }
-#endif
+ if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) {
+ QAction *oldAct = mb->d_func()->currentAction;
+ QApplication::sendEvent(mb, e);
+ if (mb->d_func()->currentAction != oldAct)
+ key_consumed = true;
}
+#endif
}
#ifdef Q_OS_WIN32
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index a5bde7c..c021063 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -215,6 +215,7 @@ public:
SelectedFromKeyboard,
SelectedFromElsewhere
};
+ QWidget *topCausedWidget() const;
QAction *actionAt(QPoint p) const;
void setFirstActionActive();
void setCurrentAction(QAction *, int popup = -1, SelectionReason reason = SelectedFromElsewhere, bool activateFirst = false);
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 689d2e1..b1ff662 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -332,7 +332,9 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst)
QPoint pos(q->mapToGlobal(QPoint(adjustedActionRect.left(), adjustedActionRect.bottom() + 1)));
QSize popup_size = activeMenu->sizeHint();
- QRect screenRect = QApplication::desktop()->screenGeometry(pos);
+ //we put the popup menu on the screen containing the bottom-center of the action rect
+ QRect screenRect = QApplication::desktop()->screenGeometry(pos + QPoint(adjustedActionRect.width() / 2, 0));
+ pos = QPoint(qMax(pos.x(), screenRect.x()), qMax(pos.y(), screenRect.y()));
const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height());
const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom());
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index 5596ca4..58a3d28 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -396,7 +396,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
void QToolBarPrivate::unplug(const QRect &_r)
{
Q_Q(QToolBar);
- layout->setExpanded(false, false);
+ layout->setExpanded(false);
QRect r = _r;
r.moveTopLeft(q->mapToGlobal(QPoint(0, 0)));
setWindowState(true, true, r);
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index de11625..b7e985c 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -480,7 +480,7 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos)
}
-QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const
+QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const
{
int p = pick(o, pos);
@@ -509,12 +509,19 @@ QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const
QList<int> result;
result << j << k;
+ *minDistance = 0; //we found a perfect match
+ return result;
+ }
+ } else {
+ const int dist = distance(pos);
+ //it will only return a path if the minDistance is higher than the current distance
+ if (dist >= 0 && *minDistance > dist) {
+ *minDistance = dist;
+
+ QList<int> result;
+ result << lines.count() << 0;
return result;
}
- } else if (appendLineDropRect().contains(pos)) {
- QList<int> result;
- result << lines.count() << 0;
- return result;
}
return QList<int>();
@@ -587,32 +594,20 @@ QRect QToolBarAreaLayoutInfo::itemRect(const QList<int> &path) const
return result;
}
-QRect QToolBarAreaLayoutInfo::appendLineDropRect() const
+int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
{
- QRect result;
-
switch (dockPos) {
case QInternal::LeftDock:
- result = QRect(rect.right(), rect.top(),
- EmptyDockAreaSize, rect.height());
- break;
+ return pos.x() - rect.right();
case QInternal::RightDock:
- result = QRect(rect.left() - EmptyDockAreaSize, rect.top(),
- EmptyDockAreaSize, rect.height());
- break;
+ return rect.left() - pos.x();
case QInternal::TopDock:
- result = QRect(rect.left(), rect.bottom() + 1,
- rect.width(), EmptyDockAreaSize);
- break;
+ return pos.y() - rect.bottom();
case QInternal::BottomDock:
- result = QRect(rect.left(), rect.top() - EmptyDockAreaSize,
- rect.width(), EmptyDockAreaSize);
- break;
+ return rect.top() - pos.y();
default:
- break;
+ return -1;
}
-
- return result;
}
/******************************************************************************
@@ -1022,21 +1017,24 @@ QList<int> QToolBarAreaLayout::indexOf(QWidget *toolBar) const
return result;
}
+//this functions returns the path to the possible gapindex for the position pos
QList<int> QToolBarAreaLayout::gapIndex(const QPoint &pos) const
{
Qt::LayoutDirection dir = mainWindow->layoutDirection();
+ int minDistance = 80; // when a dock area is empty, how "wide" is it?
+ QList<int> ret; //return value
for (int i = 0; i < QInternal::DockCount; ++i) {
QPoint p = pos;
if (docks[i].o == Qt::Horizontal)
p = QStyle::visualPos(dir, docks[i].rect, p);
- QList<int> result = docks[i].gapIndex(p);
+ QList<int> result = docks[i].gapIndex(p, &minDistance);
if (!result.isEmpty()) {
result.prepend(i);
- return result;
+ ret = result;
}
}
- return QList<int>();
+ return ret;
}
QList<int> QToolBarAreaLayout::currentGapIndex() const
diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h
index 1e113b7..f0ab80c 100644
--- a/src/gui/widgets/qtoolbararealayout_p.h
+++ b/src/gui/widgets/qtoolbararealayout_p.h
@@ -155,8 +155,6 @@ public:
class QToolBarAreaLayoutInfo
{
public:
- enum { EmptyDockAreaSize = 80 }; // when a dock area is empty, how "wide" is it?
-
QToolBarAreaLayoutInfo(QInternal::DockPosition pos = QInternal::TopDock);
QList<QToolBarAreaLayoutLine> lines;
@@ -173,11 +171,11 @@ public:
void removeToolBarBreak(QToolBar *before);
void moveToolBar(QToolBar *toolbar, int pos);
- QList<int> gapIndex(const QPoint &pos) const;
+ QList<int> gapIndex(const QPoint &pos, int *maxDistance) const;
bool insertGap(const QList<int> &path, QLayoutItem *item);
void clear();
QRect itemRect(const QList<int> &path) const;
- QRect appendLineDropRect() const;
+ int distance(const QPoint &pos) const;
QRect rect;
Qt::Orientation o;
diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp
index 7dc1e01..0afe5d8 100644
--- a/src/gui/widgets/qtoolbarlayout.cpp
+++ b/src/gui/widgets/qtoolbarlayout.cpp
@@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const
return result;
}
-void QToolBarLayout::setExpanded(bool exp, bool animated)
+void QToolBarLayout::setExpanded(bool exp)
{
if (exp == expanded)
return;
@@ -654,7 +654,6 @@ void QToolBarLayout::setExpanded(bool exp, bool animated)
if (!tb)
return;
if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
- animating = true;
QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
if (expanded) {
tb->raise();
@@ -665,7 +664,7 @@ void QToolBarLayout::setExpanded(bool exp, bool animated)
layoutActions(rect.size());
}
}
- layout->layoutState.toolBarAreaLayout.apply(animated);
+ layout->layoutState.toolBarAreaLayout.apply(win->isAnimated());
}
}
diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h
index d49a5df..afd0227 100644
--- a/src/gui/widgets/qtoolbarlayout_p.h
+++ b/src/gui/widgets/qtoolbarlayout_p.h
@@ -112,7 +112,7 @@ public:
bool hasExpandFlag() const;
public Q_SLOTS:
- void setExpanded(bool b, bool animated = true);
+ void setExpanded(bool b);
private:
QList<QToolBarItem*> items;
diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
index bdc31af..413419d 100644
--- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -865,15 +865,22 @@ void tst_QAbstractItemModel::testMoveSameParentDown_data()
QTest::addColumn<int>("startRow");
QTest::addColumn<int>("endRow");
QTest::addColumn<int>("destRow");
+ // We can't put the actual parent index for the move in here because m_model is not defined until init() is run.
+ QTest::addColumn<bool>("topLevel");
// Move from the start to the middle
- QTest::newRow("move01") << 0 << 2 << 8;
+ QTest::newRow("move01") << 0 << 2 << 8 << true;
// Move from the start to the end
- QTest::newRow("move02") << 0 << 2 << 10;
+ QTest::newRow("move02") << 0 << 2 << 10 << true;
// Move from the middle to the middle
- QTest::newRow("move03") << 3 << 5 << 8;
+ QTest::newRow("move03") << 3 << 5 << 8 << true;
// Move from the middle to the end
- QTest::newRow("move04") << 3 << 5 << 10;
+ QTest::newRow("move04") << 3 << 5 << 10 << true;
+
+ QTest::newRow("move05") << 0 << 2 << 8 << false;
+ QTest::newRow("move06") << 0 << 2 << 10 << false;
+ QTest::newRow("move07") << 3 << 5 << 8 << false;
+ QTest::newRow("move08") << 3 << 5 << 10 << false;
}
void tst_QAbstractItemModel::testMoveSameParentDown()
@@ -881,6 +888,9 @@ void tst_QAbstractItemModel::testMoveSameParentDown()
QFETCH( int, startRow);
QFETCH( int, endRow);
QFETCH( int, destRow);
+ QFETCH( bool, topLevel);
+
+ QModelIndex moveParent = topLevel ? QModelIndex() : m_model->index(5, 0);
QList<QPersistentModelIndex> persistentList;
QModelIndexList indexList;
@@ -913,33 +923,37 @@ void tst_QAbstractItemModel::testMoveSameParentDown()
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
+ if (!topLevel)
+ moveCommand->setAncestorRowNumbers(QList<int>() << 5);
moveCommand->setStartRow(startRow);
moveCommand->setEndRow(endRow);
moveCommand->setDestRow(destRow);
+ if (!topLevel)
+ moveCommand->setDestAncestors(QList<int>() << 5);
moveCommand->doCommand();
QVariantList beforeSignal = beforeSpy.takeAt(0);
QVariantList afterSignal = afterSpy.takeAt(0);
QCOMPARE(beforeSignal.size(), 5);
- QCOMPARE(beforeSignal.at(0).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(beforeSignal.at(0).value<QModelIndex>(), moveParent);
QCOMPARE(beforeSignal.at(1).toInt(), startRow);
QCOMPARE(beforeSignal.at(2).toInt(), endRow);
- QCOMPARE(beforeSignal.at(3).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(beforeSignal.at(3).value<QModelIndex>(), moveParent);
QCOMPARE(beforeSignal.at(4).toInt(), destRow);
QCOMPARE(afterSignal.size(), 5);
- QCOMPARE(afterSignal.at(0).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(afterSignal.at(0).value<QModelIndex>(), moveParent);
QCOMPARE(afterSignal.at(1).toInt(), startRow);
QCOMPARE(afterSignal.at(2).toInt(), endRow);
- QCOMPARE(afterSignal.at(3).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(afterSignal.at(3).value<QModelIndex>(), moveParent);
QCOMPARE(afterSignal.at(4).toInt(), destRow);
for (int i = 0; i < indexList.size(); i++)
{
QModelIndex idx = indexList.at(i);
QModelIndex persistentIndex = persistentList.at(i);
- if (idx.parent() == QModelIndex())
+ if (idx.parent() == moveParent)
{
int row = idx.row();
if ( row >= startRow)
@@ -976,15 +990,21 @@ void tst_QAbstractItemModel::testMoveSameParentUp_data()
QTest::addColumn<int>("startRow");
QTest::addColumn<int>("endRow");
QTest::addColumn<int>("destRow");
+ QTest::addColumn<bool>("topLevel");
// Move from the middle to the start
- QTest::newRow("move01") << 5 << 7 << 0;
+ QTest::newRow("move01") << 5 << 7 << 0 << true;
// Move from the end to the start
- QTest::newRow("move02") << 8 << 9 << 0;
+ QTest::newRow("move02") << 8 << 9 << 0 << true;
// Move from the middle to the middle
- QTest::newRow("move03") << 5 << 7 << 2;
+ QTest::newRow("move03") << 5 << 7 << 2 << true;
// Move from the end to the middle
- QTest::newRow("move04") << 8 << 9 << 5;
+ QTest::newRow("move04") << 8 << 9 << 5 << true;
+
+ QTest::newRow("move05") << 5 << 7 << 0 << false;
+ QTest::newRow("move06") << 8 << 9 << 0 << false;
+ QTest::newRow("move07") << 5 << 7 << 2 << false;
+ QTest::newRow("move08") << 8 << 9 << 5 << false;
}
void tst_QAbstractItemModel::testMoveSameParentUp()
@@ -993,6 +1013,9 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
QFETCH( int, startRow);
QFETCH( int, endRow);
QFETCH( int, destRow);
+ QFETCH( bool, topLevel);
+
+ QModelIndex moveParent = topLevel ? QModelIndex() : m_model->index(5, 0);
QList<QPersistentModelIndex> persistentList;
QModelIndexList indexList;
@@ -1026,26 +1049,30 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
+ if (!topLevel)
+ moveCommand->setAncestorRowNumbers(QList<int>() << 5);
moveCommand->setStartRow(startRow);
moveCommand->setEndRow(endRow);
moveCommand->setDestRow(destRow);
+ if (!topLevel)
+ moveCommand->setDestAncestors(QList<int>() << 5);
moveCommand->doCommand();
QVariantList beforeSignal = beforeSpy.takeAt(0);
QVariantList afterSignal = afterSpy.takeAt(0);
QCOMPARE(beforeSignal.size(), 5);
- QCOMPARE(beforeSignal.at(0).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(beforeSignal.at(0).value<QModelIndex>(), moveParent);
QCOMPARE(beforeSignal.at(1).toInt(), startRow);
QCOMPARE(beforeSignal.at(2).toInt(), endRow);
- QCOMPARE(beforeSignal.at(3).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(beforeSignal.at(3).value<QModelIndex>(), moveParent);
QCOMPARE(beforeSignal.at(4).toInt(), destRow);
QCOMPARE(afterSignal.size(), 5);
- QCOMPARE(afterSignal.at(0).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(afterSignal.at(0).value<QModelIndex>(), moveParent);
QCOMPARE(afterSignal.at(1).toInt(), startRow);
QCOMPARE(afterSignal.at(2).toInt(), endRow);
- QCOMPARE(afterSignal.at(3).value<QModelIndex>(), QModelIndex());
+ QCOMPARE(afterSignal.at(3).value<QModelIndex>(), moveParent);
QCOMPARE(afterSignal.at(4).toInt(), destRow);
@@ -1053,7 +1080,7 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
{
QModelIndex idx = indexList.at(i);
QModelIndex persistentIndex = persistentList.at(i);
- if (idx.parent() == QModelIndex())
+ if (idx.parent() == moveParent)
{
int row = idx.row();
if ( row >= destRow)
diff --git a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
index 5033a50..99a263b 100644
--- a/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
+++ b/tests/auto/qabstractscrollarea/tst_qabstractscrollarea.cpp
@@ -71,6 +71,8 @@ private slots:
void viewportCrash();
void task214488_layoutDirection_data();
void task214488_layoutDirection();
+ void wheelEvent_data();
+ void wheelEvent();
};
tst_QAbstractScrollArea::tst_QAbstractScrollArea()
@@ -296,10 +298,10 @@ public:
setAttribute(Qt::WA_DropSiteRegistered, true);
- startTimer(2000);
+ startTimer(200);
}
- void timerEvent(QTimerEvent *event)
+ void timerEvent(QTimerEvent *)
{
// should not crash.
(void)new QScrollArea(this);
@@ -385,5 +387,96 @@ void tst_QAbstractScrollArea::patternBackground()
QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::red).rgb());
}
+Q_DECLARE_METATYPE(QWheelEvent *);
+
+void tst_QAbstractScrollArea::wheelEvent_data()
+{
+ QTest::addColumn<QSize>("widgetSize");
+ QTest::addColumn<QPoint>("initialOffset");
+ QTest::addColumn<QWheelEvent *>("event");
+ QTest::addColumn<int>("movedX"); // -1 , 0 , or 1
+ QTest::addColumn<int>("movedY");
+
+ QPoint pos(100,100);
+ int delta =-120;
+
+ QTest::newRow("1") << QSize(600,600) << QPoint(50,50)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 1 << 0;
+
+ QTest::newRow("2") << QSize(600,600) << QPoint(50,50)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 0 << 1;
+
+ QTest::newRow("3") << QSize(600,600) << QPoint(50,50)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << -1 << 0;
+
+ QTest::newRow("4") << QSize(600,600) << QPoint(50,50)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << 0 << -1;
+
+ QTest::newRow("5") << QSize(20,600) << QPoint(0,50)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 0 << 1;
+
+ QTest::newRow("6") << QSize(20,600) << QPoint(0,50)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 0 << 1;
+
+ QTest::newRow("7") << QSize(20,600) << QPoint(0,50)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << 0 << -1;
+
+ QTest::newRow("8") << QSize(20,600) << QPoint(0,50)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << 0 << -1;
+
+ QTest::newRow("9") << QSize(600,20) << QPoint(50,0)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Horizontal) << 1 << 0;
+
+ QTest::newRow("a") << QSize(600,20) << QPoint(50,0)
+ << new QWheelEvent(pos, delta, 0, 0, Qt::Vertical) << 1 << 0;
+
+ QTest::newRow("b") << QSize(600,20) << QPoint(50,0)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Horizontal) << -1 << 0;
+
+ QTest::newRow("c") << QSize(600,20) << QPoint(50,0)
+ << new QWheelEvent(pos, -delta, 0, 0, Qt::Vertical) << -1 << 0;
+}
+
+
+
+
+void tst_QAbstractScrollArea::wheelEvent()
+{
+ QFETCH(QSize, widgetSize);
+ QFETCH(QPoint, initialOffset);
+ QFETCH(QWheelEvent *, event);
+ QFETCH(int, movedX);
+ QFETCH(int, movedY);
+
+ QScrollArea scrollArea;
+ scrollArea.resize(200, 200);
+ QLabel widget("H e l l o");
+ widget.resize(widgetSize);
+ scrollArea.setWidget(&widget);
+ scrollArea.show();
+ QTest::qWait(20);
+
+ scrollArea.verticalScrollBar()->setValue(initialOffset.y());
+ scrollArea.horizontalScrollBar()->setValue(initialOffset.x());
+
+ QCOMPARE(scrollArea.verticalScrollBar()->value(), initialOffset.y());
+ QCOMPARE(scrollArea.horizontalScrollBar()->value(), initialOffset.x());
+
+ QApplication::sendEvent(scrollArea.viewport(), event);
+
+ if(movedX == 0)
+ QCOMPARE(scrollArea.horizontalScrollBar()->value(), initialOffset.x());
+ else
+ QVERIFY(movedX * scrollArea.horizontalScrollBar()->value() > movedX * initialOffset.x());
+
+ if(movedY == 0)
+ QCOMPARE(scrollArea.verticalScrollBar()->value(), initialOffset.y());
+ else
+ QVERIFY(movedY * scrollArea.verticalScrollBar()->value() > movedY * initialOffset.y());
+
+ delete event;
+}
+
+
QTEST_MAIN(tst_QAbstractScrollArea)
#include "tst_qabstractscrollarea.moc"
diff --git a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
index 381f46f..a57c1d6 100644
--- a/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
+++ b/tests/auto/qcalendarwidget/tst_qcalendarwidget.cpp
@@ -75,6 +75,8 @@ private slots:
void resetTextFormat();
void setWeekdayFormat();
+ void showPrevNext_data();
+ void showPrevNext();
};
// Testing get/set functions
@@ -293,5 +295,73 @@ void tst_QCalendarWidget::cleanup()
{
}
+
+typedef void (QCalendarWidget::*ShowFunc)();
+Q_DECLARE_METATYPE(ShowFunc)
+
+void tst_QCalendarWidget::showPrevNext_data()
+{
+ QTest::addColumn<ShowFunc>("function");
+ QTest::addColumn<QDate>("dateOrigin");
+ QTest::addColumn<QDate>("expectedDate");
+
+ QTest::newRow("showNextMonth") << &QCalendarWidget::showNextMonth << QDate(1984,7,30) << QDate(1984,8,30);
+ QTest::newRow("showPrevMonth") << &QCalendarWidget::showPreviousMonth << QDate(1984,7,30) << QDate(1984,6,30);
+ QTest::newRow("showNextYear") << &QCalendarWidget::showNextYear << QDate(1984,7,30) << QDate(1985,7,30);
+ QTest::newRow("showPrevYear") << &QCalendarWidget::showPreviousYear << QDate(1984,7,30) << QDate(1983,7,30);
+
+ QTest::newRow("showNextMonth limit") << &QCalendarWidget::showNextMonth << QDate(2007,12,4) << QDate(2008,1,4);
+ QTest::newRow("showPreviousMonth limit") << &QCalendarWidget::showPreviousMonth << QDate(2006,1,23) << QDate(2005,12,23);
+
+ QTest::newRow("showNextMonth now") << &QCalendarWidget::showNextMonth << QDate() << QDate::currentDate().addMonths(1);
+ QTest::newRow("showNextYear now") << &QCalendarWidget::showNextYear << QDate() << QDate::currentDate().addYears(1);
+ QTest::newRow("showPrevieousMonth now") << &QCalendarWidget::showPreviousMonth << QDate() << QDate::currentDate().addMonths(-1);
+ QTest::newRow("showPreviousYear now") << &QCalendarWidget::showPreviousYear << QDate() << QDate::currentDate().addYears(-1);
+
+ QTest::newRow("showToday now") << &QCalendarWidget::showToday << QDate(2000,1,31) << QDate::currentDate();
+ QTest::newRow("showNextMonth 31") << &QCalendarWidget::showNextMonth << QDate(2000,1,31) << QDate(2000,2,28);
+ QTest::newRow("selectedDate") << &QCalendarWidget::showSelectedDate << QDate(2008,2,29) << QDate(2008,2,29);
+
+}
+
+void tst_QCalendarWidget::showPrevNext()
+{
+ QFETCH(ShowFunc, function);
+ QFETCH(QDate, dateOrigin);
+ QFETCH(QDate, expectedDate);
+
+ QCalendarWidget calWidget;
+ calWidget.show();
+ QTest::qWaitForWindowShown(&calWidget);
+ if(!dateOrigin.isNull()) {
+ calWidget.setSelectedDate(dateOrigin);
+ calWidget.setCurrentPage(dateOrigin.year(), dateOrigin.month());
+
+ QCOMPARE(calWidget.yearShown(), dateOrigin.year());
+ QCOMPARE(calWidget.monthShown(), dateOrigin.month());
+ } else {
+ QCOMPARE(calWidget.yearShown(), QDate::currentDate().year());
+ QCOMPARE(calWidget.monthShown(), QDate::currentDate().month());
+ }
+
+ (calWidget.*function)();
+
+ QCOMPARE(calWidget.yearShown(), expectedDate.year());
+ QCOMPARE(calWidget.monthShown(), expectedDate.month());
+
+ // QTBUG-4058
+ QTest::qWait(20);
+ QToolButton *button = qFindChild<QToolButton *>(&calWidget, "qt_calendar_prevmonth");
+ QTest::mouseClick(button, Qt::LeftButton);
+ expectedDate = expectedDate.addMonths(-1);
+ QCOMPARE(calWidget.yearShown(), expectedDate.year());
+ QCOMPARE(calWidget.monthShown(), expectedDate.month());
+
+ if(!dateOrigin.isNull()) {
+ //the selectedDate should not have changed
+ QCOMPARE(calWidget.selectedDate(), dateOrigin);
+ }
+}
+
QTEST_MAIN(tst_QCalendarWidget)
#include "tst_qcalendarwidget.moc"
diff --git a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
index c5f06e2..3c61f81 100644
--- a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
@@ -58,6 +58,7 @@ private slots:
#endif
void applicationPid();
void globalPostedEventsCount();
+ void processEventsAlwaysSendsPostedEvents();
};
class EventSpy : public QObject
@@ -488,5 +489,40 @@ void tst_QCoreApplication::globalPostedEventsCount()
QCOMPARE(x.globalPostedEventsCount, expected);
}
+class ProcessEventsAlwaysSendsPostedEventsObject : public QObject
+{
+public:
+ int counter;
+
+ inline ProcessEventsAlwaysSendsPostedEventsObject()
+ : counter(0)
+ { }
+
+ bool event(QEvent *event)
+ {
+ if (event->type() == QEvent::User)
+ ++counter;
+ return QObject::event(event);
+ }
+};
+
+void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
+{
+ int argc = 1;
+ char *argv[] = { "tst_qcoreapplication" };
+ QCoreApplication app(argc, argv);
+
+ ProcessEventsAlwaysSendsPostedEventsObject object;
+ QTime t;
+ t.start();
+ int i = 1;
+ do {
+ QCoreApplication::postEvent(&object, new QEvent(QEvent::User));
+ QCoreApplication::processEvents();
+ QCOMPARE(object.counter, i);
+ ++i;
+ } while (t.elapsed() < 3000);
+}
+
QTEST_APPLESS_MAIN(tst_QCoreApplication)
#include "tst_qcoreapplication.moc"
diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp
index e62ba8c..c9a7f1c 100644
--- a/tests/auto/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp
@@ -87,12 +87,14 @@ private slots:
void dockLocationChanged();
void setTitleBarWidget();
void titleBarDoubleClick();
+ void restoreStateOfFloating();
// task specific tests:
void task165177_deleteFocusWidget();
void task169808_setFloating();
void task237438_setFloatingCrash();
void task248604_infiniteResize();
void task258459_visibilityChanged();
+ void taskQTBUG_1665_closableChanged();
};
// Testing get/set functions
@@ -612,6 +614,7 @@ void tst_QDockWidget::dockLocationChanged()
QMainWindow mw;
QDockWidget dw;
+ dw.setObjectName("dock1");
QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)));
mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
@@ -636,6 +639,7 @@ void tst_QDockWidget::dockLocationChanged()
QCOMPARE(spy.count(), 0);
QDockWidget dw2;
+ dw2.setObjectName("dock2");
mw.addDockWidget(Qt::TopDockWidgetArea, &dw2);
mw.tabifyDockWidget(&dw2, &dw);
QCOMPARE(spy.count(), 1);
@@ -657,6 +661,12 @@ void tst_QDockWidget::dockLocationChanged()
QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
Qt::TopDockWidgetArea);
spy.clear();
+
+ QByteArray ba = mw.saveState();
+ mw.restoreState(ba);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
+ Qt::TopDockWidgetArea);
}
void tst_QDockWidget::featuresChanged()
@@ -714,6 +724,21 @@ void tst_QDockWidget::titleBarDoubleClick()
QCOMPARE(win.dockWidgetArea(&dock), Qt::TopDockWidgetArea);
}
+void tst_QDockWidget::restoreStateOfFloating()
+{
+ QMainWindow mw;
+ QDockWidget dock;
+ dock.setObjectName("dock1");
+ mw.addDockWidget(Qt::TopDockWidgetArea, &dock);
+ QVERIFY(!dock.isFloating());
+ QByteArray ba = mw.saveState();
+ dock.setFloating(true);
+ QVERIFY(dock.isFloating());
+ QVERIFY(mw.restoreState(ba));
+ QVERIFY(!dock.isFloating());
+}
+
+
void tst_QDockWidget::task165177_deleteFocusWidget()
{
QMainWindow mw;
@@ -834,5 +859,22 @@ void tst_QDockWidget::task258459_visibilityChanged()
QCOMPARE(spy2.first().first().toBool(), true); //dock1 is visible
}
+void tst_QDockWidget::taskQTBUG_1665_closableChanged()
+{
+ QDockWidget dock;
+ dock.show();
+ QTest::qWaitForWindowShown(&dock);
+
+ if (dock.windowFlags() & Qt::FramelessWindowHint)
+ QSKIP("this machine doesn't support native dock widget", SkipAll);
+
+ QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint);
+
+ //now let's remove the closable attribute
+ dock.setFeatures(dock.features() ^ QDockWidget::DockWidgetClosable);
+ QVERIFY(!(dock.windowFlags() & Qt::WindowCloseButtonHint));
+}
+
+
QTEST_MAIN(tst_QDockWidget)
#include "tst_qdockwidget.moc"
diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp
index fa76e44..5622e10 100644
--- a/tests/auto/qfont/tst_qfont.cpp
+++ b/tests/auto/qfont/tst_qfont.cpp
@@ -395,6 +395,13 @@ void tst_QFont::compare()
font.setOverline(false);
QVERIFY( font == font2 );
QVERIFY(!(font < font2));
+
+ font.setCapitalization(QFont::SmallCaps);
+ QVERIFY( font != font2 );
+ QCOMPARE(font < font2,!(font2 < font));
+ font.setCapitalization(QFont::MixedCase);
+ QVERIFY( font == font2 );
+ QVERIFY(!(font < font2));
}
#if defined(Q_WS_X11)
diff --git a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
index 7045c19..b974ecab 100644
--- a/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/qfontcombobox/tst_qfontcombobox.cpp
@@ -153,7 +153,7 @@ void tst_QFontComboBox::currentFont()
if (oldCurrentFont != box.currentFont()) {
//the signal may be emit twice if there is a foundry into brackets
- QVERIFY(spy0.count() >= 1);
+ QCOMPARE(spy0.count(),1);
}
}
@@ -286,6 +286,10 @@ void tst_QFontComboBox::currentFontChanged()
if (box.model()->rowCount() > 2) {
QTest::keyPress(&box, Qt::Key_Down);
QCOMPARE(spy0.count(), 1);
+
+ QFont f( "Sans Serif" );
+ box.setCurrentFont(f);
+ QCOMPARE(spy0.count(), 2);
} else
qWarning("Not enough fonts installed on test system. Consider adding some");
}
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index e33c7b6..cd1eedd 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -399,7 +399,7 @@ void tst_QGraphicsGridLayout::columnAlignment()
widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
view.show();
widget->show();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
// Check default
QCOMPARE(layout->columnAlignment(0), 0);
QCOMPARE(layout->columnAlignment(1), 0);
@@ -414,7 +414,7 @@ void tst_QGraphicsGridLayout::columnAlignment()
layout->setAlignment(layout->itemAt(1,1), Qt::AlignRight);
layout->setAlignment(layout->itemAt(1,2), Qt::AlignLeft);
- QApplication::processEvents(); // process LayoutRequest
+ QApplication::sendPostedEvents(0, 0); // process LayoutRequest
/*
+----------+------------+---------+
| Left | HCenter | Right |
@@ -846,7 +846,7 @@ void tst_QGraphicsGridLayout::rowAlignment()
widget->resize(300, 400);
view.show();
widget->show();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
// Check default
QCOMPARE(layout->rowAlignment(0), 0);
QCOMPARE(layout->rowAlignment(1), 0);
@@ -869,7 +869,7 @@ void tst_QGraphicsGridLayout::rowAlignment()
layout->setAlignment(layout->itemAt(1,0), Qt::AlignTop);
layout->setAlignment(layout->itemAt(2,0), Qt::AlignHCenter);
- QApplication::processEvents(); // process LayoutRequest
+ QApplication::sendPostedEvents(0, 0); // process LayoutRequest
QCOMPARE(layout->alignment(layout->itemAt(0,0)), Qt::AlignRight); //Qt::AlignRight | Qt::AlignBottom
QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(50, 50, 50, 50));
@@ -1834,7 +1834,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors()
desc.apply(layout, item);
}
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
widget->show();
view.show();
@@ -1842,7 +1842,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors()
if (newSize.isValid())
widget->resize(newSize);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
for (i = 0; i < expectedSizes.count(); ++i) {
QSizeF itemSize = layout->itemAt(i)->geometry().size();
QCOMPARE(itemSize, expectedSizes.at(i));
@@ -1994,7 +1994,7 @@ void tst_QGraphicsGridLayout::alignment2()
desc.apply(layout, item);
}
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
widget->show();
view.resize(400,300);
@@ -2002,7 +2002,7 @@ void tst_QGraphicsGridLayout::alignment2()
if (newSize.isValid())
widget->resize(newSize);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
for (i = 0; i < expectedGeometries.count(); ++i) {
QRectF itemRect = layout->itemAt(i)->geometry();
QCOMPARE(itemRect, expectedGeometries.at(i));
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index d65c6ec..27c6809 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -413,6 +413,7 @@ private slots:
void task243707_addChildBeforeParent();
void task197802_childrenVisibility();
void QTBUG_4233_updateCachedWithSceneRect();
+ void QTBUG_5418_textItemSetDefaultColor();
private:
QList<QGraphicsItem *> paintedItems;
@@ -9751,5 +9752,62 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
+void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
+{
+ struct Item : public QGraphicsTextItem
+ {
+ bool painted;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *opt, QWidget *wid)
+ {
+ painted = true;
+ QGraphicsTextItem::paint(painter, opt, wid);
+ }
+ };
+
+ Item *i = new Item;
+ i->painted = false;
+ i->setPlainText("I AM A TROLL");
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ scene.addItem(i);
+ QApplication::processEvents();
+ QTRY_VERIFY(i->painted);
+ QApplication::processEvents();
+
+ i->painted = false;
+ QColor col(Qt::red);
+ i->setDefaultTextColor(col);
+ QApplication::processEvents();
+ QTRY_VERIFY(i->painted); //check that changing the color force an update
+
+ i->painted = false;
+ QImage image(400, 200, QImage::Format_RGB32);
+ image.fill(0);
+ QPainter painter(&image);
+ scene.render(&painter);
+ painter.end();
+ QVERIFY(i->painted);
+
+ int numRedPixel = 0;
+ QRgb rgb = col.rgb();
+ for (int y = 0; y < image.height(); ++y) {
+ for (int x = 0; x < image.width(); ++x) {
+ // Because of antialiasing we allow a certain range of errors here.
+ QRgb pixel = image.pixel(x, y);
+ if (qAbs((int)(pixel & 0xff) - (int)(rgb & 0xff)) +
+ qAbs((int)((pixel & 0xff00) >> 8) - (int)((rgb & 0xff00) >> 8)) +
+ qAbs((int)((pixel & 0xff0000) >> 16) - (int)((rgb & 0xff0000) >> 16)) <= 50) {
+ if (++numRedPixel >= 10) {
+ return;
+ }
+ }
+ }
+ }
+ QCOMPARE(numRedPixel, -1); //color not found, FAIL!
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 546f92d..d3087dc 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -664,16 +664,16 @@ void tst_QGraphicsLinearLayout::invalidate()
widget->show();
layout.setContentsMargins(1, 2, 3, 4);
- qApp->processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(layout.layoutRequest, 1);
layout.setOrientation(Qt::Vertical);
- qApp->processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(layout.layoutRequest, 2);
for (int i = 0; i < count; ++i)
layout.invalidate(); // Event is compressed, should only get one layoutrequest
- qApp->processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(layout.layoutRequest, count ? 3 : 2);
delete widget;
}
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 9c6aa39..f07453c 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -217,7 +217,6 @@ private slots:
void update();
void inputMethodSensitivity();
void inputContextReset();
- void defaultClipIntersectToView();
// task specific tests below me
void task172231_untransformableItems();
@@ -3693,77 +3692,6 @@ void tst_QGraphicsView::inputContextReset()
QCOMPARE(inputContext.resets, 0);
}
-class ViewClipTester : public QGraphicsView
-{
-public:
- ViewClipTester(QGraphicsScene *scene = 0)
- : QGraphicsView(scene)
- { }
- QRegion clipRegion;
-
-protected:
- void drawBackground(QPainter *painter, const QRectF &rect)
- {
- clipRegion = painter->clipRegion();
- }
-};
-
-class ItemClipTester : public QGraphicsRectItem
-{
-public:
- ItemClipTester() : QGraphicsRectItem(0, 0, 20, 20)
- {
- setBrush(Qt::blue);
- }
- QRegion clipRegion;
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
- {
- clipRegion = painter->clipRegion();
- QGraphicsRectItem::paint(painter, option, widget);
- }
-};
-
-void tst_QGraphicsView::defaultClipIntersectToView()
-{
- QGraphicsScene scene;
- ItemClipTester *tester = new ItemClipTester;
- scene.addItem(tester);
-
- ViewClipTester view(&scene);
- view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
- view.setFrameStyle(0);
- view.resize(200, 200);
- view.show();
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view);
-
- QRect viewRect(0, 0, 200, 200);
- QCOMPARE(view.clipRegion, QRegion(viewRect));
- QCOMPARE(tester->clipRegion, QRegion(viewRect));
-
- view.viewport()->update(0, 0, 5, 5);
- view.viewport()->update(10, 10, 5, 5);
- qApp->processEvents();
- viewRect = QRect(0, 0, 15, 15);
- QCOMPARE(view.clipRegion, QRegion(viewRect));
- QCOMPARE(tester->clipRegion, QRegion(viewRect));
-
- view.scale(2, 2);
- qApp->processEvents();
-
- viewRect.moveTop(-viewRect.height());
- viewRect = QRect(0, 0, 100, 100);
- QCOMPARE(view.clipRegion, QRegion(viewRect));
- QCOMPARE(tester->clipRegion, QRegion(viewRect));
-
- view.viewport()->update(0, 0, 5, 5);
- view.viewport()->update(10, 10, 5, 5);
- qApp->processEvents();
- viewRect = QRect(0, 0, 8, 8);
- QCOMPARE(view.clipRegion, QRegion(viewRect));
- QCOMPARE(tester->clipRegion, QRegion(viewRect));
-}
-
void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
{
QGraphicsView view;
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 6b5ad09..829e55c 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -160,6 +160,7 @@ private slots:
void widgetSendsGeometryChanges();
void respectHFW();
void addChildInpolishEvent();
+ void polishEvent();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2768,6 +2769,32 @@ void tst_QGraphicsWidget::addChildInpolishEvent()
QCOMPARE(PolishWidget::numberOfPolish, 2);
}
+void tst_QGraphicsWidget::polishEvent()
+{
+ class MyGraphicsWidget : public QGraphicsWidget
+ { public:
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
+ { events << QEvent::Paint; }
+ void polishEvent()
+ { events << QEvent::Polish; }
+ QList<QEvent::Type> events;
+ };
+
+ QGraphicsScene scene;
+
+ MyGraphicsWidget *widget = new MyGraphicsWidget;
+ scene.addItem(widget);
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ // Make sure the item is painted.
+ QTRY_VERIFY(widget->events.contains(QEvent::Paint));
+
+ // Make sure the item got polish before paint.
+ QCOMPARE(widget->events.at(0), QEvent::Polish);
+}
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp
index 46e2a03..313dc95 100644
--- a/tests/auto/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp
@@ -268,7 +268,7 @@ void tst_QGridLayout::setMinAndMaxSize()
leftChild.setMinimumSize(100, 100);
leftChild.setMaximumSize(200, 200);
layout.addWidget(&leftChild, 0, 0);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumSize(), leftChild.minimumSize());
QCOMPARE(widget.maximumSize(), leftChild.maximumSize());
@@ -277,7 +277,7 @@ void tst_QGridLayout::setMinAndMaxSize()
rightChild.setMinimumSize(100, 100);
rightChild.setMaximumSize(200, 200);
layout.addWidget(&rightChild, 0, 2);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth());
@@ -293,7 +293,7 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.setColumnMinimumWidth(1, colMin);
QCOMPARE(layout.columnMinimumWidth(1), colMin);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth() + colMin);
QCOMPARE(widget.maximumWidth(),
@@ -306,7 +306,7 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.setColumnStretch(1,1);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth() + colMin);
QCOMPARE(widget.maximumWidth(), QLAYOUTSIZE_MAX);
@@ -318,7 +318,7 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.setColumnStretch(1,0);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth() + colMin);
QCOMPARE(widget.maximumWidth(),
@@ -335,7 +335,7 @@ void tst_QGridLayout::setMinAndMaxSize()
static const int spacerS = 250;
QSpacerItem *spacer = new QSpacerItem(spacerS, spacerS);
layout.addItem(spacer, 0, 1);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth() + spacerS);
@@ -348,7 +348,7 @@ void tst_QGridLayout::setMinAndMaxSize()
spacer->changeSize(spacerS, spacerS, QSizePolicy::Fixed, QSizePolicy::Minimum);
layout.invalidate();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumWidth(),
leftChild.minimumWidth() + rightChild.minimumWidth() + spacerS);
QCOMPARE(widget.maximumWidth(),
@@ -358,13 +358,13 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.removeItem(spacer);
rightChild.hide();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumSize(), leftChild.minimumSize());
QCOMPARE(widget.maximumSize(), leftChild.maximumSize());
rightChild.show();
layout.removeWidget(&rightChild);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumSize(), leftChild.minimumSize());
QCOMPARE(widget.maximumSize(), leftChild.maximumSize());
@@ -373,7 +373,7 @@ void tst_QGridLayout::setMinAndMaxSize()
bottomChild.setMinimumSize(100, 100);
bottomChild.setMaximumSize(200, 200);
layout.addWidget(&bottomChild, 1, 0);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumHeight(),
leftChild.minimumHeight() + bottomChild.minimumHeight());
@@ -385,13 +385,13 @@ void tst_QGridLayout::setMinAndMaxSize()
qMax(leftChild.maximumWidth(), bottomChild.maximumWidth()));
bottomChild.hide();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumSize(), leftChild.minimumSize());
QCOMPARE(widget.maximumSize(), leftChild.maximumSize());
bottomChild.show();
layout.removeWidget(&bottomChild);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.minimumSize(), leftChild.minimumSize());
QCOMPARE(widget.maximumSize(), leftChild.maximumSize());
}
@@ -423,7 +423,7 @@ void tst_QGridLayout::spacingAndSpacers()
SizeHinter leftChild(100,100);
leftChild.setPalette(QPalette(Qt::red));
layout.addWidget(&leftChild, 0, 0);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
expectedSizeHint = leftChild.sizeHint();
QCOMPARE(widget.sizeHint(), expectedSizeHint);
@@ -431,7 +431,7 @@ void tst_QGridLayout::spacingAndSpacers()
SizeHinter rightChild(200,100);
rightChild.setPalette(QPalette(Qt::green));
layout.addWidget(&rightChild, 0, 2);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(rightChild.sizeHint(), QSize(200,100));
expectedSizeHint += QSize(rightChild.sizeHint().width(), 0);
@@ -440,11 +440,11 @@ void tst_QGridLayout::spacingAndSpacers()
layout.setColumnMinimumWidth(1, 100);
widget.adjustSize();
expectedSizeHint += QSize(100,0);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.sizeHint(), expectedSizeHint);
rightChild.hide();
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
expectedSizeHint -= QSize(rightChild.sizeHint().width(), 0);
QCOMPARE(widget.sizeHint(), expectedSizeHint);
@@ -459,12 +459,12 @@ void tst_QGridLayout::spacingAndSpacers()
leftChild.setMaximumWidth(200);
rightChild.setMaximumWidth(200);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.maximumWidth(), leftChild.maximumWidth() + rightChild.maximumWidth());
#endif
layout.removeWidget(&rightChild);
- QApplication::processEvents();
+ QApplication::sendPostedEvents(0, 0);
QCOMPARE(widget.sizeHint(), expectedSizeHint);
diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp
index 1c257bf..bc9ae6c 100644
--- a/tests/auto/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp
@@ -119,6 +119,7 @@ private slots:
void symetricConstructors_data();
void symetricConstructors();
void checkMultipleNames();
+ void mnemonic_data();
void mnemonic();
void toString_data();
void toString();
@@ -133,6 +134,7 @@ private slots:
void translated_data();
void translated();
+
void initTestCase();
private:
QTranslator *ourTranslator;
@@ -299,7 +301,7 @@ void tst_QKeySequence::standardKeys_data()
QTest::newRow("findNext") << (int)QKeySequence::FindNext<< QString("F3");
QTest::newRow("findPrevious") << (int)QKeySequence::FindPrevious << QString("SHIFT+F3");
QTest::newRow("close") << (int)QKeySequence::Close<< QString("CTRL+F4");
- QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
+ QTest::newRow("replace") << (int)QKeySequence::Replace<< QString("CTRL+H");
#endif
QTest::newRow("bold") << (int)QKeySequence::Bold << QString("CTRL+B");
QTest::newRow("italic") << (int)QKeySequence::Italic << QString("CTRL+I");
@@ -357,17 +359,50 @@ void tst_QKeySequence::keyBindings()
}
+
+void tst_QKeySequence::mnemonic_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<bool>("warning");
+
+ QTest::newRow("1") << QString::fromLatin1("&bonjour") << QString::fromLatin1("ALT+B") << false;
+ QTest::newRow("2") << QString::fromLatin1("&&bonjour") << QString() << false;
+ QTest::newRow("3") << QString::fromLatin1("&&bon&jour") << QString::fromLatin1("ALT+J") << false;
+ QTest::newRow("4") << QString::fromLatin1("&&bon&jo&ur") << QString::fromLatin1("ALT+J") << true;
+ QTest::newRow("5") << QString::fromLatin1("b&on&&jour") << QString::fromLatin1("ALT+O") << false;
+ QTest::newRow("6") << QString::fromLatin1("bonjour") << QString() << false;
+ QTest::newRow("7") << QString::fromLatin1("&&&bonjour") << QString::fromLatin1("ALT+B") << false;
+ QTest::newRow("8") << QString::fromLatin1("bonjour&&&") << QString() << false;
+ QTest::newRow("9") << QString::fromLatin1("bo&&nj&o&&u&r") << QString::fromLatin1("ALT+O") << true;
+ QTest::newRow("10") << QString::fromLatin1("BON&JOUR") << QString::fromLatin1("ALT+J") << false;
+ QTest::newRow("11") << QString::fromUtf8("bonjour") << QString() << false;
+}
+
void tst_QKeySequence::mnemonic()
{
#ifdef Q_WS_MAC
QSKIP("mnemonics are not used on Mac OS X", SkipAll);
#endif
- QKeySequence k = QKeySequence::mnemonic("&Foo");
- QVERIFY(k == QKeySequence("ALT+F"));
- k = QKeySequence::mnemonic("&& &x");
- QVERIFY(k == QKeySequence("ALT+X"));
+ QFETCH(QString, string);
+ QFETCH(QString, key);
+ QFETCH(bool, warning);
+
+#ifndef QT_NO_DEBUG
+ if (warning) {
+ QString str = QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(string);
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(str));
+ // qWarning(qPrintable(str));
+ }
+#endif
+ QKeySequence seq = QKeySequence::mnemonic(string);
+ QKeySequence res = QKeySequence(key);
+
+ QCOMPARE(seq, res);
}
+
+
void tst_QKeySequence::toString_data()
{
QTest::addColumn<QString>("strSequence");
diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp
index 9d957a5..6b7e106 100644
--- a/tests/auto/qlabel/tst_qlabel.cpp
+++ b/tests/auto/qlabel/tst_qlabel.cpp
@@ -51,6 +51,7 @@
#include <qmovie.h>
#include <qpicture.h>
#include <qmessagebox.h>
+#include <private/qlabel_p.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -116,6 +117,9 @@ private slots:
void unicodeText_data();
void unicodeText();
+ void mnemonic_data();
+ void mnemonic();
+
private:
QLabel *testWidget;
QPointer<Widget> test_box;
@@ -224,6 +228,7 @@ void tst_QLabel::setBuddy()
QVERIFY( !test_edit->hasFocus() );
QTest::keyClick( test_box, 't', Qt::AltModifier );
QVERIFY( test_edit->hasFocus() );
+ delete test_box;
}
void tst_QLabel::text()
@@ -245,6 +250,7 @@ void tst_QLabel::setText_data()
QTest::newRow( QString(prefix + "data1").toLatin1() ) << QString("This is the first line\nThis is the second line") << QString("Courier");
QTest::newRow( QString(prefix + "data2").toLatin1() ) << QString("This is the first line\nThis is the second line\nThis is the third line") << QString("Helvetica");
QTest::newRow( QString(prefix + "data3").toLatin1() ) << QString("This is <b>bold</b> richtext") << QString("Courier");
+ QTest::newRow( QString(prefix + "data4").toLatin1() ) << QString("I Have a &shortcut") << QString("Helvetica");
}
void tst_QLabel::setText()
@@ -509,5 +515,50 @@ void tst_QLabel::unicodeText()
testWidget->show();
}
+void tst_QLabel::mnemonic_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("expectedDocText");
+ QTest::addColumn<QString>("expectedShortcutCursor");
+
+ QTest::newRow("1") << QString("Normal") << QString("Normal") << QString();
+ QTest::newRow("2") << QString("&Simple") << QString("Simple") << QString("S");
+ QTest::newRow("3") << QString("Also &simple") << QString("Also simple") << QString("s");
+ QTest::newRow("4") << QString("&&With &Double &&amp;") << QString("&With Double &amp;") << QString("D");
+ QTest::newRow("5") << QString("Hep&&Hop") << QString("Hep&Hop") << QString("");
+ QTest::newRow("6") << QString("Hep&&&Hop") << QString("Hep&Hop") << QString("H");
+}
+
+
+void tst_QLabel::mnemonic()
+{
+ // this test that the mnemonics appears correctly when the label has a text control.
+
+ QFETCH(QString, text);
+ QFETCH(QString, expectedDocText);
+ QFETCH(QString, expectedShortcutCursor);
+
+ QWidget w;
+ QHBoxLayout *hbox = new QHBoxLayout;
+ QLabel *lab = new QLabel(text);
+ //lab->setText("plop &plop");
+ QLineEdit *lineedit = new QLineEdit;
+ lab->setBuddy(lineedit);
+ lab->setTextInteractionFlags(Qt::TextSelectableByMouse);
+
+ hbox->addWidget(lab);
+ hbox->addWidget(lineedit);
+ hbox->addWidget(new QLineEdit);
+ w.setLayout(hbox);
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+
+ QLabelPrivate *d = static_cast<QLabelPrivate *>(QObjectPrivate::get(lab));
+ QVERIFY(d->control);
+ QCOMPARE(d->control->document()->toPlainText(), expectedDocText);
+ QCOMPARE(d->shortcutCursor.selectedText(), expectedShortcutCursor);
+}
+
+
QTEST_MAIN(tst_QLabel)
#include "tst_qlabel.moc"