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/tablemodel | |
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/tablemodel')
-rw-r--r-- | examples/sql/tablemodel/tablemodel.cpp | 18 | ||||
-rw-r--r-- | examples/sql/tablemodel/tablemodel.desktop | 11 | ||||
-rw-r--r-- | examples/sql/tablemodel/tablemodel.pro | 2 |
3 files changed, 28 insertions, 3 deletions
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) + |