summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 03:09:22 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-30 03:09:22 (GMT)
commit0282ea19722c247157c652ef9122379f0e715497 (patch)
tree9773641d150774bd8e66e87e33e5e8899a6a4a9c /src/declarative/util
parentd85c0c07b72476d801db3f1cb622cb32ab50dcc4 (diff)
parente3c91e87a06b73a06c86f93c69951768874bbaf6 (diff)
downloadQt-0282ea19722c247157c652ef9122379f0e715497.zip
Qt-0282ea19722c247157c652ef9122379f0e715497.tar.gz
Qt-0282ea19722c247157c652ef9122379f0e715497.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: src/declarative/qml/parser/javascriptgrammar.cpp src/declarative/qml/parser/javascriptgrammar_p.h
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qfxview.cpp54
-rw-r--r--src/declarative/util/qfxview.h1
-rw-r--r--src/declarative/util/qmlscript.h2
-rw-r--r--src/declarative/util/qmlstate.cpp1
4 files changed, 51 insertions, 7 deletions
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp
index 1e9d5a4..42047b6 100644
--- a/src/declarative/util/qfxview.cpp
+++ b/src/declarative/util/qfxview.cpp
@@ -49,6 +49,7 @@
#include "qicon.h"
#include "qurl.h"
#include "qboxlayout.h"
+#include "qbasictimer.h"
#include "qmlbindablevalue.h"
#include "qml.h"
@@ -100,6 +101,8 @@ public:
QmlEngine engine;
QmlComponent *component;
+ QBasicTimer resizetimer;
+
void init();
};
@@ -107,10 +110,10 @@ public:
\class QFxView
\brief The QFxView class provides a widget for displaying a Qt Declarative user interface.
- QFxView currently provides a minimal interface for displaying Qml files, and
- connecting between QML and C++ Qt objects.
+ QFxView currently provides a minimal interface for displaying QML
+ files, and connecting between QML and C++ Qt objects.
- Typcial usage looks something like this:
+ Typcial usage:
\code
...
QFxView *view = new QFxView(this);
@@ -129,12 +132,24 @@ public:
\endcode
*/
+/*!
+ \fn QFxView::QFxView(QWidget *parent)
+
+ Constructs a QFxView with the given \a parent.
+*/
QFxView::QFxView(QWidget *parent)
: QSimpleCanvas(parent), d(new QFxViewPrivate(this))
{
d->init();
}
+/*!
+ \fn QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent)
+
+ Constructs a QFxView with the given \a parent. The canvas
+ \a mode can be QSimpleCanvas::GraphicsView or
+ QSimpleCanvas::SimpleCanvas.
+*/
QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent)
: QSimpleCanvas(mode, parent), d(new QFxViewPrivate(this))
{
@@ -157,29 +172,49 @@ void QFxViewPrivate::init()
QFontDatabase database;
}
+/*!
+ The destructor clears the instance and deletes the internal
+ representation.
+
+ \sa clearItems()
+ */
QFxView::~QFxView()
{
clearItems();
delete d; d = 0;
}
+/*!
+ Sets the source to the \a url. The XML string is set to
+ empty.
+ */
void QFxView::setUrl(const QUrl& url)
{
d->source = url;
d->xml = QString();
}
+/*!
+ Sets the source to the URL from the \a filename, and sets
+ the XML string to \a xml.
+ */
void QFxView::setXml(const QString &xml, const QString &filename)
{
d->source = QUrl::fromLocalFile(filename);
d->xml = xml;
}
+/*!
+ Returns the XML string.
+ */
QString QFxView::xml() const
{
return d->xml;
}
+/*!
+ Returns a pointer to the QmlEngine.
+ */
QmlEngine* QFxView::engine()
{
return &d->engine;
@@ -250,8 +285,17 @@ void QFxView::continueExecute()
void QFxView::sizeChanged()
{
- if (d->root)
- emit sceneResized(QSize(d->root->width(),d->root->height()));
+ // delay, so we catch both width and height changing.
+ d->resizetimer.start(0,this);
+}
+
+void QFxView::timerEvent(QTimerEvent* e)
+{
+ if (e->timerId() == d->resizetimer.timerId()) {
+ if (d->root)
+ emit sceneResized(QSize(d->root->width(),d->root->height()));
+ d->resizetimer.stop();
+ }
}
QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent)
diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h
index 3c4be20..c658f07 100644
--- a/src/declarative/util/qfxview.h
+++ b/src/declarative/util/qfxview.h
@@ -95,6 +95,7 @@ protected:
virtual void resizeEvent(QResizeEvent *);
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
+ void timerEvent(QTimerEvent*);
private:
friend class QFxViewPrivate;
diff --git a/src/declarative/util/qmlscript.h b/src/declarative/util/qmlscript.h
index fc038b4..8047a88 100644
--- a/src/declarative/util/qmlscript.h
+++ b/src/declarative/util/qmlscript.h
@@ -58,7 +58,7 @@ class Q_DECLARATIVE_EXPORT QmlScript : public QObject
Q_DECLARE_PRIVATE(QmlScript);
Q_PROPERTY(QString script READ script WRITE setScript);
- Q_PROPERTY(QString src READ source WRITE setSource);
+ Q_PROPERTY(QString source READ source WRITE setSource);
Q_CLASSINFO("DefaultProperty", "script");
public:
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 5850a97..cd33f5e 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -175,7 +175,6 @@ void QmlState::setWhen(QmlBindableValue *when)
}
/*!
- \advanced
\qmlproperty string State::extends
This property holds the state that this state extends