summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/debugger/qmldebug.cpp1
-rw-r--r--src/declarative/extra/extra.pri6
-rw-r--r--src/declarative/extra/qmlfontloader.cpp (renamed from src/declarative/util/qmlfontfamily.cpp)64
-rw-r--r--src/declarative/extra/qmlfontloader.h (renamed from src/declarative/util/qmlfontfamily.h)18
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp9
-rw-r--r--src/declarative/qml/qmlenginedebug_p.h1
-rw-r--r--src/declarative/util/util.pri2
7 files changed, 54 insertions, 47 deletions
diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp
index 8309ec6..9397bb9 100644
--- a/src/declarative/debugger/qmldebug.cpp
+++ b/src/declarative/debugger/qmldebug.cpp
@@ -103,6 +103,7 @@ void QmlEngineDebugPrivate::decode(QDataStream &ds, QmlDebugObjectReference &o,
ds >> data;
QmlDebugPropertyReference prop;
prop.m_name = data.name;
+ prop.m_binding = data.binding;
if (data.type == QmlEngineDebugServer::QmlObjectProperty::Basic)
prop.m_value = data.value;
else if (data.type == QmlEngineDebugServer::QmlObjectProperty::Object) {
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri
index d3ce7eb..1f84406 100644
--- a/src/declarative/extra/extra.pri
+++ b/src/declarative/extra/extra.pri
@@ -8,7 +8,8 @@ SOURCES += \
extra/qfxflowview.cpp \
extra/qfxparticles.cpp \
extra/qmlbehaviour.cpp \
- extra/qbindablemap.cpp
+ extra/qbindablemap.cpp \
+ extra/qmlfontloader.cpp
HEADERS += \
extra/qnumberformat.h \
@@ -21,7 +22,8 @@ HEADERS += \
extra/qfxflowview.h \
extra/qfxparticles.h \
extra/qmlbehaviour.h \
- extra/qbindablemap.h
+ extra/qbindablemap.h \
+ extra/qmlfontloader.h
contains(QT_CONFIG, xmlpatterns) {
QT+=xmlpatterns
diff --git a/src/declarative/util/qmlfontfamily.cpp b/src/declarative/extra/qmlfontloader.cpp
index 73688c1..2f54f24 100644
--- a/src/declarative/util/qmlfontfamily.cpp
+++ b/src/declarative/extra/qmlfontloader.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "private/qobject_p.h"
-#include "qmlfontfamily.h"
+#include "qmlfontloader.h"
#include <QUrl>
#include <QDebug>
#include <QNetworkRequest>
@@ -52,59 +52,59 @@
QT_BEGIN_NAMESPACE
-class QmlFontFamilyPrivate : public QObjectPrivate
+class QmlFontLoaderPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QmlFontFamily);
+ Q_DECLARE_PUBLIC(QmlFontLoader);
public:
- QmlFontFamilyPrivate() : reply(0), status(QmlFontFamily::Null) {}
+ QmlFontLoaderPrivate() : reply(0), status(QmlFontLoader::Null) {}
void addFontToDatabase(const QByteArray &);
QUrl url;
QString name;
QNetworkReply *reply;
- QmlFontFamily::Status status;
+ QmlFontLoader::Status status;
};
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FontFamily,QmlFontFamily)
+QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FontLoader,QmlFontLoader)
/*!
- \qmlclass FontFamily QmlFontFamily
+ \qmlclass FontLoader QmlFontLoader
\ingroup group_utility
\brief This item allows using fonts by name or url.
Example:
\code
- FontFamily { id: FixedFont; name: "Courier" }
- FontFamily { id: WebFont; source: "http://www.mysite.com/myfont.ttf" }
+ FontLoader { id: FixedFont; name: "Courier" }
+ FontLoader { id: WebFont; source: "http://www.mysite.com/myfont.ttf" }
Text { text: "Fixed-size font"; font.family: FixedFont.name }
Text { text: "Fancy font"; font.family: WebFont.name }
\endcode
*/
-QmlFontFamily::QmlFontFamily(QObject *parent)
- : QObject(*(new QmlFontFamilyPrivate), parent)
+QmlFontLoader::QmlFontLoader(QObject *parent)
+ : QObject(*(new QmlFontLoaderPrivate), parent)
{
}
-QmlFontFamily::~QmlFontFamily()
+QmlFontLoader::~QmlFontLoader()
{
}
/*!
- \qmlproperty url FontFamily::source
+ \qmlproperty url FontLoader::source
The url of the font to load.
*/
-QUrl QmlFontFamily::source() const
+QUrl QmlFontLoader::source() const
{
- Q_D(const QmlFontFamily);
+ Q_D(const QmlFontLoader);
return d->url;
}
-void QmlFontFamily::setSource(const QUrl &url)
+void QmlFontLoader::setSource(const QUrl &url)
{
- Q_D(QmlFontFamily);
+ Q_D(QmlFontLoader);
if (url == d->url)
return;
d->url = qmlContext(this)->resolvedUrl(url);
@@ -128,7 +128,7 @@ void QmlFontFamily::setSource(const QUrl &url)
}
/*!
- \qmlproperty string FontFamily::name
+ \qmlproperty string FontLoader::name
This property holds the name of the font family.
It is set automatically when a font is loaded using the \c url property.
@@ -137,19 +137,19 @@ void QmlFontFamily::setSource(const QUrl &url)
Example:
\qml
- FontFamily { id: WebFont; source: "http://www.mysite.com/myfont.ttf" }
+ FontLoader { id: WebFont; source: "http://www.mysite.com/myfont.ttf" }
Text { text: "Fancy font"; font.family: WebFont.name }
\endqml
*/
-QString QmlFontFamily::name() const
+QString QmlFontLoader::name() const
{
- Q_D(const QmlFontFamily);
+ Q_D(const QmlFontLoader);
return d->name;
}
-void QmlFontFamily::setName(const QString &name)
+void QmlFontLoader::setName(const QString &name)
{
- Q_D(QmlFontFamily);
+ Q_D(QmlFontLoader);
if (d->name == name )
return;
d->name = name;
@@ -157,7 +157,7 @@ void QmlFontFamily::setName(const QString &name)
}
/*!
- \qmlproperty enum FontFamily::status
+ \qmlproperty enum FontLoader::status
This property holds the status of font loading. It can be one of:
\list
@@ -167,15 +167,15 @@ void QmlFontFamily::setName(const QString &name)
\o Error - an error occurred while loading the font
\endlist
*/
-QmlFontFamily::Status QmlFontFamily::status() const
+QmlFontLoader::Status QmlFontLoader::status() const
{
- Q_D(const QmlFontFamily);
+ Q_D(const QmlFontLoader);
return d->status;
}
-void QmlFontFamily::replyFinished()
+void QmlFontLoader::replyFinished()
{
- Q_D(QmlFontFamily);
+ Q_D(QmlFontLoader);
if (!d->reply->error()) {
QByteArray ba = d->reply->readAll();
d->addFontToDatabase(ba);
@@ -187,17 +187,17 @@ void QmlFontFamily::replyFinished()
d->reply = 0;
}
-void QmlFontFamilyPrivate::addFontToDatabase(const QByteArray &ba)
+void QmlFontLoaderPrivate::addFontToDatabase(const QByteArray &ba)
{
- Q_Q(QmlFontFamily);
+ Q_Q(QmlFontLoader);
int id = QFontDatabase::addApplicationFontFromData(ba);
if (id != -1) {
name = QFontDatabase::applicationFontFamilies(id).at(0);
emit q->nameChanged();
- status = QmlFontFamily::Ready;
+ status = QmlFontLoader::Ready;
} else {
- status = QmlFontFamily::Error;
+ status = QmlFontLoader::Error;
qWarning() << "Cannot load font: " << name << url;
}
emit q->statusChanged();
diff --git a/src/declarative/util/qmlfontfamily.h b/src/declarative/extra/qmlfontloader.h
index 17b6635..c2c7a16 100644
--- a/src/declarative/util/qmlfontfamily.h
+++ b/src/declarative/extra/qmlfontloader.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QMLFONTFAMILY_H
-#define QMLFONTFAMILY_H
+#ifndef QMLFONTLOADER_H
+#define QMLFONTLOADER_H
#include <QtCore/qobject.h>
#include <QtDeclarative/qml.h>
@@ -51,11 +51,11 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QmlFontFamilyPrivate;
-class Q_DECLARATIVE_EXPORT QmlFontFamily : public QObject
+class QmlFontLoaderPrivate;
+class Q_DECLARATIVE_EXPORT QmlFontLoader : public QObject
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QmlFontFamily)
+ Q_DECLARE_PRIVATE(QmlFontLoader)
Q_ENUMS(Status)
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
@@ -65,8 +65,8 @@ class Q_DECLARATIVE_EXPORT QmlFontFamily : public QObject
public:
enum Status { Null = 0, Ready, Loading, Error };
- QmlFontFamily(QObject *parent = 0);
- ~QmlFontFamily();
+ QmlFontLoader(QObject *parent = 0);
+ ~QmlFontLoader();
QUrl source() const;
void setSource(const QUrl &url);
@@ -86,9 +86,9 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QmlFontFamily)
+QML_DECLARE_TYPE(QmlFontLoader)
QT_END_HEADER
-#endif // QMLFONTFAMILY_H
+#endif // QMLFONTLOADER_H
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 2b8aac3..c26f3b7 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -44,6 +44,8 @@
#include <QtCore/qmetaobject.h>
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlmetatype.h>
+#include <qmlmetaproperty.h>
+#include <qmlbinding.h>
#include "qmlcontext_p.h"
QT_BEGIN_NAMESPACE
@@ -73,7 +75,7 @@ QDataStream &operator>>(QDataStream &ds,
QDataStream &operator<<(QDataStream &ds,
const QmlEngineDebugServer::QmlObjectProperty &data)
{
- ds << (int)data.type << data.name << data.value;
+ ds << (int)data.type << data.name << data.value << data.binding;
return ds;
}
@@ -81,7 +83,7 @@ QDataStream &operator>>(QDataStream &ds,
QmlEngineDebugServer::QmlObjectProperty &data)
{
int type;
- ds >> type >> data.name >> data.value;
+ ds >> type >> data.name >> data.value >> data.binding;
data.type = (QmlEngineDebugServer::QmlObjectProperty::Type)type;
return ds;
}
@@ -95,6 +97,9 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
rv.type = QmlObjectProperty::Unknown;
rv.name = prop.name();
+ QmlBinding *binding = QmlMetaProperty(obj, rv.name).binding();
+ if (binding)
+ rv.binding = binding->expression();
if (prop.type() < QVariant::UserType) {
rv.type = QmlObjectProperty::Basic;
diff --git a/src/declarative/qml/qmlenginedebug_p.h b/src/declarative/qml/qmlenginedebug_p.h
index e85ab6f..87b2ffd 100644
--- a/src/declarative/qml/qmlenginedebug_p.h
+++ b/src/declarative/qml/qmlenginedebug_p.h
@@ -81,6 +81,7 @@ public:
Type type;
QString name;
QVariant value;
+ QString binding;
};
static void addEngine(QmlEngine *);
diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri
index dfb79ac..59e3695 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -7,7 +7,6 @@ SOURCES += \
util/qmlscript.cpp \
util/qmlanimation.cpp \
util/qmlfont.cpp \
- util/qmlfontfamily.cpp \
util/qmlpalette.cpp \
util/qmlfollow.cpp \
util/qmlstate.cpp\
@@ -34,7 +33,6 @@ HEADERS += \
util/qmlanimation.h \
util/qmlanimation_p.h \
util/qmlfont.h \
- util/qmlfontfamily.h \
util/qmlpalette.h \
util/qmlfollow.h \
util/qmlstate.h\