diff options
author | David Boddie <david.boddie@nokia.com> | 2011-04-28 17:39:11 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-04-28 17:39:11 (GMT) |
commit | 3abaecc3aec4e46f1c5969c33875fd45aa542385 (patch) | |
tree | 58613c5d2b765018c31d0b189e9c5a34d8adde69 /examples/painting | |
parent | ddb22795641253a026b72f752ebc769745dd41be (diff) | |
download | Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.zip Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.gz Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.bz2 |
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
Diffstat (limited to 'examples/painting')
33 files changed, 314 insertions, 132 deletions
diff --git a/examples/painting/basicdrawing/basicdrawing.desktop b/examples/painting/basicdrawing/basicdrawing.desktop new file mode 100644 index 0000000..7f178ec --- /dev/null +++ b/examples/painting/basicdrawing/basicdrawing.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Basic Drawing +Exec=/opt/usr/bin/basicdrawing +Icon=basicdrawing +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/basicdrawing/basicdrawing.pro b/examples/painting/basicdrawing/basicdrawing.pro index 4fa0e71..2f1b895 100644 --- a/examples/painting/basicdrawing/basicdrawing.pro +++ b/examples/painting/basicdrawing/basicdrawing.pro @@ -15,3 +15,6 @@ symbian { TARGET.UID3 = 0xA000A649 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) diff --git a/examples/painting/basicdrawing/main.cpp b/examples/painting/basicdrawing/main.cpp index 6662742..aa839f6 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 54422a0..072c3e0 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.desktop b/examples/painting/concentriccircles/concentriccircles.desktop new file mode 100644 index 0000000..7007f19 --- /dev/null +++ b/examples/painting/concentriccircles/concentriccircles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Concentric Circles +Exec=/opt/usr/bin/concentriccircles +Icon=concentriccircles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/concentriccircles/concentriccircles.pro b/examples/painting/concentriccircles/concentriccircles.pro index 0ef4337..6a7cc00 100644 --- a/examples/painting/concentriccircles/concentriccircles.pro +++ b/examples/painting/concentriccircles/concentriccircles.pro @@ -14,3 +14,5 @@ symbian { TARGET.UID3 = 0xA000A64A include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/concentriccircles/main.cpp b/examples/painting/concentriccircles/main.cpp index f2079f5..4a43828 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.desktop b/examples/painting/fontsampler/fontsampler.desktop new file mode 100644 index 0000000..8582891 --- /dev/null +++ b/examples/painting/fontsampler/fontsampler.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Font Sampler +Exec=/opt/usr/bin/fontsampler +Icon=fontsampler +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/fontsampler/fontsampler.pro b/examples/painting/fontsampler/fontsampler.pro index 1bb2f1d..86b9c67 100644 --- a/examples/painting/fontsampler/fontsampler.pro +++ b/examples/painting/fontsampler/fontsampler.pro @@ -10,3 +10,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/painting/fontsampler INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/fontsampler/main.cpp b/examples/painting/fontsampler/main.cpp index 01c8ada..dffe803 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 0976d1f..9669843 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 7ea4cd5..4021ee7 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 6545b34..1a95ebd 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>&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>&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>&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&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>&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>&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>&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 a41f405..9488204 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.desktop b/examples/painting/imagecomposition/imagecomposition.desktop new file mode 100644 index 0000000..854fc86 --- /dev/null +++ b/examples/painting/imagecomposition/imagecomposition.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Image Composition +Exec=/opt/usr/bin/imagecomposition +Icon=imagecomposition +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/imagecomposition/imagecomposition.pro b/examples/painting/imagecomposition/imagecomposition.pro index e9e8725..089358a 100644 --- a/examples/painting/imagecomposition/imagecomposition.pro +++ b/examples/painting/imagecomposition/imagecomposition.pro @@ -13,3 +13,5 @@ symbian { TARGET.UID3 = 0xA000A64B include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/imagecomposition/main.cpp b/examples/painting/imagecomposition/main.cpp index e70fa5f..f97a3ff 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 f2079f5..4a43828 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.desktop b/examples/painting/painterpaths/painterpaths.desktop new file mode 100644 index 0000000..ae92f2c --- /dev/null +++ b/examples/painting/painterpaths/painterpaths.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Painter Paths +Exec=/opt/usr/bin/painterpaths +Icon=painterpaths +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro index d096fa6..2c849cd 100644 --- a/examples/painting/painterpaths/painterpaths.pro +++ b/examples/painting/painterpaths/painterpaths.pro @@ -15,3 +15,5 @@ symbian { TARGET.UID3 = 0xA000A64C include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/painterpaths/window.cpp b/examples/painting/painterpaths/window.cpp index 429f470..0a4c1b0 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 4891fdd..b95cd93 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 229c1be..825c3b3 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 contains(QT_CONFIG, svg): SUBDIRS += svggenerator svgviewer @@ -15,4 +14,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS painting.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/painting INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/painting/svggenerator/main.cpp b/examples/painting/svggenerator/main.cpp index f2079f5..4a43828 100644 --- a/examples/painting/svggenerator/main.cpp +++ b/examples/painting/svggenerator/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/svggenerator/svggenerator.desktop b/examples/painting/svggenerator/svggenerator.desktop new file mode 100644 index 0000000..3ae32a4 --- /dev/null +++ b/examples/painting/svggenerator/svggenerator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SVG Generator +Exec=/opt/usr/bin/svggenerator +Icon=svggenerator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro index 2e67372..ae8a26a 100644 --- a/examples/painting/svggenerator/svggenerator.pro +++ b/examples/painting/svggenerator/svggenerator.pro @@ -20,3 +20,5 @@ symbian { TARGET.UID3 = 0xA000CF68 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/svggenerator/window.cpp b/examples/painting/svggenerator/window.cpp index f3e950e..eb3d1b4 100644 --- a/examples/painting/svggenerator/window.cpp +++ b/examples/painting/svggenerator/window.cpp @@ -49,6 +49,10 @@ Window::Window(QWidget *parent) : QWidget(parent) { setupUi(this); + +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + this->layout()->setSizeConstraint(QLayout::SetDefaultConstraint); +#endif } void Window::updateBackground(int background) diff --git a/examples/painting/svgviewer/main.cpp b/examples/painting/svgviewer/main.cpp index de5cc09..bad6cd5 100644 --- a/examples/painting/svgviewer/main.cpp +++ b/examples/painting/svgviewer/main.cpp @@ -57,6 +57,10 @@ int main(int argc, char **argv) window.openFile(argv[1]); else window.openFile(":/files/bubbles.svg"); +#if defined(Q_OS_SYMBIAN) + window.showMaximized(); +#else window.show(); +#endif return app.exec(); } diff --git a/examples/painting/svgviewer/svgviewer.desktop b/examples/painting/svgviewer/svgviewer.desktop new file mode 100644 index 0000000..477ef78 --- /dev/null +++ b/examples/painting/svgviewer/svgviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SVG Viewer +Exec=/opt/usr/bin/svgviewer +Icon=svgviewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/svgviewer/svgviewer.pro b/examples/painting/svgviewer/svgviewer.pro index 6417849..0d938f4 100644 --- a/examples/painting/svgviewer/svgviewer.pro +++ b/examples/painting/svgviewer/svgviewer.pro @@ -29,3 +29,5 @@ symbian: { addFiles.path = . DEPLOYMENT += addFiles } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/painting/transformations/main.cpp b/examples/painting/transformations/main.cpp index f2079f5..4a43828 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.desktop b/examples/painting/transformations/transformations.desktop new file mode 100644 index 0000000..2f53891 --- /dev/null +++ b/examples/painting/transformations/transformations.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Transformations +Exec=/opt/usr/bin/transformations +Icon=transformations +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/transformations/transformations.pro b/examples/painting/transformations/transformations.pro index 91470f7..846fccb 100644 --- a/examples/painting/transformations/transformations.pro +++ b/examples/painting/transformations/transformations.pro @@ -14,3 +14,8 @@ symbian { TARGET.UID3 = 0xA000A64D include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +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) |