Squashed commit of the changes from the mobile-examples repository

(4.7-generated-declarative branch).
This commit is contained in:
David Boddie 2011-04-27 19:16:41 +02:00
parent 5feefb0c03
commit 0748751c9f
474 changed files with 3193 additions and 670 deletions

View File

@ -29,7 +29,7 @@
\example network/broadcastreceiver \example network/broadcastreceiver
\title Broadcast Receiver Example \title Broadcast Receiver Example
The Broadcast Receiever example shows how to receive information that is broadcasted The Broadcast Receiver example shows how to receive information that is broadcasted
over a local network. over a local network.
\image broadcastreceiver-example.png \image broadcastreceiver-example.png

View File

@ -29,7 +29,7 @@
\example itemviews/combowidgetmapper \example itemviews/combowidgetmapper
\title Combo Widget Mapper Example \title Combo Widget Mapper Example
The Delegate Widget Mapper example shows how to use a custom delegate to The Combo Widget Mapper example shows how to use a custom delegate to
map information from a model to specific widgets on a form. map information from a model to specific widgets on a form.
\image combowidgetmapper-example.png \image combowidgetmapper-example.png

View File

@ -29,7 +29,7 @@
\example graphicsview/dragdroprobot \example graphicsview/dragdroprobot
\title Drag and Drop Robot Example \title Drag and Drop Robot Example
This GraphicsView example shows how to implement Drag and Drop in a The Drag and Drop Robot example shows how to implement Drag and Drop in a
QGraphicsItem subclass, as well as how to animate items using Qt's QGraphicsItem subclass, as well as how to animate items using Qt's
\l{Animation Framework}. \l{Animation Framework}.

View File

@ -29,7 +29,7 @@
\example graphicsview/elasticnodes \example graphicsview/elasticnodes
\title Elastic Nodes Example \title Elastic Nodes Example
This GraphicsView example shows how to implement edges between nodes in a The Elastic Nodes example shows how to implement edges between nodes in a
graph, with basic interaction. You can click to drag a node around, and graph, with basic interaction. You can click to drag a node around, and
zoom in and out using the mouse wheel or the keyboard. Hitting the space zoom in and out using the mouse wheel or the keyboard. Hitting the space
bar will randomize the nodes. The example is also resolution independent; bar will randomize the nodes. The example is also resolution independent;

View File

@ -29,7 +29,7 @@
\example xml/rsslisting \example xml/rsslisting
\title RSS-Listing Example \title RSS-Listing Example
This example shows how to create a widget that displays news items The RSS-Listing example shows how to create a widget that displays news items
from RDF news sources. from RDF news sources.
\image rsslistingexample.png \image rsslistingexample.png

View File

@ -104,7 +104,6 @@
array of the data elements that the user can change. The table widget can be array of the data elements that the user can change. The table widget can be
integrated into a program flow by reading and writing the data elements that integrated into a program flow by reading and writing the data elements that
the table widget provides. the table widget provides.
This method is very intuitive and useful in many applications, but displaying This method is very intuitive and useful in many applications, but displaying
and editing a database table with a standard table widget can be problematic. and editing a database table with a standard table widget can be problematic.
Two copies of the data have to be coordinated: one outside the Two copies of the data have to be coordinated: one outside the

View File

@ -11,3 +11,4 @@ symbian {
TARGET.UID3 = 0xA000D7D1 TARGET.UID3 = 0xA000D7D1
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -210,7 +210,11 @@ int main(int argc, char **argv)
view->setBackgroundBrush(bgPix); view->setBackgroundBrush(bgPix);
view->setCacheMode(QGraphicsView::CacheBackground); view->setCacheMode(QGraphicsView::CacheBackground);
view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
#ifdef Q_OS_SYMBIAN
view->showMaximized();
#else
view->show(); view->show();
#endif
QStateMachine states; QStateMachine states;
states.addState(rootState); states.addState(rootState);

View File

@ -11,3 +11,4 @@ symbian {
TARGET.UID3 = 0xA000E3F5 TARGET.UID3 = 0xA000E3F5
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -80,6 +80,21 @@ private:
QPixmap p; QPixmap p;
}; };
class GraphicsView : public QGraphicsView
{
Q_OBJECT
public:
GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) : QGraphicsView(scene, parent)
{
}
virtual void resizeEvent(QResizeEvent *event)
{
fitInView(sceneRect(), Qt::KeepAspectRatio);
}
};
void createStates(const QObjectList &objects, void createStates(const QObjectList &objects,
const QRect &selectedRect, QState *parent) const QRect &selectedRect, QState *parent)
{ {
@ -112,10 +127,10 @@ int main(int argc, char **argv)
p3->setObjectName("p3"); p3->setObjectName("p3");
p4->setObjectName("p4"); p4->setObjectName("p4");
p1->setGeometry(QRectF(0.0, 0.0, 64.0, 64.0)); p1->setGeometry(QRectF( 0.0, 0.0, 64.0, 64.0));
p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0)); p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0));
p3->setGeometry(QRectF(236.0, 236.0, 64.0, 64.0)); p3->setGeometry(QRectF(236.0, 236.0, 64.0, 64.0));
p4->setGeometry(QRectF(0.0, 236.0, 64.0, 64.0)); p4->setGeometry(QRectF( 0.0, 236.0, 64.0, 64.0));
QGraphicsScene scene(0, 0, 300, 300); QGraphicsScene scene(0, 0, 300, 300);
scene.setBackgroundBrush(Qt::white); scene.setBackgroundBrush(Qt::white);
@ -124,7 +139,7 @@ int main(int argc, char **argv)
scene.addItem(p3); scene.addItem(p3);
scene.addItem(p4); scene.addItem(p4);
QGraphicsView window(&scene); GraphicsView window(&scene);
window.setFrameStyle(0); window.setFrameStyle(0);
window.setAlignment(Qt::AlignLeft | Qt::AlignTop); window.setAlignment(Qt::AlignLeft | Qt::AlignTop);
window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -135,12 +150,13 @@ int main(int argc, char **argv)
QState *group = new QState(&machine); QState *group = new QState(&machine);
group->setObjectName("group"); group->setObjectName("group");
QRect selectedRect(86, 86, 128, 128); QRect selectedRect(86, 86, 128, 128);
QState *idleState = new QState(group); QState *idleState = new QState(group);
group->setInitialState(idleState); group->setInitialState(idleState);
QObjectList objects; QObjectList objects;
objects << p1 << p2 << p3 << p4; objects << p1 << p2 << p3 << p4;
createStates(objects, selectedRect, group); createStates(objects, selectedRect, group);
createAnimations(objects, &machine); createAnimations(objects, &machine);
@ -148,8 +164,12 @@ int main(int argc, char **argv)
machine.setInitialState(group); machine.setInitialState(group);
machine.start(); machine.start();
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
window.showMaximized();
#else
window.resize(300, 300); window.resize(300, 300);
window.show(); window.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -5,7 +5,7 @@ SOURCES = main.cpp \
FORMS = form.ui FORMS = form.ui
RESOURCES = easing.qrc RESOURCES = easing.qrc
# install # install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation/easing target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation/easing
@ -17,3 +17,5 @@ symbian {
TARGET.UID3 = 0xA000E3F6 TARGET.UID3 = 0xA000E3F6
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: CONFIG += qt_example

View File

@ -49,12 +49,27 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title"> <property name="title">
<string>Path type</string> <string>Path type</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item> <item row="0" column="0">
<widget class="QRadioButton" name="lineRadio"> <widget class="QRadioButton" name="lineRadio">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text"> <property name="text">
<string>Line</string> <string>Line</string>
</property> </property>
@ -66,8 +81,14 @@
</attribute> </attribute>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QRadioButton" name="circleRadio"> <widget class="QRadioButton" name="circleRadio">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Circle</string> <string>Circle</string>
</property> </property>
@ -96,6 +117,18 @@
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Period</string> <string>Period</string>
</property> </property>
@ -106,6 +139,18 @@
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="minimum"> <property name="minimum">
<double>-1.000000000000000</double> <double>-1.000000000000000</double>
</property> </property>
@ -117,18 +162,52 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Amplitude</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="amplitudeSpinBox"> <widget class="QDoubleSpinBox" name="amplitudeSpinBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>-1.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Overshoot</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="overshootSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="minimum"> <property name="minimum">
<double>-1.000000000000000</double> <double>-1.000000000000000</double>
</property> </property>
@ -141,25 +220,15 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Overshoot</string> <string>Amplitude</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="overshootSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>-1.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -46,7 +46,15 @@ int main(int argc, char **argv)
Q_INIT_RESOURCE(easing); Q_INIT_RESOURCE(easing);
QApplication app(argc, argv); QApplication app(argc, argv);
Window w; Window w;
#if defined(Q_OS_SYMBIAN)
w.showMaximized();
#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
w.show();
#else
w.resize(400, 400); w.resize(400, 400);
w.show(); w.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -41,7 +41,12 @@
#include "window.h" #include "window.h"
Window::Window(QWidget *parent) Window::Window(QWidget *parent)
: QWidget(parent), m_iconSize(64, 64) : QWidget(parent),
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
m_iconSize(32, 32)
#else
m_iconSize(64, 64)
#endif
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
QButtonGroup *buttonGroup = findChild<QButtonGroup *>(); // ### workaround for uic in 4.4 QButtonGroup *buttonGroup = findChild<QButtonGroup *>(); // ### workaround for uic in 4.4

View File

@ -39,7 +39,6 @@
****************************************************************************/ ****************************************************************************/
#include <QtGui> #include <QtGui>
#include "ui_form.h" #include "ui_form.h"
#include "animation.h" #include "animation.h"
@ -73,6 +72,4 @@ private:
PixmapItem *m_item; PixmapItem *m_item;
Animation *m_anim; Animation *m_anim;
QSize m_iconSize; QSize m_iconSize;
}; };

