summaryrefslogtreecommitdiffstats
path: root/examples/painting
diff options
context:
space:
mode:
Diffstat (limited to 'examples/painting')
-rw-r--r--examples/painting/basicdrawing/basicdrawing.pro3
-rw-r--r--examples/painting/basicdrawing/main.cpp4
-rw-r--r--examples/painting/basicdrawing/window.cpp43
-rw-r--r--examples/painting/concentriccircles/concentriccircles.pro2
-rw-r--r--examples/painting/concentriccircles/main.cpp4
-rw-r--r--examples/painting/fontsampler/fontsampler.pro1
-rw-r--r--examples/painting/fontsampler/main.cpp4
-rw-r--r--examples/painting/fontsampler/mainwindow.cpp56
-rw-r--r--examples/painting/fontsampler/mainwindow.h4
-rw-r--r--examples/painting/fontsampler/mainwindowbase.ui126
-rw-r--r--examples/painting/imagecomposition/imagecomposer.cpp10
-rw-r--r--examples/painting/imagecomposition/imagecomposition.pro2
-rw-r--r--examples/painting/imagecomposition/main.cpp4
-rw-r--r--examples/painting/painterpaths/main.cpp4
-rw-r--r--examples/painting/painterpaths/painterpaths.pro2
-rw-r--r--examples/painting/painterpaths/window.cpp53
-rw-r--r--examples/painting/painterpaths/window.h4
-rw-r--r--examples/painting/painting.pro6
-rw-r--r--examples/painting/transformations/main.cpp4
-rw-r--r--examples/painting/transformations/transformations.pro5
20 files changed, 210 insertions, 131 deletions
diff --git a/examples/painting/basicdrawing/basicdrawing.pro b/examples/painting/basicdrawing/basicdrawing.pro
index e607721ffb..41642e8f35 100644
--- a/examples/painting/basicdrawing/basicdrawing.pro
+++ b/examples/painting/basicdrawing/basicdrawing.pro
@@ -15,3 +15,6 @@ symbian {
TARGET.UID3 = 0xA000A649
CONFIG += qt_example
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
+simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/painting/basicdrawing/main.cpp b/examples/painting/basicdrawing/main.cpp
index 6662742166..aa839f68cc 100644
--- a/examples/painting/basicdrawing/main.cpp
+++ b/examples/painting/basicdrawing/main.cpp
@@ -48,6 +48,10 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
Window window;
+#if defined(Q_OS_SYMBIAN)
+ window.showMaximized();
+#else
window.show();
+#endif
return app.exec();
}
diff --git a/examples/painting/basicdrawing/window.cpp b/examples/painting/basicdrawing/window.cpp
index 54422a0104..072c3e08aa 100644
--- a/examples/painting/basicdrawing/window.cpp
+++ b/examples/painting/basicdrawing/window.cpp
@@ -74,7 +74,11 @@ Window::Window()
//! [2]
penWidthSpinBox = new QSpinBox;
penWidthSpinBox->setRange(0, 20);
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+ penWidthSpinBox->setSpecialValueText(tr("0"));
+#else
penWidthSpinBox->setSpecialValueText(tr("0 (cosmetic pen)"));
+#endif
penWidthLabel = new QLabel(tr("Pen &Width:"));
penWidthLabel->setBuddy(penWidthSpinBox);
@@ -134,12 +138,12 @@ Window::Window()
brushStyleComboBox->addItem(tr("Dense 7"), Qt::Dense7Pattern);
brushStyleComboBox->addItem(tr("None"), Qt::NoBrush);
- brushStyleLabel = new QLabel(tr("&Brush Style:"));
+ brushStyleLabel = new QLabel(tr("&Brush:"));
brushStyleLabel->setBuddy(brushStyleComboBox);
//! [4]
//! [5]
- otherOptionsLabel = new QLabel(tr("Other Options:"));
+ otherOptionsLabel = new QLabel(tr("Options:"));
//! [5] //! [6]
antialiasingCheckBox = new QCheckBox(tr("&Antialiasing"));
//! [6] //! [7]
@@ -168,26 +172,27 @@ Window::Window()
//! [9]
QGridLayout *mainLayout = new QGridLayout;
//! [9] //! [10]
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+ mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
+#endif
mainLayout->setColumnStretch(0, 1);
mainLayout->setColumnStretch(3, 1);
mainLayout->addWidget(renderArea, 0, 0, 1, 4);
- mainLayout->setRowMinimumHeight(1, 6);
- mainLayout->addWidget(shapeLabel, 2, 1, Qt::AlignRight);
- mainLayout->addWidget(shapeComboBox, 2, 2);
- mainLayout->addWidget(penWidthLabel, 3, 1, Qt::AlignRight);
- mainLayout->addWidget(penWidthSpinBox, 3, 2);
- mainLayout->addWidget(penStyleLabel, 4, 1, Qt::AlignRight);
- mainLayout->addWidget(penStyleComboBox, 4, 2);
- mainLayout->addWidget(penCapLabel, 5, 1, Qt::AlignRight);
- mainLayout->addWidget(penCapComboBox, 5, 2);
- mainLayout->addWidget(penJoinLabel, 6, 1, Qt::AlignRight);
- mainLayout->addWidget(penJoinComboBox, 6, 2);
- mainLayout->addWidget(brushStyleLabel, 7, 1, Qt::AlignRight);
- mainLayout->addWidget(brushStyleComboBox, 7, 2);
- mainLayout->setRowMinimumHeight(8, 6);
- mainLayout->addWidget(otherOptionsLabel, 9, 1, Qt::AlignRight);
- mainLayout->addWidget(antialiasingCheckBox, 9, 2);
- mainLayout->addWidget(transformationsCheckBox, 10, 2);
+ mainLayout->addWidget(shapeLabel, 2, 0, Qt::AlignRight);
+ mainLayout->addWidget(shapeComboBox, 2, 1);
+ mainLayout->addWidget(penWidthLabel, 3, 0, Qt::AlignRight);
+ mainLayout->addWidget(penWidthSpinBox, 3, 1);
+ mainLayout->addWidget(penStyleLabel, 4, 0, Qt::AlignRight);
+ mainLayout->addWidget(penStyleComboBox, 4, 1);
+ mainLayout->addWidget(penCapLabel, 3, 2, Qt::AlignRight);
+ mainLayout->addWidget(penCapComboBox, 3, 3);
+ mainLayout->addWidget(penJoinLabel, 2, 2, Qt::AlignRight);
+ mainLayout->addWidget(penJoinComboBox, 2, 3);
+ mainLayout->addWidget(brushStyleLabel, 4, 2, Qt::AlignRight);
+ mainLayout->addWidget(brushStyleComboBox, 4, 3);
+ mainLayout->addWidget(otherOptionsLabel, 5, 0, Qt::AlignRight);
+ mainLayout->addWidget(antialiasingCheckBox, 5, 1, 1, 1, Qt::AlignRight);
+ mainLayout->addWidget(transformationsCheckBox, 5, 2, 1, 2, Qt::AlignRight);
setLayout(mainLayout);
shapeChanged();
diff --git a/examples/painting/concentriccircles/concentriccircles.pro b/examples/painting/concentriccircles/concentriccircles.pro
index f7e050ba21..731edc61ae 100644
--- a/examples/painting/concentriccircles/concentriccircles.pro
+++ b/examples/painting/concentriccircles/concentriccircles.pro
@@ -14,3 +14,5 @@ symbian {
TARGET.UID3 = 0xA000A64A
CONFIG += qt_example
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/painting/concentriccircles/main.cpp b/examples/painting/concentriccircles/main.cpp
index f2079f511b..4a43828d45 100644
--- a/examples/painting/concentriccircles/main.cpp
+++ b/examples/painting/concentriccircles/main.cpp
@@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
+#if defined(Q_OS_SYMBIAN)
+ window.showMaximized();
+#else
window.show();
+#endif
return app.exec();
}
diff --git a/examples/painting/fontsampler/fontsampler.pro b/examples/painting/fontsampler/fontsampler.pro
index b9328a6439..6d93d913e8 100644
--- a/examples/painting/fontsampler/fontsampler.pro
+++ b/examples/painting/fontsampler/fontsampler.pro
@@ -10,3 +10,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/fontsampler
INSTALLS += target sources
symbian: CONFIG += qt_example
+maemo5: CONFIG += qt_example
diff --git a/examples/painting/fontsampler/main.cpp b/examples/painting/fontsampler/main.cpp
index 01c8adae53..dffe80348a 100644
--- a/examples/painting/fontsampler/main.cpp
+++ b/examples/painting/fontsampler/main.cpp
@@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
+#if defined(Q_OS_SYMBIAN)
+ window.showMaximized();
+#else
window.show();
+#endif
return app.exec();
}
diff --git a/examples/painting/fontsampler/mainwindow.cpp b/examples/painting/fontsampler/mainwindow.cpp
index 0976d1f971..96698437b1 100644
--- a/examples/painting/fontsampler/mainwindow.cpp
+++ b/examples/painting/fontsampler/mainwindow.cpp
@@ -47,6 +47,10 @@ MainWindow::MainWindow(QWidget *parent)
{
setupUi(this);
+#if defined(Q_OS_SYMBIAN)
+ addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
+#endif
+
sampleSizes << 32 << 24 << 16 << 14 << 12 << 8 << 4 << 2 << 1;
markedCount = 0;
setupFontTree();
@@ -140,7 +144,11 @@ void MainWindow::showFont(QTreeWidgetItem *item)
QString oldText = textEdit->toPlainText().trimmed();
bool modified = textEdit->document()->isModified();
textEdit->clear();
+#if defined(Q_OS_SYMBIAN)
+ textEdit->document()->setDefaultFont(QFont(family, 10, weight, italic));
+#else
textEdit->document()->setDefaultFont(QFont(family, 32, weight, italic));
+#endif
QTextCursor cursor = textEdit->textCursor();
QTextBlockFormat blockFormat;
@@ -217,6 +225,30 @@ void MainWindow::updateStyles(QTreeWidgetItem *item, int column)
printPreviewAction->setEnabled(markedCount > 0);
}
+QMap<QString, StyleItems> MainWindow::currentPageMap()
+{
+ QMap<QString, StyleItems> pageMap;
+
+ for (int row = 0; row < fontTree->topLevelItemCount(); ++row) {
+ QTreeWidgetItem *familyItem = fontTree->topLevelItem(row);
+ QString family;
+
+ if (familyItem->checkState(0) == Qt::Checked) {
+ family = familyItem->text(0);
+ pageMap[family] = StyleItems();
+ }
+
+ for (int childRow = 0; childRow < familyItem->childCount(); ++childRow) {
+ QTreeWidgetItem *styleItem = familyItem->child(childRow);
+ if (styleItem->checkState(0) == Qt::Checked)
+ pageMap[family].append(styleItem);
+ }
+ }
+
+ return pageMap;
+}
+
+#ifndef QT_NO_PRINTER
void MainWindow::on_printAction_triggered()
{
pageMap = currentPageMap();
@@ -283,29 +315,6 @@ void MainWindow::on_printPreviewAction_triggered()
preview.exec();
}
-QMap<QString, StyleItems> MainWindow::currentPageMap()
-{
- QMap<QString, StyleItems> pageMap;
-
- for (int row = 0; row < fontTree->topLevelItemCount(); ++row) {
- QTreeWidgetItem *familyItem = fontTree->topLevelItem(row);
- QString family;
-
- if (familyItem->checkState(0) == Qt::Checked) {
- family = familyItem->text(0);
- pageMap[family] = StyleItems();
- }
-
- for (int childRow = 0; childRow < familyItem->childCount(); ++childRow) {
- QTreeWidgetItem *styleItem = familyItem->child(childRow);
- if (styleItem->checkState(0) == Qt::Checked)
- pageMap[family].append(styleItem);
- }
- }
-
- return pageMap;
-}
-
void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
{
QString family = pageMap.keys()[index];
@@ -370,3 +379,4 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
painter->restore();
}
+#endif
diff --git a/examples/painting/fontsampler/mainwindow.h b/examples/painting/fontsampler/mainwindow.h
index 7ea4cd5ed0..4021ee7c6c 100644
--- a/examples/painting/fontsampler/mainwindow.h
+++ b/examples/painting/fontsampler/mainwindow.h
@@ -61,11 +61,15 @@ public:
public slots:
void on_clearAction_triggered();
void on_markAction_triggered();
+#ifndef QT_NO_PRINTER
void on_printAction_triggered();
void on_printPreviewAction_triggered();
+#endif
void on_unmarkAction_triggered();
+#ifndef QT_NO_PRINTER
void printDocument(QPrinter *printer);
void printPage(int index, QPainter *painter, QPrinter *printer);
+#endif
void showFont(QTreeWidgetItem *item);
void updateStyles(QTreeWidgetItem *item, int column);
diff --git a/examples/painting/fontsampler/mainwindowbase.ui b/examples/painting/fontsampler/mainwindowbase.ui
index 6545b34083..1a95ebd6d1 100644
--- a/examples/painting/fontsampler/mainwindowbase.ui
+++ b/examples/painting/fontsampler/mainwindowbase.ui
@@ -1,10 +1,8 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>MainWindowBase</class>
- <widget class="QMainWindow" name="MainWindowBase" >
- <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindowBase">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -12,129 +10,133 @@
<height>345</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Font Sampler</string>
</property>
- <widget class="QWidget" name="centralwidget" >
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>9</number>
+ </property>
<item>
- <widget class="QTextEdit" name="textEdit" />
+ <widget class="QTextEdit" name="textEdit"/>
</item>
</layout>
</widget>
- <widget class="QMenuBar" name="menubar" >
- <property name="geometry" >
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
- <height>24</height>
+ <height>18</height>
</rect>
</property>
- <widget class="QMenu" name="menu_Selection" >
- <property name="title" >
+ <widget class="QMenu" name="menu_Selection">
+ <property name="title">
<string>&amp;Selection</string>
</property>
- <addaction name="markAction" />
- <addaction name="unmarkAction" />
- <addaction name="clearAction" />
+ <addaction name="markAction"/>
+ <addaction name="unmarkAction"/>
+ <addaction name="clearAction"/>
</widget>
- <widget class="QMenu" name="menu_File" >
- <property name="title" >
+ <widget class="QMenu" name="menu_File">
+ <property name="title">
<string>&amp;File</string>
</property>
- <addaction name="printPreviewAction" />
- <addaction name="printAction" />
- <addaction name="quitAction" />
+ <addaction name="printPreviewAction"/>
+ <addaction name="printAction"/>
+ <addaction name="quitAction"/>
</widget>
- <addaction name="menu_File" />
- <addaction name="menu_Selection" />
+ <addaction name="menu_File"/>
+ <addaction name="menu_Selection"/>
</widget>
- <widget class="QStatusBar" name="statusbar" />
- <widget class="QDockWidget" name="dockWidget" >
- <property name="features" >
- <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures</set>
+ <widget class="QStatusBar" name="statusbar"/>
+ <widget class="QDockWidget" name="dockWidget">
+ <property name="features">
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Available Fonts</string>
</property>
- <attribute name="dockWidgetArea" >
+ <attribute name="dockWidgetArea">
<number>1</number>
</attribute>
- <widget class="QWidget" name="dockWidgetContents" >
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
+ <widget class="QWidget" name="dockWidgetContents">
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>9</number>
+ </property>
<item>
- <widget class="QTreeWidget" name="fontTree" >
- <property name="selectionMode" >
+ <widget class="QTreeWidget" name="fontTree">
+ <property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
</widget>
</item>
</layout>
</widget>
</widget>
- <action name="printAction" >
- <property name="enabled" >
+ <action name="printAction">
+ <property name="enabled">
<bool>false</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>&amp;Print...</string>
</property>
- <property name="shortcut" >
+ <property name="shortcut">
<string>Ctrl+P</string>
</property>
</action>
- <action name="quitAction" >
- <property name="text" >
+ <action name="quitAction">
+ <property name="text">
<string>E&amp;xit</string>
</property>
- <property name="shortcut" >
+ <property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
- <action name="markAction" >
- <property name="text" >
+ <action name="markAction">
+ <property name="text">
<string>&amp;Mark</string>
</property>
- <property name="shortcut" >
+ <property name="shortcut">
<string>Ctrl+M</string>
</property>
</action>
- <action name="unmarkAction" >
- <property name="text" >
+ <action name="unmarkAction">
+ <property name="text">
<string>&amp;Unmark</string>
</property>
- <property name="shortcut" >
+ <property name="shortcut">
<string>Ctrl+U</string>
</property>
</action>
- <action name="clearAction" >
- <property name="text" >
+ <action name="clearAction">
+ <property name="text">
<string>&amp;Clear</string>
</property>
</action>
- <action name="printPreviewAction" >
- <property name="enabled" >
+ <action name="printPreviewAction">
+ <property name="enabled">
<bool>false</bool>
</property>
- <property name="text" >
+ <property name="text">
<string>Print Preview...</string>
</property>
</action>
</widget>
- <pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
diff --git a/examples/painting/imagecomposition/imagecomposer.cpp b/examples/painting/imagecomposition/imagecomposer.cpp
index a41f405fd0..9488204e30 100644
--- a/examples/painting/imagecomposition/imagecomposer.cpp
+++ b/examples/painting/imagecomposition/imagecomposer.cpp
@@ -43,7 +43,11 @@
#include "imagecomposer.h"
//! [0]
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
+static const QSize resultSize(50, 50);
+#else
static const QSize resultSize(200, 200);
+#endif
//! [0]
//! [1]
@@ -104,7 +108,10 @@ ImageComposer::ImageComposer()
mainLayout->addWidget(destinationButton, 0, 2, 3, 1);
mainLayout->addWidget(equalLabel, 1, 3);
mainLayout->addWidget(resultLabel, 0, 4, 3, 1);
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+#else
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
+#endif
setLayout(mainLayout);
//! [4]
@@ -176,6 +183,9 @@ void ImageComposer::loadImage(const QString &fileName, QImage *image,
{
image->load(fileName);
+ // Scale the image to given size
+ *image = image->scaled(resultSize, Qt::KeepAspectRatio);
+
QImage fixedImage(resultSize, QImage::Format_ARGB32_Premultiplied);
QPainter painter(&fixedImage);
painter.setCompositionMode(QPainter::CompositionMode_Source);
diff --git a/examples/painting/imagecomposition/imagecomposition.pro b/examples/painting/imagecomposition/imagecomposition.pro
index e8be8fa2b5..a763108306 100644
--- a/examples/painting/imagecomposition/imagecomposition.pro
+++ b/examples/painting/imagecomposition/imagecomposition.pro
@@ -13,3 +13,5 @@ symbian {
TARGET.UID3 = 0xA000A64B
CONFIG += qt_example
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/painting/imagecomposition/main.cpp b/examples/painting/imagecomposition/main.cpp
index e70fa5fae9..f97a3ff7ef 100644
--- a/examples/painting/imagecomposition/main.cpp
+++ b/examples/painting/imagecomposition/main.cpp
@@ -49,7 +49,11 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
ImageComposer composer;
+#if defined(Q_OS_SYMBIAN)
+ composer.showMaximized();
+#else
composer.show();
+#endif
return app.exec();
}
//! [0]
diff --git a/examples/painting/painterpaths/main.cpp b/examples/painting/painterpaths/main.cpp
index f2079f511b..4a43828d45 100644
--- a/examples/painting/painterpaths/main.cpp
+++ b/examples/painting/painterpaths/main.cpp
@@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
+#if defined(Q_OS_SYMBIAN)
+ window.showMaximized();
+#else
window.show();
+#endif
return app.exec();
}
diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro
index 84bbecaa83..2a7d224716 100644
--- a/examples/painting/painterpaths/painterpaths.pro
+++ b/examples/painting/painterpaths/painterpaths.pro
@@ -15,3 +15,5 @@ symbian {
TARGET.UID3 = 0xA000A64C
CONFIG += qt_example
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/painting/painterpaths/window.cpp b/examples/painting/painterpaths/window.cpp
index 429f470b26..0a4c1b0ca3 100644
--- a/examples/painting/painterpaths/window.cpp
+++ b/examples/painting/painterpaths/window.cpp
@@ -130,16 +130,17 @@ Window::Window()
//! [9]
//! [10]
- renderAreas[0] = new RenderArea(rectPath);
- renderAreas[1] = new RenderArea(roundRectPath);
- renderAreas[2] = new RenderArea(ellipsePath);
- renderAreas[3] = new RenderArea(piePath);
- renderAreas[4] = new RenderArea(polygonPath);
- renderAreas[5] = new RenderArea(groupPath);
- renderAreas[6] = new RenderArea(textPath);
- renderAreas[7] = new RenderArea(bezierPath);
- renderAreas[8] = new RenderArea(starPath);
- Q_ASSERT(NumRenderAreas == 9);
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
+ renderAreas.push_back(new RenderArea(rectPath));
+ renderAreas.push_back(new RenderArea(roundRectPath));
+ renderAreas.push_back(new RenderArea(ellipsePath));
+ renderAreas.push_back(new RenderArea(piePath));
+ renderAreas.push_back(new RenderArea(polygonPath));
+ renderAreas.push_back(new RenderArea(groupPath));
+#endif
+ renderAreas.push_back(new RenderArea(textPath));
+ renderAreas.push_back(new RenderArea(bezierPath));
+ renderAreas.push_back(new RenderArea(starPath));
//! [10]
//! [11]
@@ -201,19 +202,27 @@ Window::Window()
connect(penColorComboBox, SIGNAL(activated(int)),
this, SLOT(penColorChanged()));
- for (int i = 0; i < NumRenderAreas; ++i) {
+ for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) {
connect(penWidthSpinBox, SIGNAL(valueChanged(int)),
- renderAreas[i], SLOT(setPenWidth(int)));
+ *it, SLOT(setPenWidth(int)));
connect(rotationAngleSpinBox, SIGNAL(valueChanged(int)),
- renderAreas[i], SLOT(setRotationAngle(int)));
+ *it, SLOT(setRotationAngle(int)));
}
//! [16] //! [17]
QGridLayout *topLayout = new QGridLayout;
- for (int i = 0; i < NumRenderAreas; ++i)
- topLayout->addWidget(renderAreas[i], i / 3, i % 3);
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+ topLayout->setSizeConstraint(QLayout::SetNoConstraint);
+#endif
+
+ int i=0;
+ for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++, i++)
+ topLayout->addWidget(*it, i / 3, i % 3);
QGridLayout *mainLayout = new QGridLayout;
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
+ mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
+#endif
mainLayout->addLayout(topLayout, 0, 0, 1, 4);
mainLayout->addWidget(fillRuleLabel, 1, 0);
mainLayout->addWidget(fillRuleComboBox, 1, 1, 1, 3);
@@ -225,8 +234,10 @@ Window::Window()
mainLayout->addWidget(penWidthSpinBox, 3, 1, 1, 3);
mainLayout->addWidget(penColorLabel, 4, 0);
mainLayout->addWidget(penColorComboBox, 4, 1, 1, 3);
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
mainLayout->addWidget(rotationAngleLabel, 5, 0);
mainLayout->addWidget(rotationAngleSpinBox, 5, 1, 1, 3);
+#endif
setLayout(mainLayout);
//! [17]
@@ -245,8 +256,8 @@ void Window::fillRuleChanged()
{
Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt();
- for (int i = 0; i < NumRenderAreas; ++i)
- renderAreas[i]->setFillRule(rule);
+ for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++)
+ (*it)->setFillRule(rule);
}
//! [19]
@@ -256,8 +267,8 @@ void Window::fillGradientChanged()
QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox));
QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox));
- for (int i = 0; i < NumRenderAreas; ++i)
- renderAreas[i]->setFillGradient(color1, color2);
+ for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++)
+ (*it)->setFillGradient(color1, color2);
}
//! [20]
@@ -266,8 +277,8 @@ void Window::penColorChanged()
{
QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox));
- for (int i = 0; i < NumRenderAreas; ++i)
- renderAreas[i]->setPenColor(color);
+ for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++)
+ (*it)->setPenColor(color);
}
//! [21]
diff --git a/examples/painting/painterpaths/window.h b/examples/painting/painterpaths/window.h
index 4891fdd153..b95cd93851 100644
--- a/examples/painting/painterpaths/window.h
+++ b/examples/painting/painterpaths/window.h
@@ -71,9 +71,7 @@ private:
//! [1]
//! [2]
- enum { NumRenderAreas = 9 };
-
- RenderArea *renderAreas[NumRenderAreas];
+ QList<RenderArea*> renderAreas;
QLabel *fillRuleLabel;
QLabel *fillGradientLabel;
QLabel *fillToLabel;
diff --git a/examples/painting/painting.pro b/examples/painting/painting.pro
index 4108a64edd..41f91822c4 100644
--- a/examples/painting/painting.pro
+++ b/examples/painting/painting.pro
@@ -3,9 +3,8 @@ SUBDIRS = basicdrawing \
concentriccircles \
imagecomposition \
painterpaths \
- transformations
-
-!wince*:!symbian: SUBDIRS += fontsampler
+ transformations \
+ fontsampler
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting
@@ -14,3 +13,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting
INSTALLS += target sources
symbian: CONFIG += qt_example
+maemo5: CONFIG += qt_example
diff --git a/examples/painting/transformations/main.cpp b/examples/painting/transformations/main.cpp
index f2079f511b..4a43828d45 100644
--- a/examples/painting/transformations/main.cpp
+++ b/examples/painting/transformations/main.cpp
@@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
+#if defined(Q_OS_SYMBIAN)
+ window.showMaximized();
+#else
window.show();
+#endif
return app.exec();
}
diff --git a/examples/painting/transformations/transformations.pro b/examples/painting/transformations/transformations.pro
index 8fe8be932e..0107046374 100644
--- a/examples/painting/transformations/transformations.pro
+++ b/examples/painting/transformations/transformations.pro
@@ -14,3 +14,8 @@ symbian {
TARGET.UID3 = 0xA000A64D
CONFIG += qt_example
}
+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)