summaryrefslogtreecommitdiffstats
path: root/examples/sql/books/bookwindow.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-01-13 00:00:41 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2024-01-14 09:32:04 +0100
commit8bfebaa22f66d2cc32d6147611bcbaea3a85188c (patch)
treea16e191d3449dff288badb64b45cb517658bc2a4 /examples/sql/books/bookwindow.cpp
parent27dd17890060313d684b72c871be9da7eb2b74fe (diff)
SQL examples: code cleanup
Misc code cleanup for the sql examples: - don't include global Qt headers but only needed ones - use proper tr() where possible - pass parameters by const ref - style fixes Change-Id: I4fd4293948918b9d7b373b6d1e8eeecf6f25a622 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'examples/sql/books/bookwindow.cpp')
-rw-r--r--examples/sql/books/bookwindow.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/examples/sql/books/bookwindow.cpp b/examples/sql/books/bookwindow.cpp
index 8b34bd7a77..6de2d5e80a 100644
--- a/examples/sql/books/bookwindow.cpp
+++ b/examples/sql/books/bookwindow.cpp
@@ -5,16 +5,27 @@
#include "bookdelegate.h"
#include "initdb.h"
-#include <QtSql>
+#include <QApplication>
+#include <QComboBox>
+#include <QDataWidgetMapper>
+#include <QGridLayout>
+#include <QHeaderView>
+#include <QLabel>
+#include <QLineEdit>
+#include <QMenu>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <QPainter>
+#include <QScrollBar>
+#include <QSpinBox>
+#include <QSqlDatabase>
+#include <QTableView>
BookWindow::BookWindow()
{
if (!QSqlDatabase::drivers().contains("QSQLITE"))
- QMessageBox::critical(
- this,
- "Unable to load database",
- "This demo needs the SQLITE driver"
- );
+ QMessageBox::critical(this, tr("Unable to load database"),
+ tr("This demo needs the SQLITE driver"));
// Initialize the database:
QSqlError err = initDb();
@@ -50,8 +61,8 @@ BookWindow::BookWindow()
void BookWindow::showError(const QSqlError &err)
{
- QMessageBox::critical(this, "Unable to initialize Database",
- "Error initializing database: " + err.text());
+ QMessageBox::critical(this, tr("Unable to initialize Database"),
+ tr("Error initializing database: %1").arg(err.text()));
}
void BookWindow::createLayout()