View File

@ -154,25 +154,28 @@ QState *createGeometryState(QObject *w1, const QRect &rect1,
} }
//![13] //![13]
class GraphicsView : public QGraphicsView
{
Q_OBJECT
public:
GraphicsView(QGraphicsScene *scene, QWidget *parent = NULL) : QGraphicsView(scene, parent)
{
}
protected:
virtual void resizeEvent(QResizeEvent *event)
{
fitInView(scene()->sceneRect());
QGraphicsView::resizeEvent(event);
}
};
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
#if 0
QWidget window;
QPalette palette;
palette.setBrush(QPalette::Window, Qt::black);
window.setPalette(palette);
QPushButton *button1 = new QPushButton("A", &window);
QPushButton *button2 = new QPushButton("B", &window);
QPushButton *button3 = new QPushButton("C", &window);
QPushButton *button4 = new QPushButton("D", &window);
button1->setObjectName("button1");
button2->setObjectName("button2");
button3->setObjectName("button3");
button4->setObjectName("button4");
#else
//![1] //![1]
QGraphicsRectWidget *button1 = new QGraphicsRectWidget; QGraphicsRectWidget *button1 = new QGraphicsRectWidget;
QGraphicsRectWidget *button2 = new QGraphicsRectWidget; QGraphicsRectWidget *button2 = new QGraphicsRectWidget;
@ -188,12 +191,11 @@ int main(int argc, char **argv)
scene.addItem(button3); scene.addItem(button3);
scene.addItem(button4); scene.addItem(button4);
//![1] //![1]
QGraphicsView window(&scene); GraphicsView window(&scene);
window.setFrameStyle(0); window.setFrameStyle(0);
window.setAlignment(Qt::AlignLeft | Qt::AlignTop); window.setAlignment(Qt::AlignLeft | Qt::AlignTop);
window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
//![2] //![2]
QStateMachine machine; QStateMachine machine;
@ -308,8 +310,13 @@ int main(int argc, char **argv)
machine.start(); machine.start();
//![9] //![9]
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
window.showMaximized();
window.fitInView(scene.sceneRect() );
#else
window.resize(300, 300); window.resize(300, 300);
window.show(); window.show();
#endif
qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));

View File

@ -10,3 +10,4 @@ symbian {
TARGET.UID3 = 0xA000E3F7 TARGET.UID3 = 0xA000E3F7
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -62,6 +62,19 @@ private:
QPixmap p; QPixmap p;
}; };
class GraphicsView : public QGraphicsView
{
public:
GraphicsView(QGraphicsScene *scene) : QGraphicsView(scene)
{
}
virtual void resizeEvent(QResizeEvent *event)
{
fitInView(sceneRect(), Qt::KeepAspectRatio);
}
};
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Q_INIT_RESOURCE(states); Q_INIT_RESOURCE(states);
@ -130,12 +143,12 @@ int main(int argc, char *argv[])
state1->assignProperty(button, "text", "Switch to state 2"); state1->assignProperty(button, "text", "Switch to state 2");
state1->assignProperty(widget, "geometry", QRectF(0, 0, 400, 150)); state1->assignProperty(widget, "geometry", QRectF(0, 0, 400, 150));
state1->assignProperty(box, "geometry", QRect(-200, 150, 200, 150)); state1->assignProperty(box, "geometry", QRect(-200, 150, 200, 150));
state1->assignProperty(p1, "pos", QPointF(68, 185)); state1->assignProperty(p1, "pos", QPointF(68, 200)); // 185));
state1->assignProperty(p2, "pos", QPointF(168, 185)); state1->assignProperty(p2, "pos", QPointF(168, 200)); // 185));
state1->assignProperty(p3, "pos", QPointF(268, 185)); state1->assignProperty(p3, "pos", QPointF(268, 200)); // 185));
state1->assignProperty(p4, "pos", QPointF(68-150, 48-150)); state1->assignProperty(p4, "pos", QPointF(68 - 150, 48 - 150));
state1->assignProperty(p5, "pos", QPointF(168, 48-150)); state1->assignProperty(p5, "pos", QPointF(168, 48 - 150));
state1->assignProperty(p6, "pos", QPointF(268+150, 48-150)); state1->assignProperty(p6, "pos", QPointF(268 + 150, 48 - 150));
state1->assignProperty(p1, "rotation", qreal(0)); state1->assignProperty(p1, "rotation", qreal(0));
state1->assignProperty(p2, "rotation", qreal(0)); state1->assignProperty(p2, "rotation", qreal(0));
state1->assignProperty(p3, "rotation", qreal(0)); state1->assignProperty(p3, "rotation", qreal(0));
@ -154,9 +167,9 @@ int main(int argc, char *argv[])
state2->assignProperty(button, "text", "Switch to state 3"); state2->assignProperty(button, "text", "Switch to state 3");
state2->assignProperty(widget, "geometry", QRectF(200, 150, 200, 150)); state2->assignProperty(widget, "geometry", QRectF(200, 150, 200, 150));
state2->assignProperty(box, "geometry", QRect(9, 150, 190, 150)); state2->assignProperty(box, "geometry", QRect(9, 150, 190, 150));
state2->assignProperty(p1, "pos", QPointF(68-150, 185+150)); state2->assignProperty(p1, "pos", QPointF(68 - 150, 185 + 150));
state2->assignProperty(p2, "pos", QPointF(168, 185+150)); state2->assignProperty(p2, "pos", QPointF(168, 185 + 150));
state2->assignProperty(p3, "pos", QPointF(268+150, 185+150)); state2->assignProperty(p3, "pos", QPointF(268 + 150, 185 + 150));
state2->assignProperty(p4, "pos", QPointF(64, 48)); state2->assignProperty(p4, "pos", QPointF(64, 48));
state2->assignProperty(p5, "pos", QPointF(168, 48)); state2->assignProperty(p5, "pos", QPointF(168, 48));
state2->assignProperty(p6, "pos", QPointF(268, 48)); state2->assignProperty(p6, "pos", QPointF(268, 48));
@ -262,8 +275,13 @@ int main(int argc, char *argv[])
machine.start(); machine.start();
QGraphicsView view(&scene); GraphicsView view(&scene);
#if defined(Q_OS_SYMBIAN)
view.showMaximized();
#else
view.show(); view.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -11,3 +11,4 @@ symbian {
TARGET.UID3 = 0xA000E3F8 TARGET.UID3 = 0xA000E3F8
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -54,4 +54,7 @@ void GraphicsView::keyPressEvent(QKeyEvent *e)
emit keyPressed(Qt::Key(e->key())); emit keyPressed(Qt::Key(e->key()));
} }
void GraphicsView::resizeEvent(QResizeEvent *event)
{
fitInView(scene()->sceneRect());
}

