diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-25 14:52:04 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-25 14:53:02 (GMT) |
commit | dfbabeca0cb8a9efdb6758c228700eeb5996652c (patch) | |
tree | 42598fd46dbde25acb47953d3f75799ccfd2e4ea /examples | |
parent | 1e6c23469ea78f6ff5a3a546c08ae22a5ba79356 (diff) | |
download | Qt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.zip Qt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.tar.gz Qt-dfbabeca0cb8a9efdb6758c228700eeb5996652c.tar.bz2 |
Fix warnings and build on mingw
Diffstat (limited to 'examples')
-rw-r--r-- | examples/graphicsview/weatheranchorlayout/main.cpp | 11 | ||||
-rw-r--r-- | examples/script/qstetrix/tetrixboard.cpp | 13 | ||||
-rw-r--r-- | examples/script/qstetrix/tetrixboard.h | 10 |
3 files changed, 15 insertions, 19 deletions
diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp index aa06476..391fdd8 100644 --- a/examples/graphicsview/weatheranchorlayout/main.cpp +++ b/examples/graphicsview/weatheranchorlayout/main.cpp @@ -97,6 +97,8 @@ protected: case Qt::MaximumSize: sh = QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); break; + default: + break; } return sh; } @@ -167,15 +169,6 @@ private: }; -static QGraphicsProxyWidget *createItem(const QString &name = "Unnamed") -{ - QGraphicsProxyWidget *w = new QGraphicsProxyWidget; - w->setWidget(new QPushButton(name)); - w->setData(0, name); - w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - return w; -} - int main(int argc, char **argv) { Q_INIT_RESOURCE(weatheranchorlayout); 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; }; |