From 7da9f68edd7819e15f33fd5803beb5f4544700ae Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 27 Aug 2009 14:14:00 +1000 Subject: Add internal note. --- src/declarative/qml/qmlmetaproperty.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index cc5e4ee..1e8ce91 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -532,7 +532,7 @@ QmlAbstractBinding *QmlMetaProperty::binding() const QmlAbstractBinding *binding = data->bindings; while (binding) { // ### This wont work for value types - if (binding->propertyIndex() == d->coreIdx) + if (binding->propertyIndex() == d->coreIdx) //### should we check for enabled? return binding; binding = binding->m_nextBinding; } -- cgit v0.12 From b99fd8c53ed7ed73d9bab171918829ba0911810a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 27 Aug 2009 15:33:12 +1000 Subject: Fix glitches when dragging a ListView. --- src/declarative/fx/qfxflickable.cpp | 19 ++++--------------- src/declarative/fx/qfxlistview.cpp | 3 ++- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 428815a..440c1ca 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -607,7 +607,6 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) { Q_Q(QFxFlickable); - pressed = false; if (lastPosTime.isNull()) return; @@ -871,13 +870,8 @@ void QFxFlickable::setViewportWidth(int w) else d->_flick->setWidth(w); // Make sure that we're entirely in view. - if (d->_moveX.value() > minXExtent() || maxXExtent() > 0) { - d->_tl.clear(); - d->_moveX.setValue(minXExtent()); - } else if (d->_moveX.value() < maxXExtent()) { - d->_tl.clear(); - d->_moveX.setValue(maxXExtent()); - } + if (!d->pressed) + d->fixupX(); emit viewportWidthChanged(); d->updateBeginningEnd(); } @@ -919,13 +913,8 @@ void QFxFlickable::setViewportHeight(int h) else d->_flick->setHeight(h); // Make sure that we're entirely in view. - if (d->_moveY.value() > minYExtent() || maxYExtent() > 0) { - d->_tl.clear(); - d->_moveY.setValue(minYExtent()); - } else if (d->_moveY.value() < maxYExtent()) { - d->_tl.clear(); - d->_moveY.setValue(maxYExtent()); - } + if (!d->pressed) + d->fixupY(); emit viewportHeightChanged(); d->updateBeginningEnd(); } diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 4030a0b..0dfdce8 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1396,13 +1396,14 @@ void QFxListView::trackedPositionChanged() case Free: if (d->trackedItem->position() < d->position()) { d->setPosition(d->trackedItem->position()); + d->fixupPosition(); } else if (d->trackedItem->endPosition() > d->position() + d->size()) { qreal pos = d->trackedItem->endPosition() - d->size(); if (d->trackedItem->size() > d->size()) pos = d->trackedItem->position(); d->setPosition(pos); + d->fixupPosition(); } - d->fixupPosition(); break; case Snap: if (d->trackedItem->position() < d->startPosition() + d->snapPos) -- cgit v0.12 From 09c662b1c3440d7ff0b151d1fd10fc19ef75725f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 27 Aug 2009 15:51:46 +1000 Subject: Start adding convenience functions for value types. Allows you to write things like "geometry: Qt.rect(0,0,100,100)" and "color: Qt.hsla(.7,.5,.2)" --- src/declarative/qml/qmlengine.cpp | 66 +++++++++++++++- src/declarative/qml/qmlengine_p.h | 5 ++ tests/auto/declarative/qmlengine/functions.qml | 6 ++ tests/auto/declarative/qmlengine/tst_qmlengine.cpp | 87 ++++++++++++++++++---- 4 files changed, 145 insertions(+), 19 deletions(-) create mode 100644 tests/auto/declarative/qmlengine/functions.qml diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index ea00d65..fbd9cf1 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include "private/qmlcomponentjs_p.h" @@ -104,6 +105,12 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) QScriptValue qtObject = scriptEngine.newQMetaObject(StaticQtMetaObject::get()); scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject); + qtObject.setProperty(QLatin1String("rgba"), scriptEngine.newFunction(QmlEnginePrivate::rgba, 4)); + qtObject.setProperty(QLatin1String("hsla"), scriptEngine.newFunction(QmlEnginePrivate::hsla, 4)); + qtObject.setProperty(QLatin1String("rect"), scriptEngine.newFunction(QmlEnginePrivate::rect, 4)); + qtObject.setProperty(QLatin1String("point"), scriptEngine.newFunction(QmlEnginePrivate::point, 2)); + qtObject.setProperty(QLatin1String("size"), scriptEngine.newFunction(QmlEnginePrivate::size, 2)); + qtObject.setProperty(QLatin1String("vector3d"), scriptEngine.newFunction(QmlEnginePrivate::vector, 3)); } QmlEnginePrivate::~QmlEnginePrivate() @@ -160,7 +167,7 @@ void QmlEnginePrivate::init() scriptEngine.globalObject().setProperty(QLatin1String("createComponent"), scriptEngine.newFunction(QmlEnginePrivate::createComponent, 1)); scriptEngine.globalObject().setProperty(QLatin1String("vector"), - scriptEngine.newFunction(QmlEnginePrivate::vector, 1)); + scriptEngine.newFunction(QmlEnginePrivate::vector, 3)); if (QCoreApplication::instance()->thread() == q->thread() && QmlEngineDebugServer::isDebuggingEnabled()) { @@ -698,7 +705,7 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi QVector3D as usual. This function takes three numeric components and combines them into a - QMLJS string that can be used with any property that takes a + QVector3D value that can be used with any property that takes a QVector3D argument. The following QML code: \code @@ -729,6 +736,59 @@ QScriptValue QmlEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engin return engine->newVariant(qVariantFromValue(QVector3D(x, y, z))); } +QScriptValue QmlEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount < 3) + return engine->nullValue(); + qsreal r = ctxt->argument(0).toNumber(); + qsreal g = ctxt->argument(1).toNumber(); + qsreal b = ctxt->argument(2).toNumber(); + qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1; + return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a))); +} + +QScriptValue QmlEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine) +{ + int argCount = ctxt->argumentCount(); + if(argCount < 3) + return engine->nullValue(); + qsreal h = ctxt->argument(0).toNumber(); + qsreal s = ctxt->argument(1).toNumber(); + qsreal l = ctxt->argument(2).toNumber(); + qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1; + return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a))); +} + +QScriptValue QmlEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine) +{ + if(ctxt->argumentCount() < 4) + return engine->nullValue(); + qsreal x = ctxt->argument(0).toNumber(); + qsreal y = ctxt->argument(1).toNumber(); + qsreal w = ctxt->argument(2).toNumber(); + qsreal h = ctxt->argument(3).toNumber(); + return qScriptValueFromValue(engine, qVariantFromValue(QRectF(x, y, w, h))); +} + +QScriptValue QmlEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine) +{ + if(ctxt->argumentCount() < 2) + return engine->nullValue(); + qsreal x = ctxt->argument(0).toNumber(); + qsreal y = ctxt->argument(1).toNumber(); + return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y))); +} + +QScriptValue QmlEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine) +{ + if(ctxt->argumentCount() < 2) + return engine->nullValue(); + qsreal w = ctxt->argument(0).toNumber(); + qsreal h = ctxt->argument(1).toNumber(); + return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h))); +} + QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) : QScriptClass(QmlEnginePrivate::getScriptEngine(bindengine)), engine(bindengine) @@ -971,7 +1031,7 @@ QScriptValue QmlObjectToString(QScriptContext *context, QScriptEngine *engine) ret += QString::number((quintptr)obj,16); ret += QLatin1String(")"); }else{ - ret += "null"; + ret += QLatin1String("null"); } return engine->newVariant(ret); } diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 53b2967..c2de72b 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -214,6 +214,11 @@ public: static QScriptValue createComponent(QScriptContext*, QScriptEngine*); static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*); static QScriptValue vector(QScriptContext*, QScriptEngine*); + static QScriptValue rgba(QScriptContext*, QScriptEngine*); + static QScriptValue hsla(QScriptContext*, QScriptEngine*); + static QScriptValue point(QScriptContext*, QScriptEngine*); + static QScriptValue size(QScriptContext*, QScriptEngine*); + static QScriptValue rect(QScriptContext*, QScriptEngine*); static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; } static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); } diff --git a/tests/auto/declarative/qmlengine/functions.qml b/tests/auto/declarative/qmlengine/functions.qml new file mode 100644 index 0000000..28e8ed4 --- /dev/null +++ b/tests/auto/declarative/qmlengine/functions.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + rectProperty: Qt.rect(0,0,100,100) + rectFProperty: Qt.rect(0,0.5,100,99.5) +} diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp index 9a04c61..8c050cb 100644 --- a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp +++ b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include @@ -12,30 +14,83 @@ public: tst_qmlengine() {} private slots: - void componentSearchPath(); -}; + void valueTypeFunctions(); +private: + QmlEngine engine; +}; -void tst_qmlengine::componentSearchPath() +class MyTypeObject : public QObject { - QFile file(SRCDIR "/imports.qml"); - QVERIFY(file.open(QIODevice::ReadOnly)); + Q_OBJECT + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); + +public: + MyTypeObject() {} - QmlEngine engine; + QPoint pointPropertyValue; + QPoint pointProperty() const { + return pointPropertyValue; + } + void setPointProperty(const QPoint &v) { + pointPropertyValue = v; + } - QList searchPath = engine.componentSearchPath(file.readAll(), - QUrl::fromLocalFile(file.fileName())); + QPointF pointFPropertyValue; + QPointF pointFProperty() const { + return pointFPropertyValue; + } + void setPointFProperty(const QPointF &v) { + pointFPropertyValue = v; + } - QList expected; - expected << QUrl::fromLocalFile(SRCDIR); - expected << QUrl::fromLocalFile(file.fileName()).resolved(QUrl("import1")); - expected << QUrl::fromLocalFile(file.fileName()).resolved(QUrl("import2")); + QSize sizePropertyValue; + QSize sizeProperty() const { + return sizePropertyValue; + } + void setSizeProperty(const QSize &v) { + sizePropertyValue = v; + } - QCOMPARE(searchPath.size(), expected.size()); - for (int i = 0; i < expected.size(); ++i) { - QCOMPARE(searchPath.at(i).toString(QUrl::StripTrailingSlash), - expected.at(i).toString(QUrl::StripTrailingSlash)); + QSizeF sizeFPropertyValue; + QSizeF sizeFProperty() const { + return sizeFPropertyValue; } + void setSizeFProperty(const QSizeF &v) { + sizeFPropertyValue = v; + } + + QRect rectPropertyValue; + QRect rectProperty() const { + return rectPropertyValue; + } + void setRectProperty(const QRect &v) { + rectPropertyValue = v; + } + + QRectF rectFPropertyValue; + QRectF rectFProperty() const { + return rectFPropertyValue; + } + void setRectFProperty(const QRectF &v) { + rectFPropertyValue = v; + } + +}; +QML_DECLARE_TYPE(MyTypeObject); +QML_DEFINE_TYPE(Test, 1, 0, 0, MyTypeObject, MyTypeObject); + +void tst_qmlengine::valueTypeFunctions() +{ + QmlComponent component(&engine, SRCDIR "/functions.qml"); + MyTypeObject *obj = qobject_cast(component.create()); + QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); + QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); } QTEST_MAIN(tst_qmlengine) -- cgit v0.12 From f80f58b857d1fa9ad53ba6780daaaafa1c4b1111 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 27 Aug 2009 17:07:12 +1000 Subject: Make sure current item is released when removed but not visible. --- src/declarative/fx/qfxgridview.cpp | 5 +++-- src/declarative/fx/qfxlistview.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index b429895..bf6e863 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -1254,6 +1254,7 @@ void QFxGridView::itemsInserted(int modelIndex, int count) void QFxGridView::itemsRemoved(int modelIndex, int count) { Q_D(QFxGridView); + bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; int index = d->mapFromModel(modelIndex); if (index == -1) { if (modelIndex + count - 1 < d->visibleIndex) { @@ -1269,7 +1270,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. d->releaseItem(d->currentItem); d->currentItem = 0; @@ -1311,7 +1312,7 @@ void QFxGridView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. d->releaseItem(d->currentItem); d->currentItem = 0; diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 0dfdce8..c1e03dd 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1522,6 +1522,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) { Q_D(QFxListView); d->updateUnrequestedIndexes(); + bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; if (!d->mapRangeFromModel(modelIndex, count)) { if (modelIndex + count - 1 < d->visibleIndex) { // Items removed before our visible items. @@ -1536,7 +1537,7 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. d->releaseItem(d->currentItem); d->currentItem = 0; @@ -1579,8 +1580,9 @@ void QFxListView::itemsRemoved(int modelIndex, int count) d->currentIndex -= count; if (d->currentItem) d->currentItem->index -= count; - } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { + } else if (currentRemoved) { // current item has been removed. + d->currentItem->attached->setIsCurrentItem(false); d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; -- cgit v0.12 From 2d384efd8e85515c9f3e7ed628cc3fd57b044a00 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 27 Aug 2009 17:44:17 +1000 Subject: Revert "Fix setting the id property" This reverts commit f51450571addf2cb9a55153b209b8c1a45898193. We apparently do not want to either make the id easily accessible or have a special case the turns things into strings. And the autotests are all broken anyways - fixing something only they use isn't important --- src/declarative/qml/qmlcompiler.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 764699e..070add7 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1235,13 +1235,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, // default property or to sub-objects (which are always in binding // sub-contexts) COMPILE_CHECK(buildIdProperty(prop, obj)); - if (prop->type == QVariant::String){ - if(!prop->values.at(0)->value.isString()){ - //Need to convert to string to assign to the QString id property - prop->values.at(0)->value = Variant(prop->values.at(0)->value.asString()); - } + if (prop->type == QVariant::String && + prop->values.at(0)->value.isString()) COMPILE_CHECK(buildPropertyAssignment(prop, obj, ctxt)); - } } else if (isAttachedPropertyName(prop->name)) { @@ -1702,7 +1698,7 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop, // children: [ Item {}, Item {} ] // } // -// We allow assigning multiple values to single value properties +// We allow assignming multiple values to single value properties bool QmlCompiler::buildPropertyAssignment(QmlParser::Property *prop, QmlParser::Object *obj, const BindingContext &ctxt) -- cgit v0.12 From 1975260b35906a3cc0ca25f25b553e4572238e05 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 27 Aug 2009 18:12:33 +1000 Subject: Expose some functionality through Qt.DesktopServices Only openUrl() currently. Reviewed-by:Aaron Kennedy --- src/declarative/qml/qmlengine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index ea00d65..cf90fe7 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +96,14 @@ struct StaticQtMetaObject : public QObject { return &static_cast (0)->staticQtMetaObject; } }; +QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) +{ + if(!ctxt->argumentCount()) + return e->newVariant(QVariant(false)); + bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString())); + return e->newVariant(QVariant(ret)); +} + QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) : rootContext(0), currentBindContext(0), currentExpression(0), isDebugging(false), contextClass(0), objectClass(0), valueTypeClass(0), @@ -103,6 +112,9 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) { QScriptValue qtObject = scriptEngine.newQMetaObject(StaticQtMetaObject::get()); + QScriptValue desktopObject = scriptEngine.newObject(); + desktopObject.setProperty(QLatin1String("openUrl"),scriptEngine.newFunction(desktopOpenUrl, 1)); + qtObject.setProperty(QLatin1String("DesktopServices"), desktopObject); scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject); } -- cgit v0.12 From dd60bef7c93a09a92228574bade084d520e711f9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 27 Aug 2009 18:16:53 +1000 Subject: Flickr tweak for more generic components Using TitleBar in twitter too, this slight change prevents a copy of the whole component. --- demos/declarative/flickr/mobile/TitleBar.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 6d655a6..49d670f 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -3,6 +3,8 @@ import Qt 4.6 Item { id: TitleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " BorderImage { source: "images/titlebar2.sci"; width: parent.width; height: parent.height + 14; y: -7 } Item { @@ -22,13 +24,14 @@ Item { anchors.leftMargin: 10; anchors.rightMargin: 10 anchors.verticalCenter: parent.verticalCenter elide: "ElideLeft" - text: (RssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + RssModel.tags) + text: (RssModel.tags=="" ? untaggedString : taggedString + RssModel.tags) font.bold: true; color: "white"; style: "Raised"; styleColor: "black" } Button { - id: TagButton; x: TitleBar.width - 50; y: 3; width: 45; height: 32; text: "..." + id: TagButton; x: TitleBar.width - 50; width: 45; height: 32; text: "..." onClicked: if (TitleBar.state == "Tags") accept(); else TitleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter } Item { -- cgit v0.12