View File

@ -51,6 +51,7 @@ public:
GraphicsView(QWidget *parent = 0); GraphicsView(QWidget *parent = 0);
protected: protected:
virtual void resizeEvent(QResizeEvent *event);
void keyPressEvent(QKeyEvent *); void keyPressEvent(QKeyEvent *);
signals: signals:

View File

@ -159,10 +159,14 @@ void LifeCycle::start()
m_machine->start(); m_machine->start();
} }
void LifeCycle::addActivity(const QString &fileName, Qt::Key key) void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sender, const char *signal)
{ {
QState *state = makeState(m_alive, fileName); QState *state = makeState(m_alive, fileName);
m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state)); m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state));
if((sender != NULL) || (signal != NULL)) {
m_alive->addTransition(sender, signal, state);
}
} }
QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName) QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName)

View File

@ -50,6 +50,7 @@ class QAnimationGroup;
class QState; class QState;
class QAbstractState; class QAbstractState;
class QAbstractTransition; class QAbstractTransition;
class QObject;
QT_END_NAMESPACE QT_END_NAMESPACE
class GraphicsView; class GraphicsView;
class LifeCycle class LifeCycle
@ -59,7 +60,7 @@ public:
~LifeCycle(); ~LifeCycle();
void setDeathAnimation(const QString &fileName); void setDeathAnimation(const QString &fileName);
void addActivity(const QString &fileName, Qt::Key key); void addActivity(const QString &fileName, Qt::Key key, QObject *sender = NULL, const char *signal = NULL);
void start(); void start();

View File

@ -43,6 +43,7 @@
#include "lifecycle.h" #include "lifecycle.h"
#include "stickman.h" #include "stickman.h"
#include "graphicsview.h" #include "graphicsview.h"
#include "rectbutton.h"
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
@ -55,6 +56,11 @@ int main(int argc, char **argv)
StickMan *stickMan = new StickMan; StickMan *stickMan = new StickMan;
stickMan->setDrawSticks(false); stickMan->setDrawSticks(false);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
RectButton *buttonJump = new RectButton("Jump"); buttonJump->setPos(100, 125);
RectButton *buttonDance = new RectButton("Dance"); buttonDance->setPos(100, 200);
RectButton *buttonChill = new RectButton("Chill"); buttonChill->setPos(100, 275);
#else
QGraphicsTextItem *textItem = new QGraphicsTextItem(); QGraphicsTextItem *textItem = new QGraphicsTextItem();
textItem->setHtml("<font color=\"white\"><b>Stickman</b>" textItem->setHtml("<font color=\"white\"><b>Stickman</b>"
"<p>" "<p>"
@ -71,31 +77,55 @@ int main(int argc, char **argv)
qreal w = textItem->boundingRect().width(); qreal w = textItem->boundingRect().width();
QRectF stickManBoundingRect = stickMan->mapToScene(stickMan->boundingRect()).boundingRect(); QRectF stickManBoundingRect = stickMan->mapToScene(stickMan->boundingRect()).boundingRect();
textItem->setPos(-w / 2.0, stickManBoundingRect.bottom() + 25.0); textItem->setPos(-w / 2.0, stickManBoundingRect.bottom() + 25.0);
#endif
QGraphicsScene scene; QGraphicsScene scene;
scene.addItem(stickMan); scene.addItem(stickMan);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
scene.addItem(buttonJump);
scene.addItem(buttonDance);
scene.addItem(buttonChill);
#else
scene.addItem(textItem); scene.addItem(textItem);
#endif
scene.setBackgroundBrush(Qt::black); scene.setBackgroundBrush(Qt::black);
GraphicsView view; GraphicsView view;
view.setRenderHints(QPainter::Antialiasing); view.setRenderHints(QPainter::Antialiasing);
view.setTransformationAnchor(QGraphicsView::NoAnchor); view.setTransformationAnchor(QGraphicsView::NoAnchor);
view.setScene(&scene); view.setScene(&scene);
view.show();
view.setFocus();
QRectF sceneRect = scene.sceneRect(); QRectF sceneRect = scene.sceneRect();
// making enough room in the scene for stickman to jump and die // making enough room in the scene for stickman to jump and die
view.resize(sceneRect.width() + 100, sceneRect.height() + 100); view.resize(sceneRect.width() + 100, sceneRect.height() + 100);
view.setSceneRect(sceneRect); view.setSceneRect(sceneRect);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.showMaximized();
view.fitInView(scene.sceneRect(), Qt::KeepAspectRatio);
#else
view.show();
view.setFocus();
#endif
LifeCycle cycle(stickMan, &view); LifeCycle cycle(stickMan, &view);
cycle.setDeathAnimation(":/animations/dead"); cycle.setDeathAnimation(":/animations/dead");
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
cycle.addActivity(":/animations/jumping", Qt::Key_J, buttonJump, SIGNAL(clicked()));
cycle.addActivity(":/animations/dancing", Qt::Key_D, buttonDance, SIGNAL(clicked()));
cycle.addActivity(":/animations/chilling", Qt::Key_C, buttonChill, SIGNAL(clicked()));
#else
cycle.addActivity(":/animations/jumping", Qt::Key_J); cycle.addActivity(":/animations/jumping", Qt::Key_J);
cycle.addActivity(":/animations/dancing", Qt::Key_D); cycle.addActivity(":/animations/dancing", Qt::Key_D);
cycle.addActivity(":/animations/chilling", Qt::Key_C); cycle.addActivity(":/animations/chilling", Qt::Key_C);
#endif
cycle.start(); cycle.start();
return app.exec(); return app.exec();
} }

