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/sql/querymodel | |
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/sql/querymodel')
-rw-r--r-- | examples/sql/querymodel/main.cpp | 27 | ||||
-rw-r--r-- | examples/sql/querymodel/querymodel.desktop | 11 | ||||
-rw-r--r-- | examples/sql/querymodel/querymodel.pro | 2 |
3 files changed, 34 insertions, 6 deletions
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) + |