summaryrefslogtreecommitdiffstats
path: root/examples/script
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-03-25 14:52:04 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-03-25 14:53:02 (GMT)
commitdfbabeca0cb8a9efdb6758c228700eeb5996652c (patch)
tree42598fd46dbde25acb47953d3f75799ccfd2e4ea /examples/script
parent1e6c23469ea78f6ff5a3a546c08ae22a5ba79356 (diff)
downloadQt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.zip
Qt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.tar.gz
Qt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.tar.bz2
Fix warnings and build on mingw
Diffstat (limited to 'examples/script')
-rw-r--r--examples/script/qstetrix/tetrixboard.cpp13
-rw-r--r--examples/script/qstetrix/tetrixboard.h10
2 files changed, 13 insertions, 10 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)
diff --git a/examples/script/qstetrix/tetrixboard.h b/examples/script/qstetrix/tetrixboard.h
index 7a04317..781ec39 100644
--- a/examples/script/qstetrix/tetrixboard.h
+++ b/examples/script/qstetrix/tetrixboard.h
@@ -45,21 +45,19 @@
#include <QTimer>
#include <QFrame>
#include <QPointer>
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-QT_END_NAMESPACE
+#include <QLabel>
class TetrixBoard : public QFrame
{
Q_OBJECT
Q_PROPERTY(QObject* timer READ getTimer)
- Q_PROPERTY(QWidget* nextPieceLabel WRITE setNextPieceLabel)
+ Q_PROPERTY(QWidget* nextPieceLabel READ nextPieceLabel WRITE setNextPieceLabel)
public:
TetrixBoard(QWidget *parent = 0);
void setNextPieceLabel(QWidget *label);
+ QLabel *nextPieceLabel() const;
void setBoardWidth(int width);
void setBoardHeight(int height);
QSize minimumSizeHint() const;
@@ -95,7 +93,7 @@ private:
int squareHeight() { return contentsRect().height() / BoardHeight; }
QTimer *timer;
- QPointer<QLabel> nextPieceLabel;
+ QPointer<QLabel> nextPieceLbl;
QImage image;
};