View File

@ -2,13 +2,15 @@ HEADERS += stickman.h \
animation.h \ animation.h \
node.h \ node.h \
lifecycle.h \ lifecycle.h \
graphicsview.h graphicsview.h \
rectbutton.h
SOURCES += main.cpp \ SOURCES += main.cpp \
stickman.cpp \ stickman.cpp \
animation.cpp \ animation.cpp \
node.cpp \ node.cpp \
lifecycle.cpp \ lifecycle.cpp \
graphicsview.cpp graphicsview.cpp \
rectbutton.cpp
RESOURCES += stickman.qrc RESOURCES += stickman.qrc
@ -22,3 +24,4 @@ symbian {
TARGET.UID3 = 0xA000E3F9 TARGET.UID3 = 0xA000E3F9
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -1,5 +1,4 @@
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
QT -= gui QT -= gui
@ -16,3 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -1,5 +1,4 @@
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
QT -= gui QT -= gui
@ -16,3 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/complexpingpong
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -1,5 +1,4 @@
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
CONFIG += qdbus CONFIG += qdbus
@ -19,3 +18,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/chat
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -15,3 +15,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus
INSTALLS += sources INSTALLS += sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -1,5 +1,4 @@
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
QT -= gui QT -= gui
@ -16,4 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/listnames
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -16,3 +16,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -16,3 +16,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/pingpong
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -3,7 +3,6 @@
###################################################################### ######################################################################
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
CONFIG += qdbus CONFIG += qdbus
@ -20,3 +19,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/car
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -3,7 +3,6 @@
###################################################################### ######################################################################
TEMPLATE = app TEMPLATE = app
TARGET =
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
CONFIG += qdbus CONFIG += qdbus
@ -21,3 +20,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/controlle
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example does not work on Symbian platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -8,3 +8,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar
INSTALLS += sources INSTALLS += sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -9,3 +9,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -9,3 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop/screenshot
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -10,3 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/classwizard
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -14,3 +14,7 @@ INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -17,3 +17,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs
INSTALLS += sources INSTALLS += sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -9,3 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/extension
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -63,9 +63,6 @@ FindDialog::FindDialog(QWidget *parent)
//! [0] //! [0]
moreButton->setAutoDefault(false); moreButton->setAutoDefault(false);
buttonBox = new QDialogButtonBox(Qt::Vertical);
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
//! [1] //! [1]
//! [2] //! [2]
@ -77,7 +74,42 @@ FindDialog::FindDialog(QWidget *parent)
//! [2] //! [2]
//! [3] //! [3]
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
// Create menu
QMenu *menu = new QMenu(this);
// Create Find menu item
menu->addAction(tr("Find"));
// Create More menu item
QAction *moreAction = menu->addAction(tr("More"));
moreAction->setCheckable(true);
// Create Options CBA
QAction *optionAction = new QAction(tr("Options"), this);
// Set defined menu into Options button
optionAction->setMenu(menu);
optionAction->setSoftKeyRole(QAction::PositiveSoftKey);
addAction(optionAction);
// Connect More menu item to setVisible slot
connect(moreAction, SIGNAL(triggered(bool)), extension, SLOT(setVisible(bool)));
// Create Exit CBA
QAction *backSoftKeyAction = new QAction(QString(tr("Exit")), this);
backSoftKeyAction->setSoftKeyRole(QAction::NegativeSoftKey);
// Exit button closes the application
connect(backSoftKeyAction, SIGNAL(triggered()), qApp, SLOT(quit()));
addAction(backSoftKeyAction);
#else
buttonBox = new QDialogButtonBox(Qt::Vertical);
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
connect(moreButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool))); connect(moreButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool)));
#endif
QVBoxLayout *extensionLayout = new QVBoxLayout; QVBoxLayout *extensionLayout = new QVBoxLayout;
extensionLayout->setMargin(0); extensionLayout->setMargin(0);
@ -96,13 +128,18 @@ FindDialog::FindDialog(QWidget *parent)
leftLayout->addLayout(topLeftLayout); leftLayout->addLayout(topLeftLayout);
leftLayout->addWidget(caseCheckBox); leftLayout->addWidget(caseCheckBox);
leftLayout->addWidget(fromStartCheckBox); leftLayout->addWidget(fromStartCheckBox);
leftLayout->addStretch(1);
QGridLayout *mainLayout = new QGridLayout; QGridLayout *mainLayout = new QGridLayout;
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
mainLayout->setSizeConstraint(QLayout::SetFixedSize); mainLayout->setSizeConstraint(QLayout::SetFixedSize);
#endif
mainLayout->addLayout(leftLayout, 0, 0); mainLayout->addLayout(leftLayout, 0, 0);
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_SIMULATOR)
mainLayout->addWidget(buttonBox, 0, 1); mainLayout->addWidget(buttonBox, 0, 1);
#endif
mainLayout->addWidget(extension, 1, 0, 1, 2); mainLayout->addWidget(extension, 1, 0, 1, 2);
mainLayout->setRowStretch(2, 1);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Extension")); setWindowTitle(tr("Extension"));

View File

@ -46,5 +46,12 @@ int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
FindDialog dialog; FindDialog dialog;
return dialog.exec();
#ifdef Q_OS_SYMBIAN
dialog.showMaximized();
#else
dialog.show();
#endif
return app.exec();
} }

View File

