diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-07-31 11:34:23 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-07-31 11:34:23 +0000 |
commit | cf2d59bfe8720627e016195903e16cd0c97fa612 (patch) | |
tree | 5cc0755d649d606867bf6168a091a91c9d3e6f3d /examples | |
parent | 7621bb0f3bba69e0b2849974a335dff4742c8e95 (diff) | |
parent | 23c9d4c98f3c6729b56700edc1d7144b444b16db (diff) |
Merge "Merge branch '5.11' into dev" into refs/staging/dev
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/widgets/tetrix/tetrixwindow.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/widgets/widgets/tetrix/tetrixwindow.cpp b/examples/widgets/widgets/tetrix/tetrixwindow.cpp index 43fbdcdea8..7e951aceb8 100644 --- a/examples/widgets/widgets/tetrix/tetrixwindow.cpp +++ b/examples/widgets/widgets/tetrix/tetrixwindow.cpp @@ -83,14 +83,25 @@ TetrixWindow::TetrixWindow() pauseButton->setFocusPolicy(Qt::NoFocus); //! [3] //! [4] - connect(startButton, SIGNAL(clicked()), board, SLOT(start())); + connect(startButton, &QPushButton::clicked, board, &TetrixBoard::start); //! [4] //! [5] - connect(quitButton , SIGNAL(clicked()), qApp, SLOT(quit())); - connect(pauseButton, SIGNAL(clicked()), board, SLOT(pause())); - connect(board, SIGNAL(scoreChanged(int)), scoreLcd, SLOT(display(int))); - connect(board, SIGNAL(levelChanged(int)), levelLcd, SLOT(display(int))); - connect(board, SIGNAL(linesRemovedChanged(int)), - linesLcd, SLOT(display(int))); + connect(quitButton , &QPushButton::clicked, qApp, &QApplication::quit); + connect(pauseButton, &QPushButton::clicked, board, &TetrixBoard::pause); +#if __cplusplus >= 201402L + connect(board, &TetrixBoard::scoreChanged, + scoreLcd, qOverload<int>(&QLCDNumber::display)); + connect(board, &TetrixBoard::levelChanged, + levelLcd, qOverload<int>(&QLCDNumber::display)); + connect(board, &TetrixBoard::linesRemovedChanged, + linesLcd, qOverload<int>(&QLCDNumber::display)); +#else + connect(board, &TetrixBoard::scoreChanged, + scoreLcd, QOverload<int>::of(&QLCDNumber::display)); + connect(board, &TetrixBoard::levelChanged, + levelLcd, QOverload<int>::of(&QLCDNumber::display)); + connect(board, &TetrixBoard::linesRemovedChanged, + linesLcd, QOverload<int>::of(&QLCDNumber::display)); +#endif //! [5] //! [6] @@ -117,9 +128,9 @@ TetrixWindow::TetrixWindow() //! [7] QLabel *TetrixWindow::createLabel(const QString &text) { - QLabel *lbl = new QLabel(text); - lbl->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); - return lbl; + QLabel *label = new QLabel(text); + label->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); + return label; } //! [7] |