summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/animation/stickman/lifecycle.cpp4
-rw-r--r--examples/dialogs/findfiles/window.cpp2
-rw-r--r--examples/effects/blurpicker/blureffect.cpp4
-rw-r--r--examples/effects/blurpicker/blureffect.h2
-rw-r--r--examples/effects/blurpicker/blurpicker.cpp53
-rw-r--r--examples/effects/blurpicker/blurpicker.h12
-rw-r--r--examples/effects/customshader/blureffect.cpp4
-rw-r--r--examples/effects/customshader/blureffect.h2
-rw-r--r--examples/effects/customshader/blurpicker.cpp53
-rw-r--r--examples/effects/customshader/blurpicker.h12
-rw-r--r--examples/effects/effects.pro6
-rw-r--r--examples/effects/fademessage/fademessage.cpp28
-rw-r--r--examples/effects/fademessage/fademessage.h5
-rw-r--r--examples/effects/fademessage/fademessage.pro3
-rw-r--r--examples/effects/lighting/lighting.cpp2
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/gestures/gestures.pro2
-rw-r--r--examples/gestures/imagegestures/imagegestures.pro16
-rw-r--r--examples/gestures/imagegestures/imagewidget.cpp (renamed from examples/gestures/imageviewer/imagewidget.cpp)73
-rw-r--r--examples/gestures/imagegestures/imagewidget.h (renamed from examples/gestures/imageviewer/imagewidget.h)19
-rw-r--r--examples/gestures/imagegestures/main.cpp59
-rw-r--r--examples/gestures/imagegestures/mainwidget.cpp56
-rw-r--r--examples/gestures/imagegestures/mainwidget.h65
-rw-r--r--examples/gestures/imageviewer/imageviewer.pro14
-rw-r--r--examples/graphicsview/anchorlayout/anchorlayout.pro10
-rw-r--r--examples/graphicsview/anchorlayout/main.cpp4
-rw-r--r--examples/graphicsview/graphicsview.pro3
-rw-r--r--examples/graphicsview/simpleanchorlayout/main.cpp134
-rw-r--r--examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro9
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/5days.jpgbin0 -> 5748 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/details.jpgbin0 -> 5323 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/place.jpgbin0 -> 62438 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/tabbar.jpgbin0 -> 849 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/title.jpgbin0 -> 3472 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.pngbin0 -> 18976 bytes
-rw-r--r--examples/graphicsview/weatheranchorlayout/main.cpp267
-rw-r--r--examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro14
-rw-r--r--examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc10
-rw-r--r--examples/help/contextsensitivehelp/doc/source.html6
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qchbin27648 -> 25600 bytes
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhcbin10240 -> 8192 bytes
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhp46
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.ui2
-rw-r--r--examples/mainwindows/mdi/mainwindow.cpp2
-rw-r--r--examples/mainwindows/sdi/mainwindow.h2
-rw-r--r--examples/multimedia/audio/audio.pro10
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp (renamed from examples/multimedia/audio/audiodevices/audiodevices.cpp)2
-rw-r--r--examples/multimedia/audiodevices/audiodevices.h (renamed from examples/multimedia/audio/audiodevices/audiodevices.h)0
-rw-r--r--examples/multimedia/audiodevices/audiodevices.pro (renamed from examples/multimedia/audio/audiodevices/audiodevices.pro)4
-rw-r--r--examples/multimedia/audiodevices/audiodevicesbase.ui (renamed from examples/multimedia/audio/audiodevices/audiodevicesbase.ui)0
-rw-r--r--examples/multimedia/audiodevices/main.cpp (renamed from examples/multimedia/audio/audiodevices/main.cpp)0
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp (renamed from examples/multimedia/audio/audioinput/audioinput.cpp)10
-rw-r--r--examples/multimedia/audioinput/audioinput.h (renamed from examples/multimedia/audio/audioinput/audioinput.h)0
-rw-r--r--examples/multimedia/audioinput/audioinput.pro (renamed from examples/multimedia/audio/audioinput/audioinput.pro)4
-rw-r--r--examples/multimedia/audioinput/main.cpp (renamed from examples/multimedia/audio/audioinput/main.cpp)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp (renamed from examples/multimedia/audio/audiooutput/audiooutput.cpp)12
-rw-r--r--examples/multimedia/audiooutput/audiooutput.h (renamed from examples/multimedia/audio/audiooutput/audiooutput.h)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.pro (renamed from examples/multimedia/audio/audiooutput/audiooutput.pro)4
-rw-r--r--examples/multimedia/audiooutput/main.cpp (renamed from examples/multimedia/audio/audiooutput/main.cpp)0
-rw-r--r--examples/multimedia/multimedia.pro14
-rw-r--r--examples/multimedia/videographicsitem/main.cpp (renamed from examples/video/videographicsitem/main.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videographicsitem.pro (renamed from examples/video/videographicsitem/videographicsitem.pro)4
-rw-r--r--examples/multimedia/videographicsitem/videoitem.cpp (renamed from examples/video/videographicsitem/videoitem.cpp)4
-rw-r--r--examples/multimedia/videographicsitem/videoitem.h (renamed from examples/video/videographicsitem/videoitem.h)0
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.cpp (renamed from examples/video/videographicsitem/videoplayer.cpp)3
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.h (renamed from examples/video/videographicsitem/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/main.cpp (renamed from examples/video/videowidget/main.cpp)0
-rw-r--r--examples/multimedia/videowidget/videoplayer.cpp (renamed from examples/video/videowidget/videoplayer.cpp)3
-rw-r--r--examples/multimedia/videowidget/videoplayer.h (renamed from examples/video/videowidget/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.cpp (renamed from examples/video/videowidget/videowidget.cpp)2
-rw-r--r--examples/multimedia/videowidget/videowidget.h (renamed from examples/video/videowidget/videowidget.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.pro (renamed from examples/video/videowidget/videowidget.pro)6
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.cpp (renamed from examples/video/videowidget/videowidgetsurface.cpp)4
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.h (renamed from examples/video/videowidget/videowidgetsurface.h)0
-rw-r--r--examples/multitouch/pinchzoom/graphicsview.cpp20
-rw-r--r--examples/multitouch/pinchzoom/graphicsview.h3
-rw-r--r--examples/network/blockingfortuneclient/blockingclient.cpp17
-rw-r--r--examples/network/fortuneclient/client.cpp4
-rw-r--r--examples/network/fortuneserver/server.cpp4
-rw-r--r--examples/network/googlesuggest/googlesuggest.cpp58
-rw-r--r--examples/network/googlesuggest/googlesuggest.h6
-rw-r--r--examples/network/googlesuggest/searchbox.cpp7
-rw-r--r--examples/network/googlesuggest/searchbox.h2
-rw-r--r--examples/network/network.pro1
-rw-r--r--examples/network/qftp/sym_iap_util.h4
-rw-r--r--examples/network/threadedfortuneserver/dialog.cpp4
-rw-r--r--examples/opengl/hellogl_es/hellogl_es.pro9
-rw-r--r--examples/opengl/hellogl_es2/glwidget.cpp30
-rw-r--r--examples/opengl/hellogl_es2/hellogl_es2.pro6
-rw-r--r--examples/opengl/pbuffers/cube.h2
-rw-r--r--examples/opengl/pbuffers/glwidget.cpp8
-rw-r--r--examples/opengl/pbuffers/glwidget.h2
-rw-r--r--examples/opengl/textures/glwidget.cpp12
-rw-r--r--examples/painting/svggenerator/svggenerator.pro5
-rw-r--r--examples/script/customclass/bytearrayclass.cpp17
-rw-r--r--examples/tools/regexp/regexpdialog.cpp4
-rw-r--r--examples/video/video.pro6
-rw-r--r--examples/webkit/domtraversal/domtraversal.pro11
-rw-r--r--examples/webkit/domtraversal/main.cpp52
-rw-r--r--examples/webkit/domtraversal/window.cpp (renamed from examples/gestures/imageviewer/main.cpp)68
-rw-r--r--examples/webkit/domtraversal/window.h71
-rw-r--r--examples/webkit/domtraversal/window.ui89
-rw-r--r--examples/webkit/fancybrowser/mainwindow.cpp7
-rw-r--r--examples/webkit/simpleselector/main.cpp54
-rw-r--r--examples/webkit/simpleselector/simpleselector.pro11
-rw-r--r--examples/webkit/simpleselector/window.cpp81
-rw-r--r--examples/webkit/simpleselector/window.h64
-rw-r--r--examples/webkit/simpleselector/window.ui72
-rw-r--r--examples/webkit/webkit.pro6
-rw-r--r--examples/xmlpatterns/filetree/filetree.pro6
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro5
-rw-r--r--examples/xmlpatterns/recipes/recipes.pro5
-rw-r--r--examples/xmlpatterns/schema/schema.pro5
-rw-r--r--examples/xmlpatterns/trafficinfo/trafficinfo.pro5
114 files changed, 1582 insertions, 355 deletions
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index 250fb85b63..1b6f9cd7c3 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -194,14 +194,14 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
topLevel->setInitialState(frameState);
else
//! [2]
- previousState->addTransition(previousState, SIGNAL(polished()), frameState);
+ previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState);
//! [2]
previousState = frameState;
}
// Loop
- previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState());
+ previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), topLevel->initialState());
return topLevel;
diff --git a/examples/dialogs/findfiles/window.cpp b/examples/dialogs/findfiles/window.cpp
index f8fc00b55a..afe6399087 100644
--- a/examples/dialogs/findfiles/window.cpp
+++ b/examples/dialogs/findfiles/window.cpp
@@ -243,7 +243,7 @@ void Window::openFileOfItem(int row, int /* column */)
{
QTableWidgetItem *item = filesTable->item(row, 0);
- QDesktopServices::openUrl(currentDir.absoluteFilePath(item->text()));
+ QDesktopServices::openUrl(QUrl::fromLocalFile(currentDir.absoluteFilePath(item->text())));
}
//! [12]
diff --git a/examples/effects/blurpicker/blureffect.cpp b/examples/effects/blurpicker/blureffect.cpp
index 9046cbd21d..956637d20a 100644
--- a/examples/effects/blurpicker/blureffect.cpp
+++ b/examples/effects/blurpicker/blureffect.cpp
@@ -62,8 +62,8 @@ QRectF BlurEffect::boundingRect() const
return QGraphicsBlurEffect::boundingRect();
}
-void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+void BlurEffect::draw(QPainter *painter)
{
adjustForItem();
- QGraphicsBlurEffect::draw(painter, source);
+ QGraphicsBlurEffect::draw(painter);
}
diff --git a/examples/effects/blurpicker/blureffect.h b/examples/effects/blurpicker/blureffect.h
index 6cfa55a500..3d1d433b80 100644
--- a/examples/effects/blurpicker/blureffect.h
+++ b/examples/effects/blurpicker/blureffect.h
@@ -54,7 +54,7 @@ public:
QRectF boundingRect() const;
- void draw(QPainter *painter, QGraphicsEffectSource *source);
+ void draw(QPainter *painter);
private:
void adjustForItem();
diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp
index 1f46444a32..4911c7330a 100644
--- a/examples/effects/blurpicker/blurpicker.cpp
+++ b/examples/effects/blurpicker/blurpicker.cpp
@@ -49,24 +49,29 @@
#define M_PI 3.14159265358979323846
#endif
-BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index")
{
setBackgroundBrush(QPixmap(":/images/background.jpg"));
- setScene(&m_scene);
+ setScene(new QGraphicsScene(this));
setupScene();
- updateIconPositions();
+ setIndex(0);
- connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions()));
- m_timeLine.setDuration(400);
+ m_animation.setDuration(400);
+ m_animation.setEasingCurve(QEasingCurve::InOutSine);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
}
-void BlurPicker::updateIconPositions()
+qreal BlurPicker::index() const
{
- m_index = m_timeLine.currentFrame() / 1000.0;
+ return m_index;
+}
+
+void BlurPicker::setIndex(qreal index)
+{
+ m_index = index;
qreal baseline = 0;
for (int i = 0; i < m_icons.count(); ++i) {
@@ -82,12 +87,12 @@ void BlurPicker::updateIconPositions()
static_cast<BlurEffect *>(icon->graphicsEffect())->setBaseLine(baseline);
}
- m_scene.update();
+ scene()->update();
}
void BlurPicker::setupScene()
{
- m_scene.setSceneRect(-200, -120, 400, 240);
+ scene()->setSceneRect(-200, -120, 400, 240);
QStringList names;
names << ":/images/accessories-calculator.png";
@@ -101,32 +106,34 @@ void BlurPicker::setupScene()
for (int i = 0; i < names.count(); i++) {
QPixmap pixmap(names[i]);
- QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap);
+ QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap);
icon->setZValue(1);
icon->setGraphicsEffect(new BlurEffect(icon));
m_icons << icon;
}
- QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg"));
+ QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg"));
bg->setZValue(0);
bg->setPos(-200, -150);
}
void BlurPicker::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Left) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000);
- m_timeLine.start();
- event->accept();
- }
+ int delta = 0;
+ switch (event->key())
+ {
+ case Qt::Key_Left:
+ delta = -1;
+ break;
+ case Qt::Key_Right:
+ delta = 1;
+ break;
+ default:
+ break;
}
-
- if (event->key() == Qt::Key_Right) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000);
- m_timeLine.start();
+ if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
+ m_animation.setEndValue(m_index + delta);
+ m_animation.start();
event->accept();
- }
}
}
diff --git a/examples/effects/blurpicker/blurpicker.h b/examples/effects/blurpicker/blurpicker.h
index b460df444d..b302db4058 100644
--- a/examples/effects/blurpicker/blurpicker.h
+++ b/examples/effects/blurpicker/blurpicker.h
@@ -44,31 +44,31 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "blureffect.h"
class BlurPicker: public QGraphicsView
{
Q_OBJECT
+ Q_PROPERTY(qreal index READ index WRITE setIndex);
public:
BlurPicker(QWidget *parent = 0);
+ qreal index() const;
+ void setIndex(qreal);
+
protected:
void keyPressEvent(QKeyEvent *event);
-private slots:
- void updateIconPositions();
-
private:
void setupScene();
private:
qreal m_index;
- QGraphicsScene m_scene;
QList<QGraphicsItem*> m_icons;
- QTimeLine m_timeLine;
+ QPropertyAnimation m_animation;
};
#endif // BLURPICKER_H
diff --git a/examples/effects/customshader/blureffect.cpp b/examples/effects/customshader/blureffect.cpp
index 9046cbd21d..956637d20a 100644
--- a/examples/effects/customshader/blureffect.cpp
+++ b/examples/effects/customshader/blureffect.cpp
@@ -62,8 +62,8 @@ QRectF BlurEffect::boundingRect() const
return QGraphicsBlurEffect::boundingRect();
}
-void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+void BlurEffect::draw(QPainter *painter)
{
adjustForItem();
- QGraphicsBlurEffect::draw(painter, source);
+ QGraphicsBlurEffect::draw(painter);
}
diff --git a/examples/effects/customshader/blureffect.h b/examples/effects/customshader/blureffect.h
index 6cfa55a500..3d1d433b80 100644
--- a/examples/effects/customshader/blureffect.h
+++ b/examples/effects/customshader/blureffect.h
@@ -54,7 +54,7 @@ public:
QRectF boundingRect() const;
- void draw(QPainter *painter, QGraphicsEffectSource *source);
+ void draw(QPainter *painter);
private:
void adjustForItem();
diff --git a/examples/effects/customshader/blurpicker.cpp b/examples/effects/customshader/blurpicker.cpp
index 6cda711758..d38d99b8ad 100644
--- a/examples/effects/customshader/blurpicker.cpp
+++ b/examples/effects/customshader/blurpicker.cpp
@@ -50,24 +50,29 @@
#define M_PI 3.14159265358979323846
#endif
-BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+BlurPicker::BlurPicker(QWidget *parent): QGraphicsView(parent), m_index(0.0), m_animation(this, "index")
{
setBackgroundBrush(QPixmap(":/images/background.jpg"));
- setScene(&m_scene);
+ setScene(new QGraphicsScene(this));
setupScene();
- updateIconPositions();
+ setIndex(0);
- connect(&m_timeLine, SIGNAL(valueChanged(qreal)), SLOT(updateIconPositions()));
- m_timeLine.setDuration(400);
+ m_animation.setDuration(400);
+ m_animation.setEasingCurve(QEasingCurve::InOutSine);
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
}
-void BlurPicker::updateIconPositions()
+qreal BlurPicker::index() const
{
- m_index = m_timeLine.currentFrame() / 1000.0;
+ return m_index;
+}
+
+void BlurPicker::setIndex(qreal index)
+{
+ m_index = index;
qreal baseline = 0;
for (int i = 0; i < m_icons.count(); ++i) {
@@ -84,12 +89,12 @@ void BlurPicker::updateIconPositions()
static_cast<BlurEffect *>(icon->graphicsEffect())->setBaseLine(baseline);
}
- m_scene.update();
+ scene()->update();
}
void BlurPicker::setupScene()
{
- m_scene.setSceneRect(-200, -120, 400, 240);
+ scene()->setSceneRect(-200, -120, 400, 240);
QStringList names;
names << ":/images/accessories-calculator.png";
@@ -103,7 +108,7 @@ void BlurPicker::setupScene()
for (int i = 0; i < names.count(); i++) {
QPixmap pixmap(names[i]);
- QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap);
+ QGraphicsPixmapItem *icon = scene()->addPixmap(pixmap);
icon->setZValue(1);
if (i == 3)
icon->setGraphicsEffect(new CustomShaderEffect());
@@ -112,26 +117,28 @@ void BlurPicker::setupScene()
m_icons << icon;
}
- QGraphicsPixmapItem *bg = m_scene.addPixmap(QPixmap(":/images/background.jpg"));
+ QGraphicsPixmapItem *bg = scene()->addPixmap(QPixmap(":/images/background.jpg"));
bg->setZValue(0);
bg->setPos(-200, -150);
}
void BlurPicker::keyPressEvent(QKeyEvent *event)
{
- if (event->key() == Qt::Key_Left) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 - 1000);
- m_timeLine.start();
- event->accept();
- }
+ int delta = 0;
+ switch (event->key())
+ {
+ case Qt::Key_Left:
+ delta = -1;
+ break;
+ case Qt::Key_Right:
+ delta = 1;
+ break;
+ default:
+ break;
}
-
- if (event->key() == Qt::Key_Right) {
- if (m_timeLine.state() == QTimeLine::NotRunning) {
- m_timeLine.setFrameRange(m_index * 1000, m_index * 1000 + 1000);
- m_timeLine.start();
+ if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
+ m_animation.setEndValue(m_index + delta);
+ m_animation.start();
event->accept();
- }
}
}
diff --git a/examples/effects/customshader/blurpicker.h b/examples/effects/customshader/blurpicker.h
index b460df444d..b302db4058 100644
--- a/examples/effects/customshader/blurpicker.h
+++ b/examples/effects/customshader/blurpicker.h
@@ -44,31 +44,31 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "blureffect.h"
class BlurPicker: public QGraphicsView
{
Q_OBJECT
+ Q_PROPERTY(qreal index READ index WRITE setIndex);
public:
BlurPicker(QWidget *parent = 0);
+ qreal index() const;
+ void setIndex(qreal);
+
protected:
void keyPressEvent(QKeyEvent *event);
-private slots:
- void updateIconPositions();
-
private:
void setupScene();
private:
qreal m_index;
- QGraphicsScene m_scene;
QList<QGraphicsItem*> m_icons;
- QTimeLine m_timeLine;
+ QPropertyAnimation m_animation;
};
#endif // BLURPICKER_H
diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro
index 01fa293b3c..2dec8d5829 100644
--- a/examples/effects/effects.pro
+++ b/examples/effects/effects.pro
@@ -5,7 +5,11 @@ SUBDIRS = \
lighting \
fademessage
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2):SUBDIRS += customshader
+!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl) {
+ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+ SUBDIRS += customshader
+ }
+}
# install
target.path = $$[QT_INSTALL_EXAMPLES]/effects
diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp
index 818d00f3e0..4128a5911f 100644
--- a/examples/effects/fademessage/fademessage.cpp
+++ b/examples/effects/fademessage/fademessage.cpp
@@ -43,7 +43,7 @@
#include <QtGui>
-FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
+FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent)
{
setScene(&m_scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -51,9 +51,12 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent), m_index(0.0)
setupScene();
- m_timeLine = new QTimeLine(500, this);
- m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
- connect(m_timeLine, SIGNAL(valueChanged(qreal)), m_effect, SLOT(setStrength(qreal)));
+ m_animation = new QPropertyAnimation(m_effect, "strength", this);
+ m_animation->setDuration(500);
+ m_animation->setEasingCurve(QEasingCurve::InOutSine);
+ m_animation->setStartValue(0);
+ m_animation->setEndValue(1);
+
setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame);
@@ -63,13 +66,12 @@ void FadeMessage::togglePopup()
{
if (m_message->isVisible()) {
m_message->setVisible(false);
- m_timeLine->setDirection(QTimeLine::Backward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Backward);
} else {
m_message->setVisible(true);
- m_timeLine->setDirection(QTimeLine::Forward);
- m_timeLine->start();
+ m_animation->setDirection(QAbstractAnimation::Forward);
}
+ m_animation->start();
}
void FadeMessage::setupScene()
@@ -94,13 +96,17 @@ void FadeMessage::setupScene()
QFont font;
font.setPointSize(font.pointSize() * 2);
font.setBold(true);
- int fh = QFontMetrics(font).height();
+ QFontMetrics fontMetrics(font);
+ int fh = fontMetrics.height();
+
+ QString sceneText = "Qt Everywhere!";
+ int sceneTextWidth = fontMetrics.width(sceneText);
- QGraphicsRectItem *block = m_scene.addRect(50, 300, 300, fh + 3);
+ QGraphicsRectItem *block = m_scene.addRect(50, 300, sceneTextWidth, fh + 3);
block->setPen(Qt::NoPen);
block->setBrush(QColor(102, 153, 51));
- QGraphicsTextItem *text = m_scene.addText("Qt Everywhere!", font);
+ QGraphicsTextItem *text = m_scene.addText(sceneText, font);
text->setDefaultTextColor(Qt::white);
text->setPos(50, 300);
block->setZValue(2);
diff --git a/examples/effects/fademessage/fademessage.h b/examples/effects/fademessage/fademessage.h
index 34e2fb8c7f..e73ef6b183 100644
--- a/examples/effects/fademessage/fademessage.h
+++ b/examples/effects/fademessage/fademessage.h
@@ -44,7 +44,7 @@
#include <QGraphicsEffect>
#include <QGraphicsView>
-#include <QTimeLine>
+#include <QPropertyAnimation>
#include "fademessage.h"
@@ -62,11 +62,10 @@ private slots:
void togglePopup();
private:
- qreal m_index;
QGraphicsScene m_scene;
QGraphicsColorizeEffect *m_effect;
QGraphicsItem *m_message;
- QTimeLine *m_timeLine;
+ QPropertyAnimation *m_animation;
};
#endif // FADEMESSAGE_H
diff --git a/examples/effects/fademessage/fademessage.pro b/examples/effects/fademessage/fademessage.pro
index ed9e53d082..cb1fda790b 100644
--- a/examples/effects/fademessage/fademessage.pro
+++ b/examples/effects/fademessage/fademessage.pro
@@ -11,3 +11,6 @@ sources.files = $$SOURCES \
$$FORMS \
fademessage.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/effects/fademessage
+
+DEPLOYMENT_PLUGIN += qjpeg
+
diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp
index 7026b66bac..51fa9f8f7c 100644
--- a/examples/effects/lighting/lighting.cpp
+++ b/examples/effects/lighting/lighting.cpp
@@ -94,7 +94,7 @@ void Lighting::setupScene()
else
item = new QGraphicsRectItem(0, 0, 50, 50);
- item->setPen(QPen(Qt::black));
+ item->setPen(QPen(Qt::black, 1));
item->setBrush(QBrush(Qt::white));
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
effect->setBlurRadius(8);
diff --git a/examples/examples.pro b/examples/examples.pro
index 7acd67b817..d11e36bf68 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -39,8 +39,7 @@ symbian: SUBDIRS = \
xml
contains(QT_CONFIG, multimedia) {
- SUBDIRS += video
- !static: SUBDIRS += multimedia
+ SUBDIRS += multimedia
}
contains(QT_CONFIG, script): SUBDIRS += script
diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro
index 09cd56a2a2..e3978b6baa 100644
--- a/examples/gestures/gestures.pro
+++ b/examples/gestures/gestures.pro
@@ -1,7 +1,7 @@
TEMPLATE = \
subdirs
SUBDIRS = \
- imageviewer
+ imagegestures
# install
target.path = $$[QT_INSTALL_EXAMPLES]/gestures
diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro
new file mode 100644
index 0000000000..8c947e41bd
--- /dev/null
+++ b/examples/gestures/imagegestures/imagegestures.pro
@@ -0,0 +1,16 @@
+HEADERS = imagewidget.h \
+ mainwidget.h
+SOURCES = imagewidget.cpp \
+ main.cpp \
+ mainwidget.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures
+sources.files = $$SOURCES \
+ $$HEADERS \
+ $$RESOURCES \
+ $$FORMS \
+ imagegestures.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures
+INSTALLS += target \
+ sources
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp
index f3fd8e48e4..afa0185efd 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imagegestures/imagewidget.cpp
@@ -43,38 +43,39 @@
#include <QtGui>
+//! [constructor]
ImageWidget::ImageWidget(QWidget *parent)
: QWidget(parent),
position(0),
horizontalOffset(0),
verticalOffset(0),
rotationAngle(0),
- scaleFactor(1)
+ scaleFactor(1),
+ currentStepScaleFactor(1)
{
- setObjectName("ImageWidget");
setMinimumSize(QSize(100,100));
- setAttribute(Qt::WA_PaintOnScreen);
- setAttribute(Qt::WA_OpaquePaintEvent);
- setAttribute(Qt::WA_NoSystemBackground);
-
+//! [enable gestures]
grabGesture(Qt::PanGesture);
grabGesture(Qt::PinchGesture);
grabGesture(Qt::SwipeGesture);
+//! [enable gestures]
}
+//! [constructor]
+//! [event handler]
bool ImageWidget::event(QEvent *event)
{
if (event->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent*>(event));
return QWidget::event(event);
}
+//! [event handler]
void ImageWidget::paintEvent(QPaintEvent*)
{
QPainter p(this);
- p.fillRect(rect(), Qt::white);
float iw = currentImage.width();
float ih = currentImage.height();
@@ -84,7 +85,7 @@ void ImageWidget::paintEvent(QPaintEvent*)
p.translate(ww/2, wh/2);
p.translate(horizontalOffset, verticalOffset);
p.rotate(rotationAngle);
- p.scale(scaleFactor, scaleFactor);
+ p.scale(currentStepScaleFactor * scaleFactor, currentStepScaleFactor * scaleFactor);
p.translate(-iw/2, -ih/2);
p.drawImage(0, 0, currentImage);
}
@@ -93,25 +94,24 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
{
rotationAngle = 0;
scaleFactor = 1;
+ currentStepScaleFactor = 1;
verticalOffset = 0;
horizontalOffset = 0;
update();
}
+//! [gesture event handler]
bool ImageWidget::gestureEvent(QGestureEvent *event)
{
- if (QGesture *pan = event->gesture(Qt::PanGesture)) {
- panTriggered(static_cast<QPanGesture*>(pan));
- return true;
- } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) {
- pinchTriggered(static_cast<QPinchGesture*>(pinch));
- return true;
- } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) {
- swipeTriggered(static_cast<QSwipeGesture*>(swipe));
- return true;
- }
- return false;
+ if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
+ swipeTriggered(static_cast<QSwipeGesture *>(swipe));
+ else if (QGesture *pan = event->gesture(Qt::PanGesture))
+ panTriggered(static_cast<QPanGesture *>(pan));
+ if (QGesture *pinch = event->gesture(Qt::PinchGesture))
+ pinchTriggered(static_cast<QPinchGesture *>(pinch));
+ return true;
}
+//! [gesture event handler]
void ImageWidget::panTriggered(QPanGesture *gesture)
{
@@ -125,39 +125,44 @@ void ImageWidget::panTriggered(QPanGesture *gesture)
setCursor(Qt::ArrowCursor);
}
#endif
- QSizeF lastOffset = gesture->offset();
- horizontalOffset += lastOffset.width();
- verticalOffset += lastOffset.height();
+ QPointF delta = gesture->delta();
+ horizontalOffset += delta.x();
+ verticalOffset += delta.y();
update();
}
void ImageWidget::pinchTriggered(QPinchGesture *gesture)
{
- QPinchGesture::WhatChanged whatChanged = gesture->whatChanged();
- if (whatChanged & QPinchGesture::RotationAngleChanged) {
+ QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
+ if (changeFlags & QPinchGesture::RotationAngleChanged) {
qreal value = gesture->property("rotationAngle").toReal();
qreal lastValue = gesture->property("lastRotationAngle").toReal();
rotationAngle += value - lastValue;
}
- if (whatChanged & QPinchGesture::ScaleFactorChanged) {
+ if (changeFlags & QPinchGesture::ScaleFactorChanged) {
qreal value = gesture->property("scaleFactor").toReal();
- qreal lastValue = gesture->property("lastScaleFactor").toReal();
- scaleFactor += value - lastValue;
+ currentStepScaleFactor = value;
+ }
+ if (gesture->state() == Qt::GestureFinished) {
+ scaleFactor *= currentStepScaleFactor;
+ currentStepScaleFactor = 1;
}
update();
}
-//! [swipe slot]
+//! [swipe function]
void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
{
- if (gesture->horizontalDirection() == QSwipeGesture::Left
+ if (gesture->state() == Qt::GestureFinished) {
+ if (gesture->horizontalDirection() == QSwipeGesture::Left
|| gesture->verticalDirection() == QSwipeGesture::Up)
- goPrevImage();
- else
- goNextImage();
- update();
+ goPrevImage();
+ else
+ goNextImage();
+ update();
+ }
}
-//! [swipe slot]
+//! [swipe function]
void ImageWidget::resizeEvent(QResizeEvent*)
{
diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h
index e05a67a803..7a68488d50 100644
--- a/examples/gestures/imageviewer/imagewidget.h
+++ b/examples/gestures/imagegestures/imagewidget.h
@@ -46,33 +46,35 @@
#include <QImage>
#include <QtGui>
+QT_BEGIN_NAMESPACE
class QGestureEvent;
class QPanGesture;
class QPinchGesture;
class QSwipeGesture;
+QT_END_NAMESPACE
+//! [class definition begin]
class ImageWidget : public QWidget
{
Q_OBJECT
public:
ImageWidget(QWidget *parent = 0);
-
void openDirectory(const QString &path);
protected:
- bool event(QEvent*);
- bool gestureEvent(QGestureEvent*);
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
- void mouseDoubleClickEvent(QMouseEvent*);
+ bool event(QEvent *event);
+ void paintEvent(QPaintEvent *event);
+ void resizeEvent(QResizeEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *event);
private:
+ bool gestureEvent(QGestureEvent *event);
void panTriggered(QPanGesture*);
void pinchTriggered(QPinchGesture*);
void swipeTriggered(QSwipeGesture*);
+//! [class definition begin]
-private:
void updateImage();
QImage loadImage(const QString &fileName);
void loadImage();
@@ -91,6 +93,9 @@ private:
float verticalOffset;
float rotationAngle;
float scaleFactor;
+ float currentStepScaleFactor;
+//! [class definition end]
};
+//! [class definition end]
#endif
diff --git a/examples/gestures/imagegestures/main.cpp b/examples/gestures/imagegestures/main.cpp
new file mode 100644
index 0000000000..9c99f311d7
--- /dev/null
+++ b/examples/gestures/imagegestures/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwidget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ MainWidget w;
+ w.show();
+
+ if (QApplication::arguments().size() > 1)
+ w.openDirectory(QApplication::arguments().at(1));
+ else
+ w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));
+
+ return app.exec();
+}
diff --git a/examples/gestures/imagegestures/mainwidget.cpp b/examples/gestures/imagegestures/mainwidget.cpp
new file mode 100644
index 0000000000..51e9f1eaf7
--- /dev/null
+++ b/examples/gestures/imagegestures/mainwidget.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include "imagewidget.h"
+#include "mainwidget.h"
+
+MainWidget::MainWidget(QWidget *parent)
+ : QMainWindow(parent)
+{
+ resize(400, 300);
+ imageWidget = new ImageWidget(this);
+ setCentralWidget(imageWidget);
+}
+
+void MainWidget::openDirectory(const QString &path)
+{
+ imageWidget->openDirectory(path);
+}
diff --git a/examples/gestures/imagegestures/mainwidget.h b/examples/gestures/imagegestures/mainwidget.h
new file mode 100644
index 0000000000..71b09b02de
--- /dev/null
+++ b/examples/gestures/imagegestures/mainwidget.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include <QMainWindow>
+
+class ImageWidget;
+
+class MainWidget : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWidget(QWidget *parent = 0);
+
+public slots:
+ void openDirectory(const QString &path);
+
+private:
+ bool loadImage(const QString &fileName);
+
+ ImageWidget *imageWidget;
+};
+
+#endif
diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imageviewer/imageviewer.pro
deleted file mode 100644
index 68c1f1ce8d..0000000000
--- a/examples/gestures/imageviewer/imageviewer.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-HEADERS += imagewidget.h
-SOURCES += imagewidget.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
-sources.files = $$SOURCES \
- $$HEADERS \
- $$RESOURCES \
- $$FORMS \
- imageviewer.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
-INSTALLS += target \
- sources
diff --git a/examples/graphicsview/anchorlayout/anchorlayout.pro b/examples/graphicsview/anchorlayout/anchorlayout.pro
index c2a1beadc8..fd085cc330 100644
--- a/examples/graphicsview/anchorlayout/anchorlayout.pro
+++ b/examples/graphicsview/anchorlayout/anchorlayout.pro
@@ -1,9 +1,4 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue May 12 15:22:25 2009
-######################################################################
-
-# Input
-SOURCES += main.cpp
+SOURCES = main.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/anchorlayout
@@ -11,5 +6,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES anchorlayout.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/anchorlayout
INSTALLS += target sources
-TARGET = anchorlayout_example
-CONFIG+=console \ No newline at end of file
+TARGET = anchorlayout
diff --git a/examples/graphicsview/anchorlayout/main.cpp b/examples/graphicsview/anchorlayout/main.cpp
index 3e19f18536..f898d1d245 100644
--- a/examples/graphicsview/anchorlayout/main.cpp
+++ b/examples/graphicsview/anchorlayout/main.cpp
@@ -76,8 +76,8 @@ int main(int argc, char **argv)
QGraphicsProxyWidget *c = createItem(minSize, prefSize, maxSize, "C");
QGraphicsProxyWidget *d = createItem(minSize, prefSize, maxSize, "D");
QGraphicsProxyWidget *e = createItem(minSize, prefSize, maxSize, "E");
- QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F");
- QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G");
+ QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F (overflow)");
+ QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G (overflow)");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setSpacing(0);
diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro
index a919c74909..210ab1f739 100644
--- a/examples/graphicsview/graphicsview.pro
+++ b/examples/graphicsview/graphicsview.pro
@@ -9,7 +9,8 @@ SUBDIRS = \
diagramscene \
dragdroprobot \
flowlayout \
- anchorlayout
+ anchorlayout \
+ weatheranchorlayout
contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids
contains(DEFINES, QT_NO_CURSOR)|contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= dragdroprobot
diff --git a/examples/graphicsview/simpleanchorlayout/main.cpp b/examples/graphicsview/simpleanchorlayout/main.cpp
new file mode 100644
index 0000000000..493b00f178
--- /dev/null
+++ b/examples/graphicsview/simpleanchorlayout/main.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class Widget : public QGraphicsWidget
+{
+public:
+ Widget(const QColor &color, const QColor &textColor, const QString &caption,
+ QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent), caption(caption), color(color), textColor(textColor)
+ {
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
+ {
+ QFont font;
+ font.setPixelSize(0.75 * qMin(boundingRect().width(), boundingRect().height()));
+
+ painter->fillRect(boundingRect(), color);
+ painter->save();
+ painter->setFont(font);
+ painter->setPen(textColor);
+ painter->drawText(boundingRect(), Qt::AlignCenter, caption);
+ painter->restore();
+ }
+
+private:
+ QString caption;
+ QColor color;
+ QColor textColor;
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene *scene = new QGraphicsScene();
+
+ Widget *a = new Widget(Qt::blue, Qt::white, "a");
+ a->setPreferredSize(100, 100);
+ Widget *b = new Widget(Qt::green, Qt::black, "b");
+ b->setPreferredSize(100, 100);
+ Widget *c = new Widget(Qt::red, Qt::black, "c");
+ c->setPreferredSize(100, 100);
+
+ QGraphicsAnchorLayout *layout = new QGraphicsAnchorLayout();
+/*
+ //! [adding a corner anchor in two steps]
+ layout->addAnchor(a, Qt::AnchorTop, layout, Qt::AnchorTop);
+ layout->addAnchor(a, Qt::AnchorLeft, layout, Qt::AnchorLeft);
+ //! [adding a corner anchor in two steps]
+*/
+ //! [adding a corner anchor]
+ layout->addCornerAnchors(a, Qt::TopLeftCorner, layout, Qt::TopLeftCorner);
+ //! [adding a corner anchor]
+
+ //! [adding anchors]
+ layout->addAnchor(b, Qt::AnchorLeft, a, Qt::AnchorRight);
+ layout->addAnchor(b, Qt::AnchorTop, a, Qt::AnchorBottom);
+ //! [adding anchors]
+
+ // Place a third widget below the second.
+ layout->addAnchor(b, Qt::AnchorBottom, c, Qt::AnchorTop);
+
+/*
+ //! [adding anchors to match sizes in two steps]
+ layout->addAnchor(b, Qt::AnchorLeft, c, Qt::AnchorLeft);
+ layout->addAnchor(b, Qt::AnchorRight, c, Qt::AnchorRight);
+ //! [adding anchors to match sizes in two steps]
+*/
+
+ //! [adding anchors to match sizes]
+ layout->addAnchors(b, c, Qt::Horizontal);
+ //! [adding anchors to match sizes]
+
+ // Anchor the bottom-right corner of the third widget to the bottom-right
+ // corner of the layout.
+ layout->addCornerAnchors(c, Qt::BottomRightCorner, layout, Qt::BottomRightCorner);
+
+ QGraphicsWidget *w = new QGraphicsWidget(0, Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
+ w->setPos(20, 20);
+ w->setMinimumSize(100, 100);
+ w->setPreferredSize(320, 240);
+ w->setLayout(layout);
+ w->setWindowTitle(QApplication::translate("simpleanchorlayout", "QGraphicsAnchorLayout in use"));
+ scene->addItem(w);
+
+ QGraphicsView *view = new QGraphicsView();
+ view->setScene(scene);
+ view->setWindowTitle(QApplication::translate("simpleanchorlayout", "Simple Anchor Layout"));
+ view->resize(360, 320);
+ view->show();
+
+ return app.exec();
+}
diff --git a/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro
new file mode 100644
index 0000000000..e1c7aeb446
--- /dev/null
+++ b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro
@@ -0,0 +1,9 @@
+SOURCES = main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/simpleanchorlayout
+sources.files = $$SOURCES $$HEADERS $$RESOURCES simpleanchorlayout.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/simpleanchorlayout
+INSTALLS += target sources
+
+TARGET = simpleanchorlayout
diff --git a/examples/graphicsview/weatheranchorlayout/images/5days.jpg b/examples/graphicsview/weatheranchorlayout/images/5days.jpg
new file mode 100644
index 0000000000..fd92ba8ba7
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/5days.jpg
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/images/details.jpg b/examples/graphicsview/weatheranchorlayout/images/details.jpg
new file mode 100644
index 0000000000..fde0448c69
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/details.jpg
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/images/place.jpg b/examples/graphicsview/weatheranchorlayout/images/place.jpg
new file mode 100644
index 0000000000..03e5344330
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/place.jpg
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg b/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg
new file mode 100644
index 0000000000..7777662901
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/tabbar.jpg
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/images/title.jpg b/examples/graphicsview/weatheranchorlayout/images/title.jpg
new file mode 100644
index 0000000000..fa84c8156c
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/title.jpg
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png b/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png
new file mode 100644
index 0000000000..eea6ce6529
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/images/weather-few-clouds.png
Binary files differ
diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp
new file mode 100644
index 0000000000..d835ae3f1b
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/main.cpp
@@ -0,0 +1,267 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include <QLabel>
+#include <QPainter>
+#include <QPushButton>
+#include <QApplication>
+
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#include <QGraphicsWidget>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsAnchorLayout>
+#include <QGraphicsSceneResizeEvent>
+
+
+class PixmapWidget : public QGraphicsLayoutItem
+{
+
+public:
+ PixmapWidget(const QPixmap &pix) : QGraphicsLayoutItem()
+ {
+ original = new QGraphicsPixmapItem(pix);
+ setGraphicsItem(original);
+ original->show();
+ r = QRectF(QPointF(0, 0), pix.size());
+ }
+
+ ~PixmapWidget()
+ {
+ setGraphicsItem(0);
+ delete original;
+ }
+
+ void setZValue(qreal z)
+ {
+ original->setZValue(z);
+ }
+
+ void setGeometry (const QRectF &rect)
+ {
+ original->scale(rect.width() / r.width(), rect.height() / r.height());
+ original->setPos(rect.x(), rect.y());
+ r = rect;
+ }
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ Q_UNUSED(constraint);
+ QSizeF sh;
+ switch (which) {
+ case Qt::MinimumSize:
+ sh = QSizeF(0, 0);
+ break;
+ case Qt::PreferredSize:
+ sh = QSizeF(50, 50);
+ break;
+ case Qt::MaximumSize:
+ sh = QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
+ break;
+ }
+ return sh;
+ }
+
+private:
+ QGraphicsPixmapItem *original;
+ QRectF r;
+};
+
+
+class PlaceWidget : public QGraphicsWidget
+{
+ Q_OBJECT
+
+public:
+ PlaceWidget(const QPixmap &pix) : QGraphicsWidget(), original(pix), scaled(pix)
+ {
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*)
+ {
+ QPointF reflection = QPointF();
+ reflection.setY(scaled.height() + 2);
+
+ painter->drawPixmap(QPointF(), scaled);
+
+ QPixmap tmp(scaled.size());
+ tmp.fill(Qt::transparent);
+ QPainter p(&tmp);
+
+ // create gradient
+ QPoint p1(scaled.width() / 2, 0);
+ QPoint p2(scaled.width() / 2, scaled.height());
+ QLinearGradient linearGrad(p1, p2);
+ linearGrad.setColorAt(0, QColor(0, 0, 0, 0));
+ linearGrad.setColorAt(0.65, QColor(0, 0, 0, 127));
+ linearGrad.setColorAt(1, QColor(0, 0, 0, 255));
+
+ // apply 'mask'
+ p.setBrush(linearGrad);
+ p.fillRect(0, 0, tmp.width(), tmp.height(), QBrush(linearGrad));
+ p.fillRect(0, 0, tmp.width(), tmp.height(), QBrush(linearGrad));
+
+ // paint the image flipped
+ p.setCompositionMode(QPainter::CompositionMode_DestinationOver);
+ p.drawPixmap(0, 0, QPixmap::fromImage(scaled.toImage().mirrored(false, true)));
+ p.end();
+
+ painter->drawPixmap(reflection, tmp);
+ }
+
+ void resizeEvent(QGraphicsSceneResizeEvent *event)
+ {
+ QSize newSize = event->newSize().toSize();
+ newSize.setHeight(newSize.height() / 2);
+ scaled = original.scaled(newSize);
+ }
+
+ QRectF boundingRect() const
+ {
+ QSize size(scaled.width(), scaled.height() * 2 + 2);
+ return QRectF(QPointF(0, 0), size);
+ }
+
+private:
+ QPixmap original;
+ QPixmap scaled;
+};
+
+
+static QGraphicsProxyWidget *createItem(const QString &name = "Unnamed")
+{
+ QGraphicsProxyWidget *w = new QGraphicsProxyWidget;
+ w->setWidget(new QPushButton(name));
+ w->setData(0, name);
+ w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ return w;
+}
+
+int main(int argc, char **argv)
+{
+ Q_INIT_RESOURCE(weatheranchorlayout);
+
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+ scene.setSceneRect(0, 0, 800, 480);
+
+ // pixmaps widgets
+ PixmapWidget *title = new PixmapWidget(QPixmap(":/images/title.jpg"));
+ PlaceWidget *place = new PlaceWidget(QPixmap(":/images/place.jpg"));
+ PixmapWidget *details = new PixmapWidget(QPixmap(":/images/5days.jpg"));
+ PixmapWidget *sunnyWeather = new PixmapWidget(QPixmap(":/images/weather-few-clouds.png"));
+ PixmapWidget *tabbar = new PixmapWidget(QPixmap(":/images/tabbar.jpg"));
+
+
+ // setup sizes
+ title->setPreferredSize(QSizeF(348, 45));
+ title->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ place->setPreferredSize(QSizeF(96, 72));
+ place->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ details->setMinimumSize(QSizeF(200, 112));
+ details->setPreferredSize(QSizeF(200, 112));
+ details->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ tabbar->setPreferredSize(QSizeF(70, 24));
+ tabbar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+
+ sunnyWeather->setPreferredSize(QSizeF(128, 97));
+ sunnyWeather->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+ sunnyWeather->setZValue(9999);
+
+ // start anchor layout
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ l->setSpacing(0);
+
+ // setup the main widget
+ QGraphicsWidget *w = new QGraphicsWidget(0, Qt::Window);
+ QPalette p;
+ p.setColor(QPalette::Window, Qt::black);
+ w->setPalette(p);
+ w->setPos(20, 20);
+ w->setLayout(l);
+
+ // vertical anchors
+ QGraphicsAnchor *anchor = l->addAnchor(title, Qt::AnchorTop, l, Qt::AnchorTop);
+ anchor = l->addAnchor(place, Qt::AnchorTop, title, Qt::AnchorBottom);
+ anchor->setSpacing(12);
+ anchor = l->addAnchor(place, Qt::AnchorBottom, l, Qt::AnchorBottom);
+ anchor->setSpacing(12);
+
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorTop, title, Qt::AnchorTop);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorBottom, l, Qt::AnchorVerticalCenter);
+
+ anchor = l->addAnchor(tabbar, Qt::AnchorTop, title, Qt::AnchorBottom);
+ anchor->setSpacing(5);
+ anchor = l->addAnchor(details, Qt::AnchorTop, tabbar, Qt::AnchorBottom);
+ anchor->setSpacing(2);
+ anchor = l->addAnchor(details, Qt::AnchorBottom, l, Qt::AnchorBottom);
+ anchor->setSpacing(12);
+
+ // horizontal anchors
+ anchor = l->addAnchor(l, Qt::AnchorLeft, title, Qt::AnchorLeft);
+ anchor = l->addAnchor(title, Qt::AnchorRight, l, Qt::AnchorRight);
+
+ anchor = l->addAnchor(place, Qt::AnchorLeft, l, Qt::AnchorLeft);
+ anchor->setSpacing(15);
+ anchor = l->addAnchor(place, Qt::AnchorRight, details, Qt::AnchorLeft);
+ anchor->setSpacing(35);
+
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorLeft, place, Qt::AnchorHorizontalCenter);
+ anchor = l->addAnchor(sunnyWeather, Qt::AnchorRight, l, Qt::AnchorHorizontalCenter);
+
+ anchor = l->addAnchor(tabbar, Qt::AnchorHorizontalCenter, details, Qt::AnchorHorizontalCenter);
+ anchor = l->addAnchor(details, Qt::AnchorRight, l, Qt::AnchorRight);
+
+ // QGV setup
+ scene.addItem(w);
+ scene.setBackgroundBrush(Qt::white);
+ QGraphicsView *view = new QGraphicsView(&scene);
+ view->show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro
new file mode 100644
index 0000000000..fa2733c875
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue May 12 15:22:25 2009
+######################################################################
+
+# Input
+SOURCES += main.cpp
+RESOURCES += weatheranchorlayout.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout
+sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/weatheranchorlayout
+INSTALLS += target sources
+
diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc
new file mode 100644
index 0000000000..e39f8c0423
--- /dev/null
+++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.qrc
@@ -0,0 +1,10 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/5days.jpg</file>
+ <file>images/title.jpg</file>
+ <file>images/place.jpg</file>
+ <file>images/tabbar.jpg</file>
+ <file>images/details.jpg</file>
+ <file>images/weather-few-clouds.png</file>
+</qresource>
+</RCC>
diff --git a/examples/help/contextsensitivehelp/doc/source.html b/examples/help/contextsensitivehelp/doc/source.html
index 2140765064..68b2f8c71e 100644
--- a/examples/help/contextsensitivehelp/doc/source.html
+++ b/examples/help/contextsensitivehelp/doc/source.html
@@ -4,8 +4,8 @@
<title>Water Source</title>
</head>
<body>
- The current pipe system connects to four different sources. Be aware that only
- a limited amount of water can be taken from some sources.
+ The current pipe system connects to four different sources. Be aware
+ that only a limited amount of water can be taken from some sources.
<br>
<table border=1>
<tr>
@@ -13,7 +13,7 @@
<td>Amount</td>
</tr>
<tr>
- <td>Foundain</td>
+ <td>Fountain</td>
<td>4000</td>
</tr>
<tr>
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qch b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
index e74f9b80a3..35d29be226 100644
--- a/examples/help/contextsensitivehelp/doc/wateringmachine.qch
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
index 3227c3a22f..b5653c3ff7 100644
--- a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
index 745d881a5c..6dd08e7aee 100644
--- a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
@@ -1,25 +1,25 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
<QtHelpProject version="1.0">
- <virtualFolder>wateringmachine</virtualFolder>
- <namespace>wateringcompany.com.1_0_0.premium</namespace>
- <filterSection>
- <keywords>
- <keyword name="plants" id="plants" ref="plants.html"/>
- <keyword name="temperature" id="temperature" ref="temperature.html"/>
- <keyword name="rain" id="rain" ref="rain.html"/>
- <keyword name="time" id="time" ref="time.html"/>
- <keyword name="amount" id="amount" ref="amount.html"/>
- <keyword name="source" id="source" ref="source.html"/>
- <keyword name="filtering" id="filtering" ref="filter.html"/>
- </keywords>
- <files>
- <file>plants.html</file>
- <file>temperature.html</file>
- <file>rain.html</file>
- <file>time.html</file>
- <file>amount.html</file>
- <file>source.html</file>
- <file>filter.html</file>
- </files>
- </filterSection>
+ <virtualFolder>wateringmachine</virtualFolder>
+ <namespace>wateringcompany.com.1-0-0.premium</namespace>
+ <filterSection>
+ <keywords>
+ <keyword name="plants" id="plants" ref="plants.html"/>
+ <keyword name="temperature" id="temperature" ref="temperature.html"/>
+ <keyword name="rain" id="rain" ref="rain.html"/>
+ <keyword name="time" id="time" ref="time.html"/>
+ <keyword name="amount" id="amount" ref="amount.html"/>
+ <keyword name="source" id="source" ref="source.html"/>
+ <keyword name="filtering" id="filtering" ref="filter.html"/>
+ </keywords>
+ <files>
+ <file>plants.html</file>
+ <file>temperature.html</file>
+ <file>rain.html</file>
+ <file>time.html</file>
+ <file>amount.html</file>
+ <file>source.html</file>
+ <file>filter.html</file>
+ </files>
+ </filterSection>
</QtHelpProject>
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.ui b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
index a7f5349d78..d7a473a3c4 100644
--- a/examples/help/contextsensitivehelp/wateringconfigdialog.ui
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
@@ -258,7 +258,7 @@
<widget class="QComboBox" name="sourceComboBox" >
<item>
<property name="text" >
- <string>Foundain</string>
+ <string>Fountain</string>
</property>
</item>
<item>
diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp
index 712d91f884..edb33b7a40 100644
--- a/examples/mainwindows/mdi/mainwindow.cpp
+++ b/examples/mainwindows/mdi/mainwindow.cpp
@@ -71,7 +71,7 @@ MainWindow::MainWindow()
void MainWindow::closeEvent(QCloseEvent *event)
{
mdiArea->closeAllSubWindows();
- if (activeMdiChild()) {
+ if (mdiArea->currentSubWindow()) {
event->ignore();
} else {
writeSettings();
diff --git a/examples/mainwindows/sdi/mainwindow.h b/examples/mainwindows/sdi/mainwindow.h
index ca478dfc5b..a925e2f8de 100644
--- a/examples/mainwindows/sdi/mainwindow.h
+++ b/examples/mainwindows/sdi/mainwindow.h
@@ -50,12 +50,14 @@ class QMenu;
class QTextEdit;
QT_END_NAMESPACE
+//! [class definition with macro]
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
+//! [class definition with macro]
MainWindow(const QString &fileName);
protected:
diff --git a/examples/multimedia/audio/audio.pro b/examples/multimedia/audio/audio.pro
deleted file mode 100644
index c64bb34c66..0000000000
--- a/examples/multimedia/audio/audio.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = audioinput \
- audiooutput \
- audiodevices
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS audio.pro README
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index 419860518b..e205e03450 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -148,7 +148,7 @@ void AudioTest::modeChanged(int idx)
mode=QAudio::AudioOutput;
deviceBox->clear();
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode))
+ foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
}
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h
index 5fe5547d03..5fe5547d03 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.h
+++ b/examples/multimedia/audiodevices/audiodevices.h
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro
index 173aa8f43b..232da098b8 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.pro
+++ b/examples/multimedia/audiodevices/audiodevices.pro
@@ -6,9 +6,9 @@ FORMS += audiodevicesbase.ui
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui
index 52073389ab..52073389ab 100644
--- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui
+++ b/examples/multimedia/audiodevices/audiodevicesbase.ui
diff --git a/examples/multimedia/audio/audiodevices/main.cpp b/examples/multimedia/audiodevices/main.cpp
index d5ddd4f2f5..d5ddd4f2f5 100644
--- a/examples/multimedia/audio/audiodevices/main.cpp
+++ b/examples/multimedia/audiodevices/main.cpp
diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 05723aea0c..62afd7306a 100644
--- a/examples/multimedia/audio/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -170,7 +170,7 @@ InputTest::InputTest()
layout->addWidget(canvas);
deviceBox = new QComboBox(this);
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
for(int i = 0; i < devices.size(); ++i) {
deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
}
@@ -216,7 +216,7 @@ InputTest::~InputTest() {}
void InputTest::status()
{
- qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, clock = "<<audioInput->clock()<<"ms, totalTime = "<<audioInput->totalTime()/1000<<"ms";
+ qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, elapsedUSecs = "<<audioInput->elapsedUSecs()<<", processedUSecs = "<<audioInput->processedUSecs();
}
void InputTest::readMore()
@@ -239,7 +239,7 @@ void InputTest::toggleMode()
if (pullMode) {
button->setText(tr("Click for Pull Mode"));
- input = audioInput->start(0);
+ input = audioInput->start();
connect(input,SIGNAL(readyRead()),SLOT(readMore()));
pullMode = false;
} else {
@@ -252,7 +252,7 @@ void InputTest::toggleMode()
void InputTest::toggleSuspend()
{
// toggle suspend/resume
- if(audioInput->state() == QAudio::SuspendState) {
+ if(audioInput->state() == QAudio::SuspendedState) {
qWarning()<<"status: Suspended, resume()";
audioInput->resume();
button2->setText("Click To Suspend");
@@ -260,7 +260,7 @@ void InputTest::toggleSuspend()
qWarning()<<"status: Active, suspend()";
audioInput->suspend();
button2->setText("Click To Resume");
- } else if (audioInput->state() == QAudio::StopState) {
+ } else if (audioInput->state() == QAudio::StoppedState) {
qWarning()<<"status: Stopped, resume()";
audioInput->resume();
button2->setText("Click To Suspend");
diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index 14e1bacba8..14e1bacba8 100644
--- a/examples/multimedia/audio/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
diff --git a/examples/multimedia/audio/audioinput/audioinput.pro b/examples/multimedia/audioinput/audioinput.pro
index 0d6198de86..a54d452d8a 100644
--- a/examples/multimedia/audio/audioinput/audioinput.pro
+++ b/examples/multimedia/audioinput/audioinput.pro
@@ -5,9 +5,9 @@ SOURCES = audioinput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audioinput/main.cpp b/examples/multimedia/audioinput/main.cpp
index d7e9c6c802..d7e9c6c802 100644
--- a/examples/multimedia/audio/audioinput/main.cpp
+++ b/examples/multimedia/audioinput/main.cpp
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 9e532cdef7..244840d06f 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -134,7 +134,7 @@ AudioTest::AudioTest()
QVBoxLayout* layout = new QVBoxLayout;
deviceBox = new QComboBox(this);
- foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput))
+ foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
layout->addWidget(deviceBox);
@@ -200,7 +200,7 @@ void AudioTest::deviceChanged(int idx)
void AudioTest::status()
{
- qWarning()<<"byteFree = "<<audioOutput->bytesFree()<<" bytes, clock = "<<audioOutput->clock()<<"ms, totalTime = "<<audioOutput->totalTime()/1000<<"ms";
+ qWarning()<<"byteFree = "<<audioOutput->bytesFree()<<" bytes, elapsedUSecs = "<<audioOutput->elapsedUSecs()<<", processedUSecs = "<<audioOutput->processedUSecs();
}
void AudioTest::writeMore()
@@ -208,7 +208,7 @@ void AudioTest::writeMore()
if(!audioOutput)
return;
- if(audioOutput->state() == QAudio::StopState)
+ if(audioOutput->state() == QAudio::StoppedState)
return;
int l;
@@ -234,7 +234,7 @@ void AudioTest::toggle()
if (pullMode) {
button->setText("Click for Pull Mode");
- output = audioOutput->start(0);
+ output = audioOutput->start();
pullMode = false;
timer->start(20);
} else {
@@ -247,7 +247,7 @@ void AudioTest::toggle()
void AudioTest::togglePlay()
{
// toggle suspend/resume
- if(audioOutput->state() == QAudio::SuspendState) {
+ if(audioOutput->state() == QAudio::SuspendedState) {
qWarning()<<"status: Suspended, resume()";
audioOutput->resume();
button2->setText("Click To Suspend");
@@ -255,7 +255,7 @@ void AudioTest::togglePlay()
qWarning()<<"status: Active, suspend()";
audioOutput->suspend();
button2->setText("Click To Resume");
- } else if (audioOutput->state() == QAudio::StopState) {
+ } else if (audioOutput->state() == QAudio::StoppedState) {
qWarning()<<"status: Stopped, resume()";
audioOutput->resume();
button2->setText("Click To Suspend");
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h
index 6c07a3a6e1..6c07a3a6e1 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.h
+++ b/examples/multimedia/audiooutput/audiooutput.h
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.pro b/examples/multimedia/audiooutput/audiooutput.pro
index b43763cf00..26f68fe3b2 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.pro
+++ b/examples/multimedia/audiooutput/audiooutput.pro
@@ -5,9 +5,9 @@ SOURCES = audiooutput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiooutput/main.cpp b/examples/multimedia/audiooutput/main.cpp
index 79ec99eb64..79ec99eb64 100644
--- a/examples/multimedia/audio/audiooutput/main.cpp
+++ b/examples/multimedia/audiooutput/main.cpp
diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro
index ac78b15b47..4a764f2151 100644
--- a/examples/multimedia/multimedia.pro
+++ b/examples/multimedia/multimedia.pro
@@ -1,5 +1,15 @@
-TEMPLATE = subdirs
-SUBDIRS = audio
+TEMPLATE = subdirs
+
+!static {
+ SUBDIRS += \
+ audiodevices \
+ audioinput \
+ audiooutput
+}
+
+SUBDIRS += \
+ videographicsitem \
+ videowidget
# install
target.path = $$[QT_INSTALL_EXAMPLES]/multimedia
diff --git a/examples/video/videographicsitem/main.cpp b/examples/multimedia/videographicsitem/main.cpp
index 3bf4c6d67c..3bf4c6d67c 100644
--- a/examples/video/videographicsitem/main.cpp
+++ b/examples/multimedia/videographicsitem/main.cpp
diff --git a/examples/video/videographicsitem/videographicsitem.pro b/examples/multimedia/videographicsitem/videographicsitem.pro
index d79c3fb275..7c118ccd60 100644
--- a/examples/video/videographicsitem/videographicsitem.pro
+++ b/examples/multimedia/videographicsitem/videographicsitem.pro
@@ -10,9 +10,9 @@ SOURCES += main.cpp \
videoitem.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
-sources.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
INSTALLS += target sources
symbian {
diff --git a/examples/video/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp
index c95e33591b..99e8df82aa 100644
--- a/examples/video/videographicsitem/videoitem.cpp
+++ b/examples/multimedia/videographicsitem/videoitem.cpp
@@ -104,7 +104,7 @@ QList<QVideoFrame::PixelFormat> VideoItem::supportedPixelFormats(
bool VideoItem::start(const QVideoSurfaceFormat &format)
{
if (isFormatSupported(format)) {
- imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
imageSize = format.frameSize();
framePainted = true;
@@ -129,7 +129,7 @@ void VideoItem::stop()
bool VideoItem::present(const QVideoFrame &frame)
{
if (!framePainted) {
- if (!isStarted())
+ if (!QAbstractVideoSurface::isActive())
setError(StoppedError);
return false;
diff --git a/examples/video/videographicsitem/videoitem.h b/examples/multimedia/videographicsitem/videoitem.h
index 96f578acdd..96f578acdd 100644
--- a/examples/video/videographicsitem/videoitem.h
+++ b/examples/multimedia/videographicsitem/videoitem.h
diff --git a/examples/video/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp
index 83644db7d5..9ac4152df3 100644
--- a/examples/video/videographicsitem/videoplayer.cpp
+++ b/examples/multimedia/videographicsitem/videoplayer.cpp
@@ -119,8 +119,7 @@ void VideoPlayer::openFile()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
if (!fileName.isEmpty()) {
- if (videoItem->isStarted())
- videoItem->stop();
+ videoItem->stop();
movie.setFileName(fileName);
diff --git a/examples/video/videographicsitem/videoplayer.h b/examples/multimedia/videographicsitem/videoplayer.h
index 8e73e4ccf1..8e73e4ccf1 100644
--- a/examples/video/videographicsitem/videoplayer.h
+++ b/examples/multimedia/videographicsitem/videoplayer.h
diff --git a/examples/video/videowidget/main.cpp b/examples/multimedia/videowidget/main.cpp
index f5edf73e4f..f5edf73e4f 100644
--- a/examples/video/videowidget/main.cpp
+++ b/examples/multimedia/videowidget/main.cpp
diff --git a/examples/video/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp
index ed24714994..cd146e8f2b 100644
--- a/examples/video/videowidget/videoplayer.cpp
+++ b/examples/multimedia/videowidget/videoplayer.cpp
@@ -100,8 +100,7 @@ void VideoPlayer::openFile()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Movie"));
if (!fileName.isEmpty()) {
- if (surface->isStarted())
- surface->stop();
+ surface->stop();
movie.setFileName(fileName);
diff --git a/examples/video/videowidget/videoplayer.h b/examples/multimedia/videowidget/videoplayer.h
index 65474152f2..65474152f2 100644
--- a/examples/video/videowidget/videoplayer.h
+++ b/examples/multimedia/videowidget/videoplayer.h
diff --git a/examples/video/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp
index 80688e1998..f73a52f23b 100644
--- a/examples/video/videowidget/videowidget.cpp
+++ b/examples/multimedia/videowidget/videowidget.cpp
@@ -84,7 +84,7 @@ void VideoWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
- if (surface->isStarted()) {
+ if (surface->isActive()) {
const QRect videoRect = surface->videoRect();
if (!videoRect.contains(event->rect())) {
diff --git a/examples/video/videowidget/videowidget.h b/examples/multimedia/videowidget/videowidget.h
index 8c343bf0c7..8c343bf0c7 100644
--- a/examples/video/videowidget/videowidget.h
+++ b/examples/multimedia/videowidget/videowidget.h
diff --git a/examples/video/videowidget/videowidget.pro b/examples/multimedia/videowidget/videowidget.pro
index 4a1d717c5f..3f93745584 100644
--- a/examples/video/videowidget/videowidget.pro
+++ b/examples/multimedia/videowidget/videowidget.pro
@@ -13,6 +13,12 @@ SOURCES = \
videowidget.cpp \
videowidgetsurface.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+INSTALLS += target sources
+
symbian {
TARGET.UID3 = 0xA000D7C3
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/video/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp
index ec9b8b5600..b69375c11b 100644
--- a/examples/video/videowidget/videowidgetsurface.cpp
+++ b/examples/multimedia/videowidget/videowidgetsurface.cpp
@@ -73,7 +73,7 @@ bool VideoWidgetSurface::isFormatSupported(
{
Q_UNUSED(similar);
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
return imageFormat != QImage::Format_Invalid
@@ -85,7 +85,7 @@ bool VideoWidgetSurface::isFormatSupported(
//! [2]
bool VideoWidgetSurface::start(const QVideoSurfaceFormat &format)
{
- const QImage::Format imageFormat = QVideoFrame::equivalentImageFormat(format.pixelFormat());
+ const QImage::Format imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
const QSize size = format.frameSize();
if (imageFormat != QImage::Format_Invalid && !size.isEmpty()) {
diff --git a/examples/video/videowidget/videowidgetsurface.h b/examples/multimedia/videowidget/videowidgetsurface.h
index 83439d303e..83439d303e 100644
--- a/examples/video/videowidget/videowidgetsurface.h
+++ b/examples/multimedia/videowidget/videowidgetsurface.h
diff --git a/examples/multitouch/pinchzoom/graphicsview.cpp b/examples/multitouch/pinchzoom/graphicsview.cpp
index 0c79073144..00e620af7a 100644
--- a/examples/multitouch/pinchzoom/graphicsview.cpp
+++ b/examples/multitouch/pinchzoom/graphicsview.cpp
@@ -45,7 +45,7 @@
#include <QTouchEvent>
GraphicsView::GraphicsView(QGraphicsScene *scene, QWidget *parent)
- : QGraphicsView(scene, parent)
+ : QGraphicsView(scene, parent), totalScaleFactor(1)
{
viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
setDragMode(ScrollHandDrag);
@@ -58,14 +58,24 @@ bool GraphicsView::viewportEvent(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
- QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
+ QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
if (touchPoints.count() == 2) {
// determine scale factor
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
- const qreal scaleFactor = QLineF(touchPoint0.pos(), touchPoint1.pos()).length()
- / QLineF(touchPoint0.startPos(), touchPoint1.startPos()).length();
- setTransform(QTransform().scale(scaleFactor, scaleFactor));
+ qreal currentScaleFactor =
+ QLineF(touchPoint0.pos(), touchPoint1.pos()).length()
+ / QLineF(touchPoint0.startPos(), touchPoint1.startPos()).length();
+ if (touchEvent->touchPointStates() & Qt::TouchPointReleased) {
+ // if one of the fingers is released, remember the current scale
+ // factor so that adding another finger later will continue zooming
+ // by adding new scale factor to the existing remembered value.
+ totalScaleFactor *= currentScaleFactor;
+ currentScaleFactor = 1;
+ }
+ setTransform(QTransform().scale(totalScaleFactor * currentScaleFactor,
+ totalScaleFactor * currentScaleFactor));
}
return true;
}
diff --git a/examples/multitouch/pinchzoom/graphicsview.h b/examples/multitouch/pinchzoom/graphicsview.h
index c5195cd3d9..81a115d955 100644
--- a/examples/multitouch/pinchzoom/graphicsview.h
+++ b/examples/multitouch/pinchzoom/graphicsview.h
@@ -50,4 +50,7 @@ public:
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
bool viewportEvent(QEvent *event);
+
+private:
+ qreal totalScaleFactor;
};
diff --git a/examples/network/blockingfortuneclient/blockingclient.cpp b/examples/network/blockingfortuneclient/blockingclient.cpp
index b731f7a755..a3d7c233a7 100644
--- a/examples/network/blockingfortuneclient/blockingclient.cpp
+++ b/examples/network/blockingfortuneclient/blockingclient.cpp
@@ -50,7 +50,22 @@ BlockingClient::BlockingClient(QWidget *parent)
hostLabel = new QLabel(tr("&Server name:"));
portLabel = new QLabel(tr("S&erver port:"));
- hostLineEdit = new QLineEdit("Localhost");
+ // find out which IP to connect to
+ QString ipAddress;
+ QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
+ // use the first non-localhost IPv4 address
+ for (int i = 0; i < ipAddressesList.size(); ++i) {
+ if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
+ ipAddressesList.at(i).toIPv4Address()) {
+ ipAddress = ipAddressesList.at(i).toString();
+ break;
+ }
+ }
+ // if we did not find one, use IPv4 localhost
+ if (ipAddress.isEmpty())
+ ipAddress = QHostAddress(QHostAddress::LocalHost).toString();
+
+ hostLineEdit = new QLineEdit(ipAddress);
portLineEdit = new QLineEdit;
portLineEdit->setValidator(new QIntValidator(1, 65535, this));
diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp
index ca5d40efdd..e043f78a39 100644
--- a/examples/network/fortuneclient/client.cpp
+++ b/examples/network/fortuneclient/client.cpp
@@ -62,8 +62,10 @@ Client::Client(QWidget *parent)
// use the first non-localhost IPv4 address
for (int i = 0; i < ipAddressesList.size(); ++i) {
if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
- ipAddressesList.at(i).toIPv4Address())
+ ipAddressesList.at(i).toIPv4Address()) {
ipAddress = ipAddressesList.at(i).toString();
+ break;
+ }
}
// if we did not find one, use IPv4 localhost
if (ipAddress.isEmpty())
diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp
index 52b7d61f5f..06f6eebca3 100644
--- a/examples/network/fortuneserver/server.cpp
+++ b/examples/network/fortuneserver/server.cpp
@@ -68,8 +68,10 @@ Server::Server(QWidget *parent)
// use the first non-localhost IPv4 address
for (int i = 0; i < ipAddressesList.size(); ++i) {
if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
- ipAddressesList.at(i).toIPv4Address())
+ ipAddressesList.at(i).toIPv4Address()) {
ipAddress = ipAddressesList.at(i).toString();
+ break;
+ }
}
// if we did not find one, use IPv4 localhost
if (ipAddress.isEmpty())
diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp
index e1588a6b93..a1075ec803 100644
--- a/examples/network/googlesuggest/googlesuggest.cpp
+++ b/examples/network/googlesuggest/googlesuggest.cpp
@@ -39,17 +39,22 @@
**
****************************************************************************/
-#include <QtCore>
-#include <QtGui>
-#include <QtNetwork>
+//! [1]
#include "googlesuggest.h"
#define GSUGGEST_URL "http://google.com/complete/search?output=toolbar&q=%1"
+//! [1]
+//! [2]
GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), editor(parent)
{
popup = new QTreeWidget;
+ popup->setWindowFlags(Qt::Popup);
+ popup->setFocusPolicy(Qt::NoFocus);
+ popup->setFocusProxy(parent);
+ popup->setMouseTracking(true);
+
popup->setColumnCount(2);
popup->setUniformRowHeights(true);
popup->setRootIsDecorated(false);
@@ -57,18 +62,13 @@ GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), edit
popup->setSelectionBehavior(QTreeWidget::SelectRows);
popup->setFrameStyle(QFrame::Box | QFrame::Plain);
popup->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
popup->header()->hide();
+
popup->installEventFilter(this);
- popup->setMouseTracking(true);
connect(popup, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
SLOT(doneCompletion()));
- popup->setWindowFlags(Qt::Popup);
- popup->setFocusPolicy(Qt::NoFocus);
- popup->setFocusProxy(parent);
-
timer = new QTimer(this);
timer->setSingleShot(true);
timer->setInterval(500);
@@ -79,12 +79,16 @@ GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), edit
this, SLOT(handleNetworkData(QNetworkReply*)));
}
+//! [2]
+//! [3]
GSuggestCompletion::~GSuggestCompletion()
{
delete popup;
}
+//! [3]
+//! [4]
bool GSuggestCompletion::eventFilter(QObject *obj, QEvent *ev)
{
if (obj != popup)
@@ -131,9 +135,12 @@ bool GSuggestCompletion::eventFilter(QObject *obj, QEvent *ev)
return false;
}
+//! [4]
+//! [5]
void GSuggestCompletion::showCompletion(const QStringList &choices, const QStringList &hits)
{
+
if (choices.isEmpty() || choices.count() != hits.count())
return;
@@ -163,7 +170,9 @@ void GSuggestCompletion::showCompletion(const QStringList &choices, const QStrin
popup->setFocus();
popup->show();
}
+//! [5]
+//! [6]
void GSuggestCompletion::doneCompletion()
{
timer->stop();
@@ -172,26 +181,28 @@ void GSuggestCompletion::doneCompletion()
QTreeWidgetItem *item = popup->currentItem();
if (item) {
editor->setText(item->text(0));
- QKeyEvent *e;
- e = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
- QApplication::postEvent(editor, e);
- e = new QKeyEvent(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
- QApplication::postEvent(editor, e);
+ QMetaObject::invokeMethod(editor, "returnPressed");
}
}
+//! [6]
-void GSuggestCompletion::preventSuggest()
-{
- timer->stop();
-}
-
+//! [7]
void GSuggestCompletion::autoSuggest()
{
QString str = editor->text();
QString url = QString(GSUGGEST_URL).arg(str);
networkManager.get(QNetworkRequest(QString(url)));
}
+//! [7]
+
+//! [8]
+void GSuggestCompletion::preventSuggest()
+{
+ timer->stop();
+}
+//! [8]
+//! [9]
void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
{
QUrl url = networkReply->url();
@@ -199,20 +210,20 @@ void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
QStringList choices;
QStringList hits;
- QString response(networkReply->readAll());
+ QByteArray response(networkReply->readAll());
QXmlStreamReader xml(response);
while (!xml.atEnd()) {
xml.readNext();
- if (xml.isStartElement()) {
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
if (xml.name() == "suggestion") {
QStringRef str = xml.attributes().value("data");
choices << str.toString();
}
- else if (xml.name() == "num_queries") {
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ if (xml.name() == "num_queries") {
QStringRef str = xml.attributes().value("int");
hits << str.toString();
}
- }
}
showCompletion(choices, hits);
@@ -220,3 +231,4 @@ void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
networkReply->deleteLater();
}
+//! [9] \ No newline at end of file
diff --git a/examples/network/googlesuggest/googlesuggest.h b/examples/network/googlesuggest/googlesuggest.h
index 2a3c87853f..c33df360ab 100644
--- a/examples/network/googlesuggest/googlesuggest.h
+++ b/examples/network/googlesuggest/googlesuggest.h
@@ -42,8 +42,9 @@
#ifndef GOOGLESUGGEST_H
#define GOOGLESUGGEST_H
+#include <QtGui>
+#include <QtNetwork>
#include <QObject>
-#include <QNetworkAccessManager>
QT_BEGIN_NAMESPACE
class QLineEdit;
@@ -52,6 +53,7 @@ class QTimer;
class QTreeWidget;
QT_END_NAMESPACE
+//! [1]
class GSuggestCompletion : public QObject
{
Q_OBJECT
@@ -75,6 +77,6 @@ private:
QTimer *timer;
QNetworkAccessManager networkManager;
};
-
+//! [1]
#endif // GOOGLESUGGEST_H
diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp
index 21599e0ea6..ae08a75dde 100644
--- a/examples/network/googlesuggest/searchbox.cpp
+++ b/examples/network/googlesuggest/searchbox.cpp
@@ -47,12 +47,12 @@
#define GSEARCH_URL "http://www.google.com/search?q=%1"
-
+//! [1]
SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
{
completer = new GSuggestCompletion(this);
- connect(this, SIGNAL(returnPressed()), SLOT(doSearch()));
+ connect(this, SIGNAL(returnPressed()),this, SLOT(doSearch()));
setWindowTitle("Search with Google");
@@ -60,10 +60,13 @@ SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
resize(400, height());
setFocus();
}
+//! [1]
+//! [2]
void SearchBox::doSearch()
{
completer->preventSuggest();
QString url = QString(GSEARCH_URL).arg(text());
QDesktopServices::openUrl(QUrl(url));
}
+//! [2] \ No newline at end of file
diff --git a/examples/network/googlesuggest/searchbox.h b/examples/network/googlesuggest/searchbox.h
index 4b03dba20b..ec18bb090a 100644
--- a/examples/network/googlesuggest/searchbox.h
+++ b/examples/network/googlesuggest/searchbox.h
@@ -42,6 +42,7 @@
#ifndef SEARCHBOX_H
#define SEARCHBOX_H
+//! [1]
#include <QLineEdit>
class GSuggestCompletion;
@@ -58,6 +59,7 @@ protected slots:
private:
GSuggestCompletion *completer;
+//! [1]
};
diff --git a/examples/network/network.pro b/examples/network/network.pro
index 08492711cb..c5a97fb62b 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -19,6 +19,7 @@ SUBDIRS = blockingfortuneclient \
symbian: SUBDIRS = qftp
contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
+contains(QT_CONFIG, openssl-linked):SUBDIRS += securesocketclient
# install
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS network.pro README
diff --git a/examples/network/qftp/sym_iap_util.h b/examples/network/qftp/sym_iap_util.h
index ebeae0aa81..9b4128c7cf 100644
--- a/examples/network/qftp/sym_iap_util.h
+++ b/examples/network/qftp/sym_iap_util.h
@@ -501,10 +501,14 @@ static void qt_SetDefaultIapL()
static int qt_SetDefaultIap()
{
+#ifndef __WINS__
TRAPD(err1, qt_SetDefaultIapL());
// TRAPD(err2, qt_InterfaceInfoL());
// TRAPD(err3, qt_RouteInfoL());
return err1;
+#else
+ return 0; // IAP dialog not required for emulator
+#endif
}
#endif // QSYM_IAP_UTIL_H
diff --git a/examples/network/threadedfortuneserver/dialog.cpp b/examples/network/threadedfortuneserver/dialog.cpp
index b1ea395870..d0d3fc020a 100644
--- a/examples/network/threadedfortuneserver/dialog.cpp
+++ b/examples/network/threadedfortuneserver/dialog.cpp
@@ -67,8 +67,10 @@ Dialog::Dialog(QWidget *parent)
// use the first non-localhost IPv4 address
for (int i = 0; i < ipAddressesList.size(); ++i) {
if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
- ipAddressesList.at(i).toIPv4Address())
+ ipAddressesList.at(i).toIPv4Address()) {
ipAddress = ipAddressesList.at(i).toString();
+ break;
+ }
}
// if we did not find one, use IPv4 localhost
if (ipAddress.isEmpty())
diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro
index 3168743415..80ef7df315 100644
--- a/examples/opengl/hellogl_es/hellogl_es.pro
+++ b/examples/opengl/hellogl_es/hellogl_es.pro
@@ -20,15 +20,6 @@ HEADERS += bubble.h
RESOURCES += texture.qrc
QT += opengl
-wince*:{
- contains(QT_CONFIG,opengles1) {
- QMAKE_LIBS += "libGLES_CM.lib"
- }
- contains(QT_CONFIG,opengles1cl) {
- QMAKE_LIBS += "libGLES_CL.lib"
- }
-}
-
# install
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es.pro
diff --git a/examples/opengl/hellogl_es2/glwidget.cpp b/examples/opengl/hellogl_es2/glwidget.cpp
index a31c34a3c0..08e887af21 100644
--- a/examples/opengl/hellogl_es2/glwidget.cpp
+++ b/examples/opengl/hellogl_es2/glwidget.cpp
@@ -92,6 +92,8 @@ void GLWidget::showBubbles(bool bubbles)
void GLWidget::paintQtLogo()
{
+ program1.enableAttributeArray(normalAttr1);
+ program1.enableAttributeArray(vertexAttr1);
program1.setAttributeArray(vertexAttr1, vertices.constData());
program1.setAttributeArray(normalAttr1, normals.constData());
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
@@ -159,6 +161,10 @@ void GLWidget::paintTexturedCube()
program2.setUniformValue(textureUniform2, 0); // use texture unit 0
+ program2.enableAttributeArray(vertexAttr2);
+ program2.enableAttributeArray(normalAttr2);
+ program2.enableAttributeArray(texCoordAttr2);
+
glDrawArrays(GL_TRIANGLES, 0, 36);
program2.disableAttributeArray(vertexAttr2);
@@ -173,7 +179,7 @@ void GLWidget::initializeGL ()
glGenTextures(1, &m_uiTexture);
m_uiTexture = bindTexture(QImage(":/qt.png"));
- QGLShader *vshader1 = new QGLShader(QGLShader::VertexShader, this);
+ QGLShader *vshader1 = new QGLShader(QGLShader::Vertex, this);
const char *vsrc1 =
"attribute highp vec4 vertex;\n"
"attribute mediump vec3 normal;\n"
@@ -188,16 +194,16 @@ void GLWidget::initializeGL ()
" color = clamp(color, 0.0, 1.0);\n"
" gl_Position = matrix * vertex;\n"
"}\n";
- vshader1->compile(vsrc1);
+ vshader1->compileSourceCode(vsrc1);
- QGLShader *fshader1 = new QGLShader(QGLShader::FragmentShader, this);
+ QGLShader *fshader1 = new QGLShader(QGLShader::Fragment, this);
const char *fsrc1 =
"varying mediump vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = color;\n"
"}\n";
- fshader1->compile(fsrc1);
+ fshader1->compileSourceCode(fsrc1);
program1.addShader(vshader1);
program1.addShader(fshader1);
@@ -207,7 +213,7 @@ void GLWidget::initializeGL ()
normalAttr1 = program1.attributeLocation("normal");
matrixUniform1 = program1.uniformLocation("matrix");
- QGLShader *vshader2 = new QGLShader(QGLShader::VertexShader);
+ QGLShader *vshader2 = new QGLShader(QGLShader::Vertex);
const char *vsrc2 =
"attribute highp vec4 vertex;\n"
"attribute highp vec4 texCoord;\n"
@@ -222,9 +228,9 @@ void GLWidget::initializeGL ()
" gl_Position = matrix * vertex;\n"
" texc = texCoord;\n"
"}\n";
- vshader2->compile(vsrc2);
+ vshader2->compileSourceCode(vsrc2);
- QGLShader *fshader2 = new QGLShader(QGLShader::FragmentShader);
+ QGLShader *fshader2 = new QGLShader(QGLShader::Fragment);
const char *fsrc2 =
"varying highp vec4 texc;\n"
"uniform sampler2D tex;\n"
@@ -235,7 +241,7 @@ void GLWidget::initializeGL ()
" color = color * 0.2 + color * 0.8 * angle;\n"
" gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);\n"
"}\n";
- fshader2->compile(fsrc2);
+ fshader2->compileSourceCode(fsrc2);
program2.addShader(vshader2);
program2.addShader(fshader2);
@@ -284,15 +290,15 @@ void GLWidget::paintGL()
modelview.translate(0.0f, -0.2f, 0.0f);
if (qtLogo) {
- program1.enable();
+ program1.bind();
program1.setUniformValue(matrixUniform1, modelview);
paintQtLogo();
- program1.disable();
+ program1.release();
} else {
- program2.enable();
+ program2.bind();
program1.setUniformValue(matrixUniform2, modelview);
paintTexturedCube();
- program2.disable();
+ program2.release();
}
glDisable(GL_DEPTH_TEST);
diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro
index d5ad4b81ec..92b42248de 100644
--- a/examples/opengl/hellogl_es2/hellogl_es2.pro
+++ b/examples/opengl/hellogl_es2/hellogl_es2.pro
@@ -25,9 +25,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2
INSTALLS += target sources
-
-
-wince*: {
- QMAKE_LIBS += "libGLESv2.lib"
-
-} \ No newline at end of file
diff --git a/examples/opengl/pbuffers/cube.h b/examples/opengl/pbuffers/cube.h
index c882f1f672..f17299fd4b 100644
--- a/examples/opengl/pbuffers/cube.h
+++ b/examples/opengl/pbuffers/cube.h
@@ -48,7 +48,9 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qvector2d.h>
+QT_BEGIN_NAMESPACE
class QPropertyAnimation;
+QT_END_NAMESPACE
class Geometry
{
diff --git a/examples/opengl/pbuffers/glwidget.cpp b/examples/opengl/pbuffers/glwidget.cpp
index 56ba65b73d..d843a73219 100644
--- a/examples/opengl/pbuffers/glwidget.cpp
+++ b/examples/opengl/pbuffers/glwidget.cpp
@@ -175,7 +175,11 @@ void GLWidget::perspectiveProjection()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES
+ glFrustumf(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
+#else
glFrustum(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
@@ -183,7 +187,11 @@ void GLWidget::orthographicProjection()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES
+ glOrthof(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
+#else
glOrtho(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h
index c019abef98..1b46bfdf54 100644
--- a/examples/opengl/pbuffers/glwidget.h
+++ b/examples/opengl/pbuffers/glwidget.h
@@ -47,7 +47,9 @@
class Geometry;
class Cube;
class Tile;
+QT_BEGIN_NAMESPACE
class QGLPixelBuffer;
+QT_END_NAMESPACE
class GLWidget : public QGLWidget
{
diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp
index 6efd31a5bb..0f50e2dff8 100644
--- a/examples/opengl/textures/glwidget.cpp
+++ b/examples/opengl/textures/glwidget.cpp
@@ -99,7 +99,7 @@ void GLWidget::initializeGL()
#define PROGRAM_VERTEX_ATTRIBUTE 0
#define PROGRAM_TEXCOORD_ATTRIBUTE 1
- QGLShader *vshader = new QGLShader(QGLShader::VertexShader, this);
+ QGLShader *vshader = new QGLShader(QGLShader::Vertex, this);
const char *vsrc =
"attribute highp vec4 vertex;\n"
"attribute mediump vec4 texCoord;\n"
@@ -110,9 +110,9 @@ void GLWidget::initializeGL()
" gl_Position = matrix * vertex;\n"
" texc = texCoord;\n"
"}\n";
- vshader->compile(vsrc);
+ vshader->compileSourceCode(vsrc);
- QGLShader *fshader = new QGLShader(QGLShader::FragmentShader, this);
+ QGLShader *fshader = new QGLShader(QGLShader::Fragment, this);
const char *fsrc =
"uniform sampler2D texture;\n"
"varying mediump vec4 texc;\n"
@@ -120,7 +120,7 @@ void GLWidget::initializeGL()
"{\n"
" gl_FragColor = texture2D(texture, texc.st);\n"
"}\n";
- fshader->compile(fsrc);
+ fshader->compileSourceCode(fsrc);
program = new QGLShaderProgram(this);
program->addShader(vshader);
@@ -129,7 +129,7 @@ void GLWidget::initializeGL()
program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE);
program->link();
- program->enable();
+ program->bind();
program->setUniformValue("texture", 0);
#endif
@@ -163,6 +163,8 @@ void GLWidget::paintGL()
m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f);
program->setUniformValue("matrix", m);
+ program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE);
+ program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE);
program->setAttributeArray
(PROGRAM_VERTEX_ATTRIBUTE, vertices.constData());
program->setAttributeArray
diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro
index 11346192ef..e0e48953e4 100644
--- a/examples/painting/svggenerator/svggenerator.pro
+++ b/examples/painting/svggenerator/svggenerator.pro
@@ -14,4 +14,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS svggenerator.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator
INSTALLS += target sources
-symbian:TARGET.UID3 = 0xA000CF68 \ No newline at end of file
+symbian {
+ TARGET.UID3 = 0xA000CF68
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 7291b9769b..bce69e4da7 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -72,18 +72,6 @@ private:
int m_last;
};
-static qint32 toArrayIndex(const QString &str)
-{
- QByteArray bytes = str.toUtf8();
- char *eptr;
- quint32 pos = strtoul(bytes.constData(), &eptr, 10);
- if ((eptr == bytes.constData() + bytes.size())
- && (QByteArray::number(pos) == bytes)) {
- return pos;
- }
- return -1;
-}
-
//! [0]
ByteArrayClass::ByteArrayClass(QScriptEngine *engine)
: QObject(engine), QScriptClass(engine)
@@ -120,8 +108,9 @@ QScriptClass::QueryFlags ByteArrayClass::queryProperty(const QScriptValue &objec
if (name == length) {
return flags;
} else {
- qint32 pos = toArrayIndex(name);
- if (pos == -1)
+ bool isArrayIndex;
+ qint32 pos = name.toArrayIndex(&isArrayIndex);
+ if (!isArrayIndex)
return 0;
*id = pos;
if ((flags & HandlesReadAccess) && (pos >= ba->size()))
diff --git a/examples/tools/regexp/regexpdialog.cpp b/examples/tools/regexp/regexpdialog.cpp
index 08c7a9725f..3becc2bab7 100644
--- a/examples/tools/regexp/regexpdialog.cpp
+++ b/examples/tools/regexp/regexpdialog.cpp
@@ -180,8 +180,8 @@ void RegExpDialog::refresh()
indexEdit->setText(QString::number(rx.indexIn(text)));
matchedLengthEdit->setText(QString::number(rx.matchedLength()));
for (int i = 0; i < MaxCaptures; ++i) {
- captureLabels[i]->setEnabled(i <= rx.numCaptures());
- captureEdits[i]->setEnabled(i <= rx.numCaptures());
+ captureLabels[i]->setEnabled(i <= rx.captureCount());
+ captureEdits[i]->setEnabled(i <= rx.captureCount());
captureEdits[i]->setText(rx.cap(i));
}
diff --git a/examples/video/video.pro b/examples/video/video.pro
deleted file mode 100644
index f0b63b6d00..0000000000
--- a/examples/video/video.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- videographicsitem \
- videowidget
-
diff --git a/examples/webkit/domtraversal/domtraversal.pro b/examples/webkit/domtraversal/domtraversal.pro
new file mode 100644
index 0000000000..49400de2e3
--- /dev/null
+++ b/examples/webkit/domtraversal/domtraversal.pro
@@ -0,0 +1,11 @@
+QT += webkit network
+FORMS = window.ui
+HEADERS = window.h
+SOURCES = main.cpp \
+ window.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/domtraversal
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/domtraversal
+INSTALLS += target sources
diff --git a/examples/webkit/domtraversal/main.cpp b/examples/webkit/domtraversal/main.cpp
new file mode 100644
index 0000000000..c8a1aecc45
--- /dev/null
+++ b/examples/webkit/domtraversal/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Window window;
+ window.show();
+ window.setUrl(QUrl("http://qt.nokia.com/"));
+ return app.exec();
+}
diff --git a/examples/gestures/imageviewer/main.cpp b/examples/webkit/domtraversal/window.cpp
index c3d03f3879..704a6e177c 100644
--- a/examples/gestures/imageviewer/main.cpp
+++ b/examples/webkit/domtraversal/window.cpp
@@ -40,51 +40,51 @@
****************************************************************************/
#include <QtGui>
+#include <QtWebKit>
-#include "imagewidget.h"
+#include "window.h"
-class MainWidget : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWidget(QWidget *parent = 0);
-
-public slots:
- void openDirectory(const QString &path);
-
-private:
- bool loadImage(const QString &fileName);
-
- ImageWidget *imageWidget;
-};
-
-MainWidget::MainWidget(QWidget *parent)
+//! [Window constructor]
+Window::Window(QWidget *parent)
: QMainWindow(parent)
{
- resize(400, 300);
- imageWidget = new ImageWidget(this);
- setCentralWidget(imageWidget);
+ setupUi(this);
}
+//! [Window constructor]
-void MainWidget::openDirectory(const QString &path)
+//! [set URL]
+void Window::setUrl(const QUrl &url)
+{
+ webView->setUrl(url);
+}
+//! [set URL]
+
+//! [begin document inspection]
+void Window::on_webView_loadFinished()
{
- imageWidget->openDirectory(path);
+ treeWidget->clear();
+
+ QWebFrame *frame = webView->page()->mainFrame();
+ QWebElement document = frame->documentElement();
+
+ examineChildElements(document, treeWidget->invisibleRootItem());
}
+//! [begin document inspection]
-int main(int argc, char *argv[])
+//! [traverse document]
+void Window::examineChildElements(const QWebElement &parentElement,
+ QTreeWidgetItem *parentItem)
{
- QApplication app(argc, argv);
+ QWebElement element = parentElement.firstChild();
+ while (!element.isNull()) {
- MainWidget w;
- w.show();
+ QTreeWidgetItem *item = new QTreeWidgetItem();
+ item->setText(0, element.tagName());
+ parentItem->addChild(item);
- if (QApplication::arguments().size() > 1)
- w.openDirectory(QApplication::arguments().at(1));
- else
- w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));
+ examineChildElements(element, item);
- return app.exec();
+ element = element.nextSibling();
+ }
}
-
-#include "main.moc"
+//! [traverse document]
diff --git a/examples/webkit/domtraversal/window.h b/examples/webkit/domtraversal/window.h
new file mode 100644
index 0000000000..5988df9cbb
--- /dev/null
+++ b/examples/webkit/domtraversal/window.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QMainWindow>
+#include <QUrl>
+#include <QWebElement>
+
+class QTreeWidgetItem;
+
+//! [Window class definition]
+#include "ui_window.h"
+
+class Window : public QMainWindow, private Ui::Window
+{
+ Q_OBJECT
+
+public:
+ Window(QWidget *parent = 0);
+ void setUrl(const QUrl &url);
+
+public slots:
+ void on_webView_loadFinished();
+
+private:
+ void examineChildElements(const QWebElement &parentElement,
+ QTreeWidgetItem *parentItem);
+};
+//! [Window class definition]
+
+#endif
diff --git a/examples/webkit/domtraversal/window.ui b/examples/webkit/domtraversal/window.ui
new file mode 100644
index 0000000000..0fce03501c
--- /dev/null
+++ b/examples/webkit/domtraversal/window.ui
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Window</class>
+ <widget class="QMainWindow" name="Window">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Web Element DOM Traversal</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="topMargin">
+ <number>4</number>
+ </property>
+ <property name="bottomMargin">
+ <number>4</number>
+ </property>
+ <item>
+ <widget class="QWebView" name="webView">
+ <property name="url">
+ <url>
+ <string>http://qt.nokia.com/</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>27</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <widget class="QDockWidget" name="dockWidget">
+ <property name="allowedAreas">
+ <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
+ </property>
+ <property name="windowTitle">
+ <string>Document Structure</string>
+ </property>
+ <attribute name="dockWidgetArea">
+ <number>1</number>
+ </attribute>
+ <widget class="QWidget" name="dockWidgetContents">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="margin">
+ <number>4</number>
+ </property>
+ <item>
+ <widget class="QTreeWidget" name="treeWidget">
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QWebView</class>
+ <extends>QWidget</extends>
+ <header>QtWebKit/QWebView</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp
index a3293b8c28..11fac91937 100644
--- a/examples/webkit/fancybrowser/mainwindow.cpp
+++ b/examples/webkit/fancybrowser/mainwindow.cpp
@@ -150,12 +150,11 @@ void MainWindow::highlightAllLinks()
//! [8]
void MainWindow::rotateImages(bool toggle)
{
- QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )";
- view->page()->mainFrame()->evaluateJavaScript(code);
+ QString code;
if (toggle)
- code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(180deg)') } )";
+ code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s'); $(this).css('-webkit-transform', 'rotate(180deg)') } )";
else
- code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )";
+ code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s'); $(this).css('-webkit-transform', 'rotate(0deg)') } )";
view->page()->mainFrame()->evaluateJavaScript(code);
}
//! [8]
diff --git a/examples/webkit/simpleselector/main.cpp b/examples/webkit/simpleselector/main.cpp
new file mode 100644
index 0000000000..74c5469cd7
--- /dev/null
+++ b/examples/webkit/simpleselector/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+//! [main program]
+#include <QtGui>
+#include "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Window window;
+ window.setUrl(QUrl("http://www.webkit.org"));
+ window.show();
+ return app.exec();
+}
+//! [main program]
diff --git a/examples/webkit/simpleselector/simpleselector.pro b/examples/webkit/simpleselector/simpleselector.pro
new file mode 100644
index 0000000000..3f3037f769
--- /dev/null
+++ b/examples/webkit/simpleselector/simpleselector.pro
@@ -0,0 +1,11 @@
+QT += webkit
+FORMS = window.ui
+HEADERS = window.h
+SOURCES = main.cpp \
+ window.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webkit/simpleselector
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/simpleselector
+INSTALLS += target sources
diff --git a/examples/webkit/simpleselector/window.cpp b/examples/webkit/simpleselector/window.cpp
new file mode 100644
index 0000000000..ad54487a03
--- /dev/null
+++ b/examples/webkit/simpleselector/window.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#include <QWebElement>
+#include <QWebFrame>
+#include "window.h"
+
+//! [Window class constructor]
+Window::Window(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+}
+//! [Window class constructor]
+
+//! [return pressed]
+void Window::on_elementLineEdit_returnPressed()
+{
+ QWebFrame *frame = webView->page()->mainFrame();
+
+//! [select elements]
+ QWebElement document = frame->documentElement();
+ QWebElementCollection elements = document.findAll(elementLineEdit->text());
+//! [select elements]
+
+ foreach (QWebElement element, elements)
+ element.setAttribute("style", "background-color: #f0f090");
+}
+//! [return pressed]
+
+//! [button clicked]
+void Window::on_highlightButton_clicked()
+{
+ on_elementLineEdit_returnPressed();
+}
+//! [button clicked]
+
+//! [set URL]
+void Window::setUrl(const QUrl &url)
+{
+ webView->setUrl(url);
+}
+//! [set URL]
diff --git a/examples/webkit/simpleselector/window.h b/examples/webkit/simpleselector/window.h
new file mode 100644
index 0000000000..9f9344aaa3
--- /dev/null
+++ b/examples/webkit/simpleselector/window.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QUrl>
+#include <QWidget>
+//! [Window class definition]
+#include "ui_window.h"
+
+class Window : public QWidget, private Ui::Window
+{
+ Q_OBJECT
+
+public:
+ Window(QWidget *parent = 0);
+ void setUrl(const QUrl &url);
+
+public slots:
+ void on_elementLineEdit_returnPressed();
+ void on_highlightButton_clicked();
+};
+//! [Window class definition]
+
+#endif
diff --git a/examples/webkit/simpleselector/window.ui b/examples/webkit/simpleselector/window.ui
new file mode 100644
index 0000000000..aa824df64c
--- /dev/null
+++ b/examples/webkit/simpleselector/window.ui
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Window</class>
+ <widget class="QWidget" name="Window">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Web Element Selector</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QWebView" name="webView">
+ <property name="url">
+ <url>
+ <string>http://webkit.org/</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="elementLabel">
+ <property name="text">
+ <string>&amp;Element:</string>
+ </property>
+ <property name="buddy">
+ <cstring>elementLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="elementLineEdit">
+ <property name="text">
+ <string>li a</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QPushButton" name="highlightButton">
+ <property name="text">
+ <string>&amp;Highlight</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>QWebView</class>
+ <extends>QWidget</extends>
+ <header>QtWebKit/QWebView</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro
index 0a1d6bd82f..c985ed58f5 100644
--- a/examples/webkit/webkit.pro
+++ b/examples/webkit/webkit.pro
@@ -1,7 +1,9 @@
TEMPLATE = subdirs
-SUBDIRS += formextractor \
+SUBDIRS += domtraversal \
+ formextractor \
previewer \
- fancybrowser
+ fancybrowser \
+ simpleselector
contains(QT_CONFIG, openssl):SUBDIRS += googlechat
diff --git a/examples/xmlpatterns/filetree/filetree.pro b/examples/xmlpatterns/filetree/filetree.pro
index 0238c23dce..4fcf7cb16c 100644
--- a/examples/xmlpatterns/filetree/filetree.pro
+++ b/examples/xmlpatterns/filetree/filetree.pro
@@ -2,7 +2,6 @@ SOURCES += main.cpp filetree.cpp mainwindow.cpp ../shared/xmlsyntaxhighlighter.c
HEADERS += filetree.h mainwindow.h ../shared/xmlsyntaxhighlighter.h
FORMS += forms/mainwindow.ui
QT += xmlpatterns
-CONFIG -= app_bundle
RESOURCES += queries.qrc
INCLUDEPATH += ../shared/
@@ -12,4 +11,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xq *.html
sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/filetree
INSTALLS += target sources
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian {
+ TARGET.UID3 = 0xA000D7C4
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
diff --git a/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro
index 39f01062cc..5a63b2bbb5 100644
--- a/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro
+++ b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro
@@ -11,3 +11,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/qobjectxmlmodel
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xq *.html
sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/qobjectxmlmodel
INSTALLS += target sources
+
+symbian {
+ TARGET.UID3 = 0xA000D7C8
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
diff --git a/examples/xmlpatterns/recipes/recipes.pro b/examples/xmlpatterns/recipes/recipes.pro
index f02a018494..67d6d73401 100644
--- a/examples/xmlpatterns/recipes/recipes.pro
+++ b/examples/xmlpatterns/recipes/recipes.pro
@@ -10,4 +10,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html forms files
sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/recipes
INSTALLS += target sources
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian {
+ TARGET.UID3 = 0xA000D7C5
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
diff --git a/examples/xmlpatterns/schema/schema.pro b/examples/xmlpatterns/schema/schema.pro
index af32e0a39b..4d3520c1a9 100644
--- a/examples/xmlpatterns/schema/schema.pro
+++ b/examples/xmlpatterns/schema/schema.pro
@@ -9,3 +9,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xq *.html files
sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/schema
INSTALLS += target sources
+
+symbian {
+ TARGET.UID3 = 0xA000D7C6
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
diff --git a/examples/xmlpatterns/trafficinfo/trafficinfo.pro b/examples/xmlpatterns/trafficinfo/trafficinfo.pro
index 52bcc19f16..99825d0db9 100644
--- a/examples/xmlpatterns/trafficinfo/trafficinfo.pro
+++ b/examples/xmlpatterns/trafficinfo/trafficinfo.pro
@@ -7,3 +7,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/trafficinfo
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/xmlpatterns/trafficinfo
INSTALLS += target sources
+
+symbian {
+ TARGET.UID3 = 0xA000D7C7
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}