summaryrefslogtreecommitdiffstats
path: root/examples/sql/querymodel/main.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-25 01:11:52 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-25 01:11:52 +1000
commit6bd691dc5402f22840a3354b08cb6bdc99b01006 (patch)
tree6ef3847a93f501d52fcb01927c6c9f36a94570e5 /examples/sql/querymodel/main.cpp
parente60f05201f5bc412ec8c02625bcbbca5ba50812c (diff)
parent4d10065c54f9b277f44ed042f4e18858dafdd1df (diff)
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging: (21 commits) Fixed line endings. Update licenseheader text in source files for qtbase Qt module New configure.exe binary Add -qpa option on Windows Use qglobal.h's VERSION number instead of hardcoded current version More examples adjusted to Symbian and Maemo5. (cherry picked from commit a97b9620a584c9b1a2e006873183526b3d7e001e) Doc: Added some details to the accessibility events API documentation. Doc: Fixed qdoc warnings. Doc: Fixed qdoc warnings. Doc: Made an additional change for clarity. Doc: Noted that the example will not work as expected with a mouse. Doc: Fixed qdoc warnings. Doc: Applying a pending change from previous merges. Doc: Fixed qdoc warning. Doc: Fixed qdoc warnings. Doc: Applied pending fixes to API documentation. Doc: Various fixes to documentation, some based on changes in master. Doc: Added missing project and desktop files. Doc: Documented the value returned when no field can be found. Squashed commit of changes from the 4.8-temp branch. ...
Diffstat (limited to 'examples/sql/querymodel/main.cpp')
-rw-r--r--examples/sql/querymodel/main.cpp27
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();
}