@ -9,3 +9,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/findfiles
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
Window window; Window window;
#ifdef Q_OS_SYMBIAN
window.showMaximized();
#else
window.show(); window.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -44,7 +44,7 @@
//! [0] //! [0]
Window::Window(QWidget *parent) Window::Window(QWidget *parent)
: QDialog(parent) : QWidget(parent)
{ {
browseButton = createButton(tr("&Browse..."), SLOT(browse())); browseButton = createButton(tr("&Browse..."), SLOT(browse()));
findButton = createButton(tr("&Find"), SLOT(find())); findButton = createButton(tr("&Find"), SLOT(find()));
@ -62,11 +62,8 @@ Window::Window(QWidget *parent)
//! [0] //! [0]
//! [1] //! [1]
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch();
buttonsLayout->addWidget(findButton);
QGridLayout *mainLayout = new QGridLayout; QGridLayout *mainLayout = new QGridLayout;
mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
mainLayout->addWidget(fileLabel, 0, 0); mainLayout->addWidget(fileLabel, 0, 0);
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2); mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
mainLayout->addWidget(textLabel, 1, 0); mainLayout->addWidget(textLabel, 1, 0);
@ -75,12 +72,14 @@ Window::Window(QWidget *parent)
mainLayout->addWidget(directoryComboBox, 2, 1); mainLayout->addWidget(directoryComboBox, 2, 1);
mainLayout->addWidget(browseButton, 2, 2); mainLayout->addWidget(browseButton, 2, 2);
mainLayout->addWidget(filesTable, 3, 0, 1, 3); mainLayout->addWidget(filesTable, 3, 0, 1, 3);
mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 3); mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2);
mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3); mainLayout->addWidget(findButton, 4, 2);
setLayout(mainLayout); setLayout(mainLayout);
setWindowTitle(tr("Find Files")); setWindowTitle(tr("Find Files"));
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
resize(700, 300); resize(700, 300);
#endif
} }
//! [1] //! [1]
@ -194,7 +193,12 @@ void Window::showFiles(const QStringList &files)
filesTable->setItem(row, 1, sizeItem); filesTable->setItem(row, 1, sizeItem);
} }
filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()) + filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()) +
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
(" (Select file to open it)"));
#else
(" (Double click on a file to open it)")); (" (Double click on a file to open it)"));
#endif
filesFoundLabel->setWordWrap(true);
} }
//! [8] //! [8]
@ -214,6 +218,9 @@ QComboBox *Window::createComboBox(const QString &text)
comboBox->setEditable(true); comboBox->setEditable(true);
comboBox->addItem(text); comboBox->addItem(text);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
comboBox->setMinimumContentsLength(3);
#endif
return comboBox; return comboBox;
} }
//! [10] //! [10]
@ -225,7 +232,7 @@ void Window::createFilesTable()
filesTable->setSelectionBehavior(QAbstractItemView::SelectRows); filesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
QStringList labels; QStringList labels;
labels << tr("File Name") << tr("Size"); labels << tr("Filename") << tr("Size");
filesTable->setHorizontalHeaderLabels(labels); filesTable->setHorizontalHeaderLabels(labels);
filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
filesTable->verticalHeader()->hide(); filesTable->verticalHeader()->hide();

View File

@ -41,7 +41,7 @@
#ifndef WINDOW_H #ifndef WINDOW_H
#define WINDOW_H #define WINDOW_H
#include <QDialog> #include <QWidget>
#include <QDir> #include <QDir>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -53,7 +53,7 @@ class QTableWidgetItem;
QT_END_NAMESPACE QT_END_NAMESPACE
//! [0] //! [0]
class Window : public QDialog class Window : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -10,3 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/licensewizard
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -11,4 +11,7 @@ INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -49,7 +49,7 @@
"will activate the detected escape button (if any).") "will activate the detected escape button (if any).")
Dialog::Dialog(QWidget *parent) Dialog::Dialog(QWidget *parent)
: QDialog(parent) : QWidget(parent)
{ {
errorMessageDialog = new QErrorMessage(this); errorMessageDialog = new QErrorMessage(this);
@ -149,6 +149,7 @@ Dialog::Dialog(QWidget *parent)
native = new QCheckBox(this); native = new QCheckBox(this);
native->setText("Use native file dialog."); native->setText("Use native file dialog.");
native->setChecked(true); native->setChecked(true);
QGridLayout *layout = new QGridLayout; QGridLayout *layout = new QGridLayout;
layout->setColumnStretch(1, 1); layout->setColumnStretch(1, 1);
layout->setColumnMinimumWidth(1, 250); layout->setColumnMinimumWidth(1, 250);
@ -183,7 +184,19 @@ Dialog::Dialog(QWidget *parent)
layout->addWidget(errorButton, 14, 0); layout->addWidget(errorButton, 14, 0);
layout->addWidget(errorLabel, 14, 1); layout->addWidget(errorLabel, 14, 1);
layout->addWidget(native, 15, 0); layout->addWidget(native, 15, 0);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
QWidget *widget = new QWidget;
widget->setLayout(layout);
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->setWidget(widget);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(scrollArea);
setLayout(mainLayout);
#else
setLayout(layout); setLayout(layout);
#endif
setWindowTitle(tr("Standard Dialogs")); setWindowTitle(tr("Standard Dialogs"));
} }

View File

@ -41,7 +41,7 @@
#ifndef DIALOG_H #ifndef DIALOG_H
#define DIALOG_H #define DIALOG_H
#include <QDialog> #include <QWidget>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCheckBox; class QCheckBox;
@ -49,7 +49,7 @@ class QLabel;
class QErrorMessage; class QErrorMessage;
QT_END_NAMESPACE QT_END_NAMESPACE
class Dialog : public QDialog class Dialog : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -56,5 +56,11 @@ int main(int argc, char *argv[])
app.installTranslator(translator); app.installTranslator(translator);
Dialog dialog; Dialog dialog;
return dialog.exec(); #ifdef Q_OS_SYMBIAN
dialog.showMaximized();
#else
dialog.show();
#endif
return app.exec();
} }

View File

@ -11,3 +11,4 @@ INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -53,5 +53,11 @@ int main(int argc, char *argv[])
fileName = "."; fileName = ".";
TabDialog tabdialog(fileName); TabDialog tabdialog(fileName);
return tabdialog.exec(); #ifdef Q_OS_SYMBIAN
tabdialog.showMaximized();
#else
tabdialog.show();
#endif
return app.exec();
} }

View File

@ -65,6 +65,7 @@ TabDialog::TabDialog(const QString &fileName, QWidget *parent)
//! [4] //! [4]
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
mainLayout->addWidget(tabWidget); mainLayout->addWidget(tabWidget);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
setLayout(mainLayout); setLayout(mainLayout);

View File

@ -10,3 +10,6 @@ INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)

View File

