diff options
author | David Boddie <david.boddie@nokia.com> | 2011-04-27 19:16:41 +0200 |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-05-04 18:34:57 +0200 |
commit | b727e5b95c1f0bd308b228fcf0445b42847ae583 (patch) | |
tree | e120ca1ec5c2e303fb6fca97bc9754403e0f25f2 /examples/sql/querymodel/main.cpp | |
parent | 6d1e0faa19be784f79730d65af9c1a162245c7dc (diff) | |
download | qt4-tools-b727e5b95c1f0bd308b228fcf0445b42847ae583.tar.gz |
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
(cherry picked from commit 539311f7b2687e3148ea695ce06fee768abe7b44)
Diffstat (limited to 'examples/sql/querymodel/main.cpp')
-rw-r--r-- | examples/sql/querymodel/main.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/examples/sql/querymodel/main.cpp b/examples/sql/querymodel/main.cpp index b6507e92c4..ac1a33f781 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(); } |