summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/affine/main.cpp2
-rw-r--r--demos/arthurplugin/arthurplugin.pro1
-rw-r--r--demos/books/books.pro4
-rw-r--r--demos/boxes/glbuffers.cpp10
-rw-r--r--demos/boxes/glbuffers.h2
-rw-r--r--demos/boxes/qtbox.cpp2
-rw-r--r--demos/boxes/scene.cpp2
-rw-r--r--demos/browser/browserapplication.cpp4
-rw-r--r--demos/browser/cookiejar.cpp2
-rw-r--r--demos/browser/networkaccessmanager.cpp9
-rw-r--r--demos/browser/networkaccessmanager.h1
-rw-r--r--demos/browser/settings.cpp4
-rw-r--r--demos/chip/view.cpp54
-rw-r--r--demos/chip/view.h32
-rw-r--r--demos/composition/main.cpp2
-rw-r--r--demos/declarative/minehunt/minehunt.pro2
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js223
-rw-r--r--demos/declarative/snake/content/Link.qml7
-rw-r--r--demos/declarative/snake/content/snake.js16
-rw-r--r--demos/declarative/snake/snake.qml41
-rw-r--r--demos/deform/main.cpp2
-rw-r--r--demos/deform/pathdeform.cpp2
-rw-r--r--demos/demos.pro6
-rw-r--r--demos/embedded/desktopservices/desktopservices.pro4
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.pro80
-rw-r--r--demos/embedded/qmlcalculator/deployment.pri2
-rw-r--r--demos/embedded/qmlclocks/deployment.pri2
-rw-r--r--demos/embedded/qmldialcontrol/deployment.pri2
-rw-r--r--demos/embedded/qmleasing/deployment.pri2
-rw-r--r--demos/embedded/qmlflickr/deployment.pri2
-rw-r--r--demos/embedded/qmlphotoviewer/deployment.pri2
-rw-r--r--demos/embedded/qmltwitter/deployment.pri2
-rw-r--r--demos/embeddeddialogs/customproxy.cpp2
-rw-r--r--demos/glhypnotizer/glhypnotizer.pro21
-rw-r--r--demos/glhypnotizer/hypnotizer.qrc6
-rw-r--r--demos/glhypnotizer/main.cpp356
-rw-r--r--demos/glhypnotizer/qt-logo.pngbin0 -> 2493 bytes
-rw-r--r--demos/glhypnotizer/spiral.svg100
-rw-r--r--demos/gradients/main.cpp2
-rw-r--r--demos/interview/model.cpp2
-rw-r--r--demos/mainwindow/colorswatch.cpp6
-rw-r--r--demos/mainwindow/toolbar.cpp2
-rw-r--r--demos/pathstroke/main.cpp2
-rw-r--r--demos/pathstroke/pathstroke.cpp2
-rw-r--r--demos/qmediaplayer/qmediaplayer.pro2
-rw-r--r--demos/qtdemo/xml/examples.xml4
-rw-r--r--demos/shared/arthurstyle.cpp2
-rw-r--r--demos/shared/arthurwidgets.cpp2
-rw-r--r--demos/spectrum/app/app.pro2
-rw-r--r--demos/spectrum/app/settingsdialog.cpp8
-rw-r--r--demos/spreadsheet/spreadsheetitem.cpp6
51 files changed, 851 insertions, 204 deletions
diff --git a/demos/affine/main.cpp b/demos/affine/main.cpp
index c95e0b9..1975893 100644
--- a/demos/affine/main.cpp
+++ b/demos/affine/main.cpp
@@ -53,7 +53,7 @@ int main(int argc, char **argv)
QStyle *arthurStyle = new ArthurStyle();
xformWidget.setStyle(arthurStyle);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(&xformWidget);
+ QList<QWidget *> widgets = xformWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets) {
w->setStyle(arthurStyle);
w->setAttribute(Qt::WA_AcceptTouchEvents);
diff --git a/demos/arthurplugin/arthurplugin.pro b/demos/arthurplugin/arthurplugin.pro
index 3114293..bc542fb 100644
--- a/demos/arthurplugin/arthurplugin.pro
+++ b/demos/arthurplugin/arthurplugin.pro
@@ -3,6 +3,7 @@ QTDIR = $$QT_SOURCE_TREE
CONFIG += designer plugin
TEMPLATE = lib
+TARGET = $$qtLibraryTarget(arthurplugin)
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
contains(QT_CONFIG, opengl) {
diff --git a/demos/books/books.pro b/demos/books/books.pro
index a5e44e5..06718d1 100644
--- a/demos/books/books.pro
+++ b/demos/books/books.pro
@@ -16,8 +16,8 @@ INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
wince*: {
- CONFIG(debug, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll
- CONFIG(release, debug|release):sqlPlugins.sources = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll
+ CONFIG(debug, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll
+ CONFIG(release, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll
sqlPlugins.path = sqldrivers
DEPLOYMENT += sqlPlugins
}
diff --git a/demos/boxes/glbuffers.cpp b/demos/boxes/glbuffers.cpp
index 7480d4a..e12132b 100644
--- a/demos/boxes/glbuffers.cpp
+++ b/demos/boxes/glbuffers.cpp
@@ -42,6 +42,16 @@
#include "glbuffers.h"
#include <QtGui/qmatrix4x4.h>
+
+void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
+{
+ const GLdouble ymax = zNear * tan(fovy * M_PI / 360.0);
+ const GLdouble ymin = -ymax;
+ const GLdouble xmin = ymin * aspect;
+ const GLdouble xmax = ymax * aspect;
+ glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
+}
+
//============================================================================//
// GLTexture //
//============================================================================//
diff --git a/demos/boxes/glbuffers.h b/demos/boxes/glbuffers.h
index 6e29e93..6b18d3f 100644
--- a/demos/boxes/glbuffers.h
+++ b/demos/boxes/glbuffers.h
@@ -58,6 +58,8 @@ if (m_failed || !(assertion)) {
returnStatement; \
}
+void qgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
+
QT_BEGIN_NAMESPACE
class QMatrix4x4;
QT_END_NAMESPACE
diff --git a/demos/boxes/qtbox.cpp b/demos/boxes/qtbox.cpp
index 347d05e..d241165 100644
--- a/demos/boxes/qtbox.cpp
+++ b/demos/boxes/qtbox.cpp
@@ -324,7 +324,7 @@ void QtBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(moveToRectMatrix);
- gluPerspective(60.0, 1.0, 0.01, 10.0);
+ qgluPerspective(60.0, 1.0, 0.01, 10.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index a838988..39cd0fc 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -922,7 +922,7 @@ void Scene::drawBackground(QPainter *painter, const QRectF &)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
- gluPerspective(60.0, width / height, 0.01, 15.0);
+ qgluPerspective(60.0, width / height, 0.01, 15.0);
glMatrixMode(GL_MODELVIEW);
diff --git a/demos/browser/browserapplication.cpp b/demos/browser/browserapplication.cpp
index efbcd56..3eb33c9 100644
--- a/demos/browser/browserapplication.cpp
+++ b/demos/browser/browserapplication.cpp
@@ -231,14 +231,14 @@ void BrowserApplication::loadSettings()
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
QFont standardFont = QFont(standardFontFamily, standardFontSize);
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
+ standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize());
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
QFont fixedFont = QFont(fixedFontFamily, fixedFontSize);
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
+ fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize());
diff --git a/demos/browser/cookiejar.cpp b/demos/browser/cookiejar.cpp
index 67bdf15..ac73aed 100644
--- a/demos/browser/cookiejar.cpp
+++ b/demos/browser/cookiejar.cpp
@@ -186,7 +186,7 @@ void CookieJar::save()
if (cookies.at(i).isSessionCookie())
cookies.removeAt(i);
}
- cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QList<QNetworkCookie> >(cookies));
+ cookieSettings.setValue(QLatin1String("cookies"), QVariant::fromValue<QList<QNetworkCookie> >(cookies));
cookieSettings.beginGroup(QLatin1String("Exceptions"));
cookieSettings.setValue(QLatin1String("block"), m_exceptions_block);
cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow);
diff --git a/demos/browser/networkaccessmanager.cpp b/demos/browser/networkaccessmanager.cpp
index b1300cb..e2e95b1 100644
--- a/demos/browser/networkaccessmanager.cpp
+++ b/demos/browser/networkaccessmanager.cpp
@@ -64,7 +64,7 @@
NetworkAccessManager::NetworkAccessManager(QObject *parent)
: QNetworkAccessManager(parent),
requestFinishedCount(0), requestFinishedFromCacheCount(0), requestFinishedPipelinedCount(0),
- requestFinishedSecureCount(0)
+ requestFinishedSecureCount(0), requestFinishedDownloadBufferCount(0)
{
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
@@ -106,14 +106,19 @@ void NetworkAccessManager::requestFinished(QNetworkReply *reply)
if (reply->attribute(QNetworkRequest::ConnectionEncryptedAttribute).toBool() == true)
requestFinishedSecureCount++;
+ if (reply->attribute(QNetworkRequest::DownloadBufferAttribute).isValid() == true)
+ requestFinishedDownloadBufferCount++;
+
if (requestFinishedCount % 10)
return;
double pctCached = (double(requestFinishedFromCacheCount) * 100.0/ double(requestFinishedCount));
double pctPipelined = (double(requestFinishedPipelinedCount) * 100.0/ double(requestFinishedCount));
double pctSecure = (double(requestFinishedSecureCount) * 100.0/ double(requestFinishedCount));
+ double pctDownloadBuffer = (double(requestFinishedDownloadBufferCount) * 100.0/ double(requestFinishedCount));
+
#ifdef QT_DEBUG
- qDebug("STATS [%lli requests total] [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS]", requestFinishedCount, pctCached, pctPipelined, pctSecure);
+ qDebug("STATS [%lli requests total] [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS] [%3.2f%% Zerocopy]", requestFinishedCount, pctCached, pctPipelined, pctSecure, pctDownloadBuffer);
#endif
}
diff --git a/demos/browser/networkaccessmanager.h b/demos/browser/networkaccessmanager.h
index 131368a..8d492fe 100644
--- a/demos/browser/networkaccessmanager.h
+++ b/demos/browser/networkaccessmanager.h
@@ -60,6 +60,7 @@ private:
qint64 requestFinishedFromCacheCount;
qint64 requestFinishedPipelinedCount;
qint64 requestFinishedSecureCount;
+ qint64 requestFinishedDownloadBufferCount;
public slots:
void loadSettings();
diff --git a/demos/browser/settings.cpp b/demos/browser/settings.cpp
index cba496b..789b01b 100644
--- a/demos/browser/settings.cpp
+++ b/demos/browser/settings.cpp
@@ -121,8 +121,8 @@ void SettingsDialog::loadFromSettings()
// Appearance
settings.beginGroup(QLatin1String("websettings"));
- fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
- standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
+ fixedFont = qvariant_cast<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont));
+ standardFont = qvariant_cast<QFont>(settings.value(QLatin1String("standardFont"), standardFont));
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
diff --git a/demos/chip/view.cpp b/demos/chip/view.cpp
index c572337..5634f85 100644
--- a/demos/chip/view.cpp
+++ b/demos/chip/view.cpp
@@ -48,15 +48,29 @@
#include <qmath.h>
+void GraphicsView::wheelEvent(QWheelEvent *e)
+{
+ if (e->modifiers() & Qt::ControlModifier) {
+ if (e->delta() > 0)
+ view->zoomIn(6);
+ else
+ view->zoomOut(6);
+ e->accept();
+ } else {
+ QGraphicsView::wheelEvent(e);
+ }
+}
+
View::View(const QString &name, QWidget *parent)
: QFrame(parent)
{
setFrameStyle(Sunken | StyledPanel);
- graphicsView = new QGraphicsView;
+ graphicsView = new GraphicsView(this);
graphicsView->setRenderHint(QPainter::Antialiasing, false);
graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
+ graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
QSize iconSize(size, size);
@@ -111,6 +125,15 @@ View::View(const QString &name, QWidget *parent)
// Label layout
QHBoxLayout *labelLayout = new QHBoxLayout;
label = new QLabel(name);
+ label2 = new QLabel(tr("Pointer Mode"));
+ selectModeButton = new QToolButton;
+ selectModeButton->setText(tr("Select"));
+ selectModeButton->setCheckable(true);
+ selectModeButton->setChecked(true);
+ dragModeButton = new QToolButton;
+ dragModeButton->setText(tr("Drag"));
+ dragModeButton->setCheckable(true);
+ dragModeButton->setChecked(false);
antialiasButton = new QToolButton;
antialiasButton->setText(tr("Antialiasing"));
antialiasButton->setCheckable(true);
@@ -126,8 +149,17 @@ View::View(const QString &name, QWidget *parent)
printButton = new QToolButton;
printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));
+ QButtonGroup *pointerModeGroup = new QButtonGroup;
+ pointerModeGroup->setExclusive(true);
+ pointerModeGroup->addButton(selectModeButton);
+ pointerModeGroup->addButton(dragModeButton);
+
labelLayout->addWidget(label);
labelLayout->addStretch();
+ labelLayout->addWidget(label2);
+ labelLayout->addWidget(selectModeButton);
+ labelLayout->addWidget(dragModeButton);
+ labelLayout->addStretch();
labelLayout->addWidget(antialiasButton);
labelLayout->addWidget(openGlButton);
labelLayout->addWidget(printButton);
@@ -145,6 +177,8 @@ View::View(const QString &name, QWidget *parent)
connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
+ connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
+ connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
@@ -158,7 +192,7 @@ View::View(const QString &name, QWidget *parent)
QGraphicsView *View::view() const
{
- return graphicsView;
+ return static_cast<QGraphicsView *>(graphicsView);
}
void View::resetView()
@@ -188,6 +222,14 @@ void View::setupMatrix()
setResetButtonEnabled();
}
+void View::togglePointerMode()
+{
+ graphicsView->setDragMode(selectModeButton->isChecked()
+ ? QGraphicsView::RubberBandDrag
+ : QGraphicsView::ScrollHandDrag);
+ graphicsView->setInteractive(selectModeButton->isChecked());
+}
+
void View::toggleOpenGL()
{
#ifndef QT_NO_OPENGL
@@ -212,14 +254,14 @@ void View::print()
#endif
}
-void View::zoomIn()
+void View::zoomIn(int level)
{
- zoomSlider->setValue(zoomSlider->value() + 1);
+ zoomSlider->setValue(zoomSlider->value() + level);
}
-void View::zoomOut()
+void View::zoomOut(int level)
{
- zoomSlider->setValue(zoomSlider->value() - 1);
+ zoomSlider->setValue(zoomSlider->value() - level);
}
void View::rotateLeft()
diff --git a/demos/chip/view.h b/demos/chip/view.h
index 0ece458..7c587d4 100644
--- a/demos/chip/view.h
+++ b/demos/chip/view.h
@@ -43,12 +43,27 @@
#define VIEW_H
#include <QFrame>
+#include <QGraphicsView>
-QT_FORWARD_DECLARE_CLASS(QGraphicsView)
QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QSlider)
QT_FORWARD_DECLARE_CLASS(QToolButton)
+class View;
+
+class GraphicsView : public QGraphicsView
+{
+ Q_OBJECT
+public:
+ GraphicsView(View *v) : QGraphicsView(), view(v) { }
+
+protected:
+ void wheelEvent(QWheelEvent *);
+
+private:
+ View *view;
+};
+
class View : public QFrame
{
Q_OBJECT
@@ -57,22 +72,27 @@ public:
QGraphicsView *view() const;
+public slots:
+ void zoomIn(int level = 1);
+ void zoomOut(int level = 1);
+
private slots:
void resetView();
void setResetButtonEnabled();
void setupMatrix();
+ void togglePointerMode();
void toggleOpenGL();
void toggleAntialiasing();
void print();
-
- void zoomIn();
- void zoomOut();
void rotateLeft();
void rotateRight();
-
+
private:
- QGraphicsView *graphicsView;
+ GraphicsView *graphicsView;
QLabel *label;
+ QLabel *label2;
+ QToolButton *selectModeButton;
+ QToolButton *dragModeButton;
QToolButton *openGlButton;
QToolButton *antialiasButton;
QToolButton *printButton;
diff --git a/demos/composition/main.cpp b/demos/composition/main.cpp
index 2195cfe..d6bc170 100644
--- a/demos/composition/main.cpp
+++ b/demos/composition/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
QStyle *arthurStyle = new ArthurStyle();
compWidget.setStyle(arthurStyle);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(&compWidget);
+ QList<QWidget *> widgets = compWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets)
w->setStyle(arthurStyle);
compWidget.show();
diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro
index 5929ecf..d23bb05 100644
--- a/demos/declarative/minehunt/minehunt.pro
+++ b/demos/declarative/minehunt/minehunt.pro
@@ -17,7 +17,7 @@ symbian:{
TARGET.EPOCALLOWDLLDATA = 1
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- qmlminehuntfiles.sources = MinehuntCore minehunt.qml
+ qmlminehuntfiles.files = MinehuntCore minehunt.qml
DEPLOYMENT += qmlminehuntfiles
}
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index b838790..d7b827a 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -8,13 +8,16 @@ var blockSrc = "SamegameCore/BoomBlock.qml";
var scoresURL = "";
var gameDuration;
var component = Qt.createComponent(blockSrc);
+var highScoreBar = 0;
-//Index function used instead of a 2D array
-function index(column,row) {
- return column + (row * maxColumn);
+// Index function used instead of a 2D array
+function index(column, row)
+{
+ return column + row * maxColumn;
}
-function timeStr(msecs) {
+function timeStr(msecs)
+{
var secs = Math.floor(msecs/1000);
var m = Math.floor(secs/60);
var ret = "" + m + "m " + (secs%60) + "s";
@@ -23,47 +26,48 @@ function timeStr(msecs) {
function startNewGame()
{
- //Delete blocks from previous game
- for(var i = 0; i<maxIndex; i++){
- if(board[i] != null)
+ // Delete blocks from previous game
+ for (var i = 0; i < maxIndex; i++) {
+ if (board[i] != null)
board[i].destroy();
}
- //Calculate board size
+ // Calculate board size
maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize);
maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize);
- maxIndex = maxRow*maxColumn;
+ maxIndex = maxRow * maxColumn;
- //Close dialogs
+ // Close dialogs
nameInputDialog.forceClose();
dialog.forceClose();
- //Initialize Board
+ // Initialize Board
board = new Array(maxIndex);
gameCanvas.score = 0;
- for(var column=0; column<maxColumn; column++){
- for(var row=0; row<maxRow; row++){
- board[index(column,row)] = null;
- createBlock(column,row);
+ for (var column = 0; column < maxColumn; column++) {
+ for (var row = 0; row < maxRow; row++) {
+ board[index(column, row)] = null;
+ createBlock(column, row);
}
}
gameDuration = new Date();
}
-var fillFound;//Set after a floodFill call to the number of blocks found
-var floodBoard;//Set to 1 if the floodFill reaches off that node
-//NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope
+var fillFound; // Set after a floodFill call to the number of blocks found
+var floodBoard; // Set to 1 if the floodFill reaches off that node
+
+// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope
function handleClick(x,y)
{
var column = Math.floor(x/gameCanvas.blockSize);
var row = Math.floor(y/gameCanvas.blockSize);
- if(column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
return;
- if(board[index(column, row)] == null)
+ if (board[index(column, row)] == null)
return;
- //If it's a valid block, remove it and all connected (does nothing if it's not connected)
+ // If it's a valid block, remove it and all connected (does nothing if it's not connected)
floodFill(column,row, -1);
- if(fillFound <= 0)
+ if (fillFound <= 0)
return;
gameCanvas.score += (fillFound - 1) * (fillFound - 1);
shuffleDown();
@@ -72,65 +76,65 @@ function handleClick(x,y)
function floodFill(column,row,type)
{
- if(board[index(column, row)] == null)
+ if (board[index(column, row)] == null)
return;
var first = false;
- if(type == -1){
+ if (type == -1) {
first = true;
type = board[index(column,row)].type;
-
- //Flood fill initialization
+
+ // Flood fill initialization
fillFound = 0;
floodBoard = new Array(maxIndex);
}
- if(column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
return;
- if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type))
+ if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type))
return;
floodBoard[index(column, row)] = 1;
- floodFill(column+1,row,type);
- floodFill(column-1,row,type);
- floodFill(column,row+1,type);
- floodFill(column,row-1,type);
- if(first==true && fillFound == 0)
- return;//Can't remove single blocks
- board[index(column,row)].dying = true;
- board[index(column,row)] = null;
+ floodFill(column + 1, row, type);
+ floodFill(column - 1, row, type);
+ floodFill(column, row + 1, type);
+ floodFill(column, row - 1, type);
+ if (first == true && fillFound == 0)
+ return; // Can't remove single blocks
+ board[index(column, row)].dying = true;
+ board[index(column, row)] = null;
fillFound += 1;
}
function shuffleDown()
{
- //Fall down
- for(var column=0; column<maxColumn; column++){
+ // Fall down
+ for (var column = 0; column < maxColumn; column++) {
var fallDist = 0;
- for(var row=maxRow-1; row>=0; row--){
- if(board[index(column,row)] == null){
+ for (var row = maxRow - 1; row >= 0; row--) {
+ if (board[index(column,row)] == null) {
fallDist += 1;
- }else{
- if(fallDist > 0){
- var obj = board[index(column,row)];
- obj.y = (row+fallDist) * gameCanvas.blockSize;
- board[index(column,row+fallDist)] = obj;
- board[index(column,row)] = null;
+ } else {
+ if (fallDist > 0) {
+ var obj = board[index(column, row)];
+ obj.y = (row + fallDist) * gameCanvas.blockSize;
+ board[index(column, row + fallDist)] = obj;
+ board[index(column, row)] = null;
}
}
}
}
- //Fall to the left
+ // Fall to the left
fallDist = 0;
- for(column=0; column<maxColumn; column++){
- if(board[index(column, maxRow - 1)] == null){
+ for (column = 0; column < maxColumn; column++) {
+ if (board[index(column, maxRow - 1)] == null) {
fallDist += 1;
- }else{
- if(fallDist > 0){
- for(row=0; row<maxRow; row++){
- obj = board[index(column,row)];
- if(obj == null)
+ } else {
+ if (fallDist > 0) {
+ for (row = 0; row < maxRow; row++) {
+ obj = board[index(column, row)];
+ if (obj == null)
continue;
- obj.x = (column-fallDist) * gameCanvas.blockSize;
- board[index(column-fallDist,row)] = obj;
- board[index(column,row)] = null;
+ obj.x = (column - fallDist) * gameCanvas.blockSize;
+ board[index(column - fallDist,row)] = obj;
+ board[index(column, row)] = null;
}
}
}
@@ -139,39 +143,44 @@ function shuffleDown()
function victoryCheck()
{
- //awards bonuses for no blocks left
+ // Awards bonuses for no blocks left
var deservesBonus = true;
- for(var column=maxColumn-1; column>=0; column--)
- if(board[index(column, maxRow - 1)] != null)
+ for (var column = maxColumn - 1; column >= 0; column--)
+ if (board[index(column, maxRow - 1)] != null)
deservesBonus = false;
- if(deservesBonus)
+ if (deservesBonus)
gameCanvas.score += 500;
- //Checks for game over
- if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){
+ // Checks for game over
+ if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) {
gameDuration = new Date() - gameDuration;
- nameInputDialog.show("You won! Please enter your name: ");
- nameInputDialog.initialWidth = nameInputDialog.text.width + 20;
- if(nameInputDialog.name == "")
- nameInputDialog.width = nameInputDialog.initialWidth;
- nameInputDialog.text.opacity = 0;//Just a spacer
+ if(gameCanvas.score > highScoreBar){
+ nameInputDialog.show("You won! Please enter your name: ");
+ nameInputDialog.initialWidth = nameInputDialog.text.width + 20;
+ if (nameInputDialog.name == "")
+ nameInputDialog.width = nameInputDialog.initialWidth;
+ nameInputDialog.text.opacity = 0; // Just a spacer
+ }else{
+ dialog.show("You won!");
+ }
}
}
-//only floods up and right, to see if it can find adjacent same-typed blocks
+// Only floods up and right, to see if it can find adjacent same-typed blocks
function floodMoveCheck(column, row, type)
{
- if(column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
return false;
- if(board[index(column, row)] == null)
+ if (board[index(column, row)] == null)
return false;
var myType = board[index(column, row)].type;
- if(type == myType)
+ if (type == myType)
return true;
return floodMoveCheck(column + 1, row, myType) ||
- floodMoveCheck(column, row - 1, board[index(column,row)].type);
+ floodMoveCheck(column, row - 1, board[index(column, row)].type);
}
-function createBlock(column,row){
+function createBlock(column,row)
+{
// Note that we don't wait for the component to become ready. This will
// only work if the block QML is a local file. Otherwise the component will
// not be ready immediately. There is a statusChanged signal on the
@@ -199,38 +208,78 @@ function createBlock(column,row){
return true;
}
-function saveHighScore(name) {
- if(scoresURL!="")
+function initHighScoreBar()
+{
+ if(scoresURL != "")
+ return true;//don't query remote scores
+ var db = openDatabaseSync(
+ "SameGameScores",
+ "1.0",
+ "Local SameGame High Scores",
+ 100
+ );
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
+ // Only show results for the current grid size
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'
+ + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10');
+ if(rs.rows.length < 10)
+ highScoreBar = 0;
+ else
+ highScoreBar = rs.rows.item(rs.rows.length - 1).score;
+ }
+ );
+}
+
+function saveHighScore(name)
+{
+ if (scoresURL != "")
sendHighScore(name);
- //OfflineStorage
- var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100);
+ // Offline storage
+ var db = openDatabaseSync(
+ "SameGameScores",
+ "1.0",
+ "Local SameGame High Scores",
+ 100
+ );
var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)";
- var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)];
+ var data = [
+ name,
+ gameCanvas.score,
+ maxColumn + "x" + maxRow,
+ Math.floor(gameDuration / 1000)
+ ];
db.transaction(
function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
tx.executeSql(dataStr, data);
- //Only show results for the current grid size
- var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxColumn+"x"+maxRow+'" ORDER BY score desc LIMIT 10');
+ // Only show results for the current grid size
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'
+ + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10');
var r = "\nHIGH SCORES for this grid size\n\n"
- for(var i = 0; i < rs.rows.length; i++){
- r += (i+1)+". " + rs.rows.item(i).name +' got '
+ for (var i = 0; i < rs.rows.length; i++) {
+ r += (i+1) + ". " + rs.rows.item(i).name + ' got '
+ rs.rows.item(i).score + ' points in '
+ rs.rows.item(i).time + ' seconds.\n';
}
+ if(rs.rows.length == 10)
+ highScoreBar = rs.rows.item(9).score;
dialog.show(r);
}
);
}
-function sendHighScore(name) {
+function sendHighScore(name)
+{
var postman = new XMLHttpRequest()
- var postData = "name="+name+"&score="+gameCanvas.score
- +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000);
+ var postData = "name=" + name + "&score=" + gameCanvas.score
+ + "&gridSize=" + maxColumn + "x" + maxRow
+ + "&time=" + Math.floor(gameDuration / 1000);
postman.open("POST", scoresURL, true);
postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- postman.onreadystatechange = function() {
+ postman.onreadystatechange = function() {
if (postman.readyState == postman.DONE) {
dialog.show("Your score has been uploaded.");
}
diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml
index edaeeed..ff67ad7 100644
--- a/demos/declarative/snake/content/Link.qml
+++ b/demos/declarative/snake/content/Link.qml
@@ -77,7 +77,12 @@ Item { id:link
id: actualImageRotation
origin.x: width/2; origin.y: height/2;
angle: rotation * 90
- Behavior on angle { NumberAnimation { duration: spawned ? 200 : 0} }
+ Behavior on angle {
+ RotationAnimation{
+ direction: RotationAnimation.Shortest
+ duration: spawned ? 200 : 0
+ }
+ }
}
}
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 5c089de..837b82a 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -22,20 +22,26 @@ function rand(n)
function scheduleDirection(dir)
{
- direction = dir;
- if(scheduledDirections[scheduledDirections.length-1]!=direction)
- scheduledDirections.push(direction);
+ if (state == "starting") {
+ direction = dir;
+ headDirection = direction;
+ head.rotation = headDirection;
+ } else if (state == "running"){
+ direction = dir;
+ if(scheduledDirections[scheduledDirections.length-1]!=direction)
+ scheduledDirections.push(direction);
+ }
}
function startNewGame()
{
- if (state == "starting")
+ if (state == "starting") {
return;
+ }
if (activeGame) {
endGame();
startNewGameTimer.running = true;
- state = "";
return;
}
diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml
index b7476b7..edccd4c 100644
--- a/demos/declarative/snake/snake.qml
+++ b/demos/declarative/snake/snake.qml
@@ -88,7 +88,7 @@ Rectangle {
onTriggered: { Logic.moveSkull() }
}
Timer {
- id: startNewGameTimer;
+ id: startNewGameTimer;
interval: 700;
onTriggered: { Logic.startNewGame(); }
}
@@ -109,6 +109,7 @@ Rectangle {
}
Image {
+
Image {
id: title
source: "content/pics/snake.jpg"
@@ -117,14 +118,28 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
- Text {
- color: "white"
- font.pointSize: 24
- horizontalAlignment: Text.AlignHCenter
- text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- anchors.bottomMargin: gridSize
+ Column {
+ spacing: 140
+ anchors.verticalCenter: parent.verticalCenter;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Text {
+ color: "white"
+ font.pointSize: 48
+ font.italic: true;
+ font.bold: true;
+ text: "Snake"
+ anchors.horizontalCenter: parent.horizontalCenter;
+ }
+
+ Text {
+ color: "white"
+ font.pointSize: 24
+ anchors.horizontalCenter: parent.horizontalCenter;
+ //horizontalAlignment: Text.AlignHCenter
+ text: "Last Score:\t" + lastScore + "\nHighscore:\t" + highScores.topScore;
+ }
}
}
@@ -154,7 +169,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
onPressed: {
- if (!head || !heartbeat.running) {
+ if (screen.state == "") {
Logic.startNewGame();
return;
}
@@ -245,10 +260,12 @@ Rectangle {
from: "*"
to: "starting"
NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
- NumberAnimation { target: title; property: "opacity"; duration: 500 }
+ NumberAnimation { property: "opacity"; duration: 200 }
},
Transition {
- NumberAnimation { target: title; property: "opacity"; duration: 500 }
+ to: "starting"
+ NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
+ NumberAnimation { property: "opacity"; duration: 200 }
}
]
diff --git a/demos/deform/main.cpp b/demos/deform/main.cpp
index 21ce7fb..d92ddba 100644
--- a/demos/deform/main.cpp
+++ b/demos/deform/main.cpp
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
QStyle *arthurStyle = new ArthurStyle();
deformWidget.setStyle(arthurStyle);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(&deformWidget);
+ QList<QWidget *> widgets = deformWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets)
w->setStyle(arthurStyle);
diff --git a/demos/deform/pathdeform.cpp b/demos/deform/pathdeform.cpp
index 9f64c02..f80ef2b 100644
--- a/demos/deform/pathdeform.cpp
+++ b/demos/deform/pathdeform.cpp
@@ -297,7 +297,7 @@ void PathDeformWidget::setStyle( QStyle * style )
{
m_controls->setStyle(style);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(m_controls);
+ QList<QWidget *> widgets = m_controls->findChildren<QWidget *>();
foreach (QWidget *w, widgets)
w->setStyle(style);
}
diff --git a/demos/demos.pro b/demos/demos.pro
index b8b743c..ed18446 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -44,8 +44,11 @@ wince*: SUBDIRS = \
contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles2):{
SUBDIRS += demos_boxes
}
+contains(QT_CONFIG, opengl):contains(QT_CONFIG, svg){
+SUBDIRS += demos_glhypnotizer
+}
-mac*: SUBDIRS += demos_macmainwindow
+mac* && !qpa: SUBDIRS += demos_macmainwindow
wince*|symbian|embedded|x11: SUBDIRS += demos_embedded
!contains(QT_EDITION, Console):!cross_compile:!embedded:!wince*:SUBDIRS += demos_arthurplugin
@@ -103,6 +106,7 @@ demos_browser.subdir = browser
demos_boxes.subdir = boxes
demos_sub-attaq.subdir = sub-attaq
demos_spectrum.subdir = spectrum
+demos_glhypnotizer.subdir = glhypnotizer
#CONFIG += ordered
!ordered {
diff --git a/demos/embedded/desktopservices/desktopservices.pro b/demos/embedded/desktopservices/desktopservices.pro
index 94ddedd..e66db1c 100644
--- a/demos/embedded/desktopservices/desktopservices.pro
+++ b/demos/embedded/desktopservices/desktopservices.pro
@@ -7,8 +7,8 @@ SOURCES += desktopwidget.cpp contenttab.cpp linktab.cpp main.cpp
RESOURCES += desktopservices.qrc
-music.sources = data/*.mp3 data/*.wav
-image.sources = data/*.png
+music.files = data/*.mp3 data/*.wav
+image.files = data/*.png
target.path = $$[QT_INSTALL_DEMOS]/embedded/desktopservices
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro
index ca74c38..0799ed9 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.pro
+++ b/demos/embedded/fluidlauncher/fluidlauncher.pro
@@ -33,7 +33,7 @@ wince*{
BUILD_DIR = debug
}
- executables.sources = \
+ executables.files = \
$$QT_BUILD_TREE/demos/embedded/embeddedsvgviewer/$${BUILD_DIR}/embeddedsvgviewer.exe \
$$QT_BUILD_TREE/demos/embedded/styledemo/$${BUILD_DIR}/styledemo.exe \
$$QT_BUILD_TREE/demos/deform/$${BUILD_DIR}/deform.exe \
@@ -45,10 +45,10 @@ wince*{
executables.path = .
- files.sources = $$PWD/screenshots $$PWD/slides $$PWD/../embeddedsvgviewer/shapes.svg
+ files.files = $$PWD/screenshots $$PWD/slides $$PWD/../embeddedsvgviewer/shapes.svg
files.path = .
- config.sources = $$PWD/config_wince/config.xml
+ config.files = $$PWD/config_wince/config.xml
config.path = .
DEPLOYMENT += config files executables
@@ -79,7 +79,7 @@ symbian {
}
}
- executables.sources = \
+ executables.files = \
$$QT_BUILD_TREE/demos/embedded/styledemo/styledemo.exe \
$$QT_BUILD_TREE/demos/deform/deform.exe \
$$QT_BUILD_TREE/demos/pathstroke/pathstroke.exe \
@@ -97,7 +97,7 @@ symbian {
executables.path = /sys/bin
- reg_resource.sources = \
+ reg_resource.files = \
$$regResourceDir(demos/embedded/styledemo/styledemo_reg.rsc) \
$$regResourceDir(demos/deform/deform_reg.rsc) \
$$regResourceDir(demos/pathstroke/pathstroke_reg.rsc) \
@@ -114,17 +114,17 @@ symbian {
$$regResourceDir(demos/embedded/flightinfo/flightinfo_reg.rsc)
contains(QT_CONFIG, phonon) {
- reg_resource.sources += $$regResourceDir(demos/qmediaplayer/qmediaplayer_reg.rsc)
+ reg_resource.files += $$regResourceDir(demos/qmediaplayer/qmediaplayer_reg.rsc)
}
contains(QT_CONFIG, multimedia) {
- reg_resource.sources += $$regResourceDir(demos/spectrum/app/spectrum_reg.rsc)
+ reg_resource.files += $$regResourceDir(demos/spectrum/app/spectrum_reg.rsc)
}
reg_resource.path = $$REG_RESOURCE_IMPORT_DIR
- resource.sources = \
+ resource.files = \
$$appResourceDir(demos/embedded/styledemo/styledemo.rsc) \
$$appResourceDir(demos/deform/deform.rsc) \
$$appResourceDir(demos/pathstroke/pathstroke.rsc) \
@@ -143,7 +143,7 @@ symbian {
resource.path = $$APP_RESOURCE_DIR
- mifs.sources = \
+ mifs.files = \
$$appResourceDir(demos/embedded/fluidlauncher/fluidlauncher.mif) \
$$appResourceDir(demos/embedded/styledemo/styledemo.mif) \
$$appResourceDir(demos/deform/deform.mif) \
@@ -162,28 +162,28 @@ symbian {
mifs.path = $$APP_RESOURCE_DIR
contains(QT_CONFIG, svg) {
- executables.sources += \
+ executables.files += \
$$QT_BUILD_TREE/demos/embedded/embeddedsvgviewer/embeddedsvgviewer.exe \
$$QT_BUILD_TREE/demos/embedded/weatherinfo/weatherinfo.exe
- reg_resource.sources += \
+ reg_resource.files += \
$$regResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer_reg.rsc) \
$$regResourceDir(demos/embedded/weatherinfo/weatherinfo_reg.rsc)
- resource.sources += \
+ resource.files += \
$$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.rsc) \
$$appResourceDir(demos/embedded/weatherinfo/weatherinfo.rsc)
- mifs.sources += \
+ mifs.files += \
$$appResourceDir(demos/embedded/embeddedsvgviewer/embeddedsvgviewer.mif) \
$$appResourceDir(demos/embedded/weatherinfo/weatherinfo.mif)
}
contains(QT_CONFIG, webkit) {
- executables.sources += $$QT_BUILD_TREE/demos/embedded/anomaly/anomaly.exe
- reg_resource.sources += $$regResourceDir(demos/embedded/anomaly/anomaly_reg.rsc)
- resource.sources += $$appResourceDir(demos/embedded/anomaly/anomaly.rsc)
- mifs.sources += \
+ executables.files += $$QT_BUILD_TREE/demos/embedded/anomaly/anomaly.exe
+ reg_resource.files += $$regResourceDir(demos/embedded/anomaly/anomaly_reg.rsc)
+ resource.files += $$appResourceDir(demos/embedded/anomaly/anomaly.rsc)
+ mifs.files += \
$$appResourceDir(demos/embedded/anomaly/anomaly.mif)
isEmpty(QT_LIBINFIX) {
@@ -195,61 +195,61 @@ symbian {
}
contains(QT_CONFIG, phonon) {
- executables.sources += $$QT_BUILD_TREE/demos/qmediaplayer/qmediaplayer.exe
- resource.sources += $$appResourceDir(demos/qmediaplayer/qmediaplayer.rsc)
- mifs.sources += \
+ executables.files += $$QT_BUILD_TREE/demos/qmediaplayer/qmediaplayer.exe
+ resource.files += $$appResourceDir(demos/qmediaplayer/qmediaplayer.rsc)
+ mifs.files += \
$$appResourceDir(demos/qmediaplayer/qmediaplayer.mif)
}
contains(QT_CONFIG, multimedia) {
- executables.sources += $$QT_BUILD_TREE/demos/spectrum/app/spectrum.exe
- executables.sources += $$QT_BUILD_TREE/demos/spectrum/3rdparty/fftreal/fftreal.dll
- resource.sources += $$appResourceDir(demos/spectrum/app/spectrum.rsc)
- mifs.sources += \
+ executables.files += $$QT_BUILD_TREE/demos/spectrum/app/spectrum.exe
+ executables.files += $$QT_BUILD_TREE/demos/spectrum/3rdparty/fftreal/fftreal.dll
+ resource.files += $$appResourceDir(demos/spectrum/app/spectrum.rsc)
+ mifs.files += \
$$appResourceDir(demos/spectrum/app/spectrum.mif)
}
contains(QT_CONFIG, script) {
- executables.sources += $$QT_BUILD_TREE/examples/script/context2d/context2d.exe
- reg_resource.sources += $$regResourceDir(examples/script/context2d/context2d_reg.rsc)
- resource.sources += $$appResourceDir(examples/script/context2d/context2d.rsc)
- mifs.sources += \
+ executables.files += $$QT_BUILD_TREE/examples/script/context2d/context2d.exe
+ reg_resource.files += $$regResourceDir(examples/script/context2d/context2d_reg.rsc)
+ resource.files += $$appResourceDir(examples/script/context2d/context2d.rsc)
+ mifs.files += \
$$appResourceDir(examples/script/context2d/context2d.mif)
}
qmldemos = qmlcalculator qmlclocks qmldialcontrol qmleasing qmlflickr qmlphotoviewer qmltwitter
contains(QT_CONFIG, declarative) {
for(qmldemo, qmldemos) {
- executables.sources += $$QT_BUILD_TREE/demos/embedded/$${qmldemo}/$${qmldemo}.exe
- reg_resource.sources += $$regResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}_reg.rsc)
- resource.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.rsc)
- mifs.sources += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.mif)
+ executables.files += $$QT_BUILD_TREE/demos/embedded/$${qmldemo}/$${qmldemo}.exe
+ reg_resource.files += $$regResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}_reg.rsc)
+ resource.files += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.rsc)
+ mifs.files += $$appResourceDir(demos/embedded/$${qmldemo}/$${qmldemo}.mif)
}
}
- files.sources = $$PWD/screenshots $$PWD/slides
+ files.files = $$PWD/screenshots $$PWD/slides
files.path = .
- config.sources = $$PWD/config_s60/config.xml
+ config.files = $$PWD/config_s60/config.xml
config.path = .
- viewerimages.sources = $$PWD/../embeddedsvgviewer/shapes.svg
+ viewerimages.files = $$PWD/../embeddedsvgviewer/shapes.svg
viewerimages.path = /data/images/qt/demos/embeddedsvgviewer
# demos/mediaplayer make also use of these files.
- desktopservices_music.sources = \
+ desktopservices_music.files = \
$$PWD/../desktopservices/data/*.mp3 \
$$PWD/../desktopservices/data/*.wav
desktopservices_music.path = /data/sounds
- desktopservices_images.sources = $$PWD/../desktopservices/data/*.png
+ desktopservices_images.files = $$PWD/../desktopservices/data/*.png
desktopservices_images.path = /data/images
- saxbookmarks.sources = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel
- saxbookmarks.sources += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel
+ saxbookmarks.files = $$PWD/../../../examples/xml/saxbookmarks/frank.xbel
+ saxbookmarks.files += $$PWD/../../../examples/xml/saxbookmarks/jennifer.xbel
saxbookmarks.path = /data/qt/saxbookmarks
- fluidbackup.sources = backup_registration.xml
+ fluidbackup.files = backup_registration.xml
fluidbackup.path = /private/$$replace(TARGET.UID3, 0x,)
DEPLOYMENT += config files executables viewerimages saxbookmarks reg_resource resource \
diff --git a/demos/embedded/qmlcalculator/deployment.pri b/demos/embedded/qmlcalculator/deployment.pri
index a31303d..a97498e 100644
--- a/demos/embedded/qmlcalculator/deployment.pri
+++ b/demos/embedded/qmlcalculator/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmlcalculator_uid3 = A000E3FB
qmlcalculator_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlcalculator_uid3
}
-qmlcalculator_files.sources = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core
+qmlcalculator_files.files = $$qmlcalculator_src/calculator.qml $$qmlcalculator_src/Core
DEPLOYMENT += qmlcalculator_files
diff --git a/demos/embedded/qmlclocks/deployment.pri b/demos/embedded/qmlclocks/deployment.pri
index 0946733..6c6704c 100644
--- a/demos/embedded/qmlclocks/deployment.pri
+++ b/demos/embedded/qmlclocks/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmlclocks_uid3 = A000E3FC
qmlclocks_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlclocks_uid3
}
-qmlclocks_files.sources = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content
+qmlclocks_files.files = $$qmlclocks_src/clocks.qml $$qmlclocks_src/content
DEPLOYMENT += qmlclocks_files
diff --git a/demos/embedded/qmldialcontrol/deployment.pri b/demos/embedded/qmldialcontrol/deployment.pri
index e0e72e6..a978443 100644
--- a/demos/embedded/qmldialcontrol/deployment.pri
+++ b/demos/embedded/qmldialcontrol/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmldialcontrol_uid3 = A000E3FD
qmldialcontrol_files.path = $$APP_PRIVATE_DIR_BASE/$$qmldialcontrol_uid3
}
-qmldialcontrol_files.sources = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content
+qmldialcontrol_files.files = $$qmldialcontrol_src/dialcontrol.qml $$qmldialcontrol_src/content
DEPLOYMENT += qmldialcontrol_files
diff --git a/demos/embedded/qmleasing/deployment.pri b/demos/embedded/qmleasing/deployment.pri
index d3621cb..946fcd9 100644
--- a/demos/embedded/qmleasing/deployment.pri
+++ b/demos/embedded/qmleasing/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmleasing_uid3 = A000E3FE
qmleasing_files.path = $$APP_PRIVATE_DIR_BASE/$$qmleasing_uid3
}
-qmleasing_files.sources = $$qmleasing_src/easing.qml $$qmleasing_src/content
+qmleasing_files.files = $$qmleasing_src/easing.qml $$qmleasing_src/content
DEPLOYMENT += qmleasing_files
diff --git a/demos/embedded/qmlflickr/deployment.pri b/demos/embedded/qmlflickr/deployment.pri
index b508292..a38dc95 100644
--- a/demos/embedded/qmlflickr/deployment.pri
+++ b/demos/embedded/qmlflickr/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmlflickr_uid3 = A000E3FF
qmlflickr_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlflickr_uid3
}
-qmlflickr_files.sources = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile
+qmlflickr_files.files = $$qmlflickr_src/flickr.qml $$qmlflickr_src/common $$qmlflickr_src/mobile
DEPLOYMENT += qmlflickr_files
diff --git a/demos/embedded/qmlphotoviewer/deployment.pri b/demos/embedded/qmlphotoviewer/deployment.pri
index 35937a8..23882e3 100644
--- a/demos/embedded/qmlphotoviewer/deployment.pri
+++ b/demos/embedded/qmlphotoviewer/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmlphotoviewer_uid3 = A000E400
qmlphotoviewer_files.path = $$APP_PRIVATE_DIR_BASE/$$qmlphotoviewer_uid3
}
-qmlphotoviewer_files.sources = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore
+qmlphotoviewer_files.files = $$qmlphotoviewer_src/photoviewer.qml $$qmlphotoviewer_src/PhotoViewerCore
DEPLOYMENT += qmlphotoviewer_files
diff --git a/demos/embedded/qmltwitter/deployment.pri b/demos/embedded/qmltwitter/deployment.pri
index 4404e33..3edc0e5 100644
--- a/demos/embedded/qmltwitter/deployment.pri
+++ b/demos/embedded/qmltwitter/deployment.pri
@@ -4,5 +4,5 @@ symbian {
qmltwitter_uid3 = A000E401
qmltwitter_files.path = $$APP_PRIVATE_DIR_BASE/$$qmltwitter_uid3
}
-qmltwitter_files.sources = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore
+qmltwitter_files.files = $$qmltwitter_src/twitter.qml $$qmltwitter_src/TwitterCore
DEPLOYMENT += qmltwitter_files
diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp
index bc66165..cbc622a 100644
--- a/demos/embeddeddialogs/customproxy.cpp
+++ b/demos/embeddeddialogs/customproxy.cpp
@@ -113,7 +113,7 @@ QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &valu
{
if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
if (change == ItemChildAddedChange) {
- currentPopup = qVariantValue<QGraphicsItem *>(value);
+ currentPopup = qvariant_cast<QGraphicsItem *>(value);
currentPopup->setCacheMode(ItemCoordinateCache);
if (scene())
currentPopup->installSceneEventFilter(this);
diff --git a/demos/glhypnotizer/glhypnotizer.pro b/demos/glhypnotizer/glhypnotizer.pro
new file mode 100644
index 0000000..a7fdf5e
--- /dev/null
+++ b/demos/glhypnotizer/glhypnotizer.pro
@@ -0,0 +1,21 @@
+TEMPLATE = app
+CONFIG -= moc
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
+QT += opengl svg
+RESOURCES = hypnotizer.qrc
+
+build_all:!build_pass {
+ CONFIG -= build_all
+ CONFIG += release
+}
+
+# install
+target.path = $$[QT_INSTALL_DEMOS]/glhypnotizer
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.svg
+sources.path = $$[QT_INSTALL_DEMOS]/glhypnotizer
+INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
diff --git a/demos/glhypnotizer/hypnotizer.qrc b/demos/glhypnotizer/hypnotizer.qrc
new file mode 100644
index 0000000..97ba159
--- /dev/null
+++ b/demos/glhypnotizer/hypnotizer.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>qt-logo.png</file>
+ <file>spiral.svg</file>
+</qresource>
+</RCC> \ No newline at end of file
diff --git a/demos/glhypnotizer/main.cpp b/demos/glhypnotizer/main.cpp
new file mode 100644
index 0000000..28fed34
--- /dev/null
+++ b/demos/glhypnotizer/main.cpp
@@ -0,0 +1,356 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtOpenGL>
+#include <QtSvg>
+
+#define NUM_SWIRLY_ITEMS 10
+
+class GLPainter : public QObject
+{
+ Q_OBJECT
+public:
+ GLPainter(QGLWidget *widget);
+ void stop();
+ void resizeViewport(const QSize &size);
+
+public slots:
+ void start();
+
+protected:
+ void timerEvent(QTimerEvent *event);
+ void paint();
+ void initSwirlyItems();
+ void updateSwirlyItems();
+ void drawSuggestiveMessages(QPainter *p);
+
+private:
+ QMutex mutex;
+ QGLWidget *glWidget;
+ int viewportWidth;
+ int viewportHeight;
+ bool doRendering;
+ qreal rotationAngle;
+ bool swirlClockwise;
+ QSvgRenderer svgRenderer;
+ QPixmap logo;
+ QPainter::PixmapFragment swirlyItems[NUM_SWIRLY_ITEMS];
+ int swirlyCounter;
+ int textCounter;
+ int messageYPos;
+ qreal scaleFactor;
+};
+
+
+GLPainter::GLPainter(QGLWidget *widget)
+ : glWidget(widget)
+ , doRendering(true)
+ , rotationAngle(rand() % 360)
+ , swirlClockwise((rand() % 2) == 1)
+ , svgRenderer(QLatin1String(":/spiral.svg"), this)
+ , logo(QLatin1String(":/qt-logo.png"))
+{
+}
+
+void GLPainter::start()
+{
+ glWidget->makeCurrent();
+ startTimer(20);
+}
+
+void GLPainter::stop()
+{
+ QMutexLocker locker(&mutex);
+ doRendering = false;
+}
+
+void GLPainter::resizeViewport(const QSize &size)
+{
+ QMutexLocker locker(&mutex);
+ viewportWidth = size.width();
+ viewportHeight = size.height();
+ initSwirlyItems();
+ textCounter = 0;
+ messageYPos = -1;
+}
+
+void GLPainter::timerEvent(QTimerEvent *event)
+{
+ QMutexLocker locker(&mutex);
+ if (!doRendering) {
+ killTimer(event->timerId());
+ QThread::currentThread()->quit();
+ return;
+ }
+ updateSwirlyItems();
+ paint();
+}
+
+void GLPainter::paint()
+{
+ QPainter p(glWidget);
+ p.fillRect(QRect(0, 0, viewportWidth, viewportHeight), Qt::white);
+ p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ p.translate(viewportWidth / 2, viewportHeight / 2);
+ p.rotate(rotationAngle * (swirlClockwise ? 1 : -1));
+ p.scale(svgRenderer.viewBox().width() / 200.0 * 0.65,
+ svgRenderer.viewBox().height() / 200.0 * 0.65);
+ p.translate(-viewportWidth / 2, -viewportHeight / 2);
+ svgRenderer.render(&p);
+ p.resetTransform();
+ p.drawPixmapFragments(swirlyItems, NUM_SWIRLY_ITEMS, logo);
+ drawSuggestiveMessages(&p);
+ p.end();
+ rotationAngle += 1.2;
+}
+
+void GLPainter::drawSuggestiveMessages(QPainter *p)
+{
+ const int numSuggestiveMessages = 7;
+ const char *texts[numSuggestiveMessages] = {" You feel relaxed.. ",
+ " Let your mind wander.. ",
+ " Look deep into the swirls.. ",
+ " Even deeper.. ",
+ " Qt is good! ",
+ " Qt is good for you! ",
+ " You MUST use Qt! "};
+ QFont font(p->font());
+ font.setPointSizeF(font.pointSizeF() * viewportWidth/200.0);
+ p->setFont(font);
+ QFontMetrics fm(font);
+ int messageNo = textCounter/314;
+ if (messageNo > 6 || messageNo < 0) {
+ qFatal("This should not happen: %d - %d", messageNo, textCounter);
+ }
+ QLatin1String text(texts[textCounter / 314]);
+ qreal textWidth = fm.width(text);
+ int alpha = 255 * qAbs(qSin(textCounter * 0.01));
+ if (messageYPos < 0 || (textCounter % 314 == 0)) {
+ messageYPos = qBound(fm.height(), rand() % viewportHeight,
+ viewportHeight - fm.height());
+ }
+ p->setPen(QColor(255, 255, 255, alpha));
+ p->setBackground(QColor(50, 50, 50, qBound(0, alpha, 50)));
+ p->setBackgroundMode(Qt::OpaqueMode);
+ p->drawText((viewportWidth / 2) - (textWidth/ 2), messageYPos, text);
+ ++textCounter;
+ if (textCounter >= (314 * numSuggestiveMessages))
+ textCounter = 0;
+}
+
+void GLPainter::initSwirlyItems()
+{
+ swirlyCounter = swirlClockwise ? 0 : 360;
+ scaleFactor = viewportWidth / 200.0;
+ QRectF logoRect(0, 0, logo.width(), logo.height());
+
+ for (int i=0; i<NUM_SWIRLY_ITEMS; ++i) {
+ if (swirlClockwise) {
+ swirlyItems[i] = QPainter::PixmapFragment::create(QPointF(0, 0), logoRect,
+ scaleFactor,
+ scaleFactor);
+ } else {
+ swirlyItems[i] = QPainter::PixmapFragment::create(QPointF(0, 0), logoRect,
+ scaleFactor * 1 / 360.0,
+ scaleFactor * 1 / 360.0);
+ }
+ }
+}
+
+void GLPainter::updateSwirlyItems()
+{
+ swirlyCounter += swirlClockwise ? 1 : -1;
+
+ for (int i=0; i<NUM_SWIRLY_ITEMS; ++i) {
+ int factor;
+ factor = swirlClockwise ? (swirlyCounter - i * 20) : (swirlyCounter + i * 20);
+ if (factor > 0 && factor <= 360) {
+ swirlyItems[i].x = viewportWidth / 2.0 + qSin(factor * 0.05) * (viewportWidth / 2.0) * (100.0 / factor);
+ swirlyItems[i].y = viewportHeight / 2.0 + qCos(factor * 0.05) * (viewportHeight / 2.0) * (100.0 / factor);
+ swirlyItems[i].rotation += -swirlyCounter * 0.01;
+ swirlyItems[i].scaleX += swirlClockwise ? -scaleFactor * 1 / 360.0 : scaleFactor * 1 / 360.0;
+ if (swirlClockwise) {
+ if (swirlyItems[i].scaleX < 0)
+ swirlyItems[i].scaleX = scaleFactor;
+ } else {
+ if (swirlyItems[i].scaleX > scaleFactor)
+ swirlyItems[i].scaleX = scaleFactor * 1 / 360.0;
+ }
+ swirlyItems[i].scaleY = swirlyItems[i].scaleX;
+ } else {
+ swirlyItems[i].scaleX = swirlyItems[i].scaleY = 0;
+ }
+ }
+ if (swirlClockwise) {
+ if (swirlyCounter > (360 + NUM_SWIRLY_ITEMS * 20))
+ swirlyCounter = 0;
+ } else {
+ if (swirlyCounter < -NUM_SWIRLY_ITEMS * 20)
+ swirlyCounter = 360;
+ }
+}
+
+class GLWidget : public QGLWidget
+{
+public:
+ GLWidget(QWidget *parent, QGLWidget *shareWidget = 0);
+ ~GLWidget();
+ void startRendering();
+ void stopRendering();
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+ void paintEvent(QPaintEvent *event);
+ QSize sizeHint() const { return QSize(200, 200); }
+
+private:
+ GLPainter glPainter;
+ QThread glThread;
+};
+
+GLWidget::GLWidget(QWidget *parent, QGLWidget *share)
+ : QGLWidget(QGLFormat(QGL::SampleBuffers), parent, share)
+ , glPainter(this)
+ , glThread(this)
+{
+ setAttribute(Qt::WA_PaintOutsidePaintEvent);
+ setAttribute(Qt::WA_DeleteOnClose);
+}
+
+GLWidget::~GLWidget()
+{
+ stopRendering();
+}
+
+void GLWidget::startRendering()
+{
+ glPainter.moveToThread(&glThread);
+ connect(&glThread, SIGNAL(started()), &glPainter, SLOT(start()));
+ glThread.start();
+}
+
+void GLWidget::stopRendering()
+{
+ glPainter.stop();
+ glThread.wait();
+}
+
+void GLWidget::resizeEvent(QResizeEvent *event)
+{
+ glPainter.resizeViewport(event->size());
+}
+
+void GLWidget::paintEvent(QPaintEvent *)
+{
+ // Handled by GLPainter.
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow();
+
+private slots:
+ void newThread();
+ void killThread();
+
+private:
+ QMdiArea mdiArea;
+ QGLWidget shareWidget;
+};
+
+MainWindow::MainWindow()
+ : QMainWindow(0)
+ , mdiArea(this)
+ , shareWidget(this)
+{
+ setWindowTitle("Qt GL Hypnotizer");
+ QMenu *menu = menuBar()->addMenu("&Hypnotizers");
+ menu->addAction("&New hypnotizer thread", this, SLOT(newThread()), QKeySequence("Ctrl+N"));
+ menu->addAction("&End current hypnotizer thread", this, SLOT(killThread()), QKeySequence("Ctrl+K"));
+ menu->addSeparator();
+ menu->addAction("E&xit", qApp, SLOT(quit()), QKeySequence("Ctrl+Q"));
+
+ setCentralWidget(&mdiArea);
+ shareWidget.resize(1, 1);
+ newThread();
+}
+
+void MainWindow::newThread()
+{
+ static int windowCount = 1;
+ if (mdiArea.subWindowList().count() > 9)
+ return;
+ GLWidget *widget = new GLWidget(&mdiArea, &shareWidget);
+ mdiArea.addSubWindow(widget);
+ widget->setWindowTitle("Thread #" + QString::number(windowCount++));
+ widget->show();
+ widget->startRendering();
+}
+
+void MainWindow::killThread()
+{
+ delete mdiArea.activeSubWindow();
+}
+
+int main(int argc, char *argv[])
+{
+ // Make Xlib and GLX thread safe under X11
+ QApplication::setAttribute(Qt::AA_X11InitThreads);
+ QApplication application(argc, argv);
+
+ // Using QPainter to draw into QGLWidgets is only supported with GL 2.0
+ if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) ||
+ (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0))) {
+ QMessageBox::information(0, "Qt GL Hypnotizer",
+ "This system does not support OpenGL 2.0 or OpenGL ES 2.0, "
+ "which is required for this example to work.");
+ return 0;
+ }
+
+ MainWindow mainWindow;
+ mainWindow.show();
+ return application.exec();
+}
+
+#include "main.moc"
diff --git a/demos/glhypnotizer/qt-logo.png b/demos/glhypnotizer/qt-logo.png
new file mode 100644
index 0000000..eaea344
--- /dev/null
+++ b/demos/glhypnotizer/qt-logo.png
Binary files differ
diff --git a/demos/glhypnotizer/spiral.svg b/demos/glhypnotizer/spiral.svg
new file mode 100644
index 0000000..ff1f047
--- /dev/null
+++ b/demos/glhypnotizer/spiral.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="512"
+ height="512"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.47pre4 r22446"
+ sodipodi:docname="spiral.svg">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient5046">
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="0"
+ id="stop5048" />
+ <stop
+ style="stop-color:#6c90da;stop-opacity:1;"
+ offset="1"
+ id="stop5050" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5046"
+ id="radialGradient5052"
+ cx="359.38702"
+ cy="438.07581"
+ fx="359.38702"
+ fy="438.07581"
+ r="304.44159"
+ gradientTransform="matrix(1,0,0,0.91551877,0,37.009184)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.99232897"
+ inkscape:cx="267.31099"
+ inkscape:cy="295.6491"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="963"
+ inkscape:window-height="1024"
+ inkscape:window-x="286"
+ inkscape:window-y="74"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-540.36218)">
+ <path
+ sodipodi:type="spiral"
+ style="fill:url(#radialGradient5052);fill-opacity:1;stroke:#000000;stroke-width:20.29999924;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="path2816"
+ sodipodi:cx="331.42856"
+ sodipodi:cy="463.79074"
+ sodipodi:expansion="1"
+ sodipodi:revolution="3"
+ sodipodi:radius="337.44537"
+ sodipodi:argument="-18.046196"
+ sodipodi:t0="0"
+ d="m 331.42856,463.79074 c 11.74672,12.17647 -10.61822,21.84178 -20.23809,19.52382 -26.06925,-6.28154 -29.6746,-39.8823 -18.80954,-59.99999 19.43502,-35.98584 68.28562,-39.36493 99.76189,-18.09528 46.19269,31.21408 49.35062,97.07722 17.381,139.5238 -42.61047,56.57461 -126.00702,59.46265 -179.2857,16.66673 -67.04578,-53.85429 -69.64012,-155.00279 -15.95246,-219.0476 65.02296,-77.56686 184.03573,-79.85552 258.80951,-15.23819 88.11831,76.14929 90.09472,213.09185 14.52392,298.57141 C 400.3696,724.38498 245.45564,726.04525 149.28577,639.50509 40.011453,541.17265 38.669765,368.25918 136.1904,261.40987 245.59381,141.54108 436.52669,140.5196 554.04752,249.02876 684.51792,369.4945 685.21808,578.4614 565.71435,706.64779"
+ transform="matrix(0.9291373,0,0,0.91940263,-79.040559,394.33975)" />
+ </g>
+</svg>
diff --git a/demos/gradients/main.cpp b/demos/gradients/main.cpp
index df45f84..1d2f0d5 100644
--- a/demos/gradients/main.cpp
+++ b/demos/gradients/main.cpp
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
GradientWidget gradientWidget(0);
QStyle *arthurStyle = new ArthurStyle();
gradientWidget.setStyle(arthurStyle);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(&gradientWidget);
+ QList<QWidget *> widgets = gradientWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets) {
w->setStyle(arthurStyle);
w->setAttribute(Qt::WA_AcceptTouchEvents);
diff --git a/demos/interview/model.cpp b/demos/interview/model.cpp
index fca232c..6031615 100644
--- a/demos/interview/model.cpp
+++ b/demos/interview/model.cpp
@@ -109,7 +109,7 @@ QVariant Model::headerData(int section, Qt::Orientation orientation, int role) c
if (role == Qt::DisplayRole)
return QString::number(section);
if (role == Qt::DecorationRole)
- return qVariantFromValue(services);
+ return QVariant::fromValue(services);
return QAbstractItemModel::headerData(section, orientation, role);
}
diff --git a/demos/mainwindow/colorswatch.cpp b/demos/mainwindow/colorswatch.cpp
index 19599bf..dd16fdd 100644
--- a/demos/mainwindow/colorswatch.cpp
+++ b/demos/mainwindow/colorswatch.cpp
@@ -454,7 +454,7 @@ void ColorSwatch::updateContextMenu()
tabMenu->clear();
splitHMenu->clear();
splitVMenu->clear();
- QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow);
+ QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>();
foreach (ColorSwatch *dock, dock_list) {
// if (!dock->isVisible() || dock->isFloating())
// continue;
@@ -467,7 +467,7 @@ void ColorSwatch::updateContextMenu()
void ColorSwatch::splitInto(QAction *action)
{
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
- QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow);
+ QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>();
ColorSwatch *target = 0;
foreach (ColorSwatch *dock, dock_list) {
if (action->text() == dock->objectName()) {
@@ -486,7 +486,7 @@ void ColorSwatch::splitInto(QAction *action)
void ColorSwatch::tabInto(QAction *action)
{
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget());
- QList<ColorSwatch*> dock_list = qFindChildren<ColorSwatch*>(mainWindow);
+ QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>();
ColorSwatch *target = 0;
foreach (ColorSwatch *dock, dock_list) {
if (action->text() == dock->objectName()) {
diff --git a/demos/mainwindow/toolbar.cpp b/demos/mainwindow/toolbar.cpp
index 21731dc..1176ee5 100644
--- a/demos/mainwindow/toolbar.cpp
+++ b/demos/mainwindow/toolbar.cpp
@@ -232,7 +232,7 @@ void ToolBar::updateMenu()
void ToolBar::order()
{
QList<QAction *> ordered, actions1 = actions(),
- actions2 = qFindChildren<QAction *>(this);
+ actions2 = findChildren<QAction *>();
while (!actions2.isEmpty()) {
QAction *action = actions2.takeFirst();
if (!actions1.contains(action))
diff --git a/demos/pathstroke/main.cpp b/demos/pathstroke/main.cpp
index 6d688c3..ca201d3 100644
--- a/demos/pathstroke/main.cpp
+++ b/demos/pathstroke/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
PathStrokeWidget pathStrokeWidget(smallScreen);
QStyle *arthurStyle = new ArthurStyle();
pathStrokeWidget.setStyle(arthurStyle);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(&pathStrokeWidget);
+ QList<QWidget *> widgets = pathStrokeWidget.findChildren<QWidget *>();
foreach (QWidget *w, widgets) {
w->setStyle(arthurStyle);
w->setAttribute(Qt::WA_AcceptTouchEvents);
diff --git a/demos/pathstroke/pathstroke.cpp b/demos/pathstroke/pathstroke.cpp
index 2d01ee5..02c35f7 100644
--- a/demos/pathstroke/pathstroke.cpp
+++ b/demos/pathstroke/pathstroke.cpp
@@ -382,7 +382,7 @@ void PathStrokeWidget::setStyle( QStyle * style )
{
m_controls->setStyle(style);
- QList<QWidget *> widgets = qFindChildren<QWidget *>(m_controls);
+ QList<QWidget *> widgets = m_controls->findChildren<QWidget *>();
foreach (QWidget *w, widgets)
w->setStyle(style);
}
diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro
index fbf06d2..a7a6181 100644
--- a/demos/qmediaplayer/qmediaplayer.pro
+++ b/demos/qmediaplayer/qmediaplayer.pro
@@ -27,7 +27,7 @@ DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout
symbian {
TARGET.UID3 = 0xA000C613
- addFiles.sources = ../embedded/desktopservices/data/sax.mp3
+ addFiles.files = ../embedded/desktopservices/data/sax.mp3
addFiles.path = /data/sounds/
DEPLOYMENT += addFiles
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index b94d2b8..2fde945 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -25,7 +25,6 @@
<example filename="spreadsheet" name="Spreadsheet" />
<example filename="sqlbrowser" name="SQL Browser" />
<example filename="arthurplugin" name="Arthur Plugin" executable="false" />
-
</demos>
<category dirname="animation" name="Animation Framework">
<example filename="animatedtiles" name="Animated Tiles" />
@@ -265,6 +264,9 @@
<example filename="previewer" name="HTML Previewer" />
<example filename="fancybrowser" name="Fancy Browser" />
<example filename="googlechat" name="Google Chat" />
+ <example filename="simplewebplugin" name="Simple Web Plugin" />
+ <example filename="webplugin" name="Web Plugin" />
+ <example filename="webftpclient" name="Web FTP Client" />
</category>
<category dirname="xml" name="XML">
<example filename="saxbookmarks" name="SAX Bookmarks" />
diff --git a/demos/shared/arthurstyle.cpp b/demos/shared/arthurstyle.cpp
index 5abcfe9..432b8b3 100644
--- a/demos/shared/arthurstyle.cpp
+++ b/demos/shared/arthurstyle.cpp
@@ -394,7 +394,7 @@ int ArthurStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWid
void ArthurStyle::polish(QWidget *widget)
{
if (widget->layout() && qobject_cast<QGroupBox *>(widget)) {
- if (qFindChildren<QGroupBox *>(widget).size() == 0) {
+ if (widget->findChildren<QGroupBox *>().size() == 0) {
widget->layout()->setSpacing(0);
widget->layout()->setMargin(12);
} else {
diff --git a/demos/shared/arthurwidgets.cpp b/demos/shared/arthurwidgets.cpp
index 617f100..b3c75f0 100644
--- a/demos/shared/arthurwidgets.cpp
+++ b/demos/shared/arthurwidgets.cpp
@@ -313,7 +313,7 @@ void ArthurFrame::loadSourceFile(const QString &sourceFile)
void ArthurFrame::showSource()
{
// Check for existing source
- if (qFindChild<QTextBrowser *>(this))
+ if (findChild<QTextBrowser *>())
return;
QString contents;
diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro
index b3ff227..a75b41a 100644
--- a/demos/spectrum/app/app.pro
+++ b/demos/spectrum/app/app.pro
@@ -86,7 +86,7 @@ symbian {
!contains(DEFINES, DISABLE_FFT) {
# Include FFTReal DLL in the SIS file
- fftreal.sources = ../fftreal.dll
+ fftreal.files = ../fftreal.dll
fftreal.path = !:/sys/bin
DEPLOYMENT += fftreal
}
diff --git a/demos/spectrum/app/settingsdialog.cpp b/demos/spectrum/app/settingsdialog.cpp
index 0fc620d..78c2db9 100644
--- a/demos/spectrum/app/settingsdialog.cpp
+++ b/demos/spectrum/app/settingsdialog.cpp
@@ -65,13 +65,13 @@ SettingsDialog::SettingsDialog(
QAudioDeviceInfo device;
foreach (device, availableInputDevices)
m_inputDeviceComboBox->addItem(device.deviceName(),
- qVariantFromValue(device));
+ QVariant::fromValue(device));
foreach (device, availableOutputDevices)
m_outputDeviceComboBox->addItem(device.deviceName(),
- qVariantFromValue(device));
+ QVariant::fromValue(device));
- m_windowFunctionComboBox->addItem(tr("None"), qVariantFromValue(int(NoWindow)));
- m_windowFunctionComboBox->addItem("Hann", qVariantFromValue(int(HannWindow)));
+ m_windowFunctionComboBox->addItem(tr("None"), QVariant::fromValue(int(NoWindow)));
+ m_windowFunctionComboBox->addItem("Hann", QVariant::fromValue(int(HannWindow)));
m_windowFunctionComboBox->setCurrentIndex(m_windowFunction);
// Initialize default devices
diff --git a/demos/spreadsheet/spreadsheetitem.cpp b/demos/spreadsheet/spreadsheetitem.cpp
index 3d1fc0d..74a1967 100644
--- a/demos/spreadsheet/spreadsheetitem.cpp
+++ b/demos/spreadsheet/spreadsheetitem.cpp
@@ -72,10 +72,10 @@ QVariant SpreadSheetItem::data(int role) const
if (role == Qt::TextColorRole) {
if (!isNumber)
- return qVariantFromValue(QColor(Qt::black));
+ return QVariant::fromValue(QColor(Qt::black));
else if (number < 0)
- return qVariantFromValue(QColor(Qt::red));
- return qVariantFromValue(QColor(Qt::blue));
+ return QVariant::fromValue(QColor(Qt::red));
+ return QVariant::fromValue(QColor(Qt::blue));
}
if (role == Qt::TextAlignmentRole)