@ -128,7 +128,11 @@ int main(int argc, char *argv[])
wizard.addPage(createConclusionPage()); wizard.addPage(createConclusionPage());
wizard.setWindowTitle("Trivial Wizard"); wizard.setWindowTitle("Trivial Wizard");
#ifdef Q_OS_SYMBIAN
wizard.showMaximized();
#else
wizard.show(); wizard.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -7,3 +7,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/trivialwizard
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -13,3 +13,4 @@ symbian {
TARGET.UID3 = 0xA000C615 TARGET.UID3 = 0xA000C615
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -46,25 +46,28 @@
DragWidget::DragWidget(QWidget *parent) DragWidget::DragWidget(QWidget *parent)
: QFrame(parent) : QFrame(parent)
{ {
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
#else
setMinimumSize(200, 200); setMinimumSize(200, 200);
#endif
setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
setAcceptDrops(true); setAcceptDrops(true);
QLabel *boatIcon = new QLabel(this); QLabel *boatIcon = new QLabel(this);
boatIcon->setPixmap(QPixmap(":/images/boat.png")); boatIcon->setPixmap(QPixmap(":/images/boat.png"));
boatIcon->move(20, 20); boatIcon->move(10, 10);
boatIcon->show(); boatIcon->show();
boatIcon->setAttribute(Qt::WA_DeleteOnClose); boatIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *carIcon = new QLabel(this); QLabel *carIcon = new QLabel(this);
carIcon->setPixmap(QPixmap(":/images/car.png")); carIcon->setPixmap(QPixmap(":/images/car.png"));
carIcon->move(120, 20); carIcon->move(100, 10);
carIcon->show(); carIcon->show();
carIcon->setAttribute(Qt::WA_DeleteOnClose); carIcon->setAttribute(Qt::WA_DeleteOnClose);
QLabel *houseIcon = new QLabel(this); QLabel *houseIcon = new QLabel(this);
houseIcon->setPixmap(QPixmap(":/images/house.png")); houseIcon->setPixmap(QPixmap(":/images/house.png"));
houseIcon->move(20, 120); houseIcon->move(10, 80);
houseIcon->show(); houseIcon->show();
houseIcon->setAttribute(Qt::WA_DeleteOnClose); houseIcon->setAttribute(Qt::WA_DeleteOnClose);
} }

View File

@ -55,7 +55,11 @@ int main(int argc, char *argv[])
mainWidget.setLayout(horizontalLayout); mainWidget.setLayout(horizontalLayout);
mainWidget.setWindowTitle(QObject::tr("Draggable Icons")); mainWidget.setWindowTitle(QObject::tr("Draggable Icons"));
#ifdef Q_OS_SYMBIAN
mainWidget.showMaximized();
#else
mainWidget.show(); mainWidget.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -15,3 +15,5 @@ symbian {
TARGET.UID3 = 0xA000CF64 TARGET.UID3 = 0xA000CF64
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -62,16 +62,18 @@ DragWidget::DragWidget(QWidget *parent)
wordLabel->show(); wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose); wordLabel->setAttribute(Qt::WA_DeleteOnClose);
x += wordLabel->width() + 2; x += wordLabel->width() + 2;
if (x >= 195) { if (x >= 245) {
x = 5; x = 5;
y += wordLabel->height() + 2; y += wordLabel->height() + 2;
} }
} }
} }
/*
QPalette newPalette = palette(); QPalette newPalette = palette();
newPalette.setColor(QPalette::Window, Qt::white); newPalette.setColor(QPalette::Window, Qt::white);
setPalette(newPalette); setPalette(newPalette);
*/
setAcceptDrops(true); setAcceptDrops(true);
setMinimumSize(400, qMax(200, y)); setMinimumSize(400, qMax(200, y));

View File

@ -47,6 +47,10 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
DragWidget window; DragWidget window;
#ifdef Q_OS_SYMBIAN
window.showMaximized();
#else
window.show(); window.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -11,3 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/dropsite
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -65,7 +65,11 @@ DragWidget::DragWidget(QWidget *parent)
wordLabel->show(); wordLabel->show();
wordLabel->setAttribute(Qt::WA_DeleteOnClose); wordLabel->setAttribute(Qt::WA_DeleteOnClose);
x += wordLabel->width() + 2; x += wordLabel->width() + 2;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
if (x >= 345) {
#else
if (x >= 245) { if (x >= 245) {
#endif
x = 5; x = 5;
y += wordLabel->height() + 2; y += wordLabel->height() + 2;
} }

View File

@ -16,4 +16,4 @@ symbian {
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -51,10 +51,15 @@ int main(int argc, char *argv[])
#endif #endif
DragWidget window; DragWidget window;
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
window.showMaximized();
#else
bool smallScreen = QApplication::arguments().contains("-small-screen"); bool smallScreen = QApplication::arguments().contains("-small-screen");
if (smallScreen) if (smallScreen)
window.showFullScreen(); window.showFullScreen();
else else
window.show(); window.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -49,6 +49,10 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
MainWindow window; MainWindow window;
window.openImage(":/images/example.jpg"); window.openImage(":/images/example.jpg");
#ifdef Q_OS_SYMBIAN
window.showMaximized();
#else
window.show(); window.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -90,14 +90,15 @@ void MainWindow::setupPuzzle()
{ {
int size = qMin(puzzleImage.width(), puzzleImage.height()); int size = qMin(puzzleImage.width(), puzzleImage.height());
puzzleImage = puzzleImage.copy((puzzleImage.width() - size)/2, puzzleImage = puzzleImage.copy((puzzleImage.width() - size)/2,
(puzzleImage.height() - size)/2, size, size).scaled(400, (puzzleImage.height() - size)/2, size, size).scaled(puzzleWidget->width(),
400, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); puzzleWidget->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
piecesList->clear(); piecesList->clear();
for (int y = 0; y < 5; ++y) { for (int y = 0; y < 5; ++y) {
for (int x = 0; x < 5; ++x) { for (int x = 0; x < 5; ++x) {
QPixmap pieceImage = puzzleImage.copy(x*80, y*80, 80, 80); int pieceSize = puzzleWidget->pieceSize();
QPixmap pieceImage = puzzleImage.copy(x * pieceSize, y * pieceSize, pieceSize, pieceSize);
piecesList->addPiece(pieceImage, QPoint(x, y)); piecesList->addPiece(pieceImage, QPoint(x, y));
} }
} }
@ -137,9 +138,14 @@ void MainWindow::setupWidgets()
{ {
QFrame *frame = new QFrame; QFrame *frame = new QFrame;
QHBoxLayout *frameLayout = new QHBoxLayout(frame); QHBoxLayout *frameLayout = new QHBoxLayout(frame);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
puzzleWidget = new PuzzleWidget(260);
#else
puzzleWidget = new PuzzleWidget(400);
#endif
piecesList = new PiecesList(puzzleWidget->pieceSize(), this);
piecesList = new PiecesList;
puzzleWidget = new PuzzleWidget;
connect(puzzleWidget, SIGNAL(puzzleCompleted()), connect(puzzleWidget, SIGNAL(puzzleCompleted()),
this, SLOT(setCompleted()), Qt::QueuedConnection); this, SLOT(setCompleted()), Qt::QueuedConnection);

View File

@ -42,12 +42,12 @@
#include "pieceslist.h" #include "pieceslist.h"
PiecesList::PiecesList(QWidget *parent) PiecesList::PiecesList(int pieceSize, QWidget *parent)
: QListWidget(parent) : QListWidget(parent), m_PieceSize(pieceSize)
{ {
setDragEnabled(true); setDragEnabled(true);
setViewMode(QListView::IconMode); setViewMode(QListView::IconMode);
setIconSize(QSize(60, 60)); setIconSize(QSize(m_PieceSize, m_PieceSize));
setSpacing(10); setSpacing(10);
setAcceptDrops(true); setAcceptDrops(true);
setDropIndicatorShown(true); setDropIndicatorShown(true);

View File

@ -48,7 +48,7 @@ class PiecesList : public QListWidget
Q_OBJECT Q_OBJECT
public: public:
PiecesList(QWidget *parent = 0); PiecesList(int pieceSize, QWidget *parent = 0);
void addPiece(QPixmap pixmap, QPoint location); void addPiece(QPixmap pixmap, QPoint location);
protected: protected:
@ -56,6 +56,8 @@ protected:
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event); void dropEvent(QDropEvent *event);
void startDrag(Qt::DropActions supportedActions); void startDrag(Qt::DropActions supportedActions);
int m_PieceSize;
}; };
#endif #endif

View File

@ -27,3 +27,4 @@ wince*: {
addFile.path = . addFile.path = .
DEPLOYMENT += addFile DEPLOYMENT += addFile
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -42,12 +42,12 @@
#include "puzzlewidget.h" #include "puzzlewidget.h"
PuzzleWidget::PuzzleWidget(QWidget *parent) PuzzleWidget::PuzzleWidget(int imageSize, QWidget *parent)
: QWidget(parent) : QWidget(parent), m_ImageSize(imageSize)
{ {
setAcceptDrops(true); setAcceptDrops(true);
setMinimumSize(400, 400); setMinimumSize(m_ImageSize, m_ImageSize);
setMaximumSize(400, 400); setMaximumSize(m_ImageSize, m_ImageSize);
} }
void PuzzleWidget::clear() void PuzzleWidget::clear()
@ -116,7 +116,7 @@ void PuzzleWidget::dropEvent(QDropEvent *event)
event->setDropAction(Qt::MoveAction); event->setDropAction(Qt::MoveAction);
event->accept(); event->accept();
if (location == QPoint(square.x()/80, square.y()/80)) { if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize())) {
inPlace++; inPlace++;
if (inPlace == 25) if (inPlace == 25)
emit puzzleCompleted(); emit puzzleCompleted();
@ -151,7 +151,7 @@ void PuzzleWidget::mousePressEvent(QMouseEvent *event)
piecePixmaps.removeAt(found); piecePixmaps.removeAt(found);
pieceRects.removeAt(found); pieceRects.removeAt(found);
if (location == QPoint(square.x()/80, square.y()/80)) if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize()))
inPlace--; inPlace--;
update(square); update(square);
@ -175,7 +175,7 @@ void PuzzleWidget::mousePressEvent(QMouseEvent *event)
pieceRects.insert(found, square); pieceRects.insert(found, square);
update(targetSquare(event->pos())); update(targetSquare(event->pos()));
if (location == QPoint(square.x()/80, square.y()/80)) if (location == QPoint(square.x()/pieceSize(), square.y()/pieceSize()))
inPlace++; inPlace++;
} }
} }
@ -200,5 +200,15 @@ void PuzzleWidget::paintEvent(QPaintEvent *event)
const QRect PuzzleWidget::targetSquare(const QPoint &position) const const QRect PuzzleWidget::targetSquare(const QPoint &position) const
{ {
return QRect(position.x()/80 * 80, position.y()/80 * 80, 80, 80); return QRect(position.x()/pieceSize() * pieceSize(), position.y()/pieceSize() * pieceSize(), pieceSize(), pieceSize());
}
int PuzzleWidget::pieceSize() const
{
return m_ImageSize / 5;
}
int PuzzleWidget::imageSize() const
{
return m_ImageSize;
} }

View File

@ -57,9 +57,12 @@ class PuzzleWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
PuzzleWidget(QWidget *parent = 0); PuzzleWidget(int imageSize, QWidget *parent = 0);
void clear(); void clear();
int pieceSize() const;
int imageSize() const;
signals: signals:
void puzzleCompleted(); void puzzleCompleted();
@ -80,6 +83,7 @@ private:
QList<QPoint> pieceLocations; QList<QPoint> pieceLocations;
QRect highlightedRect; QRect highlightedRect;
int inPlace; int inPlace;
int m_ImageSize;
}; };
#endif #endif

