Doc: Update Tetrix example
Use new connect syntax throughout the example. Task-number: QTBUG-69503 Change-Id: I5ab1453318e60586a9655ecb58263778c02aba4f Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This commit is contained in:
parent
8d77bcc562
commit
f17d33bebb
@ -83,14 +83,25 @@ TetrixWindow::TetrixWindow()
|
|||||||
pauseButton->setFocusPolicy(Qt::NoFocus);
|
pauseButton->setFocusPolicy(Qt::NoFocus);
|
||||||
//! [3] //! [4]
|
//! [3] //! [4]
|
||||||
|
|
||||||
connect(startButton, SIGNAL(clicked()), board, SLOT(start()));
|
connect(startButton, &QPushButton::clicked, board, &TetrixBoard::start);
|
||||||
//! [4] //! [5]
|
//! [4] //! [5]
|
||||||
connect(quitButton , SIGNAL(clicked()), qApp, SLOT(quit()));
|
connect(quitButton , &QPushButton::clicked, qApp, &QApplication::quit);
|
||||||
connect(pauseButton, SIGNAL(clicked()), board, SLOT(pause()));
|
connect(pauseButton, &QPushButton::clicked, board, &TetrixBoard::pause);
|
||||||
connect(board, SIGNAL(scoreChanged(int)), scoreLcd, SLOT(display(int)));
|
#if __cplusplus >= 201402L
|
||||||
connect(board, SIGNAL(levelChanged(int)), levelLcd, SLOT(display(int)));
|
connect(board, &TetrixBoard::scoreChanged,
|
||||||
connect(board, SIGNAL(linesRemovedChanged(int)),
|
scoreLcd, qOverload<int>(&QLCDNumber::display));
|
||||||
linesLcd, SLOT(display(int)));
|
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]
|
//! [5]
|
||||||
|
|
||||||
//! [6]
|
//! [6]
|
||||||
@ -117,9 +128,9 @@ TetrixWindow::TetrixWindow()
|
|||||||
//! [7]
|
//! [7]
|
||||||
QLabel *TetrixWindow::createLabel(const QString &text)
|
QLabel *TetrixWindow::createLabel(const QString &text)
|
||||||
{
|
{
|
||||||
QLabel *lbl = new QLabel(text);
|
QLabel *label = new QLabel(text);
|
||||||
lbl->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
label->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||||
return lbl;
|
return label;
|
||||||
}
|
}
|
||||||
//! [7]
|
//! [7]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user