diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-08 02:40:35 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-08 02:40:35 (GMT) |
commit | 0ad0e7aa99218a82d6c08fed27781282bfe355a2 (patch) | |
tree | ca2a48b7795646ad99aeccd254baf2007647800d | |
parent | 2d3323d239c9d20c98e09c9398931e60bb799cca (diff) | |
parent | 8429de44c2c5c046e403990ff04bc15ff1dee42a (diff) | |
download | Qt-0ad0e7aa99218a82d6c08fed27781282bfe355a2.zip Qt-0ad0e7aa99218a82d6c08fed27781282bfe355a2.tar.gz Qt-0ad0e7aa99218a82d6c08fed27781282bfe355a2.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
19 files changed, 128 insertions, 27 deletions
diff --git a/demos/declarative/calculator/calculator.pro b/demos/declarative/calculator/calculator.pro new file mode 100644 index 0000000..efe6413 --- /dev/null +++ b/demos/declarative/calculator/calculator.pro @@ -0,0 +1,13 @@ +TEMPLATE=app +CONFIG -= qt separate_debug_info +LIBS = +QT = +QMAKE_LINK = @: dummy + +sources.files = \ + CalcButton.qml \ + calculator.js \ + calculator.qml +sources.path = $$[QT_INSTALL_DEMOS]/declarative/calculator +INSTALLS = sources + diff --git a/demos/declarative/declarative.pro b/demos/declarative/declarative.pro new file mode 100644 index 0000000..037ad85 --- /dev/null +++ b/demos/declarative/declarative.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs +SUBDIRS = calculator \ + flickr \ + minehunt \ + samegame \ + snake \ + twitter \ + webbrowser + diff --git a/demos/declarative/flickr/flickr.pro b/demos/declarative/flickr/flickr.pro new file mode 100644 index 0000000..c4c1d44 --- /dev/null +++ b/demos/declarative/flickr/flickr.pro @@ -0,0 +1,16 @@ +TEMPLATE=app +CONFIG -= qt separate_debug_info +LIBS = +QT = +QMAKE_LINK = @: dummy + +sources.files = \ + flickr-desktop.qml \ + flickr-mobile-90.qml \ + flickr-mobile.qml \ + common \ + mobile + +sources.path = $$[QT_INSTALL_DEMOS]/declarative/flickr +INSTALLS = sources + diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index a497b0f..2f9a8ad 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -9,3 +9,17 @@ DESTDIR = MinehuntCore # Input SOURCES += minehunt.cpp + +sources.files = minehunt.qml +sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt + +target.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore + +MinehuntCore_sources.files = \ + MinehuntCore/Explosion.qml \ + MinehuntCore/pics \ + MinehuntCore/qmldir +MinehuntCore_sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore + +INSTALLS = sources MinehuntCore_sources target + diff --git a/demos/declarative/snake/snake.pro b/demos/declarative/snake/snake.pro new file mode 100644 index 0000000..a206fd4 --- /dev/null +++ b/demos/declarative/snake/snake.pro @@ -0,0 +1,13 @@ +TEMPLATE=app +CONFIG -= qt separate_debug_info +LIBS = +QT = +QMAKE_LINK = @: dummy + +sources.files = \ + content \ + snake.qml + +sources.path = $$[QT_INSTALL_DEMOS]/declarative/snake +INSTALLS = sources + diff --git a/demos/declarative/twitter/twitter.pro b/demos/declarative/twitter/twitter.pro new file mode 100644 index 0000000..e1dd821 --- /dev/null +++ b/demos/declarative/twitter/twitter.pro @@ -0,0 +1,13 @@ +TEMPLATE=app +CONFIG -= qt separate_debug_info +LIBS = +QT = +QMAKE_LINK = @: dummy + +sources.files = \ + TwitterCore \ + twitter.qml + +sources.path = $$[QT_INSTALL_DEMOS]/declarative/twitter +INSTALLS = sources + diff --git a/demos/declarative/webbrowser/webbrowser.pro b/demos/declarative/webbrowser/webbrowser.pro new file mode 100644 index 0000000..c033ef9 --- /dev/null +++ b/demos/declarative/webbrowser/webbrowser.pro @@ -0,0 +1,13 @@ +TEMPLATE=app +CONFIG -= qt separate_debug_info +LIBS = +QT = +QMAKE_LINK = @: dummy + +sources.files = \ + content \ + webbrowser.qml + +sources.path = $$[QT_INSTALL_DEMOS]/declarative/webbrowser +INSTALLS = sources + diff --git a/demos/demos.pro b/demos/demos.pro index 4c2318c..83e9355 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -56,6 +56,7 @@ wince*:SUBDIRS += demos_sqlbrowser contains(QT_CONFIG, phonon):!static:SUBDIRS += demos_mediaplayer contains(QT_CONFIG, webkit):contains(QT_CONFIG, svg):!symbian:SUBDIRS += demos_browser contains(QT_CONFIG, multimedia):SUBDIRS += demos_multimedia +contains(QT_CONFIG, declarative):SUBDIRS += demos_declarative # install sources.files = README *.pro @@ -84,6 +85,7 @@ demos_undo.subdir = undo demos_qtdemo.subdir = qtdemo demos_mediaplayer.subdir = qmediaplayer demos_multimedia.subdir = multimedia +demos_declarative.subdir = declarative demos_browser.subdir = browser diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 2739ab8..a20d6bc 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -127,7 +127,6 @@ QT_BEGIN_NAMESPACE QDeclarativeImage::QDeclarativeImage(QDeclarativeItem *parent) : QDeclarativeImageBase(*(new QDeclarativeImagePrivate), parent) { - connect(this, SIGNAL(pixmapChanged()), this, SLOT(updatePaintedGeometry())); } QDeclarativeImage::QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent) @@ -172,7 +171,7 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) status = pix.isNull() ? QDeclarativeImageBase::Null : QDeclarativeImageBase::Ready; q->update(); - emit q->pixmapChanged(); + q->pixmapChange(); } /*! @@ -384,4 +383,10 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi } } +void QDeclarativeImage::pixmapChange() +{ + updatePaintedGeometry(); + QDeclarativeImageBase::pixmapChange(); +} + QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index fb77ac9..7394774 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -85,6 +85,7 @@ Q_SIGNALS: protected: QDeclarativeImage(QDeclarativeImagePrivate &dd, QDeclarativeItem *parent); void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + void pixmapChange(); protected Q_SLOTS: void updatePaintedGeometry(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index a8cce3f..0e9638d 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent) : QDeclarativeItem(dd, parent) { - setFlag(QGraphicsItem::ItemHasNoContents, false); } QDeclarativeImageBase::~QDeclarativeImageBase() @@ -131,7 +130,7 @@ void QDeclarativeImageBase::load() setImplicitWidth(0); setImplicitHeight(0); emit statusChanged(d->status); - emit pixmapChanged(); + pixmapChange(); update(); } else { d->status = Loading; @@ -173,7 +172,7 @@ void QDeclarativeImageBase::load() d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(d->progress); - emit pixmapChanged(); + pixmapChange(); update(); } } @@ -197,7 +196,7 @@ void QDeclarativeImageBase::requestFinished() d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(1.0); - emit pixmapChanged(); + pixmapChange(); update(); } @@ -218,4 +217,9 @@ void QDeclarativeImageBase::componentComplete() load(); } +void QDeclarativeImageBase::pixmapChange() +{ + emit pixmapChanged(); +} + QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index c8c50ac..cfebdca 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -81,6 +81,7 @@ Q_SIGNALS: protected: virtual void load(); virtual void componentComplete(); + virtual void pixmapChange(); QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent); private Q_SLOTS: diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index 2e062a8..c4a61f3 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -71,6 +71,7 @@ public: pendingPixmapCache(false), async(false) { + QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } QPixmap pix; diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 05fe0f7..207d05e 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -180,9 +180,6 @@ void QDeclarativeGradient::doUpdate() QDeclarativeRectangle::QDeclarativeRectangle(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRectanglePrivate), parent) { - Q_D(QDeclarativeRectangle); - d->init(); - setFlag(QGraphicsItem::ItemHasNoContents, false); } void QDeclarativeRectangle::doUpdate() diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h index b87c57f..6bae219 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h @@ -67,6 +67,7 @@ public: QDeclarativeRectanglePrivate() : color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0) { + QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } ~QDeclarativeRectanglePrivate() @@ -74,13 +75,13 @@ public: delete pen; } - void init() - { - } - - QColor getColor(); QColor color; QDeclarativeGradient *gradient; + QDeclarativePen *pen; + qreal radius; + qreal paintmargin; + QPixmap rectImage; + QDeclarativePen *getPen() { if (!pen) { Q_Q(QDeclarativeRectangle); @@ -89,10 +90,6 @@ public: } return pen; } - QDeclarativePen *pen; - qreal radius; - qreal paintmargin; - QPixmap rectImage; void setPaintMargin(qreal margin) { diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index ca253df..05139f6 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -110,8 +110,6 @@ QT_BEGIN_NAMESPACE QDeclarativeText::QDeclarativeText(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeTextPrivate), parent) { - setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, false); } QDeclarativeText::~QDeclarativeText() diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index a0c8abe..0d9a0a6 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -70,14 +70,16 @@ class QDeclarativeTextPrivate : public QDeclarativeItemPrivate Q_DECLARE_PUBLIC(QDeclarativeText) public: QDeclarativeTextPrivate() - : color((QRgb)0), style(QDeclarativeText::Normal), imgDirty(true), + : color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), - dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0), + imgDirty(true), dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0), format(QDeclarativeText::AutoText) { #if defined(QML_NO_TEXT_CACHE) cache = false; #endif + QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; + QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } ~QDeclarativeTextPrivate(); @@ -106,12 +108,12 @@ public: QDeclarativeText::TextStyle style; QColor styleColor; QString activeLink; - bool imgDirty; QPixmap imgCache; QPixmap imgStyleCache; QDeclarativeText::HAlignment hAlign; QDeclarativeText::VAlignment vAlign; - QDeclarativeText::TextElideMode elideMode; + QDeclarativeText::TextElideMode elideMode; + bool imgDirty:1; bool dirty:1; bool wrap:1; bool richText:1; diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 4f9f21a..9adbc28 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -127,7 +127,7 @@ void tst_QDeclarativeWorkerScript::messaging() QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value); qApp->processEvents(); - delete item; + delete worker; } void tst_QDeclarativeWorkerScript::messaging_data() @@ -164,7 +164,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendQObjectList() QCOMPARE(result, (QVariantList() << QVariant() << QVariant() << QVariant())); qApp->processEvents(); - delete item; + delete worker; } void tst_QDeclarativeWorkerScript::messaging_sendJsObject() @@ -190,7 +190,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject() QVERIFY(result.toBool()); qApp->processEvents(); - delete item; + delete worker; } QTEST_MAIN(tst_QDeclarativeWorkerScript) diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 4319208..5b0004f 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -163,6 +163,8 @@ void tst_creation::objects_qmltype() { QFETCH(QByteArray, type); QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6); + if (!t || !t->isCreatable()) + QSKIP("Non-creatable type", SkipSingle); QBENCHMARK { QObject *obj = t->create(); |