summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-09-01 14:49:13 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-09-01 14:49:13 (GMT)
commit93906071c31a5008625e727dad530a6f05441baa (patch)
tree8fc8dbc5b0bdb17a97d4c4909889c0aa9bcc0aaa
parente48ad5a89deb5e73c28e689665dfdb71268be8e0 (diff)
parentefc616f2a1a83bd4ca50aea9d40a0df005ada063 (diff)
downloadQt-93906071c31a5008625e727dad530a6f05441baa.zip
Qt-93906071c31a5008625e727dad530a6f05441baa.tar.gz
Qt-93906071c31a5008625e727dad530a6f05441baa.tar.bz2
Merge commit 'qt/4.6' into kinetic-declarativeui
Conflicts: tools/qdoc3/test/classic.css
-rw-r--r--demos/boxes/qtbox.cpp14
-rw-r--r--demos/boxes/qtbox.h6
-rw-r--r--demos/sub-attaq/graphicsscene.cpp13
-rw-r--r--demos/sub-attaq/graphicsscene.h2
-rw-r--r--demos/sub-attaq/states.cpp25
-rw-r--r--demos/sub-attaq/states.h2
-rw-r--r--demos/sub-attaq/sub-attaq.pro18
-rw-r--r--demos/sub-attaq/textinformationitem.cpp (renamed from examples/effects/lighting/shadoweffect.cpp)42
-rw-r--r--demos/sub-attaq/textinformationitem.h (renamed from examples/effects/lighting/shadoweffect.h)29
-rw-r--r--examples/animation/states/main.cpp4
-rw-r--r--examples/effects/lighting/lighting.cpp22
-rw-r--r--examples/effects/lighting/lighting.h2
-rw-r--r--examples/effects/lighting/lighting.pro4
-rw-r--r--src/activeqt/container/qaxwidget.cpp7
-rw-r--r--src/corelib/arch/qatomic_windows.h28
-rw-r--r--src/corelib/io/qiodevice.cpp7
-rw-r--r--src/corelib/io/qtemporaryfile.cpp38
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp11
-rw-r--r--src/corelib/tools/qlist.h1
-rw-r--r--src/corelib/tools/qmargins.cpp8
-rw-r--r--src/corelib/tools/qmargins.h7
-rw-r--r--src/gui/effects/qgraphicseffect.cpp56
-rw-r--r--src/gui/effects/qgraphicseffect.h20
-rw-r--r--src/gui/effects/qgraphicseffect_p.h1
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h3
-rw-r--r--src/gui/image/qicon.cpp13
-rw-r--r--src/gui/image/qiconloader.cpp7
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h10
-rw-r--r--src/gui/itemviews/qheaderview.cpp4
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_p.h10
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp364
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/gui/widgets/qcalendarwidget.cpp9
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp2
-rw-r--r--src/network/socket/qnativesocketengine.cpp17
-rw-r--r--src/network/ssl/qsslcertificate.cpp10
-rw-r--r--src/network/ssl/qsslerror.cpp15
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h1
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp51
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h19
-rw-r--r--src/opengl/qglframebufferobject.cpp17
-rw-r--r--src/opengl/qglshaderprogram.cpp21
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp12
-rw-r--r--tests/auto/qabstractitemmodel/dynamictreemodel.cpp9
-rw-r--r--tests/auto/qabstractitemmodel/dynamictreemodel.h9
-rw-r--r--tests/auto/qabstractitemmodel/qabstractitemmodel.pro2
-rw-r--r--tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp2
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp1
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp8
-rw-r--r--tests/auto/qicon/tst_qicon.cpp3
-rw-r--r--tests/auto/qicon/tst_qicon.qrc14
-rw-r--r--tests/auto/qimagereader/images/qt.gifbin0 -> 26504 bytes
-rw-r--r--tests/auto/qimagereader/images/qt1.gifbin0 -> 7216 bytes
-rw-r--r--tests/auto/qimagereader/images/qt2.gifbin0 -> 5559 bytes
-rw-r--r--tests/auto/qimagereader/images/qt3.gifbin0 -> 4702 bytes
-rw-r--r--tests/auto/qimagereader/images/qt4.gifbin0 -> 4310 bytes
-rw-r--r--tests/auto/qimagereader/images/qt5.gifbin0 -> 4234 bytes
-rw-r--r--tests/auto/qimagereader/images/qt6.gifbin0 -> 4732 bytes
-rw-r--r--tests/auto/qimagereader/images/qt7.gifbin0 -> 5265 bytes
-rw-r--r--tests/auto/qimagereader/images/qt8.gifbin0 -> 6144 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc13
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp13
-rw-r--r--tests/auto/qmargins/tst_qmargins.cpp27
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp6
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp5
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp29
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp41
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp6
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp82
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp30
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro6
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp197
-rw-r--r--tests/manual/qhttpnetworkconnection/main.cpp81
-rw-r--r--tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro13
-rw-r--r--tests/manual/qtabletevent/device_information/main.cpp28
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.h26
-rw-r--r--tests/manual/qtabletevent/event_compression/main.cpp28
-rw-r--r--tools/qdoc3/test/classic.css1
85 files changed, 1235 insertions, 425 deletions
diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp
index 015bc95..54882fb 100644
--- a/demos/boxes/qtbox.cpp
+++ b/demos/boxes/qtbox.cpp
@@ -122,7 +122,7 @@ void ItemBase::duplicateSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase)
scene->addItem(itemBase->createNew(itemBase->m_size, itemBase->pos().x() + itemBase->m_size, itemBase->pos().y()));
}
@@ -137,7 +137,7 @@ void ItemBase::deleteSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase)
delete itemBase;
}
@@ -152,7 +152,7 @@ void ItemBase::growSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase) {
itemBase->prepareGeometryChange();
itemBase->m_size *= 2;
@@ -171,7 +171,7 @@ void ItemBase::shrinkSelectedItems(QGraphicsScene *scene)
selected = scene->selectedItems();
foreach (QGraphicsItem *item, selected) {
- ItemBase *itemBase = dynamic_cast<ItemBase *>(item);
+ ItemBase *itemBase = qgraphicsitem_cast<ItemBase *>(item);
if (itemBase) {
itemBase->prepareGeometryChange();
itemBase->m_size /= 2;
@@ -257,6 +257,12 @@ void ItemBase::wheelEvent(QGraphicsSceneWheelEvent *event)
m_size = MIN_ITEM_SIZE;
}
+int ItemBase::type() const
+{
+ return Type;
+}
+
+
bool ItemBase::isInResizeArea(const QPointF &pos)
{
return (-pos.y() < pos.x() - m_size + 9);
diff --git a/demos/boxes/qtbox.h b/demos/boxes/qtbox.h
index 6f39b0d..9465911 100644
--- a/demos/boxes/qtbox.h
+++ b/demos/boxes/qtbox.h
@@ -47,10 +47,11 @@
#include <QtGui/qvector3d.h>
#include "glbuffers.h"
-class ItemBase : public QObject, public QGraphicsItem
+class ItemBase : public QGraphicsItem
{
- Q_OBJECT
public:
+ enum { Type = UserType + 1 };
+
ItemBase(int size, int x, int y);
virtual ~ItemBase();
virtual QRectF boundingRect() const;
@@ -64,6 +65,7 @@ protected:
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
+ virtual int type() const;
bool isInResizeArea(const QPointF &pos);
static void duplicateSelectedItems(QGraphicsScene *scene);
diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp
index b4fd0c9..79de011 100644
--- a/demos/sub-attaq/graphicsscene.cpp
+++ b/demos/sub-attaq/graphicsscene.cpp
@@ -51,6 +51,7 @@
#include "animationmanager.h"
#include "qanimationstate.h"
#include "progressitem.h"
+#include "textinformationitem.h"
//Qt
#include <QtCore/QPropertyAnimation>
@@ -112,6 +113,8 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode)
//The item that display score and level
progressItem = new ProgressItem(backgroundItem);
+ textInformationItem = new TextInformationItem(backgroundItem);
+ textInformationItem->hide();
//We create the boat
boat = new Boat();
addItem(boat);
@@ -244,15 +247,15 @@ void GraphicsScene::setupScene(const QList<QAction *> &actions)
lettersFadingState->setAnimation(lettersGroupFading);
//if new game then we fade out the welcome screen and start playing
- lettersMovingState->addTransition(newAction, SIGNAL(triggered()),lettersFadingState);
- lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()),gameState);
+ lettersMovingState->addTransition(newAction, SIGNAL(triggered()), lettersFadingState);
+ lettersFadingState->addTransition(lettersFadingState, SIGNAL(animationFinished()), gameState);
//New Game is triggered then player start playing
- gameState->addTransition(newAction, SIGNAL(triggered()),gameState);
+ gameState->addTransition(newAction, SIGNAL(triggered()), gameState);
//Wanna quit, then connect to CTRL+Q
- gameState->addTransition(quitAction, SIGNAL(triggered()),final);
- lettersMovingState->addTransition(quitAction, SIGNAL(triggered()),final);
+ gameState->addTransition(quitAction, SIGNAL(triggered()), final);
+ lettersMovingState->addTransition(quitAction, SIGNAL(triggered()), final);
//Welcome screen is the initial state
machine->setInitialState(lettersMovingState);
diff --git a/demos/sub-attaq/graphicsscene.h b/demos/sub-attaq/graphicsscene.h
index 073ad17..8fa62f7 100644
--- a/demos/sub-attaq/graphicsscene.h
+++ b/demos/sub-attaq/graphicsscene.h
@@ -54,6 +54,7 @@ class Torpedo;
class Bomb;
class PixmapItem;
class ProgressItem;
+class TextInformationItem;
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
@@ -108,6 +109,7 @@ private:
Mode mode;
PixmapItem *backgroundItem;
ProgressItem *progressItem;
+ TextInformationItem *textInformationItem;
QAction * newAction;
QAction * quitAction;
Boat *boat;
diff --git a/demos/sub-attaq/states.cpp b/demos/sub-attaq/states.cpp
index 75a2615..5c809cb 100644
--- a/demos/sub-attaq/states.cpp
+++ b/demos/sub-attaq/states.cpp
@@ -47,6 +47,7 @@
#include "torpedo.h"
#include "animationmanager.h"
#include "progressitem.h"
+#include "textinformationitem.h"
//Qt
#include <QtGui/QMessageBox>
@@ -226,8 +227,15 @@ void LostState::onEntry(QEvent *)
//We clear the scene
scene->clearScene();
- //we have only one view
- QMessageBox::information(scene->views().at(0),"You lose",message);
+ //We inform the player
+ scene->textInformationItem->setMessage(message);
+ scene->textInformationItem->show();
+}
+
+void LostState::onExit(QEvent *)
+{
+ //we hide the information
+ scene->textInformationItem->hide();
}
/** Win State */
@@ -242,7 +250,7 @@ void WinState::onEntry(QEvent *)
QString message;
if (scene->levelsData.size() - 1 != game->currentLevel) {
- message = QString("You win the level %1. Your score is %2.\nPress Space to continue after closing this dialog.").arg(game->currentLevel+1).arg(game->score);
+ message = QString("You win the level %1. Your score is %2.\nPress Space to continue.").arg(game->currentLevel+1).arg(game->score);
//We increment the level number
game->currentLevel++;
} else {
@@ -253,8 +261,15 @@ void WinState::onEntry(QEvent *)
game->score = 0;
}
- //we have only one view
- QMessageBox::information(scene->views().at(0),"You win",message);
+ //We inform the player
+ scene->textInformationItem->setMessage(message);
+ scene->textInformationItem->show();
+}
+
+void WinState::onExit(QEvent *)
+{
+ //we hide the information
+ scene->textInformationItem->hide();
}
/** UpdateScore State */
diff --git a/demos/sub-attaq/states.h b/demos/sub-attaq/states.h
index 7635c0c..3176571 100644
--- a/demos/sub-attaq/states.h
+++ b/demos/sub-attaq/states.h
@@ -113,6 +113,7 @@ public:
protected:
void onEntry(QEvent *);
+ void onExit(QEvent *);
private :
GraphicsScene *scene;
PlayState *game;
@@ -125,6 +126,7 @@ public:
protected:
void onEntry(QEvent *);
+ void onExit(QEvent *);
private :
GraphicsScene *scene;
PlayState *game;
diff --git a/demos/sub-attaq/sub-attaq.pro b/demos/sub-attaq/sub-attaq.pro
index ad1327d..ba2b54b 100644
--- a/demos/sub-attaq/sub-attaq.pro
+++ b/demos/sub-attaq/sub-attaq.pro
@@ -1,5 +1,4 @@
contains(QT_CONFIG, opengl):QT += opengl
-
HEADERS += boat.h \
bomb.h \
mainwindow.h \
@@ -13,7 +12,8 @@ HEADERS += boat.h \
submarine_p.h \
custompropertyanimation.h \
qanimationstate.h \
- progressitem.h
+ progressitem.h \
+ textinformationitem.h
SOURCES += boat.cpp \
bomb.cpp \
main.cpp \
@@ -26,12 +26,18 @@ SOURCES += boat.cpp \
states.cpp \
custompropertyanimation.cpp \
qanimationstate.cpp \
- progressitem.cpp
+ progressitem.cpp \
+ textinformationitem.cpp
RESOURCES += subattaq.qrc
# install
target.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sub-attaq.pro pics
+sources.files = $$SOURCES \
+ $$HEADERS \
+ $$RESOURCES \
+ $$FORMS \
+ sub-attaq.pro \
+ pics
sources.path = $$[QT_INSTALL_DEMOS]/animation/sub-attaq
-INSTALLS += target sources
-
+INSTALLS += target \
+ sources
diff --git a/examples/effects/lighting/shadoweffect.cpp b/demos/sub-attaq/textinformationitem.cpp
index 16e52fb..759aa56 100644
--- a/examples/effects/lighting/shadoweffect.cpp
+++ b/demos/sub-attaq/textinformationitem.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -38,39 +38,17 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "textinformationitem.h"
+#include "pixmapitem.h"
-#include "shadoweffect.h"
-
-#include <math.h>
-
-ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source)
- : QGraphicsDropShadowEffect()
- , item(item), m_lightSource(source)
-{
- setBlurRadius(8);
- m_color = color();
-}
-
-void ShadowEffect::adjustForItem()
+TextInformationItem::TextInformationItem (QGraphicsItem * parent)
+ : QGraphicsTextItem(parent)
{
- QPointF delta = item->pos() - m_lightSource->pos();
- setOffset(delta.toPoint() / 30);
-
- qreal dx = delta.x();
- qreal dy = delta.y();
- qreal dd = sqrt(dx * dx + dy * dy);
- m_color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
- setColor(m_color);
+ setFont(QFont("Comic Sans MS", 25));
}
-
-QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const
-{
- const_cast<ShadowEffect *>(this)->adjustForItem();
- return QGraphicsDropShadowEffect::boundingRectFor(rect);
-}
-
-void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+#include <QDebug>
+void TextInformationItem::setMessage(const QString& text)
{
- adjustForItem();
- QGraphicsDropShadowEffect::draw(painter, source);
+ setHtml(text);
+ setPos(parentItem()->boundingRect().center().x() - boundingRect().size().width()/2 , parentItem()->boundingRect().center().y());
}
diff --git a/examples/effects/lighting/shadoweffect.h b/demos/sub-attaq/textinformationitem.h
index 64314e5..aa7f0be 100644
--- a/examples/effects/lighting/shadoweffect.h
+++ b/demos/sub-attaq/textinformationitem.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,28 +39,17 @@
**
****************************************************************************/
-#ifndef SHADOWEFFECT_H
-#define SHADOWEFFECT_H
+#ifndef TEXTINFORMATIONITEM_H
+#define TEXTINFORMATIONITEM_H
-#include <QGraphicsEffect>
-#include <QGraphicsItem>
+//Qt
+#include <QtGui/QGraphicsTextItem>
-class ShadowEffect: public QGraphicsDropShadowEffect
+class TextInformationItem : public QGraphicsTextItem
{
public:
- ShadowEffect(QGraphicsItem *item, QGraphicsItem *source);
-
- QRectF boundingRectFor(const QRectF &rect) const;
-
- void draw(QPainter *painter, QGraphicsEffectSource *source);
-
-private:
- void adjustForItem();
-
-private:
- QColor m_color;
- QGraphicsItem *item;
- QGraphicsItem *m_lightSource;
+ TextInformationItem(QGraphicsItem * parent = 0);
+ void setMessage(const QString& text);
};
-#endif // SHADOWEFFECT_H
+#endif // TEXTINFORMATIONITEM_H
diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp
index a78548c..9644049 100644
--- a/examples/animation/states/main.cpp
+++ b/examples/animation/states/main.cpp
@@ -179,8 +179,8 @@ int main(int argc, char *argv[])
// State 3
state3->assignProperty(button, "text", "Switch to state 1");
- state3->assignProperty(p1, "geometry", QRectF(5, 5, 64, 64));
- state3->assignProperty(p2, "geometry", QRectF(5, 5 + 64 + 5, 64, 64));
+ state3->assignProperty(p1, "geometry", QRectF(0, 5, 64, 64));
+ state3->assignProperty(p2, "geometry", QRectF(0, 5 + 64 + 5, 64, 64));
state3->assignProperty(p3, "geometry", QRectF(5, 5 + (64 + 5) + 64, 64, 64));
state3->assignProperty(p4, "geometry", QRectF(5 + 64 + 5, 5, 64, 64));
state3->assignProperty(p5, "geometry", QRectF(5 + 64 + 5, 5 + 64 + 5, 64, 64));
diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp
index 2294b36..e309e2e 100644
--- a/examples/effects/lighting/lighting.cpp
+++ b/examples/effects/lighting/lighting.cpp
@@ -43,8 +43,6 @@
#include <QtGui>
-#include "shadoweffect.h"
-
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
@@ -98,7 +96,7 @@ void Lighting::setupScene()
item->setPen(QPen(Qt::black));
item->setBrush(QBrush(Qt::white));
- item->setGraphicsEffect(new ShadowEffect(item, m_lightSource));
+ item->setGraphicsEffect(new QGraphicsDropShadowEffect);
item->setZValue(1);
item->setPos(i * 80, j * 80);
m_scene.addItem(item);
@@ -114,6 +112,24 @@ void Lighting::animate()
qreal xs = 200 * sin(angle) - 40 + 25;
qreal ys = 200 * cos(angle) - 40 + 25;
m_lightSource->setPos(xs, ys);
+
+ for (int i = 0; i < m_items.size(); ++i) {
+ QGraphicsItem *item = m_items.at(i);
+ Q_ASSERT(item);
+ QGraphicsDropShadowEffect *effect = static_cast<QGraphicsDropShadowEffect *>(item->graphicsEffect());
+ Q_ASSERT(effect);
+
+ QPointF delta(item->x() - xs, item->y() - ys);
+ effect->setOffset(delta.toPoint() / 30);
+
+ qreal dx = delta.x();
+ qreal dy = delta.y();
+ qreal dd = sqrt(dx * dx + dy * dy);
+ QColor color = effect->color();
+ color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
+ effect->setColor(color);
+ }
+
m_scene.update();
}
diff --git a/examples/effects/lighting/lighting.h b/examples/effects/lighting/lighting.h
index 3e12fdf..eef5cae 100644
--- a/examples/effects/lighting/lighting.h
+++ b/examples/effects/lighting/lighting.h
@@ -45,8 +45,6 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include "shadoweffect.h"
-
class Lighting: public QGraphicsView
{
Q_OBJECT
diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro
index ea9d5f6..432d1b5 100644
--- a/examples/effects/lighting/lighting.pro
+++ b/examples/effects/lighting/lighting.pro
@@ -1,5 +1,5 @@
-SOURCES += main.cpp lighting.cpp shadoweffect.cpp
-HEADERS += lighting.h shadoweffect.h
+SOURCES += main.cpp lighting.cpp
+HEADERS += lighting.h
# install
target.path = $$[QT_INSTALL_EXAMPLES]/effects/lighting
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 621c836..94f85a5 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -1437,6 +1437,9 @@ extern Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent;
HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
{
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(host->window()->winId());
+#endif
EnableWindow(host->window()->winId(), fEnable);
if (!fEnable) {
@@ -1447,7 +1450,9 @@ HRESULT WINAPI QAxClientSite::EnableModeless(BOOL fEnable)
QApplicationPrivate::leaveModal(host);
}
qt_win_ignoreNextMouseReleaseEvent = false;
-
+#if !defined(Q_OS_WINCE)
+ LockWindowUpdate(0);
+#endif
return S_OK;
}
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index 50dedc1..9b7ff5d 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -68,7 +68,7 @@
# if _WIN32_WCE < 0x600 && defined(_X86_)
// For X86 Windows CE, include winbase.h to catch inline functions which
-// overwrite the regular definitions inside of coredll.dll.
+// override the regular definitions inside of coredll.dll.
// Though one could use the original version of Increment/Decrement, others are
// not exported at all.
# include <winbase.h>
@@ -76,19 +76,21 @@
// It's safer to remove the volatile and let the compiler add it as needed.
# define QT_INTERLOCKED_NO_VOLATILE
-# else // _WIN32_WCE >= 0x600 || _X86_
+# else // _WIN32_WCE >= 0x600 || !_X86_
# define QT_INTERLOCKED_PROTOTYPE __cdecl
# define QT_INTERLOCKED_DECLARE_PROTOTYPES
-# if _WIN32_WCE >= 0x600 && defined(_X86_)
-# define QT_INTERLOCKED_PREFIX _
-# define QT_INTERLOCKED_INTRINSIC
+# if _WIN32_WCE >= 0x600
+# if defined(_X86_)
+# define QT_INTERLOCKED_PREFIX _
+# define QT_INTERLOCKED_INTRINSIC
+# endif
# else
# define QT_INTERLOCKED_NO_VOLATILE
# endif
-# endif // _WIN32_WCE >= 0x600 || _X86_
+# endif // _WIN32_WCE >= 0x600 || !_X86_
#endif // Q_OS_WINCE
@@ -131,10 +133,10 @@ extern "C" {
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
-# if !defined(__i386__) && !defined(_M_IX86)
- long QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
- long QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
- __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, long);
+# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+ void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
# endif
}
@@ -190,7 +192,7 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
valueToAdd )
-#if defined(__i386__) || defined(_M_IX86)
+#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
@@ -209,7 +211,7 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
-#else // !defined(__i386__) && !defined(_M_IX86)
+#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \
@@ -227,7 +229,7 @@ extern "C" {
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
-#endif // !defined(__i386__) && !defined(_M_IX86)
+#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 75f8e54..ac9f532 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -122,7 +122,12 @@ void debugBinaryString(const char *data, qint64 maxlen)
*/
QIODevicePrivate::QIODevicePrivate()
: openMode(QIODevice::NotOpen), buffer(QIODEVICE_BUFFERSIZE),
- pos(0), devicePos(0), accessMode(Unset)
+ pos(0), devicePos(0)
+ , baseReadLineDataCalled(false)
+ , accessMode(Unset)
+#ifdef QT_NO_QOBJECT
+ , q_ptr(0)
+#endif
{
}
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 48f34d6..fa3ed09 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -292,14 +292,20 @@ class QTemporaryFileEngine : public QFSFileEngine
Q_DECLARE_PRIVATE(QFSFileEngine)
public:
QTemporaryFileEngine(const QString &file, bool fileIsTemplate = true)
- : QFSFileEngine(file), filePathIsTemplate(fileIsTemplate)
+ : QFSFileEngine(), filePathIsTemplate(fileIsTemplate)
{
+ Q_D(QFSFileEngine);
+ d->filePath = file;
+
+ if (!filePathIsTemplate)
+ QFSFileEngine::setFileName(file);
}
~QTemporaryFileEngine();
bool isReallyOpen();
void setFileName(const QString &file);
+ void setFileTemplate(const QString &fileTemplate);
bool open(QIODevice::OpenMode flags);
bool remove();
@@ -336,6 +342,13 @@ void QTemporaryFileEngine::setFileName(const QString &file)
QFSFileEngine::setFileName(file);
}
+void QTemporaryFileEngine::setFileTemplate(const QString &fileTemplate)
+{
+ Q_D(QFSFileEngine);
+ if (filePathIsTemplate)
+ d->filePath = fileTemplate;
+}
+
bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QFSFileEngine);
@@ -382,12 +395,19 @@ bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
return false;
}
+ QString template_ = d->filePath;
d->filePath = QString::fromLocal8Bit(filename);
- filePathIsTemplate = false;
d->nativeInitFileName();
- d->closeFileHandle = true;
delete [] filename;
- return QFSFileEngine::open(openMode);
+
+ if (QFSFileEngine::open(openMode)) {
+ filePathIsTemplate = false;
+ return true;
+ }
+
+ d->filePath = template_;
+ d->nativeFilePath.clear();
+ return false;
#endif
}
@@ -533,7 +553,8 @@ QTemporaryFile::QTemporaryFile()
QTemporaryFile::QTemporaryFile(const QString &templateName)
: QFile(*new QTemporaryFilePrivate, 0)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
/*!
@@ -567,7 +588,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
- setFileTemplate(templateName);
+ Q_D(QTemporaryFile);
+ d->templateName = templateName;
}
#endif
@@ -671,10 +693,10 @@ QString QTemporaryFile::fileTemplate() const
*/
void QTemporaryFile::setFileTemplate(const QString &name)
{
- Q_ASSERT(!isOpen());
Q_D(QTemporaryFile);
- fileEngine()->setFileName(name);
d->templateName = name;
+ if (d->fileEngine)
+ static_cast<QTemporaryFileEngine*>(d->fileEngine)->setFileTemplate(name);
}
/*!
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 0a6c628..ec8fb76 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -601,7 +601,6 @@ void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent,
void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
QVector<QPersistentModelIndexData *> persistent_moved_explicitly;
QVector<QPersistentModelIndexData *> persistent_moved_in_source;
QVector<QPersistentModelIndexData *> persistent_moved_in_destination;
@@ -2469,7 +2468,6 @@ void QAbstractItemModel::endRemoveRows()
*/
bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation)
{
- Q_Q(QAbstractItemModel);
// Don't move the range within itself.
if ( ( destinationParent == srcParent )
&& ( destinationStart >= start )
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 30f1cc8..c311465 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type)
if (!type || !*type)
return result;
- QVarLengthArray<char> stackbuf((int)strlen(type));
+ QVarLengthArray<char> stackbuf(int(strlen(type)) + 1);
qRemoveWhitespace(type, stackbuf.data());
int templdepth = 0;
qNormalizeType(stackbuf.data(), templdepth, result);
@@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
if (!method || !*method)
return result;
int len = int(strlen(method));
- char stackbuf[64];
- char *buf = (len >= 64 ? new char[len+1] : stackbuf);
- qRemoveWhitespace(method, buf);
- char *d = buf;
+ QVarLengthArray<char> stackbuf(len + 1);
+ char *d = stackbuf.data();
+ qRemoveWhitespace(method, d);
result.reserve(len);
@@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
result += *d++;
}
- if (buf != stackbuf)
- delete [] buf;
return result;
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index ba8ae56..c2bdbee 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -52,6 +52,7 @@
#endif
#include <new>
+#include <string.h>
QT_BEGIN_HEADER
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index df08da1..747ea5e 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\class QMargins
\ingroup painting
- \brief The QMargins
+ \brief The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right and bottom,
that describe the size of the borders surrounding a rectangle.
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
Constructs a margins object with all margins set to 0.
- \sa isValid()
+ \sa isNull()
*/
/*!
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
Constructs margins with the given \a left, \a top, \a right, \a bottom
- \sa setWidth(), setHeight()
+ \sa setLeft(), setRight(), setTop(), setBottom()
*/
/*!
@@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE
Returns true if all margins are is 0; otherwise returns
false.
-
- \sa isValid(), isEmpty()
*/
diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h
index be918cc..549c634 100644
--- a/src/corelib/tools/qmargins.h
+++ b/src/corelib/tools/qmargins.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
-class Q_CORE_EXPORT QMargins
+class QMargins
{
public:
QMargins();
@@ -68,11 +68,6 @@ public:
void setRight(int right);
void setBottom(int bottom);
- int &rleft();
- int &rtop();
- int &rright();
- int &rbottom();
-
private:
int m_left;
int m_top;
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index ccbf7fc..f60e80e 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -335,7 +335,7 @@ void QGraphicsEffect::setEnabled(bool enable)
d->isEnabled = enable;
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
emit enabledChanged(enable);
}
@@ -349,6 +349,22 @@ void QGraphicsEffect::setEnabled(bool enable)
*/
/*!
+ Schedules a redraw of the source. Call this function whenever the source
+ needs to be redrawn.
+
+ This convenience function is equivalent to calling
+ QGraphicsEffectSource::update().
+
+ \sa updateBoundingRect(), QGraphicsEffectSource::update()
+*/
+void QGraphicsEffect::update()
+{
+ Q_D(QGraphicsEffect);
+ if (d->source)
+ d->source->update();
+}
+
+/*!
Returns a pointer to the source, which provides extra context information
that can be useful for the effect.
@@ -366,13 +382,15 @@ QGraphicsEffectSource *QGraphicsEffect::source() const
function whenever you change any parameters that will cause the virtual
boundingRectFor() function to return a different value.
+ This function will call update() if this is necessary.
+
\sa boundingRectFor(), boundingRect()
*/
void QGraphicsEffect::updateBoundingRect()
{
Q_D(QGraphicsEffect);
if (d->source)
- d->source->update();
+ d->source->d_func()->effectBoundingRectChanged();
}
/*!
@@ -523,6 +541,7 @@ void QGraphicsColorizeEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -610,6 +629,7 @@ void QGraphicsPixelizeEffect::setPixelSize(int size)
return;
d->pixelSize = size;
+ update();
emit pixelSizeChanged(size);
}
@@ -820,7 +840,7 @@ QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
By default, the offset is 8 pixels towards the lower right.
- \sa blurRadius(), color()
+ \sa xOffset(), yOffset(), blurRadius(), color()
*/
QPointF QGraphicsDropShadowEffect::offset() const
{
@@ -840,6 +860,24 @@ void QGraphicsDropShadowEffect::setOffset(const QPointF &offset)
}
/*!
+ \property QGraphicsDropShadowEffect::xOffset
+ \brief the horizontal shadow offset in pixels.
+
+ By default, the horizontal shadow offset is 8 pixels.
+
+ \sa yOffset(), offset()
+*/
+
+/*!
+ \property QGraphicsDropShadowEffect::yOffset
+ \brief the vertical shadow offset in pixels.
+
+ By default, the vertical shadow offset is 8 pixels.
+
+ \sa xOffset(), offset()
+*/
+
+/*!
\fn void QGraphicsDropShadowEffect::offsetChanged(const QPointF &offset)
This signal is emitted whenever the effect's shadow offset changes.
@@ -903,6 +941,7 @@ void QGraphicsDropShadowEffect::setColor(const QColor &color)
return;
d->filter->setColor(color);
+ update();
emit colorChanged(color);
}
@@ -1012,6 +1051,7 @@ void QGraphicsOpacityEffect::setOpacity(qreal opacity)
d->isFullyOpaque = 0;
else
d->isFullyOpaque = qFuzzyIsNull(d->opacity - 1);
+ update();
emit opacityChanged(opacity);
}
@@ -1050,6 +1090,7 @@ void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask)
d->opacityMask = mask;
d->hasOpacityMask = (mask.style() != Qt::NoBrush);
+ update();
emit opacityMaskChanged(mask);
}
@@ -1088,19 +1129,20 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour
const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset);
painter->drawPixmap(offset, pixmap);
} else {
- QRectF srcBrect = source->boundingRect();
- QPixmap pixmap(srcBrect.size().toSize());
+ QRect srcBrect = source->boundingRect().toAlignedRect();
+ offset = srcBrect.topLeft();
+ QPixmap pixmap(srcBrect.size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
pixmapPainter.setRenderHints(painter->renderHints());
- pixmapPainter.translate(-srcBrect.topLeft());
+ pixmapPainter.translate(-offset);
source->draw(&pixmapPainter);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
pixmapPainter.fillRect(srcBrect, d->opacityMask);
pixmapPainter.end();
- painter->drawPixmap(srcBrect.topLeft(), pixmap);
+ painter->drawPixmap(offset, pixmap);
}
} else {
// Draw pixmap in device coordinates to avoid pixmap scaling;
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index 8e5384c..aee7834 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -118,7 +118,7 @@ public:
public Q_SLOTS:
void setEnabled(bool enable);
- // ### add update() slot
+ void update();
Q_SIGNALS:
void enabledChanged(bool enabled);
@@ -237,6 +237,8 @@ class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal xOffset READ xOffset WRITE setXOffset NOTIFY offsetChanged)
+ Q_PROPERTY(qreal yOffset READ yOffset WRITE setYOffset NOTIFY offsetChanged)
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
@@ -245,15 +247,31 @@ public:
QRectF boundingRectFor(const QRectF &rect) const;
QPointF offset() const;
+
+ inline qreal xOffset() const
+ { return offset().x(); }
+
+ inline qreal yOffset() const
+ { return offset().y(); }
+
int blurRadius() const;
QColor color() const;
public Q_SLOTS:
void setOffset(const QPointF &ofs);
+
inline void setOffset(qreal dx, qreal dy)
{ setOffset(QPointF(dx, dy)); }
+
inline void setOffset(qreal d)
{ setOffset(QPointF(d, d)); }
+
+ inline void setXOffset(qreal dx)
+ { setOffset(QPointF(dx, yOffset())); }
+
+ inline void setYOffset(qreal dy)
+ { setOffset(QPointF(xOffset(), dy)); }
+
void setBlurRadius(int blurRadius);
void setColor(const QColor &color);
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index bfabfc0..24b605f 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -76,6 +76,7 @@ public:
virtual void update() = 0;
virtual bool isPixmap() const = 0;
virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0) const = 0;
+ virtual void effectBoundingRectChanged() = 0;
friend class QGraphicsScenePrivate;
friend class QGraphicsItem;
friend class QGraphicsItemPrivate;
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 9dc1204..cf34c6e 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -611,6 +611,9 @@ public:
inline void update()
{ item->update(); }
+ inline void effectBoundingRectChanged()
+ { item->prepareGeometryChange(); }
+
inline bool isPixmap() const
{
return (item->type() == QGraphicsPixmapItem::Type);
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4ea6af..e23677f 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -888,10 +888,9 @@ void QIcon::setThemeSearchPaths(const QStringList &paths)
On X11, the search path will use the XDG_DATA_DIRS environment
variable if available.
- On Windows the search path defaults to [Application Directory]/icons
-
- On Mac the default search path will search in the
- [Contents/Resources/icons] part of the application bundle.
+ By default all platforms will have the resource directory
+ ":\icons" as their fallback. You can use "rcc -project"
+ to generate a resource file from your icon theme.
\sa setThemeSearchPaths(), fromTheme(), setThemeName()
*/
@@ -906,7 +905,7 @@ QStringList QIcon::themeSearchPaths()
Sets the current icon theme to \a name.
The \a name should correspond to a directory name in the
- current themeSearchPath() containing an index.theme
+ themeSearchPath() containing an index.theme
file describing it's contents.
\sa themeSearchPaths(), themeName()
@@ -939,10 +938,6 @@ QString QIcon::themeName()
icon theme. If no such icon is found in the current theme
\a fallback is return instead.
- To use an icon theme on Windows or Mac, you will need to
- bundle a compliant theme with your application and make sure
- it is located in your themeSarchPaths.
-
The lastest version of the freedesktop icon specification and naming
spesification can be obtained here:
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 279703c..cb1cc61 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -187,14 +187,17 @@ QStringList QIconLoader::themeSearchPaths() const
QDir homeDir(QDir::homePath() + QLatin1String("/.icons"));
if (homeDir.exists())
m_iconDirs.prepend(homeDir.path());
-
-#elif defined(Q_WS_WIN)
+#endif
+
+#if defined(Q_WS_WIN)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/icons"));
#elif defined(Q_WS_MAC)
m_iconDirs.append(qApp->applicationDirPath() +
QLatin1String("/../Resources/icons"));
#endif
+ // Allways add resource directory as search path
+ m_iconDirs.append(QLatin1String(":/icons"));
}
return m_iconDirs;
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 2b82f49..89af452 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2892,6 +2892,12 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt:
Q_ASSERT(src->height == dest->height);
QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
+ if (colorTable.size() == 0) {
+ colorTable.resize(256);
+ for (int i=0; i<256; ++i)
+ colorTable[i] = qRgb(i, i, i);
+
+ }
int w = src->width;
const uchar *src_data = src->data;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 07c5454..ea98cb2 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -956,6 +956,7 @@ QModelIndex QAbstractItemView::currentIndex() const
void QAbstractItemView::reset()
{
Q_D(QAbstractItemView);
+ d->delayedReset.stop(); //make sure we stop the timer
QList<QEditorInfo>::const_iterator it = d->editors.constBegin();
for (; it != d->editors.constEnd(); ++it)
d->releaseEditor(it->editor);
@@ -2208,7 +2209,9 @@ void QAbstractItemView::timerEvent(QTimerEvent *event)
Q_D(QAbstractItemView);
if (event->timerId() == d->fetchMoreTimer.timerId())
d->fetchMore();
- if (event->timerId() == d->autoScrollTimer.timerId())
+ else if (event->timerId() == d->delayedReset.timerId())
+ reset();
+ else if (event->timerId() == d->autoScrollTimer.timerId())
doAutoScroll();
else if (event->timerId() == d->updateTimer.timerId())
d->updateDirtyRegion();
@@ -3132,9 +3135,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &, int, int)
*/
void QAbstractItemViewPrivate::_q_modelDestroyed()
{
- Q_Q(QAbstractItemView);
model = QAbstractItemModelPrivate::staticEmptyModel();
- QMetaObject::invokeMethod(q, "reset", Qt::QueuedConnection);
+ doDelayedReset();
}
/*!
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 4517941..434d644 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -328,6 +328,15 @@ public:
QStyleOptionViewItemV4 viewOptionsV4() const;
+ void doDelayedReset()
+ {
+ //we delay the reset of the timer because some views (QTableView)
+ //with headers can't handle the fact that the model has been destroyed
+ //all _q_modelDestroyed slots must have been called
+ if (!delayedReset.isActive())
+ delayedReset.start(0, q_func());
+ }
+
QAbstractItemModel *model;
QPointer<QAbstractItemDelegate> itemDelegate;
QMap<int, QPointer<QAbstractItemDelegate> > rowDelegates;
@@ -389,6 +398,7 @@ public:
QBasicTimer updateTimer;
QBasicTimer delayedEditing;
QBasicTimer delayedAutoScroll; //used when an item is clicked
+ QBasicTimer delayedReset;
QAbstractItemView::ScrollMode verticalScrollMode;
QAbstractItemView::ScrollMode horizontalScrollMode;
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index a1c3e4e..4dbd6dc 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const
/*!
Returns the logicalIndex for the section at the given \a visualIndex
- position, or -1 otherwise.
+ position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count().
+
+ Note that the visualIndex is not affected by hidden sections.
\sa visualIndex(), sectionPosition()
*/
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 37ffa8fb..863c43e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5962,6 +5962,8 @@ bool QWidget::hasFocus() const
isActiveWindow() active window\endlink. The \a reason argument will
be passed into any focus event sent from this function, it is used
to give an explanation of what caused the widget to get focus.
+ If the window is not active, the widget will be given the focus when
+ the window becomes active.
First, a focus out event is sent to the focus widget (if any) to
tell it that it is about to lose the focus. Then a focus in event
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ff0c453..f69c3a7 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -727,6 +727,16 @@ public:
inline bool isPixmap() const
{ return false; }
+ inline void effectBoundingRectChanged()
+ {
+ // ### This function should take a rect parameter; then we can avoid
+ // updating too much on the parent widget.
+ if (QWidget *parent = m_widget->parentWidget())
+ parent->update();
+ else
+ m_widget->update();
+ }
+
inline const QStyleOption *styleOption() const
{ return 0; }
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 422d5a3..173c870 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -298,7 +298,7 @@ QT_BEGIN_NAMESPACE
/*!
\enum QColor::Spec
- The type of color specified, either RGB, HSV or CMYK.
+ The type of color specified, either RGB, HSV, CMYK or HSL.
\value Rgb
\value Hsv
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 6d957ca..20f1d26 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -561,14 +561,20 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi
QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));
painter->setPen(QPen(mdiButtonBorderColor, 1));
- painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());
- painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());
- painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);
- painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);
- painter->drawPoint(tmp.left() + 1, tmp.top() + 1);
- painter->drawPoint(tmp.right() - 1, tmp.top() + 1);
- painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);
- painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);
+ const QLine lines[4] = {
+ QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
+ QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
+ QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
+ QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(tmp.left() + 1, tmp.top() + 1),
+ QPoint(tmp.right() - 1, tmp.top() + 1),
+ QPoint(tmp.left() + 1, tmp.bottom() - 1),
+ QPoint(tmp.right() - 1, tmp.bottom() - 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(titleBarHighlight);
painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);
@@ -900,14 +906,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QRect r = rect.adjusted(0, 1, 0, -1);
painter->setPen(buttonShadowAlpha);
painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1));
- painter->drawPoint(r.right() - 1, r.top());
- painter->drawPoint(r.right(), r.top() + 1);
- painter->drawPoint(r.right() - 1, r.bottom());
- painter->drawPoint(r.right(), r.bottom() - 1);
- painter->drawPoint(r.left() + 1, r.top() );
- painter->drawPoint(r.left(), r.top() + 1);
- painter->drawPoint(r.left() + 1, r.bottom() );
- painter->drawPoint(r.left(), r.bottom() - 1);
+ const QPoint points[8] = {
+ QPoint(r.right() - 1, r.top()),
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.bottom()),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() ),
+ QPoint(r.left(), r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() ),
+ QPoint(r.left(), r.bottom() - 1)
+ };
+ painter->drawPoints(points, 8);
painter->setPen(QPen(option->palette.background().color(), 1));
painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
@@ -939,10 +948,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points2[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points2, 4);
painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
painter->setPen(oldPen);
}
@@ -1040,10 +1052,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->setBrush(QBrush(dark.darker(120), Qt::Dense4Pattern));
painter->setBrushOrigin(rect.topLeft());
painter->setPen(Qt::NoPen);
- painter->drawRect(rect.left(), rect.top(), rect.width(), 1); // Top
- painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom
- painter->drawRect(rect.left(), rect.top(), 1, rect.height()); // Left
- painter->drawRect(rect.right(), rect.top(), 1, rect.height()); // Right
+ const QRect rects[4] = {
+ QRect(rect.left(), rect.top(), rect.width(), 1), // Top
+ QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom
+ QRect(rect.left(), rect.top(), 1, rect.height()), // Left
+ QRect(rect.right(), rect.top(), 1, rect.height()) // Right
+ };
+ painter->drawRects(rects, 4);
painter->restore();
}
break;
@@ -1065,18 +1080,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r = option->rect.adjusted(0, 1, 0, -1);
painter->setPen(QPen(Qt::black, 0));
- painter->drawLine(QPoint(r.left() + 2, r.top()),
- QPoint(r.right() - 2, r.top()));
- painter->drawLine(QPoint(r.left(), r.top() + 2),
- QPoint(r.left(), r.bottom() - 2));
- painter->drawLine(QPoint(r.right(), r.top() + 2),
- QPoint(r.right(), r.bottom() - 2));
- painter->drawLine(QPoint(r.left() + 2, r.bottom()),
- QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.top()),
+ QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.left(), r.top() + 2),
+ QPoint(r.left(), r.bottom() - 2)),
+ QLine(QPoint(r.right(), r.top() + 2),
+ QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left() + 2, r.bottom()),
+ QPoint(r.right() - 2, r.bottom()))
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(oldPen);
}
return;
@@ -1140,10 +1161,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QPoint(r.right(), r.bottom() - 2));
p->drawLine(QPoint(r.left() + 2, r.bottom()),
QPoint(r.right() - 2, r.bottom()));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ p->drawPoints(points, 4);
if (!isDefault && !hasFocus && isEnabled)
p->setPen(QPen(darkOutline.darker(110), 0));
@@ -1163,14 +1187,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
topShadow.setAlpha(60);
p->setPen(topShadow);
- p->drawPoint(QPoint(r.right(), r.top() + 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() ));
- p->drawPoint(QPoint(r.right(), r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() ));
- p->drawPoint(QPoint(r.left() + 1, r.bottom()));
- p->drawPoint(QPoint(r.left(), r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top()));
- p->drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points2[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ p->drawPoints(points2, 8);
topShadow.setAlpha(30);
p->setPen(topShadow);
@@ -1183,18 +1210,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r.adjust(-1, -1, 1, 1);
p->setPen(buttonShadowAlpha.darker(120));
- p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0));
- p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0));
- p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3));
- p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3));
- p->drawPoint(r.topRight() + QPoint(-2, 1));
- p->drawPoint(r.topRight() + QPoint(-1, 2));
- p->drawPoint(r.bottomRight() + QPoint(-1, -2));
- p->drawPoint(r.bottomRight() + QPoint(-2, -1));
- p->drawPoint(r.topLeft() + QPoint(1, 2));
- p->drawPoint(r.topLeft() + QPoint(2, 1));
- p->drawPoint(r.bottomLeft() + QPoint(1, -2));
- p->drawPoint(r.bottomLeft() + QPoint(2, -1));
+ const QLine lines[4] = {
+ QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)),
+ QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)),
+ QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)),
+ QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3))
+ };
+ p->drawLines(lines, 4);
+ const QPoint points3[8] = {
+ r.topRight() + QPoint(-2, 1),
+ r.topRight() + QPoint(-1, 2),
+ r.bottomRight() + QPoint(-1, -2),
+ r.bottomRight() + QPoint(-2, -1),
+ r.topLeft() + QPoint(1, 2),
+ r.topLeft() + QPoint(2, 1),
+ r.bottomLeft() + QPoint(1, -2),
+ r.bottomLeft() + QPoint(2, -1)
+ };
+ p->drawPoints(points3, 8);
}
painter->setPen(oldPen);
painter->setBrush(oldBrush);
@@ -1307,12 +1340,15 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(innerBottomLine);
painter->setPen(alphaCornerColor);
- painter->drawPoint(leftBottomInnerCorner1);
- painter->drawPoint(leftBottomInnerCorner2);
- painter->drawPoint(rightBottomInnerCorner1);
- painter->drawPoint(rightBottomInnerCorner2);
- painter->drawPoint(leftTopInnerCorner1);
- painter->drawPoint(leftTopInnerCorner2);
+ const QPoint points[6] = {
+ leftBottomInnerCorner1,
+ leftBottomInnerCorner2,
+ rightBottomInnerCorner1,
+ rightBottomInnerCorner2,
+ leftTopInnerCorner1,
+ leftTopInnerCorner2
+ };
+ painter->drawPoints(points, 6);
}
#endif // QT_NO_TABWIDGET
painter->restore();
@@ -1670,19 +1706,25 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
painter->fillRect(rect, option->palette.base());
QColor borderColor = dark.lighter(110);
painter->setPen(QPen(borderColor, 0));
- painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top()));
- painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom()));
- painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1));
- painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1));
+ const QLine lines[4] = {
+ QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())),
+ QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())),
+ QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)),
+ QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1))
+ };
+ painter->drawLines(lines, 4);
QColor alphaCorner = mergedColors(borderColor, option->palette.background().color());
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
//corner smoothing
painter->setPen(alphaCorner);
- painter->drawPoint(rect.topRight());
- painter->drawPoint(rect.topLeft());
- painter->drawPoint(rect.bottomRight());
- painter->drawPoint(rect.bottomLeft());
+ const QPoint points[4] = {
+ rect.topRight(),
+ rect.topLeft(),
+ rect.bottomRight(),
+ rect.bottomLeft()
+ };
+ painter->drawPoints(points, 4);
//inner shadow
painter->setPen(innerShadow);
@@ -1807,10 +1849,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
option->palette.highlight());
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
@@ -1864,10 +1909,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
highlight);
r = r.adjusted(-1, 0, 1, 0);
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
} else {
painter->fillRect(option->rect, menuBackground);
}
@@ -2447,14 +2495,17 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(topShadow);
// antialias corners
- cachePainter.drawPoint(QPoint(r.right(), r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() ));
- cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() ));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom()));
- cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top()));
- cachePainter.drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 8);
// draw frame
topShadow.setAlpha(30);
@@ -2482,10 +2533,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(QPen(darkOutline, 1));
// top and bottom lines
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
- cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
}
// gradients
@@ -2519,10 +2573,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->frame) {
// rounded corners
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1),
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 4);
if (option->state & State_HasFocus) {
QColor darkoutline = option->palette.highlight().color().darker(150);
@@ -2531,10 +2588,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->direction == Qt::LeftToRight) {
cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3));
cachePainter.setPen(QPen(darkoutline, 0));
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top()));
- cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())),
+ QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
@@ -2679,18 +2739,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// top outline
painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
- painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4);
+ const QPoint points[5] = {
+ QPoint(fullRect.left() + 4, fullRect.top() + 1),
+ QPoint(fullRect.left() + 3, fullRect.top() + 1),
+ QPoint(fullRect.left() + 2, fullRect.top() + 2),
+ QPoint(fullRect.left() + 1, fullRect.top() + 3),
+ QPoint(fullRect.left() + 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points, 5);
painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
- painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4);
+ const QPoint points2[5] = {
+ QPoint(fullRect.right() - 3, fullRect.top() + 1),
+ QPoint(fullRect.right() - 4, fullRect.top() + 1),
+ QPoint(fullRect.right() - 2, fullRect.top() + 2),
+ QPoint(fullRect.right() - 1, fullRect.top() + 3),
+ QPoint(fullRect.right() - 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points2, 5);
// draw bottomline
painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom());
@@ -2749,10 +2815,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(maxButtonIconRect.topLeft());
- painter->drawPoint(maxButtonIconRect.topRight());
- painter->drawPoint(maxButtonIconRect.bottomLeft());
- painter->drawPoint(maxButtonIconRect.bottomRight());
+ const QPoint points[4] = {
+ maxButtonIconRect.topLeft(),
+ maxButtonIconRect.topRight(),
+ maxButtonIconRect.bottomLeft(),
+ maxButtonIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
}
}
@@ -2765,18 +2834,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
qt_cleanlooks_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
painter->setPen(textAlphaColor);
- painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(),
- closeIconRect.right(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1,
- closeIconRect.right() - 1, closeIconRect.bottom());
- painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(),
- closeIconRect.left(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1,
- closeIconRect.left() + 1, closeIconRect.bottom());
- painter->drawPoint(closeIconRect.topLeft());
- painter->drawPoint(closeIconRect.topRight());
- painter->drawPoint(closeIconRect.bottomLeft());
- painter->drawPoint(closeIconRect.bottomRight());
+ const QLine lines[4] = {
+ QLine(closeIconRect.left() + 1, closeIconRect.top(),
+ closeIconRect.right(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.left(), closeIconRect.top() + 1,
+ closeIconRect.right() - 1, closeIconRect.bottom()),
+ QLine(closeIconRect.right() - 1, closeIconRect.top(),
+ closeIconRect.left(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.right(), closeIconRect.top() + 1,
+ closeIconRect.left() + 1, closeIconRect.bottom())
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ closeIconRect.topLeft(),
+ closeIconRect.topRight(),
+ closeIconRect.bottomLeft(),
+ closeIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
painter->setPen(textColor);
painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
@@ -2806,10 +2881,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
frontWindowRect.right() - 1, frontWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(frontWindowRect.topLeft());
- painter->drawPoint(frontWindowRect.topRight());
- painter->drawPoint(frontWindowRect.bottomLeft());
- painter->drawPoint(frontWindowRect.bottomRight());
+ const QPoint points[4] = {
+ frontWindowRect.topLeft(),
+ frontWindowRect.topRight(),
+ frontWindowRect.bottomLeft(),
+ frontWindowRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
QRegion clipRegion = backWindowRect;
@@ -2821,10 +2899,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
backWindowRect.right() - 1, backWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(backWindowRect.topLeft());
- painter->drawPoint(backWindowRect.topRight());
- painter->drawPoint(backWindowRect.bottomLeft());
- painter->drawPoint(backWindowRect.bottomRight());
+ const QPoint points2[4] = {
+ backWindowRect.topLeft(),
+ backWindowRect.topRight(),
+ backWindowRect.bottomLeft(),
+ backWindowRect.bottomRight()
+ };
+ painter->drawPoints(points2, 4);
painter->restore();
}
}
@@ -3498,10 +3579,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
handlePainter.save();
handlePainter.setRenderHint(QPainter::Antialiasing);
handlePainter.translate(0.5, 0.5);
- handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top()));
- handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())),
+ QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()))
+ };
+ handlePainter.drawLines(lines, 4);
handlePainter.restore();;
handlePainter.setPen(QPen(outline.darker(130), 1));
handlePainter.drawLine(QPoint(r.left() + 3, r.top()), QPoint(r.right() - 3, r.top()));
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index a54c701..3789854 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -1094,7 +1094,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
theme.rect = option->rect;
- bool reverse = bar->direction == (Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
+ bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
QTime current = QTime::currentTime();
if (isIndeterminate) {
diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp
index dfd8639..8ed57cd 100644
--- a/src/gui/widgets/qcalendarwidget.cpp
+++ b/src/gui/widgets/qcalendarwidget.cpp
@@ -1967,9 +1967,7 @@ void QCalendarWidgetPrivate::_q_editingFinished()
The widget is initialized with the current month and year, but
QCalendarWidget provides several public slots to change the year
- and month that is shown. The currently displayed month and year
- can be retrieved using the currentPageMonth() and currentPageYear()
- functions, respectively.
+ and month that is shown.
By default, today's date is selected, and the user can select a
date using both mouse and keyboard. The currently selected date
@@ -1982,6 +1980,9 @@ void QCalendarWidgetPrivate::_q_editingFinished()
all. Note that a date also can be selected programmatically using
the setSelectedDate() slot.
+ The currently displayed month and year can be retrieved using the
+ monthShown() and yearShown() functions, respectively.
+
A newly created calendar widget uses abbreviated day names, and
both Saturdays and Sundays are marked in red. The calendar grid is
not visible. The week numbers are displayed, and the first column
@@ -2287,7 +2288,7 @@ int QCalendarWidget::monthShown() const
selected date.
The currently displayed month and year can be retrieved using the
- currentPageMonth() and currentPageYear() functions respectively.
+ monthShown() and yearShown() functions respectively.
\sa yearShown(), monthShown(), showPreviousMonth(), showNextMonth(),
showPreviousYear(), showNextYear()
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index e68aa3a..da9ec09 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -519,7 +519,7 @@ bool QHttpNetworkConnectionPrivate::fillPipeline(QList<HttpMessagePair> &queue,
if (queue.isEmpty())
return true;
- for (int i = 0; i < queue.length(); i++) {
+ for (int i = queue.count() - 1; i >= 0; --i) {
HttpMessagePair messagePair = queue.at(i);
const QHttpNetworkRequest &request = messagePair.first;
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 3e56995..3d9aa61 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -389,10 +389,19 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb
qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data");
}
- // Set the send and receive buffer sizes to a magic size, found
- // most optimal for our platforms.
- setReceiveBufferSize(49152);
- setSendBufferSize(49152);
+ // Before Qt 4.6, we always set the send and receive buffer size to 49152 as
+ // this was found to be an optimal value. However, modern OS
+ // all have some kind of auto tuning for this and we therefore don't set
+ // this explictly anymore.
+ // If it introduces any performance regressions for Qt 4.6.x (x > 0) then
+ // it will be put back in.
+ //
+ // You can use tests/manual/qhttpnetworkconnection to test HTTP download speed
+ // with this.
+ //
+ // pre-4.6:
+ // setReceiveBufferSize(49152);
+ // setSendBufferSize(49152);
d->socketType = socketType;
d->socketProtocol = protocol;
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index 666770d..3793b1e 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -250,14 +250,22 @@ void QSslCertificate::clear()
*/
QByteArray QSslCertificate::version() const
{
+ if (d->versionString.isEmpty() && d->x509)
+ d->versionString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version)) + 1);
+
return d->versionString;
}
/*!
- Returns the certificate's serial number string.
+ Returns the certificate's serial number string in decimal format.
*/
QByteArray QSslCertificate::serialNumber() const
{
+ if (d->serialNumberString.isEmpty() && d->x509)
+ d->serialNumberString =
+ QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)));
+
return d->serialNumberString;
}
diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp
index 69d2ccd..d47c91d 100644
--- a/src/network/ssl/qsslerror.cpp
+++ b/src/network/ssl/qsslerror.cpp
@@ -105,10 +105,8 @@ public:
};
/*!
- Constructs a QSslError object. The two optional arguments specify the \a
- error that occurred, and which \a certificate the error relates to.
+ Constructs a QSslError object with no error and default certificate.
- \sa QSslCertificate
*/
// RVCT compiler in debug build does not like about default values in const-
@@ -120,6 +118,11 @@ QSslError::QSslError()
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The argument specifies the \a
+ error that occurred.
+
+*/
QSslError::QSslError(SslError error)
: d(new QSslErrorPrivate)
{
@@ -127,6 +130,12 @@ QSslError::QSslError(SslError error)
d->certificate = QSslCertificate();
}
+/*!
+ Constructs a QSslError object. The two arguments specify the \a
+ error that occurred, and which \a certificate the error relates to.
+
+ \sa QSslCertificate
+*/
QSslError::QSslError(SslError error, const QSslCertificate &certificate)
: d(new QSslErrorPrivate)
{
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 5b04a57..d3dcd51 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE
#ifdef SSLEAY_MACROS
DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return)
#endif
+DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return)
DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return)
DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return)
@@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols()
#ifdef SSLEAY_MACROS
RESOLVEFUNC(ASN1_dup)
#endif
+ RESOLVEFUNC(ASN1_INTEGER_get)
RESOLVEFUNC(ASN1_STRING_data)
RESOLVEFUNC(ASN1_STRING_length)
RESOLVEFUNC(BIO_ctrl)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index f9c92e5..30762ca 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE
#endif // !defined QT_LINKED_OPENSSL
bool q_resolveOpenSslSymbols();
+long q_ASN1_INTEGER_get(ASN1_INTEGER *a);
unsigned char * q_ASN1_STRING_data(ASN1_STRING *a);
int q_ASN1_STRING_length(ASN1_STRING *a);
long q_BIO_ctrl(BIO *a, int b, long c, void *d);
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a976a02..0c01263 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -380,7 +380,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
}
if (simpleShaderDepthUniformDirty) {
- shaderManager->simpleProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(q->state()->currentDepth));
simpleShaderDepthUniformDirty = false;
}
}
@@ -731,7 +731,6 @@ void QGL2PaintEngineExPrivate::resetGLState()
glActiveTexture(GL_TEXTURE0);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LESS);
glDepthMask(true);
glClearDepth(1);
}
@@ -959,7 +958,7 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
}
if (depthUniformDirty) {
- shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), (GLfloat)q->state()->currentDepth);
+ shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Depth), normalizedDeviceDepth(q->state()->currentDepth));
depthUniformDirty = false;
}
@@ -1351,7 +1350,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
if (!d->inRenderText) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glDepthMask(false);
}
@@ -1441,7 +1440,7 @@ void QGL2PaintEngineEx::ensureActive()
if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
setState(state());
d->needsSync = false;
}
@@ -1492,7 +1491,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
d->regenerateDepthClip();
} else {
if (d->use_system_clip) {
- state()->currentDepth = -0.5f;
+ state()->currentDepth = 0;
} else {
state()->depthTestEnabled = false;
}
@@ -1501,7 +1500,7 @@ void QGL2PaintEngineEx::clipEnabledChanged()
}
}
-void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
+void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint depth)
{
transferMode(BrushDrawingMode);
@@ -1510,7 +1509,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
if (q->state()->needsDepthBufferClear) {
glDepthMask(true);
- glClearDepth(0.5);
+ glClearDepth(rawDepth(2));
glClear(GL_DEPTH_BUFFER_BIT);
q->state()->needsDepthBufferClear = false;
glDepthMask(false);
@@ -1532,7 +1531,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
glColorMask(false, false, false, false);
glDepthMask(true);
- shaderManager->simpleProgram()->setUniformValue("depth", depth);
+ shaderManager->simpleProgram()->setUniformValue("depth", normalizedDeviceDepth(depth));
simpleShaderDepthUniformDirty = true;
glEnable(GL_DEPTH_TEST);
@@ -1596,12 +1595,12 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
glDepthFunc(GL_ALWAYS);
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
d->writeClip(qtVectorPathForPath(path), state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->depthTestEnabled = true;
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
}
@@ -1610,7 +1609,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
if (d->use_system_clip) {
glEnable(GL_DEPTH_TEST);
state()->depthTestEnabled = true;
- state()->currentDepth = -0.5;
+ state()->currentDepth = 0;
} else {
glDisable(GL_DEPTH_TEST);
state()->depthTestEnabled = false;
@@ -1618,18 +1617,18 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
state()->canRestoreClip = false;
break;
case Qt::IntersectClip:
- state()->maxDepth = (1.0f + state()->maxDepth) * 0.5;
+ ++state()->maxDepth;
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 1.5 * state()->maxDepth - 0.5f;
+ state()->currentDepth = state()->maxDepth - 1;
state()->depthTestEnabled = true;
break;
case Qt::ReplaceClip:
d->systemStateChanged();
state()->rectangleClip = QRect();
- state()->maxDepth = 0.5f;
+ state()->maxDepth = 4;
glDepthFunc(GL_ALWAYS);
d->writeClip(path, state()->maxDepth);
- state()->currentDepth = 0.25f;
+ state()->currentDepth = 3;
state()->canRestoreClip = false;
state()->depthTestEnabled = true;
break;
@@ -1641,7 +1640,7 @@ void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
break;
}
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
if (state()->depthTestEnabled) {
glEnable(GL_DEPTH_TEST);
d->simpleShaderDepthUniformDirty = true;
@@ -1672,8 +1671,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
glDisable(GL_SCISSOR_TEST);
- q->state()->currentDepth = -0.5f;
- q->state()->maxDepth = 0.5f;
+ q->state()->currentDepth = 1;
+ q->state()->maxDepth = 4;
q->state()->rectangleClip = QRect(0, 0, width, height);
@@ -1708,8 +1707,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
path.addRegion(systemClip);
glDepthFunc(GL_ALWAYS);
- writeClip(qtVectorPathForPath(path), 0.0f);
- glDepthFunc(GL_LEQUAL);
+ writeClip(qtVectorPathForPath(path), 2);
+ glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_TEST);
q->state()->depthTestEnabled = true;
@@ -1718,7 +1717,7 @@ void QGL2PaintEngineExPrivate::systemStateChanged()
q->transformChanged();
}
- q->state()->currentDepth = -0.5f;
+ q->state()->currentDepth = 1;
simpleShaderDepthUniformDirty = true;
depthUniformDirty = true;
}
@@ -1757,7 +1756,7 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state && old_state != s && old_state->canRestoreClip) {
d->updateDepthScissorTest();
glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
+ glDepthFunc(GL_LESS);
s->maxDepth = old_state->maxDepth;
} else {
d->regenerateDepthClip();
@@ -1802,8 +1801,8 @@ QOpenGL2PaintEngineState::QOpenGL2PaintEngineState()
needsDepthBufferClear = true;
depthTestEnabled = false;
scissorTestEnabled = false;
- currentDepth = -0.5f;
- maxDepth = 0.5f;
+ currentDepth = 1;
+ maxDepth = 4;
canRestoreClip = true;
hasRectangleClip = false;
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 58fcde1..552e390 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -82,8 +82,8 @@ public:
bool depthTestEnabled;
bool scissorTestEnabled;
- qreal currentDepth;
- qreal maxDepth;
+ uint maxDepth;
+ uint currentDepth;
bool canRestoreClip;
QRect rectangleClip;
@@ -230,13 +230,26 @@ public:
QGLEngineShaderManager* shaderManager;
- void writeClip(const QVectorPath &path, float depth);
+ void writeClip(const QVectorPath &path, uint depth);
void updateDepthScissorTest();
void setScissor(const QRect &rect);
void regenerateDepthClip();
void systemStateChanged();
uint use_system_clip : 1;
+ static inline GLfloat rawDepth(uint depth)
+ {
+ // assume at least 16 bits in the depth buffer, and
+ // use 2^15 depth levels to be safe with regard to
+ // rounding issues etc
+ return depth * (1.0f / GLfloat((1 << 15) - 1));
+ }
+
+ static inline GLfloat normalizedDeviceDepth(uint depth)
+ {
+ return 2.0f * rawDepth(depth) - 1.0f;
+ }
+
uint location(QGLEngineShaderManager::Uniform uniform)
{
return shaderManager->getUniformLocation(uniform);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 9659654..8fd113a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -875,9 +875,22 @@ QImage QGLFramebufferObject::toImage() const
if (!d->valid)
return QImage();
- const_cast<QGLFramebufferObject *>(this)->bind();
+ // qt_gl_read_framebuffer doesn't work on a multisample FBO
+ if (format().samples() != 0) {
+ QGLFramebufferObject temp(size());
+
+ QRect rect(QPoint(0, 0), size());
+ blitFramebuffer(&temp, rect, const_cast<QGLFramebufferObject *>(this), rect);
+
+ return temp.toImage();
+ }
+
+ bool wasBound = isBound();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->bind();
QImage image = qt_gl_read_framebuffer(d->size, d->ctx->format().alpha(), true);
- const_cast<QGLFramebufferObject *>(this)->release();
+ if (!wasBound)
+ const_cast<QGLFramebufferObject *>(this)->release();
return image;
}
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c4d9322..56b55d0 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source)
return d->compile(this);
} else if (d->shader) {
QVarLengthArray<const char *> src;
+ int headerLen = 0;
+ while (source && source[headerLen] == '#') {
+ // Skip #version and #extension directives at the start of
+ // the shader code. We need to insert the qualifierDefines
+ // and redefineHighp just after them.
+ if (qstrncmp(source + headerLen, "#version", 8) != 0 &&
+ qstrncmp(source + headerLen, "#extension", 10) != 0) {
+ break;
+ }
+ while (source[headerLen] != '\0' && source[headerLen] != '\n')
+ ++headerLen;
+ if (source[headerLen] == '\n')
+ ++headerLen;
+ }
+ QByteArray header;
+ if (headerLen > 0) {
+ header = QByteArray(source, headerLen);
+ src.append(header.constData());
+ }
#ifdef QGL_DEFINE_QUALIFIERS
src.append(qualifierDefines);
#endif
@@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source)
d->shaderType == PartialFragmentShader)
src.append(redefineHighp);
#endif
- src.append(source);
+ src.append(source + headerLen);
QGLContextGroup *ctx = d->ctx;
glShaderSource(d->shader, src.size(), src.data(), 0);
return d->compile(this);
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index de985d8..0f6a349 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -234,7 +234,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
#define LM(l, m) (((m)<<8)|l)
digress = false;
- int initial = length;
+ const int initial = length;
while (!digress && length) {
length--;
unsigned char ch=*buffer++;
@@ -333,7 +333,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
sheight = newtop + newheight;
QImage::Format format = trans_index >= 0 ? QImage::Format_ARGB32 : QImage::Format_RGB32;
- if (image->isNull() || (image->size() != QSize(swidth, sheight)) || image->format() != format) {
+ if (image->isNull()) {
(*image) = QImage(swidth, sheight, format);
memset(image->bits(), 0, image->numBytes());
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 742d596..2692c96 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
}
}
- char* buf = new char[colSize];
+ QVarLengthArray<char> buf(colSize);
while (true) {
r = SQLGetData(hStmt,
column+1,
unicode ? SQL_C_WCHAR : SQL_C_CHAR,
- (SQLPOINTER)buf,
+ (SQLPOINTER)buf.data(),
colSize,
&lengthIndicator);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
@@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// colSize-1: remove 0 termination when there is more data to fetch
int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString((QChar*) buf, rSize / 2);
+ fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
} else {
- fieldVal += QString::fromAscii(buf, rSize);
+ fieldVal += QString::fromAscii(buf.constData(), rSize);
}
- if (lengthIndicator - fieldVal.size() <= 0) {
+ memset(buf.data(), 0, colSize);
+ if (lengthIndicator < colSize) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
break;
}
@@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
break;
}
}
- delete[] buf;
return fieldVal;
}
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
index 6425dcd..dd0615d 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
+++ b/tests/auto/qabstractitemmodel/dynamictreemodel.cpp
@@ -41,13 +41,10 @@
#include "dynamictreemodel.h"
-#include <QHash>
-#include <QList>
-#include <QTimer>
+#include <QtCore/QHash>
+#include <QtCore/QList>
+#include <QtCore/QTimer>
-#include <QDebug>
-
-#include <kdebug.h>
DynamicTreeModel::DynamicTreeModel(QObject *parent)
: QAbstractItemModel(parent),
diff --git a/tests/auto/qabstractitemmodel/dynamictreemodel.h b/tests/auto/qabstractitemmodel/dynamictreemodel.h
index d84bf68..a769c38 100644
--- a/tests/auto/qabstractitemmodel/dynamictreemodel.h
+++ b/tests/auto/qabstractitemmodel/dynamictreemodel.h
@@ -42,14 +42,11 @@
#ifndef DYNAMICTREEMODEL_H
#define DYNAMICTREEMODEL_H
-#include <QAbstractItemModel>
+#include <QtCore/QAbstractItemModel>
-#include <QHash>
-#include <QList>
+#include <QtCore/QHash>
+#include <QtCore/QList>
-#include <QDebug>
-
-#include <kdebug.h>
template<typename T> class QList;
diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
index 84ed5a2..a31868b 100644
--- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
+++ b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
SOURCES += tst_qabstractitemmodel.cpp dynamictreemodel.cpp
HEADERS += dynamictreemodel.h
-QT = core
+
diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
index da65e7d..58832c7 100644
--- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -43,7 +43,7 @@
#include <QtTest/QtTest>
#include <QtCore/QtCore>
-#include <QSortFilterProxyModel>
+#include <QtGui/QSortFilterProxyModel>
//TESTED_CLASS=QAbstractListModel QAbstractTableModel
//TESTED_FILES=
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index a807e62..e6364c8 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -5417,6 +5417,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation()
qt_x11_wait_for_window_manager(&view);
#endif
view.resize(200, 200);
+ QTest::qWait(250);
QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(10, 10),
view.viewport()->mapToGlobal(QPoint(10, 10)));
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index 6549be8..419eb71 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -189,7 +189,9 @@ void tst_QHttpNetworkConnection::head()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
QVERIFY(reply->isFinished());
@@ -249,7 +251,9 @@ void tst_QHttpNetworkConnection::get()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
stopWatch.start();
QByteArray ba;
diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/qicon/tst_qicon.cpp
index b614ab9..bacf7a5 100644
--- a/tests/auto/qicon/tst_qicon.cpp
+++ b/tests/auto/qicon/tst_qicon.cpp
@@ -609,8 +609,7 @@ void tst_QIcon::task184901_badCache()
void tst_QIcon::fromTheme()
{
- const QString prefix = QLatin1String(SRCDIR) + QLatin1String("/");
- QString searchPath = prefix + QLatin1String("/icons");
+ QString searchPath = QLatin1String(":/icons");
QIcon::setThemeSearchPaths(QStringList() << searchPath);
QVERIFY(QIcon::themeSearchPaths().size() == 1);
QCOMPARE(searchPath, QIcon::themeSearchPaths()[0]);
diff --git a/tests/auto/qicon/tst_qicon.qrc b/tests/auto/qicon/tst_qicon.qrc
index 1e1a030..7925a33 100644
--- a/tests/auto/qicon/tst_qicon.qrc
+++ b/tests/auto/qicon/tst_qicon.qrc
@@ -2,5 +2,19 @@
<qresource prefix="/">
<file>image.png</file>
<file>rect.png</file>
+<file>./icons/testtheme/16x16/actions/appointment-new.png</file>
+<file>./icons/testtheme/22x22/actions/appointment-new.png</file>
+<file>./icons/testtheme/32x32/actions/appointment-new.png</file>
+<file>./icons/testtheme/index.theme</file>
+<file>./icons/testtheme/scalable/actions/svg-only.svg</file>
+<file>./icons/themeparent/16x16/actions/address-book-new.png</file>
+<file>./icons/themeparent/16x16/actions/appointment-new.png</file>
+<file>./icons/themeparent/22x22/actions/address-book-new.png</file>
+<file>./icons/themeparent/22x22/actions/appointment-new.png</file>
+<file>./icons/themeparent/32x32/actions/address-book-new.png</file>
+<file>./icons/themeparent/32x32/actions/appointment-new.png</file>
+<file>./icons/themeparent/index.theme</file>
+<file>./icons/themeparent/scalable/actions/address-book-new.svg</file>
+<file>./icons/themeparent/scalable/actions/appointment-new.svg</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/images/qt.gif b/tests/auto/qimagereader/images/qt.gif
new file mode 100644
index 0000000..e0a5a80
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt1.gif b/tests/auto/qimagereader/images/qt1.gif
new file mode 100644
index 0000000..0ce910c
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt1.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt2.gif b/tests/auto/qimagereader/images/qt2.gif
new file mode 100644
index 0000000..993a315
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt2.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt3.gif b/tests/auto/qimagereader/images/qt3.gif
new file mode 100644
index 0000000..7391678
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt3.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt4.gif b/tests/auto/qimagereader/images/qt4.gif
new file mode 100644
index 0000000..41109a9
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt4.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt5.gif b/tests/auto/qimagereader/images/qt5.gif
new file mode 100644
index 0000000..5a3fb54
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt5.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt6.gif b/tests/auto/qimagereader/images/qt6.gif
new file mode 100644
index 0000000..f22e7c9
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt6.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt7.gif b/tests/auto/qimagereader/images/qt7.gif
new file mode 100644
index 0000000..a315671
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt7.gif
Binary files differ
diff --git a/tests/auto/qimagereader/images/qt8.gif b/tests/auto/qimagereader/images/qt8.gif
new file mode 100644
index 0000000..2a7d09e
--- /dev/null
+++ b/tests/auto/qimagereader/images/qt8.gif
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index c6b963b..11b9406 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -1,5 +1,5 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource>
+<RCC>
+ <qresource prefix="/" >
<file>images/16bpp.bmp</file>
<file>images/4bpp-rle.bmp</file>
<file>images/YCbCr_cmyk.jpg</file>
@@ -48,5 +48,14 @@
<file>images/tst7.png</file>
<file>images/transparent.xpm</file>
<file>images/trolltech.gif</file>
+ <file>images/qt.gif</file>
+ <file>images/qt1.gif</file>
+ <file>images/qt2.gif</file>
+ <file>images/qt3.gif</file>
+ <file>images/qt4.gif</file>
+ <file>images/qt5.gif</file>
+ <file>images/qt6.gif</file>
+ <file>images/qt7.gif</file>
+ <file>images/qt8.gif</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 27c6925..a325a33 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -140,6 +140,7 @@ private slots:
#if defined QTEST_HAVE_GIF
void gifHandlerBugs();
+ void animatedGif();
#endif
void readCorruptImage_data();
@@ -710,6 +711,18 @@ void tst_QImageReader::gifHandlerBugs()
QCOMPARE(im1.convertToFormat(QImage::Format_ARGB32), im2.convertToFormat(QImage::Format_ARGB32));
}
}
+
+void tst_QImageReader::animatedGif()
+{
+ QImageReader io(prefix + "qt.gif");
+ QImage image= io.read();
+ int i=0;
+ while(!image.isNull()){
+ QString frameName = QString(prefix + "qt%1.gif").arg(++i);
+ QCOMPARE(image, QImage(frameName));
+ image=io.read();
+ }
+}
#endif
class Server : public QObject
diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/qmargins/tst_qmargins.cpp
index 070aa19..6ee2495 100644
--- a/tests/auto/qmargins/tst_qmargins.cpp
+++ b/tests/auto/qmargins/tst_qmargins.cpp
@@ -9,8 +9,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** 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
@@ -21,25 +21,24 @@
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** 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.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
-
#include <QtTest/QtTest>
#include <qmargins.h>
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 52e967f..a223d1c 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1366,8 +1366,10 @@ void tst_QNetworkReply::getFromHttp()
QCOMPARE(reply->url(), request.url());
QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
+ QCOMPARE(reply->size(), reference.size());
+ // only compare when the header is set.
+ if (reply->header(QNetworkRequest::ContentLengthHeader).isValid())
+ QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
QCOMPARE(reply->readAll(), reference.readAll());
}
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index 26c1f9b..9c4cbc4 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -1145,8 +1145,9 @@ void tst_QPainterPath::testToFillPolygons()
path.lineTo(QPointF(70, 100));
path.lineTo(QPointF(40, 100));
- QPolygonF polygon = path.toFillPolygons(QMatrix()).first();
- QCOMPARE(polygon.count(QPointF(70, 50)), 2);
+ const QList<QPolygonF> polygons = path.toFillPolygons();
+ QCOMPARE(polygons.size(), 2);
+ QCOMPARE(polygons.first().count(QPointF(70, 50)), 0);
}
void tst_QPainterPath::connectPathDuplicatePoint()
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 02ab1cc..7752a4f 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -95,6 +95,9 @@ private slots:
void fromImage_data();
void fromImage();
+ void fromUninitializedImage_data();
+ void fromUninitializedImage();
+
void convertFromImage_data();
void convertFromImage();
@@ -318,6 +321,32 @@ void tst_QPixmap::fromImage()
QCOMPARE(result, image);
}
+
+void tst_QPixmap::fromUninitializedImage_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+
+ QTest::newRow("Format_Mono") << QImage::Format_Mono;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
+}
+
+void tst_QPixmap::fromUninitializedImage()
+{
+ QFETCH(QImage::Format, format);
+
+ QImage image(100, 100, format);
+ QPixmap pix = QPixmap::fromImage(image);
+
+ // it simply shouldn't crash...
+ QVERIFY(true);
+
+}
+
void tst_QPixmap::convertFromImage_data()
{
QTest::addColumn<QImage>("img1");
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index a6b887a..e9a0670 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -180,6 +180,8 @@ private slots:
void odbc_uintfield();
void odbc_bindBoolean_data() { generic_data("QODBC"); }
void odbc_bindBoolean();
+ void odbc_testqGetString_data() { generic_data("QODBC"); }
+ void odbc_testqGetString();
void oci_serverDetach_data() { generic_data("QOCI"); }
void oci_serverDetach(); // For task 154518
@@ -347,6 +349,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
<< qTableName("numericfields")
<< qTableName("qtest_ibaseblobs")
<< qTableName("qtestBindBool")
+ << qTableName("testqGetString")
<< qTableName("qtest_sqlguid")
<< qTableName("uint_table")
<< qTableName("uint_test")
@@ -2024,6 +2027,44 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QCOMPARE(q.value(1).toBool(), false);
}
+void tst_QSqlDatabase::odbc_testqGetString()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))"));
+
+ QString largeString;
+ largeString.fill('A', 65536);
+
+ // Bind and insert
+ QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)"));
+ q.bindValue(0, 1);
+ q.bindValue(1, largeString);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(0, 2);
+ q.bindValue(1, largeString+QLatin1Char('B'));
+ QVERIFY_SQL(q, exec());
+ q.bindValue(0, 3);
+ q.bindValue(1, largeString+QLatin1Char('B')+QLatin1Char('C'));
+ QVERIFY_SQL(q, exec());
+
+ // Retrive
+ QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id"));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1);
+ QCOMPARE(q.value(1).toString().length(), 65536);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 2);
+ QCOMPARE(q.value(1).toString().length(), 65537);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 3);
+ QCOMPARE(q.value(1).toString().length(), 65538);
+}
+
+
void tst_QSqlDatabase::mysql_multiselect()
{
QFETCH(QString, dbName);
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index add48c4..4dfb6b9 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -267,6 +267,8 @@ void tst_QSslCertificate::compareCertificates(
QCOMPARE(cert1.alternateSubjectNames(), cert2.alternateSubjectNames());
QCOMPARE(cert1.effectiveDate(), cert2.effectiveDate());
QCOMPARE(cert1.expiryDate(), cert2.expiryDate());
+ QCOMPARE(cert1.version(), cert2.version());
+ QCOMPARE(cert1.serialNumber(), cert2.serialNumber());
// ### add more functions here ...
}
@@ -677,7 +679,9 @@ void tst_QSslCertificate::certInfo()
QCOMPARE(cert.subjectInfo("C"), QString("NO"));
QCOMPARE(cert.subjectInfo("ST"), QString());
- QCOMPARE(cert.version(), QByteArray());
+ QCOMPARE(cert.version(), QByteArray::number(1));
+ QCOMPARE(cert.serialNumber(), QByteArray::number(17));
+
QCOMPARE(cert.toPem().constData(), (const char*)pem);
QCOMPARE(cert.toDer(), QByteArray::fromHex(der));
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index b797c39..5a84cc1 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -93,6 +93,8 @@ private slots:
void renameFdLeak();
void reOpenThroughQFile();
void keepOpenMode();
+ void resetTemplateAfterError();
+ void setTemplateAfterOpen();
public:
};
@@ -476,5 +478,85 @@ void tst_QTemporaryFile::keepOpenMode()
}
}
+void tst_QTemporaryFile::resetTemplateAfterError()
+{
+ // calling setFileTemplate on a failed open
+
+ QString tempPath = QDir::tempPath();
+
+ QString const fileTemplate("destination/qt_temp_file_test.XXXXXX");
+ QString const fileTemplate2(tempPath + "/qt_temp_file_test.XXXXXX");
+
+ QVERIFY2( QDir(tempPath).exists() || QDir().mkpath(tempPath), "Test precondition" );
+ QVERIFY2( !QFile::exists("destination"), "Test precondition" );
+ QVERIFY2( !QFile::exists(fileTemplate2) || QFile::remove(fileTemplate2), "Test precondition" );
+
+ QFile file(fileTemplate2);
+ QByteArray fileContent("This file is intentionally NOT left empty.");
+
+ QVERIFY( file.open(QIODevice::ReadWrite | QIODevice::Truncate) );
+ QCOMPARE( file.write(fileContent), (qint64)fileContent.size() );
+ QVERIFY( file.flush() );
+
+ QString fileName;
+ {
+ QTemporaryFile temp;
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+
+ temp.setFileTemplate( fileTemplate );
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QCOMPARE( temp.fileTemplate(), fileTemplate );
+
+ QVERIFY( !temp.open() );
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QCOMPARE( temp.fileTemplate(), fileTemplate );
+
+ temp.setFileTemplate( fileTemplate2 );
+ QVERIFY( temp.open() );
+
+ fileName = temp.fileName();
+ QVERIFY( QFile::exists(fileName) );
+ QVERIFY( !fileName.isEmpty() );
+ QVERIFY2( fileName != fileTemplate2,
+ ("Generated name shouldn't be same as template: " + fileTemplate2).toLocal8Bit().constData() );
+ }
+
+ QVERIFY( !QFile::exists(fileName) );
+
+ file.seek(0);
+ QCOMPARE( QString(file.readAll()), QString(fileContent) );
+ QVERIFY( file.remove() );
+}
+
+void tst_QTemporaryFile::setTemplateAfterOpen()
+{
+ QTemporaryFile temp;
+
+ QVERIFY( temp.fileName().isEmpty() );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+
+ QVERIFY( temp.open() );
+
+ QString const fileName = temp.fileName();
+ QString const newTemplate("funny-path/funny-name-XXXXXX.tmp");
+
+ QVERIFY( !fileName.isEmpty() );
+ QVERIFY( QFile::exists(fileName) );
+ QVERIFY( !temp.fileTemplate().isEmpty() );
+ QVERIFY( temp.fileTemplate() != newTemplate );
+
+ temp.close(); // QTemporaryFile::setFileTemplate will assert on isOpen() up to 4.5.2
+ temp.setFileTemplate(newTemplate);
+ QCOMPARE( temp.fileTemplate(), newTemplate );
+
+ QVERIFY( temp.open() );
+ QCOMPARE( temp.fileName(), fileName );
+ QCOMPARE( temp.fileTemplate(), newTemplate );
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index ef43c3a..6709807 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -233,6 +233,7 @@ private slots:
void task239271_addRowsWithFirstColumnHidden();
void task254234_proxySort();
void task248022_changeSelection();
+ void task245654_changeModelAndExpandAll();
};
class QtTestModel: public QAbstractItemModel
@@ -3463,6 +3464,35 @@ void tst_QTreeView::task248022_changeSelection()
QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count());
}
+void tst_QTreeView::task245654_changeModelAndExpandAll()
+{
+ QTreeView view;
+ QStandardItemModel *model = new QStandardItemModel;
+ QStandardItem *top = new QStandardItem("top");
+ QStandardItem *sub = new QStandardItem("sub");
+ top->appendRow(sub);
+ model->appendRow(top);
+ view.setModel(model);
+ view.expandAll();
+ QApplication::processEvents();
+ QVERIFY(view.isExpanded(top->index()));
+
+ //now let's try to delete the model
+ //then repopulate and expand again
+ delete model;
+ model = new QStandardItemModel;
+ top = new QStandardItem("top");
+ sub = new QStandardItem("sub");
+ top->appendRow(sub);
+ model->appendRow(top);
+ view.setModel(model);
+ view.expandAll();
+ QApplication::processEvents();
+ QVERIFY(view.isExpanded(top->index()));
+
+}
+
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
new file mode 100644
index 0000000..0d563b9
--- /dev/null
+++ b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qgraphicsanchorlayout
+
+SOURCES += tst_qgraphicsanchorlayout.cpp
+
diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
new file mode 100644
index 0000000..e419bae
--- /dev/null
+++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtOpenGL 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtGui/qgraphicsanchorlayout.h>
+#include <QtGui/qgraphicswidget.h>
+#include <QtGui/qgraphicsview.h>
+
+class tst_QGraphicsAnchorLayout : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QGraphicsAnchorLayout() {}
+ ~tst_QGraphicsAnchorLayout() {}
+
+private slots:
+ void s60_hard_complex_data();
+ void s60_hard_complex();
+};
+
+
+class RectWidget : public QGraphicsWidget
+{
+public:
+ RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){}
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->drawRoundRect(rect());
+ painter->drawLine(rect().topLeft(), rect().bottomRight());
+ painter->drawLine(rect().bottomLeft(), rect().topRight());
+ }
+};
+
+static QGraphicsWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0),
+ const QSizeF &preferred = QSize(150.0, 100.0),
+ const QSizeF &maximum = QSizeF(200.0, 100.0),
+ const QString &name = QString())
+{
+ QGraphicsWidget *w = new RectWidget;
+ w->setMinimumSize(minimum);
+ w->setPreferredSize(preferred);
+ w->setMaximumSize(maximum);
+ w->setData(0, name);
+ return w;
+}
+
+static void setAnchor(QGraphicsAnchorLayout *l,
+ QGraphicsLayoutItem *firstItem,
+ Qt::AnchorPoint firstEdge,
+ QGraphicsLayoutItem *secondItem,
+ Qt::AnchorPoint secondEdge,
+ qreal spacing)
+{
+ l->addAnchor(firstItem, firstEdge, secondItem, secondEdge);
+ l->setAnchorSpacing(firstItem, firstEdge, secondItem, secondEdge, spacing);
+}
+
+void tst_QGraphicsAnchorLayout::s60_hard_complex_data()
+{
+ QTest::addColumn<int>("whichSizeHint");
+ QTest::newRow("minimumSizeHint")
+ << int(Qt::MinimumSize);
+ QTest::newRow("preferredSizeHint")
+ << int(Qt::PreferredSize);
+ QTest::newRow("maximumSizeHint")
+ << int(Qt::MaximumSize);
+ // Add it as a reference to see how much overhead the body of effectiveSizeHint takes.
+ QTest::newRow("noSizeHint")
+ << -1;
+}
+
+void tst_QGraphicsAnchorLayout::s60_hard_complex()
+{
+ QFETCH(int, whichSizeHint);
+
+ // Test for "hard" complex case, taken from wiki
+ // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases
+ QSizeF min(0, 10);
+ QSizeF pref(50, 10);
+ QSizeF max(100, 10);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "a");
+ QGraphicsWidget *b = createItem(min, pref, max, "b");
+ QGraphicsWidget *c = createItem(min, pref, max, "c");
+ QGraphicsWidget *d = createItem(min, pref, max, "d");
+ QGraphicsWidget *e = createItem(min, pref, max, "e");
+ QGraphicsWidget *f = createItem(min, pref, max, "f");
+ QGraphicsWidget *g = createItem(min, pref, max, "g");
+
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ l->setContentsMargins(0, 0, 0, 0);
+
+ //<!-- Trunk -->
+ setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10);
+ setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10);
+ setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 10);
+ setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 10);
+ setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 10);
+
+ //<!-- Above trunk -->
+ setAnchor(l, b, Qt::AnchorLeft, e, Qt::AnchorLeft, 10);
+ setAnchor(l, e, Qt::AnchorRight, d, Qt::AnchorLeft, 10);
+
+ //<!-- Below trunk -->
+ setAnchor(l, a, Qt::AnchorHorizontalCenter, g, Qt::AnchorLeft, 10);
+ setAnchor(l, g, Qt::AnchorRight, f, Qt::AnchorHorizontalCenter, 10);
+ setAnchor(l, c, Qt::AnchorLeft, f, Qt::AnchorLeft, 10);
+ setAnchor(l, f, Qt::AnchorRight, d, Qt::AnchorRight, 10);
+
+ //<!-- vertical is simpler -->
+ setAnchor(l, l, Qt::AnchorTop, e, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, a, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, b, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, c, Qt::AnchorTop, 0);
+ setAnchor(l, e, Qt::AnchorBottom, d, Qt::AnchorTop, 0);
+ setAnchor(l, a, Qt::AnchorBottom, f, Qt::AnchorTop, 0);
+ setAnchor(l, a, Qt::AnchorBottom, b, Qt::AnchorBottom, 0);
+ setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorBottom, 0);
+ setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0);
+ setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0);
+ setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+
+ // It won't query the size hint if it already has a size set.
+ // If only one of the sizes is unset it will query sizeHint only of for that hint type.
+ l->setMinimumSize(60,40);
+ l->setPreferredSize(220,40);
+ l->setMaximumSize(240,40);
+
+ switch (whichSizeHint) {
+ case Qt::MinimumSize:
+ l->setMinimumSize(-1, -1);
+ break;
+ case Qt::PreferredSize:
+ l->setPreferredSize(-1, -1);
+ break;
+ case Qt::MaximumSize:
+ l->setMaximumSize(-1, -1);
+ break;
+ default:
+ break;
+ }
+
+ QSizeF sizeHint;
+ // warm up instruction cache
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ // ...then measure...
+ QBENCHMARK {
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ }
+}
+
+QTEST_MAIN(tst_QGraphicsAnchorLayout)
+
+#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/manual/qhttpnetworkconnection/main.cpp b/tests/manual/qhttpnetworkconnection/main.cpp
new file mode 100644
index 0000000..b15a7ed
--- /dev/null
+++ b/tests/manual/qhttpnetworkconnection/main.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the 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 contains benchmarks for QNetworkReply functions.
+
+#include <QDebug>
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtNetwork/qnetworkreply.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+#include "../../auto/network-settings.h"
+
+class tst_qhttpnetworkconnection : public QObject
+{
+ Q_OBJECT
+private slots:
+ void bigRemoteFile();
+
+};
+
+void tst_qhttpnetworkconnection::bigRemoteFile()
+{
+ QNetworkAccessManager manager;
+ qint64 size;
+ QTime t;
+ QNetworkRequest request(QUrl("http://nds1.nokia.com/files/support/global/phones/software/Nokia_Ovi_Suite_webinstaller.exe"));
+ QNetworkReply* reply = manager.get(request);
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ qDebug() << "Starting download";
+ t.start();
+ QTestEventLoop::instance().enterLoop(50);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ size = reply->size();
+ delete reply;
+ qDebug() << "Finished!" << endl;
+ qDebug() << "Time:" << t.elapsed() << "msec";
+ qDebug() << "Bytes:" << size;
+ qDebug() << "Speed:" << (size / 1024) / (t.elapsed() / 1000) << "KB/sec";
+}
+
+QTEST_MAIN(tst_qhttpnetworkconnection)
+
+#include "main.moc"
diff --git a/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
new file mode 100644
index 0000000..2471389
--- /dev/null
+++ b/tests/manual/qhttpnetworkconnection/qhttpnetworkconnection.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qhttpnetworkconnection
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/qtabletevent/device_information/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp
index 0c2eda3..69867bc 100644
--- a/tests/manual/qtabletevent/device_information/main.cpp
+++ b/tests/manual/qtabletevent/device_information/main.cpp
@@ -3,14 +3,14 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the test suite module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** 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
@@ -21,20 +21,20 @@
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** 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.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h
index b16e9ed..d3ccb32 100644
--- a/tests/manual/qtabletevent/device_information/tabletwidget.h
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.h
@@ -9,8 +9,8 @@
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** 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
@@ -21,20 +21,20 @@
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** 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.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp
index 3b869e3..26611d3 100644
--- a/tests/manual/qtabletevent/event_compression/main.cpp
+++ b/tests/manual/qtabletevent/event_compression/main.cpp
@@ -3,14 +3,14 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the test suite module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** 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
@@ -21,20 +21,20 @@
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** 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.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index b02edec..c0bc3d47 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -254,7 +254,6 @@ span.string,span.char
}
.qmltype {
- // font-weight: bold;
text-align: center;
font-size: 160%;
}