View File

@ -131,8 +131,34 @@ void BlurPicker::keyPressEvent(QKeyEvent *event)
break; break;
} }
if (m_animation.state() == QAbstractAnimation::Stopped && delta) { if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
m_animation.setEndValue(m_index + delta); m_animation.setEndValue(m_index + delta);
m_animation.start(); m_animation.start();
event->accept(); event->accept();
}
}
void BlurPicker::resizeEvent(QResizeEvent */*event*/)
{
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
fitInView(sceneRect(), Qt::KeepAspectRatio);
#endif
}
void BlurPicker::mousePressEvent(QMouseEvent *event)
{
int delta = 0;
if(event->x() > (width() / 2))
{
delta = 1;
}
else
{
delta = -1;
}
if (m_animation.state() == QAbstractAnimation::Stopped && delta) {
m_animation.setEndValue(m_index + delta);
m_animation.start();
event->accept();
} }
} }

View File

@ -60,6 +60,8 @@ public:
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent *event);
void mousePressEvent(QMouseEvent *event);
private: private:
void setupScene(); void setupScene();

View File

@ -7,3 +7,6 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/blurpicker
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/blurpicker sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/blurpicker
INSTALLS += target sources INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -47,8 +47,13 @@ int main(int argc, char **argv)
BlurPicker blurPicker; BlurPicker blurPicker;
blurPicker.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Application Picker")); blurPicker.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Application Picker"));
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
blurPicker.showMaximized();
#else
blurPicker.setFixedSize(400, 300); blurPicker.setFixedSize(400, 300);
blurPicker.show(); blurPicker.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -56,7 +56,6 @@ FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent)
m_animation->setStartValue(0); m_animation->setStartValue(0);
m_animation->setEndValue(1); m_animation->setEndValue(1);
setRenderHint(QPainter::Antialiasing, true); setRenderHint(QPainter::Antialiasing, true);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
} }
@ -75,7 +74,7 @@ void FadeMessage::togglePopup()
void FadeMessage::setupScene() void FadeMessage::setupScene()
{ {
QGraphicsRectItem *parent = m_scene.addRect(0, 0, 400, 600); QGraphicsRectItem *parent = m_scene.addRect(0, 0, 800, 600);
parent->setPen(Qt::NoPen); parent->setPen(Qt::NoPen);
parent->setZValue(0); parent->setZValue(0);
@ -85,7 +84,7 @@ void FadeMessage::setupScene()
for (int i = 1; i < 5; ++i) for (int i = 1; i < 5; ++i)
for (int j = 2; j < 5; ++j) { for (int j = 2; j < 5; ++j) {
QGraphicsRectItem *item = m_scene.addRect(i * 50, j * 50, 38, 38); QGraphicsRectItem *item = m_scene.addRect(i * 50, (j - 1) * 50, 38, 38);
item->setParentItem(parent); item->setParentItem(parent);
item->setZValue(1); item->setZValue(1);
int hue = 12 * (i * 5 + j); int hue = 12 * (i * 5 + j);
@ -124,6 +123,10 @@ void FadeMessage::setupScene()
press->setText(tr("Press me")); press->setText(tr("Press me"));
connect(press, SIGNAL(clicked()), SLOT(togglePopup())); connect(press, SIGNAL(clicked()), SLOT(togglePopup()));
m_scene.addWidget(press); m_scene.addWidget(press);
press->move(300, 500);
}
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
press->move(200, 210);
#else
press->move(300, 500);
#endif
}

View File

@ -12,5 +12,7 @@ sources.files = $$SOURCES \
fademessage.pro fademessage.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/fademessage sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/fademessage
DEPLOYMENT_PLUGIN += qjpeg symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -48,8 +48,12 @@ int main(int argc, char **argv)
FadeMessage widget; FadeMessage widget;
widget.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Popup Message with Effect")); widget.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Popup Message with Effect"));
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
widget.showMaximized();
#else
widget.setFixedSize(400, 600); widget.setFixedSize(400, 600);
widget.show(); widget.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -134,3 +134,9 @@ void Lighting::animate()
m_scene.update(); m_scene.update();
} }
void Lighting::resizeEvent(QResizeEvent */*event*/)
{
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
fitInView(sceneRect(), Qt::KeepAspectRatio);
#endif
}

