summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-10 21:13:05 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-11-23 11:33:28 +0100
commitfa045a3ce76d51dfa679945e74d9e2a685e14597 (patch)
tree7407220cf2dbc3e04b9cba9f7caef86f76687625 /examples
parent1ffd12a8dc783b8e0806b839a3015b4fb9298bad (diff)
SQL/drilldown example: add new icons and misc cleanup
Cleanup the drilldown example: - use icons with the current style - remove unneeded QOverload<> - remove some empty lines which don't look good in the documentation - use Q_SLOTS/Q_SIGNALS instead slots/signals Fixes: QTBUG-113696 Change-Id: I62476a8989c0abd1f424d1425cb05489491e2153 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/sql/doc/images/drilldown-example.pngbin6612 -> 10335 bytes
-rw-r--r--examples/sql/doc/src/drilldown.qdoc4
-rw-r--r--examples/sql/drilldown/imageitem.cpp6
-rw-r--r--examples/sql/drilldown/imageitem.h3
-rw-r--r--examples/sql/drilldown/images/qt-creator.pngbin6655 -> 8355 bytes
-rw-r--r--examples/sql/drilldown/images/qt-logo.pngbin5527 -> 6650 bytes
-rw-r--r--examples/sql/drilldown/images/qt-project.pngbin16832 -> 8376 bytes
-rw-r--r--examples/sql/drilldown/images/qt-quick.pngbin26635 -> 8029 bytes
-rw-r--r--examples/sql/drilldown/informationwindow.cpp10
-rw-r--r--examples/sql/drilldown/informationwindow.h8
-rw-r--r--examples/sql/drilldown/view.cpp4
-rw-r--r--examples/sql/drilldown/view.h3
12 files changed, 17 insertions, 21 deletions
diff --git a/examples/sql/doc/images/drilldown-example.png b/examples/sql/doc/images/drilldown-example.png
index 39a4117637..b6cf443e7c 100644
--- a/examples/sql/doc/images/drilldown-example.png
+++ b/examples/sql/doc/images/drilldown-example.png
Binary files differ
diff --git a/examples/sql/doc/src/drilldown.qdoc b/examples/sql/doc/src/drilldown.qdoc
index 3ef310db18..d334018b4a 100644
--- a/examples/sql/doc/src/drilldown.qdoc
+++ b/examples/sql/doc/src/drilldown.qdoc
@@ -46,8 +46,8 @@
\snippet drilldown/informationwindow.h 0
When we create an information window, we pass the associated
- item ID, a parent, and a pointer to the database, to the
- constructor. We will use the database pointer to populate our
+ item ID, a pointer to the model, and a parent to the
+ constructor. We will use the model pointer to populate our
window with data, while passing the parent parameter on to the
base class. The ID is stored for future reference.
diff --git a/examples/sql/drilldown/imageitem.cpp b/examples/sql/drilldown/imageitem.cpp
index 59f1255f9f..4dfb5ee6e8 100644
--- a/examples/sql/drilldown/imageitem.cpp
+++ b/examples/sql/drilldown/imageitem.cpp
@@ -54,7 +54,7 @@ void ImageItem::setFrame(int frame)
QPointF center = boundingRect().center();
setTransform(QTransform::fromTranslate(center.x(), center.y()), true);
- setTransform(QTransform::fromScale(1 + frame / 330.0, 1 + frame / 330.0), true);
+ setTransform(QTransform::fromScale(1 + frame / 300.0, 1 + frame / 300.0), true);
setTransform(QTransform::fromTranslate(-center.x(), -center.y()), true);
}
//! [3]
@@ -62,8 +62,8 @@ void ImageItem::setFrame(int frame)
//! [4]
void ImageItem::adjust()
{
- setTransform(QTransform::fromScale(120 / boundingRect().width(),
- 120 / boundingRect().height()));
+ setTransform(QTransform::fromScale(120.0 / boundingRect().width(),
+ 120.0 / boundingRect().height()));
}
//! [4]
diff --git a/examples/sql/drilldown/imageitem.h b/examples/sql/drilldown/imageitem.h
index f6be4d50ab..23a41aa2f2 100644
--- a/examples/sql/drilldown/imageitem.h
+++ b/examples/sql/drilldown/imageitem.h
@@ -11,7 +11,6 @@
class ImageItem : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT
-
public:
enum { Type = UserType + 1 };
@@ -25,7 +24,7 @@ protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
-private slots:
+private Q_SLOTS:
void setFrame(int frame);
void updateItemPosition();
diff --git a/examples/sql/drilldown/images/qt-creator.png b/examples/sql/drilldown/images/qt-creator.png
index 0602bdcad1..576f9f39ff 100644
--- a/examples/sql/drilldown/images/qt-creator.png
+++ b/examples/sql/drilldown/images/qt-creator.png
Binary files differ
diff --git a/examples/sql/drilldown/images/qt-logo.png b/examples/sql/drilldown/images/qt-logo.png
index 7603fa0c90..fb8b1686bd 100644
--- a/examples/sql/drilldown/images/qt-logo.png
+++ b/examples/sql/drilldown/images/qt-logo.png
Binary files differ
diff --git a/examples/sql/drilldown/images/qt-project.png b/examples/sql/drilldown/images/qt-project.png
index e066fbe3f9..8c20e3f0c2 100644
--- a/examples/sql/drilldown/images/qt-project.png
+++ b/examples/sql/drilldown/images/qt-project.png
Binary files differ
diff --git a/examples/sql/drilldown/images/qt-quick.png b/examples/sql/drilldown/images/qt-quick.png
index 90d9fd075d..a905f47c35 100644
--- a/examples/sql/drilldown/images/qt-quick.png
+++ b/examples/sql/drilldown/images/qt-quick.png
Binary files differ
diff --git a/examples/sql/drilldown/informationwindow.cpp b/examples/sql/drilldown/informationwindow.cpp
index 614db9a9aa..d69c91d0cb 100644
--- a/examples/sql/drilldown/informationwindow.cpp
+++ b/examples/sql/drilldown/informationwindow.cpp
@@ -9,9 +9,9 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
: QDialog(parent)
{
//! [0] //! [1]
- QLabel *itemLabel = new QLabel(tr("Item: "));
- QLabel *descriptionLabel = new QLabel(tr("Description: "));
- QLabel *imageFileLabel = new QLabel(tr("Image file: "));
+ QLabel *itemLabel = new QLabel(tr("Item:"));
+ QLabel *descriptionLabel = new QLabel(tr("Description:"));
+ QLabel *imageFileLabel = new QLabel(tr("Image file:"));
createButtons();
@@ -37,8 +37,8 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
//! [3]
//! [4]
- connect(descriptionEditor, &QTextEdit::textChanged, this, [this]() { enableButtons(); });
- connect(imageFileEditor, &QComboBox::currentIndexChanged, this, [this]() { enableButtons(); });
+ connect(descriptionEditor, &QTextEdit::textChanged, this, [this]() { enableButtons(true); });
+ connect(imageFileEditor, &QComboBox::currentIndexChanged, this, [this]() { enableButtons(true); });
QFormLayout *formLayout = new QFormLayout;
formLayout->addRow(itemLabel, itemText);
diff --git a/examples/sql/drilldown/informationwindow.h b/examples/sql/drilldown/informationwindow.h
index 368d99c303..2380463785 100644
--- a/examples/sql/drilldown/informationwindow.h
+++ b/examples/sql/drilldown/informationwindow.h
@@ -11,22 +11,20 @@
class InformationWindow : public QDialog
{
Q_OBJECT
-
public:
InformationWindow(int id, QSqlRelationalTableModel *items,
QWidget *parent = nullptr);
-
int id() const;
-signals:
+Q_SIGNALS:
void imageChanged(int id, const QString &fileName);
//! [0]
//! [1]
-private slots:
+private Q_SLOTS:
void revert();
void submit();
- void enableButtons(bool enable = true);
+ void enableButtons(bool enable);
//! [1]
//! [2]
diff --git a/examples/sql/drilldown/view.cpp b/examples/sql/drilldown/view.cpp
index f41d32f282..c2f7301a21 100644
--- a/examples/sql/drilldown/view.cpp
+++ b/examples/sql/drilldown/view.cpp
@@ -87,8 +87,8 @@ void View::showInformation(ImageItem *image)
if (!window) {
window = new InformationWindow(id, itemTable, this);
- connect(window, QOverload<int,const QString &>::of(&InformationWindow::imageChanged),
- this, QOverload<int,const QString &>::of(&View::updateImage));
+ connect(window, &InformationWindow::imageChanged,
+ this, &View::updateImage);
window->move(pos() + QPoint(20, 40));
window->show();
diff --git a/examples/sql/drilldown/view.h b/examples/sql/drilldown/view.h
index acbfeb1558..f44dedce99 100644
--- a/examples/sql/drilldown/view.h
+++ b/examples/sql/drilldown/view.h
@@ -14,7 +14,6 @@ class InformationWindow;
class View : public QGraphicsView
{
Q_OBJECT
-
public:
View(const QString &items, const QString &images, QWidget *parent = nullptr);
@@ -23,7 +22,7 @@ protected:
//! [0]
//! [1]
-private slots:
+private Q_SLOTS:
void updateImage(int id, const QString &fileName);
//! [1]