diff options
Diffstat (limited to 'examples/script/qstetrix/tetrixboard.cpp')
-rw-r--r-- | examples/script/qstetrix/tetrixboard.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/script/qstetrix/tetrixboard.cpp b/examples/script/qstetrix/tetrixboard.cpp index 7d44c4c..f35740d 100644 --- a/examples/script/qstetrix/tetrixboard.cpp +++ b/examples/script/qstetrix/tetrixboard.cpp @@ -54,7 +54,12 @@ TetrixBoard::TetrixBoard(QWidget *parent) void TetrixBoard::setNextPieceLabel(QWidget *label) { - nextPieceLabel = qobject_cast<QLabel*>(label); + nextPieceLbl = qobject_cast<QLabel*>(label); +} + +QLabel *TetrixBoard::nextPieceLabel() const +{ + return nextPieceLbl; } QObject *TetrixBoard::getTimer() @@ -82,16 +87,16 @@ void TetrixBoard::keyPressEvent(QKeyEvent *event) void TetrixBoard::showNextPiece(int width, int height) { - if (!nextPieceLabel) + if (!nextPieceLabel()) return; QPixmap pixmap(width * squareWidth(), height * squareHeight()); QPainter painter(&pixmap); - painter.fillRect(pixmap.rect(), nextPieceLabel->palette().background()); + painter.fillRect(pixmap.rect(), nextPieceLabel()->palette().background()); emit paintNextPieceRequested(&painter); - nextPieceLabel->setPixmap(pixmap); + nextPieceLabel()->setPixmap(pixmap); } void TetrixBoard::drawPauseScreen(QPainter *painter) |