View File

@ -57,6 +57,9 @@ private slots:
private: private:
void setupScene(); void setupScene();
protected:
void resizeEvent(QResizeEvent *event);
private: private:
qreal angle; qreal angle;
QGraphicsScene m_scene; QGraphicsScene m_scene;

View File

@ -6,3 +6,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/lighting
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/lighting sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/lighting
INSTALLS += target sources INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)

View File

@ -47,8 +47,13 @@ int main(int argc, char **argv)
Lighting lighting; Lighting lighting;
lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows")); lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows"));
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
lighting.showMaximized();
#else
lighting.resize(640, 480); lighting.resize(640, 480);
lighting.show(); lighting.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -62,3 +62,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]
INSTALLS += sources INSTALLS += sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example

View File

@ -19,3 +19,7 @@ symbian {
TARGET.UID3 = 0xA000D7D0 TARGET.UID3 = 0xA000D7D0
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
symbian: warning(This example does not work on Symbian platform)
maemo5: warning(This example does not work on Maemo platform)
simulator: warning(This example does not work on Simulator platform)

View File

@ -7,3 +7,8 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/anchorlayout
INSTALLS += target sources INSTALLS += target sources
TARGET = anchorlayout TARGET = anchorlayout
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -122,7 +122,12 @@ int main(int argc, char **argv)
scene.addItem(w); scene.addItem(w);
scene.setBackgroundBrush(Qt::darkGreen); scene.setBackgroundBrush(Qt::darkGreen);
QGraphicsView view(&scene); QGraphicsView view(&scene);
#if defined(Q_WS_S60)
view.showMaximized();
#else
view.show(); view.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -15,3 +15,5 @@ symbian {
TARGET.UID3 = 0xA000A645 TARGET.UID3 = 0xA000A645
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -51,8 +51,12 @@ int main(int argc, char **argv)
Window *window = new Window; Window *window = new Window;
scene.addItem(window); scene.addItem(window);
QGraphicsView view(&scene); QGraphicsView view(&scene);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
view.showMaximized();
#else
view.resize(600, 600); view.resize(600, 600);
view.show(); view.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -17,3 +17,5 @@ symbian {
TARGET.UID3 = 0xA000A643 TARGET.UID3 = 0xA000A643
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -79,8 +79,12 @@ int main(int argc, char **argv)
view.setDragMode(QGraphicsView::ScrollHandDrag); view.setDragMode(QGraphicsView::ScrollHandDrag);
//! [5] //! [6] //! [5] //! [6]
view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice")); view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice"));
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
view.showMaximized();
#else
view.resize(400, 300); view.resize(400, 300);
view.show(); view.show();
#endif
QTimer timer; QTimer timer;
QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance())); QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance()));

View File

@ -19,4 +19,8 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/diagramscene
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
symbian: warning(This example might not fully work on Symbian platform)
maemo5: warning(This example might not fully work on Maemo platform)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -18,3 +18,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/dragdroprobot
INSTALLS += target sources INSTALLS += target sources
symbian: CONFIG += qt_example symbian: CONFIG += qt_example
maemo5: CONFIG += qt_example
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -45,6 +45,22 @@
#include <math.h> #include <math.h>
class GraphicsView : public QGraphicsView
{
public:
GraphicsView(QGraphicsScene *scene) : QGraphicsView(scene)
{
}
protected:
virtual void resizeEvent(QResizeEvent *event)
{
#if defined(Q_OS_SYMBIAN)
fitInView(sceneRect(), Qt::KeepAspectRatio);
#endif
}
};
//! [0] //! [0]
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@ -69,12 +85,16 @@ int main(int argc, char **argv)
scene.addItem(robot); scene.addItem(robot);
//! [1] //! [1]
//! [2] //! [2]
QGraphicsView view(&scene); GraphicsView view(&scene);
view.setRenderHint(QPainter::Antialiasing); view.setRenderHint(QPainter::Antialiasing);
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
view.setBackgroundBrush(QColor(230, 200, 167)); view.setBackgroundBrush(QColor(230, 200, 167));
view.setWindowTitle("Drag and Drop Robot"); view.setWindowTitle("Drag and Drop Robot");
view.show(); #if defined(Q_OS_SYMBIAN)
view.showMaximized();
#else
view.show();
#endif
return app.exec(); return app.exec();
} }

View File

@ -144,6 +144,6 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
painter->setBrush(Qt::black); painter->setBrush(Qt::black);
painter->drawPolygon(QPolygonF() << line.p1() << sourceArrowP1 << sourceArrowP2); painter->drawPolygon(QPolygonF() << line.p1() << sourceArrowP1 << sourceArrowP2);
painter->drawPolygon(QPolygonF() << line.p2() << destArrowP1 << destArrowP2); painter->drawPolygon(QPolygonF() << line.p2() << destArrowP1 << destArrowP2);
} }
//! [6] //! [6]

View File

@ -21,3 +21,6 @@ symbian {
TARGET.UID3 = 0xA000A642 TARGET.UID3 = 0xA000A642
CONFIG += qt_example CONFIG += qt_example
} }
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
simulator: warning(This example might not fully work on Simulator platform)

View File

@ -132,17 +132,14 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
centerNode->moveBy(20, 0); centerNode->moveBy(20, 0);
break; break;
case Qt::Key_Plus: case Qt::Key_Plus:
scaleView(qreal(1.2)); zoomIn();
break; break;
case Qt::Key_Minus: case Qt::Key_Minus:
scaleView(1 / qreal(1.2)); zoomOut();
break; break;
case Qt::Key_Space: case Qt::Key_Space:
case Qt::Key_Enter: case Qt::Key_Enter:
foreach (QGraphicsItem *item, scene()->items()) { shuffle();
if (qgraphicsitem_cast<Node *>(item))
item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
}
break; break;
default: default:
QGraphicsView::keyPressEvent(event); QGraphicsView::keyPressEvent(event);
@ -206,6 +203,7 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
painter->drawRect(sceneRect); painter->drawRect(sceneRect);
#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
// Text // Text
QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4, QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
sceneRect.width() - 4, sceneRect.height() - 4); sceneRect.width() - 4, sceneRect.height() - 4);
@ -220,6 +218,7 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
painter->drawText(textRect.translated(2, 2), message); painter->drawText(textRect.translated(2, 2), message);
painter->setPen(Qt::black); painter->setPen(Qt::black);
painter->drawText(textRect, message); painter->drawText(textRect, message);
#endif
} }
//! [6] //! [6]
@ -233,3 +232,21 @@ void GraphWidget::scaleView(qreal scaleFactor)
scale(scaleFactor, scaleFactor); scale(scaleFactor, scaleFactor);
} }
//! [7] //! [7]
void GraphWidget::shuffle()
{
foreach (QGraphicsItem *item, scene()->items()) {
if (qgraphicsitem_cast<Node *>(item))
item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
}
}
void GraphWidget::zoomIn()
{
scaleView(qreal(1.2));
}
void GraphWidget::zoomOut()
{
scaleView(1 / qreal(1.2));
}

Some files were not shown because too many files have changed in this diff Show More