summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-01 16:15:01 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-01 16:15:01 (GMT)
commitc272d672fc1863f9e3a201e93ad277c734749845 (patch)
tree76676724c821878811841b817110438a52be820f /examples
parent5fb8d729ddf56003af326ba4c9dbff56b57ed105 (diff)
parent7c939ad26e2d79a5c72ace724dfa2a3be8e398b3 (diff)
downloadQt-c272d672fc1863f9e3a201e93ad277c734749845.zip
Qt-c272d672fc1863f9e3a201e93ad277c734749845.tar.gz
Qt-c272d672fc1863f9e3a201e93ad277c734749845.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (67 commits) Skip tst_QGraphicsItem::updateMicroFocus test on Windows and Mac as it does not passes QScript: more missing APIShim Fix compilation warnings QScript: fix compilation warning QScript: fix APIShim usage. QtScript: remove duplicated APIshim in QScriptValueIterator Attempt to fix the test. Total makeover of SVG image reader Add a QGraphicsItem::updateMicroFocus() to QGraphicsItem. Micro optimization after feedback from Jan-Arve. Show only one dialog when using QFileDialog on Mac. Re-fix compilation: re-add symbols introduced in Qt 4.6.3 to Qt 4.7 Fix bad merge from 4.6. Doc: Updated the qdoc manual with i18n info. Fixed a code example. Fix QStaticText test on Mac Support the pen set on the painter in QStaticText when using rich text Fix setting font for QStaticText on Linux and Mac Hack .pro files on windows to define QT_NO_EGL Fix QDate::isLeapYear() for years < 1 One more test for chinese codecs ...
Diffstat (limited to 'examples')
-rw-r--r--examples/graphicsview/weatheranchorlayout/main.cpp11
-rw-r--r--examples/script/qstetrix/tetrixboard.cpp13
-rw-r--r--examples/script/qstetrix/tetrixboard.h10
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;
};