diff options
Diffstat (limited to 'examples/sql')
27 files changed, 163 insertions, 16 deletions
diff --git a/examples/sql/cachedtable/cachedtable.desktop b/examples/sql/cachedtable/cachedtable.desktop new file mode 100644 index 0000000..aeec353 --- /dev/null +++ b/examples/sql/cachedtable/cachedtable.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Cached Table +Exec=/opt/usr/bin/cachedtable +Icon=cachedtable +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/cachedtable/cachedtable.pro b/examples/sql/cachedtable/cachedtable.pro index 288ec28..7059a1b 100644 --- a/examples/sql/cachedtable/cachedtable.pro +++ b/examples/sql/cachedtable/cachedtable.pro @@ -11,3 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/sql/cachedtable INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/sql/cachedtable/main.cpp b/examples/sql/cachedtable/main.cpp index 26ddc42..ecbf565 100644 --- a/examples/sql/cachedtable/main.cpp +++ b/examples/sql/cachedtable/main.cpp @@ -51,7 +51,11 @@ int main(int argc, char *argv[]) return 1; TableEditor editor("person"); +#if defined(Q_OS_SYMBIAN) + editor.showMaximized(); +#else editor.show(); - return editor.exec(); +#endif + return app.exec(); } //! [0] diff --git a/examples/sql/cachedtable/tableeditor.cpp b/examples/sql/cachedtable/tableeditor.cpp index 216f729..083e5ab 100644 --- a/examples/sql/cachedtable/tableeditor.cpp +++ b/examples/sql/cachedtable/tableeditor.cpp @@ -45,7 +45,7 @@ //! [0] TableEditor::TableEditor(const QString &tableName, QWidget *parent) - : QDialog(parent) + : QWidget(parent) { model = new QSqlTableModel(this); model->setTable(tableName); @@ -59,6 +59,7 @@ TableEditor::TableEditor(const QString &tableName, QWidget *parent) //! [0] //! [1] QTableView *view = new QTableView; view->setModel(model); + view->resizeColumnsToContents(); //! [1] //! [2] diff --git a/examples/sql/cachedtable/tableeditor.h b/examples/sql/cachedtable/tableeditor.h index 14d9986..f13bd3d 100644 --- a/examples/sql/cachedtable/tableeditor.h +++ b/examples/sql/cachedtable/tableeditor.h @@ -50,7 +50,7 @@ class QSqlTableModel; QT_END_NAMESPACE //! [0] -class TableEditor : public QDialog +class TableEditor : public QWidget { Q_OBJECT diff --git a/examples/sql/drilldown/drilldown.desktop b/examples/sql/drilldown/drilldown.desktop new file mode 100644 index 0000000..b0f3ce0 --- /dev/null +++ b/examples/sql/drilldown/drilldown.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Drill Down +Exec=/opt/usr/bin/drilldown +Icon=drilldown +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/drilldown/drilldown.pro b/examples/sql/drilldown/drilldown.pro index 5c97e88..aaa3b84 100644 --- a/examples/sql/drilldown/drilldown.pro +++ b/examples/sql/drilldown/drilldown.pro @@ -19,3 +19,6 @@ symbian { TARGET.UID3 = 0xA000C612 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/sql/drilldown/informationwindow.cpp b/examples/sql/drilldown/informationwindow.cpp index 3f43a59..351b98d 100644 --- a/examples/sql/drilldown/informationwindow.cpp +++ b/examples/sql/drilldown/informationwindow.cpp @@ -96,7 +96,11 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices, locationId = id; displayedImage = imageFileEditor->currentText(); - setWindowFlags(Qt::Window); + // Commented the following line. Now the window will look like dialog and the Qt will place the QDialogBox buttons to menu area in Symbian. + // Too bad that the revert button is missing, Should the Qt place the buttons under Option menu in the menu area?! + // If the Qt::Window flag was used, the background of window is white in symbian and the QLabels can't be regognized from the background. + + //setWindowFlags(Qt::Window); enableButtons(false); setWindowTitle(tr("Office: %1").arg(locationText->text())); } diff --git a/examples/sql/drilldown/main.cpp b/examples/sql/drilldown/main.cpp index e3c8fa7..9bfa57c 100644 --- a/examples/sql/drilldown/main.cpp +++ b/examples/sql/drilldown/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) #ifndef Q_OS_SYMBIAN view.show(); #else - view.showFullScreen(); + view.showMaximized(); #endif #ifdef QT_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); diff --git a/examples/sql/drilldown/view.cpp b/examples/sql/drilldown/view.cpp index 68fe06a..883b28b 100644 --- a/examples/sql/drilldown/view.cpp +++ b/examples/sql/drilldown/view.cpp @@ -62,7 +62,7 @@ View::View(const QString &offices, const QString &images, QWidget *parent) QGraphicsPixmapItem *logo = scene->addPixmap(QPixmap(":/logo.png")); logo->setPos(30, 515); -#ifndef Q_OS_SYMBIAN +#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) setMinimumSize(470, 620); setMaximumSize(470, 620); #else diff --git a/examples/sql/masterdetail/main.cpp b/examples/sql/masterdetail/main.cpp index fe3dd9d..55151eb 100644 --- a/examples/sql/masterdetail/main.cpp +++ b/examples/sql/masterdetail/main.cpp @@ -54,6 +54,10 @@ int main(int argc, char *argv[]) QFile *albumDetails = new QFile("albumdetails.xml"); MainWindow window("artists", "albums", albumDetails); +#if defined(Q_OS_SYMBIAN) + window.showMaximized(); +#else window.show(); +#endif return app.exec(); } diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index 24771ba..522ee6c 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -77,8 +77,10 @@ MainWindow::MainWindow(const QString &artistTable, const QString &albumTable, layout->addWidget(artists, 0, 0); layout->addWidget(albums, 1, 0); layout->addWidget(details, 0, 1, 2, 1); +#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) layout->setColumnStretch(1, 1); layout->setColumnMinimumWidth(0, 500); +#endif QWidget *widget = new QWidget; widget->setLayout(layout); @@ -86,7 +88,9 @@ MainWindow::MainWindow(const QString &artistTable, const QString &albumTable, createMenuBar(); showImageLabel(); +#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) resize(850, 400); +#endif setWindowTitle(tr("Music Archive")); } diff --git a/examples/sql/masterdetail/masterdetail.desktop b/examples/sql/masterdetail/masterdetail.desktop new file mode 100644 index 0000000..6f8c3e5 --- /dev/null +++ b/examples/sql/masterdetail/masterdetail.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Master Detail +Exec=/opt/usr/bin/masterdetail +Icon=masterdetail +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/masterdetail/masterdetail.pro b/examples/sql/masterdetail/masterdetail.pro index 41a0274..43ddb2b 100644 --- a/examples/sql/masterdetail/masterdetail.pro +++ b/examples/sql/masterdetail/masterdetail.pro @@ -19,3 +19,8 @@ symbian { TARGET.UID3 = 0xA000D7CF 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) diff --git a/examples/sql/querymodel/main.cpp b/examples/sql/querymodel/main.cpp index b6507e9..ac1a33f 100644 --- a/examples/sql/querymodel/main.cpp +++ b/examples/sql/querymodel/main.cpp @@ -52,16 +52,23 @@ void initializeModel(QSqlQueryModel *model) model->setHeaderData(2, Qt::Horizontal, QObject::tr("Last name")); } -void createView(const QString &title, QSqlQueryModel *model) +QTableView* createView(QSqlQueryModel *model, const QString &title = "") { - static int offset = 0; - QTableView *view = new QTableView; view->setModel(model); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + Q_UNUSED(title); + view->resizeColumnsToContents(); +#else + static int offset = 0; + view->setWindowTitle(title); view->move(100 + offset, 100 + offset); offset += 20; view->show(); +#endif + + return view; } int main(int argc, char *argv[]) @@ -78,9 +85,17 @@ int main(int argc, char *argv[]) initializeModel(&editableModel); initializeModel(&customModel); - createView(QObject::tr("Plain Query Model"), &plainModel); - createView(QObject::tr("Editable Query Model"), &editableModel); - createView(QObject::tr("Custom Query Model"), &customModel); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + QTabWidget *tabWidget = new QTabWidget; + tabWidget->addTab(createView(&plainModel), QObject::tr("Plain")); + tabWidget->addTab(createView(&editableModel), QObject::tr("Editable")); + tabWidget->addTab(createView(&customModel), QObject::tr("Custom")); + tabWidget->showMaximized(); +#else + createView(&plainModel, QObject::tr("Plain Query Model")); + createView(&editableModel, QObject::tr("Editable Query Model")); + createView(&customModel, QObject::tr("Custom Query Model")); +#endif return app.exec(); } diff --git a/examples/sql/querymodel/querymodel.desktop b/examples/sql/querymodel/querymodel.desktop new file mode 100644 index 0000000..8bba971 --- /dev/null +++ b/examples/sql/querymodel/querymodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Query Model +Exec=/opt/usr/bin/querymodel +Icon=querymodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/querymodel/querymodel.pro b/examples/sql/querymodel/querymodel.pro index 32c217d..3f3c707 100644 --- a/examples/sql/querymodel/querymodel.pro +++ b/examples/sql/querymodel/querymodel.pro @@ -13,3 +13,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/sql/querymodel INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/examples/sql/relationaltablemodel/relationaltablemodel.cpp index ecb985e..8b8ceff 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.cpp +++ b/examples/sql/relationaltablemodel/relationaltablemodel.cpp @@ -108,7 +108,11 @@ int main(int argc, char *argv[]) initializeModel(&model); QTableView *view = createView(QObject::tr("Relational Table Model"), &model); +#if defined(Q_OS_SYMBIAN) + view->showMaximized(); +#else view->show(); +#endif return app.exec(); } diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.desktop b/examples/sql/relationaltablemodel/relationaltablemodel.desktop new file mode 100644 index 0000000..8d5437d --- /dev/null +++ b/examples/sql/relationaltablemodel/relationaltablemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Relational Table Model +Exec=/opt/usr/bin/relationaltablemodel +Icon=relationaltablemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.pro b/examples/sql/relationaltablemodel/relationaltablemodel.pro index 32c04b6..e3a2bd4 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.pro +++ b/examples/sql/relationaltablemodel/relationaltablemodel.pro @@ -9,3 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/sql/relationaltablemodel INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/sql/sql.pro b/examples/sql/sql.pro index 331a210..ba88516 100644 --- a/examples/sql/sql.pro +++ b/examples/sql/sql.pro @@ -17,4 +17,3 @@ sources.files = connection.h sql.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/sql INSTALLS += sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/sql/sqlwidgetmapper/main.cpp b/examples/sql/sqlwidgetmapper/main.cpp index 41e756d..9e45ede 100644 --- a/examples/sql/sqlwidgetmapper/main.cpp +++ b/examples/sql/sqlwidgetmapper/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/sql/sqlwidgetmapper/sqlwidgetmapper.desktop b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.desktop new file mode 100644 index 0000000..c02e6bc --- /dev/null +++ b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SQL Widget Mapper +Exec=/opt/usr/bin/sqlwidgetmapper +Icon=sqlwidgetmapper +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro index c216a30..5b660f9 100644 --- a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro +++ b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro @@ -11,3 +11,6 @@ INSTALLS += target sources wince*: DEPLOYMENT_PLUGIN += qsqlite +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + diff --git a/examples/sql/tablemodel/tablemodel.cpp b/examples/sql/tablemodel/tablemodel.cpp index 41a42bc..a107da0 100644 --- a/examples/sql/tablemodel/tablemodel.cpp +++ b/examples/sql/tablemodel/tablemodel.cpp @@ -54,11 +54,15 @@ void initializeModel(QSqlTableModel *model) model->setHeaderData(2, Qt::Horizontal, QObject::tr("Last name")); } -QTableView *createView(const QString &title, QSqlTableModel *model) +QTableView *createView(QSqlTableModel *model, const QString &title = "") { QTableView *view = new QTableView; view->setModel(model); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + Q_UNUSED(title) +#else view->setWindowTitle(title); +#endif return view; } @@ -72,12 +76,20 @@ int main(int argc, char *argv[]) initializeModel(&model); - QTableView *view1 = createView(QObject::tr("Table Model (View 1)"), &model); - QTableView *view2 = createView(QObject::tr("Table Model (View 2)"), &model); +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + QTabWidget *tabWidget = new QTabWidget; + tabWidget->addTab(createView(&model), "View 1"); + tabWidget->addTab(createView(&model), "View 2"); + + tabWidget->showMaximized(); +#else + QTableView *view1 = createView(&model, QObject::tr("Table Model (View 1)")); + QTableView *view2 = createView(&model, QObject::tr("Table Model (View 2)")); view1->show(); view2->move(view1->x() + view1->width() + 20, view1->y()); view2->show(); +#endif return app.exec(); } diff --git a/examples/sql/tablemodel/tablemodel.desktop b/examples/sql/tablemodel/tablemodel.desktop new file mode 100644 index 0000000..821fbd9 --- /dev/null +++ b/examples/sql/tablemodel/tablemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Table Model +Exec=/opt/usr/bin/tablemodel +Icon=tablemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/tablemodel/tablemodel.pro b/examples/sql/tablemodel/tablemodel.pro index 700029c..4785897 100644 --- a/examples/sql/tablemodel/tablemodel.pro +++ b/examples/sql/tablemodel/tablemodel.pro @@ -9,3 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/sql/tablemodel INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + |