diff --git a/examples/sql/doc/images/drilldown-example.png b/examples/sql/doc/images/drilldown-example.png index 39a4117637..b6cf443e7c 100644 Binary files a/examples/sql/doc/images/drilldown-example.png and b/examples/sql/doc/images/drilldown-example.png 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 Binary files a/examples/sql/drilldown/images/qt-creator.png and b/examples/sql/drilldown/images/qt-creator.png differ diff --git a/examples/sql/drilldown/images/qt-logo.png b/examples/sql/drilldown/images/qt-logo.png index 7603fa0c90..fb8b1686bd 100644 Binary files a/examples/sql/drilldown/images/qt-logo.png and b/examples/sql/drilldown/images/qt-logo.png differ diff --git a/examples/sql/drilldown/images/qt-project.png b/examples/sql/drilldown/images/qt-project.png index e066fbe3f9..8c20e3f0c2 100644 Binary files a/examples/sql/drilldown/images/qt-project.png and b/examples/sql/drilldown/images/qt-project.png differ diff --git a/examples/sql/drilldown/images/qt-quick.png b/examples/sql/drilldown/images/qt-quick.png index 90d9fd075d..a905f47c35 100644 Binary files a/examples/sql/drilldown/images/qt-quick.png and b/examples/sql/drilldown/images/qt-quick.png 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::of(&InformationWindow::imageChanged), - this, QOverload::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]