From 8f8d8dde3cde7ed2bcf6af9e85f40ee551eaafce Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Fri, 24 May 2013 16:07:13 +0200 Subject: QmlProfiler: fix SceneGraph profiling Change-Id: I54c960f0b0da061816223a51795c83a9f9dd3f66 Reviewed-by: Kai Koehne --- src/qml/debugger/qqmlprofilerservice.cpp | 2 +- src/quick/scenegraph/qsgthreadedrenderloop.cpp | 2 +- tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp index 963a861821..0ba939cdca 100644 --- a/src/qml/debugger/qqmlprofilerservice.cpp +++ b/src/qml/debugger/qqmlprofilerservice.cpp @@ -105,7 +105,7 @@ QByteArray QQmlProfilerData::toByteArray() const case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break; // WindowsAnimations: update time case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break; - // WindowsRenderWindow: polish time, sync time, render time, swap time + // WindowsRenderWindow: polish time case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break; default:break; } diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index c4a9328ceb..bd69fd5464 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -1032,7 +1032,7 @@ void QSGThreadedRenderLoop::polishAndSync() polishTime, waitTime - polishTime, syncTime - waitTime, - timer.elapsed() - syncTime); + timer.nsecsElapsed() - syncTime); } #endif } diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 21fc48117f..e4f886f7ce 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -283,7 +283,7 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message) case QQmlProfilerClient::SceneGraphWindowsRenderShow: stream >> subtime_1 >> subtime_2 >> subtime_3; break; // WindowsAnimations: update time case QQmlProfilerClient::SceneGraphWindowsAnimations: stream >> subtime_1; break; - // WindowsRenderWindow: polish time, sync time, render time, swap time + // WindowsRenderWindow: polish time case QQmlProfilerClient::SceneGraphWindowsPolishFrame: stream >> subtime_1; break; } break; -- cgit v1.2.1 From bc824685c18ac15c70e095de540800312433de80 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 27 May 2013 09:37:33 +0200 Subject: Doc: Add Dialogs/Controls/Layouts in submodules section Change-Id: Ide4afaa74d73ea09cf329de593283c269ecdacb3 Reviewed-by: Jerome Pasion Reviewed-by: Shawn Rutledge --- src/quick/doc/src/qmltypereference.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index 7e49ac0f51..d580ba8c96 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -64,6 +64,12 @@ information about the concepts which are central to \c QtQuick. system for QML applications \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information + \li \l{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + interacting with system dialogs + \li \l{QtQuick.Controls 1.0}{Controls} - provides a set of reusable + UI components + \li \l{QtQuick.Layouts 1.0}{Layouts} - contains types that are used + to arrange items in the user interface \endlist \section1 Basic Types -- cgit v1.2.1 From 7ca40c0c10712851ec792ad0c846bd08d17f4654 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 27 May 2013 15:19:14 +0200 Subject: skip failing qquickanimatedimage mirror tests for now Failing on mac, which is a blocker for CI. Task-number: QTBUG-31370 Change-Id: Icb42bb5ae59510a8754de895070d7a3d08af2623 Reviewed-by: Sergio Ahumada --- tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 201287b2a8..73474afbd7 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -190,6 +190,9 @@ void tst_qquickanimatedimage::mirror_running() QImage frame0_expected = frame0.transformed(transform); QImage frame1_expected = frame1.transformed(transform); +#ifdef Q_OS_MAC + QSKIP("QTBUG-31370 - sometimes fails on Mac"); +#endif QCOMPARE(frame0_flipped, frame0_expected); QCOMPARE(frame1_flipped, frame1_expected); @@ -221,6 +224,9 @@ void tst_qquickanimatedimage::mirror_notRunning() anim->setProperty("mirror", true); screenshot = QPixmap::fromImage(window.grabWindow()); +#ifdef Q_OS_MAC + QSKIP("QTBUG-31370 - sometimes fails on Mac"); +#endif QCOMPARE(screenshot, expected); // mirroring should not change the current frame or playing status -- cgit v1.2.1 From bc94f56985992351af5403546751dde299489c52 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 27 May 2013 12:52:40 +0200 Subject: Update all plugins.qmltypes files Task-number: QTBUG-31388 Change-Id: I13a821a009c6c06f2c7fe7f7d28f1a579d69c8df Reviewed-by: Shawn Rutledge --- src/imports/qtquick2/plugins.qmltypes | 625 ++++++++++++++++++++++++---------- src/imports/window/plugins.qmltypes | 22 +- 2 files changed, 462 insertions(+), 185 deletions(-) diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index e5381629cc..cc619dc4ff 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -3,12 +3,20 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump -builtins'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable -builtins'. Module { Component { name: "QAbstractItemModel" prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } Signal { name: "dataChanged" Parameter { name: "topLeft"; type: "QModelIndex" } @@ -167,6 +175,7 @@ Module { name: "QInputMethod" prototype: "QObject" exports: ["QtQuick/InputMethod 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Action" values: { @@ -215,6 +224,7 @@ Module { Component { name: "QObject" exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "objectName"; type: "string" } Signal { name: "objectNameChanged" @@ -227,10 +237,27 @@ Module { Parameter { name: "delay"; type: "int" } } } + Component { + name: "QQmlApplication" + prototype: "QObject" + Property { name: "arguments"; type: "QStringList"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "version"; type: "string" } + Signal { name: "aboutToQuit" } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setVersion" + Parameter { name: "arg"; type: "string" } + } + } Component { name: "QQmlBind" prototype: "QObject" exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "value"; type: "QVariant" } @@ -244,6 +271,7 @@ Module { "QtQml/Component 2.0", "QtQuick/Component 2.0" ] + exportMetaObjectRevisions: [0, 0, 0] attachedType: "QQmlComponentAttached" Enum { name: "CompilationMode" @@ -298,13 +326,105 @@ Module { name: "QQmlConnections" prototype: "QObject" exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "ignoreUnknownSignals"; type: "bool" } } + Component { + name: "QQmlDelegateModel" + defaultProperty: "delegate" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualDataModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlDelegateModelAttached" + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "filterOnGroup"; type: "string" } + Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true } + Property { + name: "persistedItems" + type: "QQmlDelegateModelGroup" + isReadonly: true + isPointer: true + } + Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true } + Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "rootIndex"; type: "QVariant" } + Signal { name: "filterGroupChanged" } + Signal { name: "defaultGroupsChanged" } + Method { + name: "modelIndex" + type: "QVariant" + Parameter { name: "idx"; type: "int" } + } + Method { name: "parentModelIndex"; type: "QVariant" } + } + Component { + name: "QQmlDelegateModelAttached" + prototype: "QObject" + Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true } + Property { name: "groups"; type: "QStringList" } + Property { name: "isUnresolved"; type: "bool"; isReadonly: true } + Signal { name: "unresolvedChanged" } + } + Component { + name: "QQmlDelegateModelGroup" + prototype: "QObject" + exports: ["QtQuick/VisualDataGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "includeByDefault"; type: "bool" } + Signal { name: "defaultIncludeChanged" } + Signal { + name: "changed" + Parameter { name: "removed"; type: "QQmlV8Handle" } + Parameter { name: "inserted"; type: "QQmlV8Handle" } + } + Method { + name: "insert" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "create" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "resolve" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "remove" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "addGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "removeGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "setGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "move" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + } + Component { name: "QQmlDelegateModelParts"; prototype: "QObject" } Component { name: "QQmlEasingValueType" prototype: "QQmlValueType" exports: ["QtQuick/Easing 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Type" values: { @@ -362,9 +482,112 @@ Module { Property { name: "period"; type: "double" } Property { name: "bezierCurve"; type: "QVariantList" } } + Component { + name: "QQmlInstanceModel" + prototype: "QObject" + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "modelUpdated" + Parameter { name: "changeSet"; type: "QQmlChangeSet" } + Parameter { name: "reset"; type: "bool" } + } + Signal { + name: "createdItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "initItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "destroyingItem" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQmlInstantiator" + defaultProperty: "delegate" + prototype: "QObject" + exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"] + exportMetaObjectRevisions: [0, 0] + Property { name: "active"; type: "bool" } + Property { name: "asynchronous"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { + name: "objectAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "objectRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Method { + name: "objectAt" + type: "QObject*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQmlListElement" + prototype: "QObject" + exports: ["QtQuick/ListElement 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQmlListModel" + prototype: "QAbstractListModel" + exports: ["QtQuick/ListModel 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "dynamicRoles"; type: "bool" } + Method { name: "clear" } + Method { + name: "remove" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "append" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "insert" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + Method { + name: "set" + Parameter { name: "index"; type: "int" } + Parameter { type: "QQmlV8Handle" } + } + Method { + name: "setProperty" + Parameter { name: "index"; type: "int" } + Parameter { name: "property"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "move" + Parameter { name: "from"; type: "int" } + Parameter { name: "to"; type: "int" } + Parameter { name: "count"; type: "int" } + } + Method { name: "sync" } + } Component { name: "QQmlLocale" exports: ["QtQuick/Locale 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "MeasurementSystem" values: { @@ -403,10 +626,25 @@ Module { } } } + Component { + name: "QQmlObjectModel" + defaultProperty: "children" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualItemModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlObjectModelAttached" + Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQmlObjectModelAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + } Component { name: "QQmlTimer" prototype: "QObject" exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "interval"; type: "int" } Property { name: "running"; type: "bool" } Property { name: "repeat"; type: "bool" } @@ -422,6 +660,7 @@ Module { name: "QQuickAbstractAnimation" prototype: "QObject" exports: ["QtQuick/Animation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Loops" values: { @@ -461,14 +700,18 @@ Module { name: "QQuickAccessibleAttached" prototype: "QObject" exports: ["QtQuick/Accessible 2.0"] + exportMetaObjectRevisions: [0] Property { name: "role"; type: "QAccessible::Role" } Property { name: "name"; type: "string" } Property { name: "description"; type: "string" } + Method { name: "valueChanged" } + Method { name: "cursorPositionChanged" } } Component { name: "QQuickAnchorAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/AnchorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } Property { name: "duration"; type: "int" } Property { name: "easing"; type: "QEasingCurve" } @@ -485,6 +728,7 @@ Module { name: "QQuickAnchorChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/AnchorChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true } } @@ -527,6 +771,7 @@ Module { defaultProperty: "data" prototype: "QQuickImage" exports: ["QtQuick/AnimatedImage 2.0"] + exportMetaObjectRevisions: [0] Property { name: "playing"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "currentFrame"; type: "int" } @@ -539,6 +784,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/AnimatedSprite 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "LoopParameters" values: { @@ -698,6 +944,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/AnimationController 2.0"] + exportMetaObjectRevisions: [0] Property { name: "progress"; type: "double" } Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Method { name: "reload" } @@ -712,8 +959,9 @@ Module { } Component { name: "QQuickApplication" - prototype: "QObject" + prototype: "QQmlApplication" exports: ["QtQuick/Application 2.0"] + exportMetaObjectRevisions: [0] Property { name: "active"; type: "bool"; isReadonly: true } Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true } @@ -723,6 +971,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Positioner 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPositionerAttached" Property { name: "spacing"; type: "double" } Property { name: "populate"; type: "QQuickTransition"; isPointer: true } @@ -734,6 +983,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/Behavior 2.0"] + exportMetaObjectRevisions: [0] Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Property { name: "enabled"; type: "bool" } } @@ -742,6 +992,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/BorderImage 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "TileMode" values: { @@ -760,6 +1011,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Canvas 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -846,6 +1098,7 @@ Module { name: "QQuickColorAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/ColorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QColor" } Property { name: "to"; type: "QColor" } } @@ -854,6 +1107,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Column 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickCurve" @@ -867,6 +1121,7 @@ Module { name: "QQuickDoubleValidator" prototype: "QDoubleValidator" exports: ["QtQuick/DoubleValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -874,13 +1129,15 @@ Module { name: "QQuickDrag" prototype: "QObject" exports: ["QtQuick/Drag 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickDragAttached" Enum { name: "Axis" values: { "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -914,6 +1171,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/DropArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "containsDrag"; type: "bool"; isReadonly: true } Property { name: "keys"; type: "QStringList" } Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } @@ -945,6 +1203,7 @@ Module { defaultProperty: "flickableData" prototype: "QQuickItem" exports: ["QtQuick/Flickable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "BoundsBehavior" values: { @@ -1054,6 +1313,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Flipable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Side" values: { @@ -1070,6 +1330,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Flow 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Flow" values: { @@ -1086,11 +1347,13 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/FocusScope 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickFontLoader" prototype: "QObject" exports: ["QtQuick/FontLoader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1108,6 +1371,7 @@ Module { name: "QQuickFontValueType" prototype: "QQmlValueType" exports: ["QtQuick/Font 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "FontWeight" values: { @@ -1146,6 +1410,7 @@ Module { defaultProperty: "stops" prototype: "QObject" exports: ["QtQuick/Gradient 2.0"] + exportMetaObjectRevisions: [0] Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true } Signal { name: "updated" } } @@ -1153,6 +1418,7 @@ Module { name: "QQuickGradientStop" prototype: "QObject" exports: ["QtQuick/GradientStop 2.0"] + exportMetaObjectRevisions: [0] Property { name: "position"; type: "double" } Property { name: "color"; type: "QColor" } } @@ -1160,7 +1426,8 @@ Module { name: "QQuickGrid" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Grid 2.0"] + exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "Flow" values: { @@ -1168,6 +1435,22 @@ Module { "TopToBottom": 1 } } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } Property { name: "rows"; type: "int" } Property { name: "columns"; type: "int" } Property { name: "rowSpacing"; type: "double" } @@ -1175,18 +1458,43 @@ Module { Property { name: "flow"; type: "Flow" } Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" } + Property { + name: "effectiveHorizontalItemAlignment" + revision: 1 + type: "HAlignment" + isReadonly: true + } + Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" } + Signal { + name: "horizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "effectiveHorizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "VAlignment" } + } } Component { name: "QQuickGridMesh" prototype: "QQuickShaderEffectMesh" exports: ["QtQuick/GridMesh 2.0"] + exportMetaObjectRevisions: [0] Property { name: "resolution"; type: "QSize" } } Component { name: "QQuickGridView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/GridView 2.0"] + exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickGridViewAttached" Enum { name: "Flow" @@ -1223,6 +1531,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/Image 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -1305,11 +1614,14 @@ Module { prototype: "QQuickItem" Property { name: "implicitWidth"; type: "double"; isReadonly: true } Property { name: "implicitHeight"; type: "double"; isReadonly: true } + Signal { name: "implicitWidthChanged2"; revision: 1 } + Signal { name: "implicitHeightChanged2"; revision: 1 } } Component { name: "QQuickIntValidator" prototype: "QIntValidator" exports: ["QtQuick/IntValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -1317,7 +1629,8 @@ Module { name: "QQuickItem" defaultProperty: "data" prototype: "QObject" - exports: ["QtQuick/Item 2.0"] + exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "TransformOrigin" values: { @@ -1361,6 +1674,7 @@ Module { Property { name: "clip"; type: "bool" } Property { name: "focus"; type: "bool" } Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } Property { name: "rotation"; type: "double" } Property { name: "scale"; type: "double" } Property { name: "transformOrigin"; type: "TransformOrigin" } @@ -1391,6 +1705,11 @@ Module { name: "activeFocusChanged" Parameter { type: "bool" } } + Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } Signal { name: "parentChanged" Parameter { type: "QQuickItem"; isPointer: true } @@ -1411,6 +1730,11 @@ Module { name: "clipChanged" Parameter { type: "bool" } } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } Method { name: "update" } Method { name: "contains" @@ -1426,6 +1750,16 @@ Module { Parameter { type: "QQmlV8Function"; isPointer: true } } Method { name: "forceActiveFocus" } + Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; type: "QQuickItem*" } Method { name: "childAt" type: "QQuickItem*" @@ -1486,6 +1820,8 @@ Module { name: "QQuickItemView" defaultProperty: "flickableData" prototype: "QQuickFlickable" + exports: ["QtQuick/ItemView 2.1"] + exportMetaObjectRevisions: [1] Enum { name: "LayoutDirection" values: { @@ -1577,6 +1913,7 @@ Module { } Method { name: "positionViewAtBeginning" } Method { name: "positionViewAtEnd" } + Method { name: "forceLayout"; revision: 1 } } Component { name: "QQuickItemViewAttached" @@ -1595,6 +1932,7 @@ Module { name: "QQuickKeyNavigationAttached" prototype: "QObject" exports: ["QtQuick/KeyNavigation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1614,6 +1952,7 @@ Module { name: "QQuickKeysAttached" prototype: "QObject" exports: ["QtQuick/Keys 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1789,62 +2128,16 @@ Module { name: "QQuickLayoutMirroringAttached" prototype: "QObject" exports: ["QtQuick/LayoutMirroring 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "childrenInherit"; type: "bool" } } - Component { - name: "QQuickListElement" - prototype: "QObject" - exports: ["QtQuick/ListElement 2.0"] - } - Component { - name: "QQuickListModel" - prototype: "QAbstractListModel" - exports: ["QtQuick/ListModel 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "dynamicRoles"; type: "bool" } - Method { name: "clear" } - Method { - name: "remove" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "append" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "insert" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV8Handle" - Parameter { name: "index"; type: "int" } - } - Method { - name: "set" - Parameter { name: "index"; type: "int" } - Parameter { type: "QQmlV8Handle" } - } - Method { - name: "setProperty" - Parameter { name: "index"; type: "int" } - Parameter { name: "property"; type: "string" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "move" - Parameter { name: "from"; type: "int" } - Parameter { name: "to"; type: "int" } - Parameter { name: "count"; type: "int" } - } - Method { name: "sync" } - } Component { name: "QQuickListView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/ListView 2.0"] + exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickListViewAttached" Enum { name: "Orientation" @@ -1882,6 +2175,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Loader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1909,6 +2203,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MouseArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "mouseX"; type: "double"; isReadonly: true } Property { name: "mouseY"; type: "double"; isReadonly: true } Property { name: "containsMouse"; type: "bool"; isReadonly: true } @@ -1979,6 +2274,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MultiPointTouchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } Property { name: "minimumTouchPoints"; type: "int" } Property { name: "maximumTouchPoints"; type: "int" } @@ -2011,6 +2307,7 @@ Module { name: "QQuickNumberAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/NumberAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } } @@ -2019,6 +2316,7 @@ Module { defaultProperty: "data" prototype: "QObject" exports: ["QtQuick/Package 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPackageAttached" Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } @@ -2032,6 +2330,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PaintedItem 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -2050,12 +2349,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParallelAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickParentAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParentAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "newParent"; type: "QQuickItem"; isPointer: true } Property { name: "via"; type: "QQuickItem"; isPointer: true } @@ -2064,6 +2365,7 @@ Module { name: "QQuickParentChange" prototype: "QQuickStateOperation" exports: ["QtQuick/ParentChange 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "parent"; type: "QQuickItem"; isPointer: true } Property { name: "x"; type: "QQmlScriptString" } @@ -2078,6 +2380,7 @@ Module { defaultProperty: "pathElements" prototype: "QObject" exports: ["QtQuick/Path 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true } Property { name: "startX"; type: "double" } Property { name: "startY"; type: "double" } @@ -2088,6 +2391,7 @@ Module { name: "QQuickPathAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PathAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Orientation" values: { @@ -2140,6 +2444,7 @@ Module { name: "QQuickPathArc" prototype: "QQuickCurve" exports: ["QtQuick/PathArc 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ArcDirection" values: { @@ -2156,6 +2461,7 @@ Module { name: "QQuickPathAttribute" prototype: "QQuickPathElement" exports: ["QtQuick/PathAttribute 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "value"; type: "double" } } @@ -2163,11 +2469,13 @@ Module { name: "QQuickPathCatmullRomCurve" prototype: "QQuickCurve" exports: ["QtQuick/PathCurve 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathCubic" prototype: "QQuickCurve" exports: ["QtQuick/PathCubic 2.0"] + exportMetaObjectRevisions: [0] Property { name: "control1X"; type: "double" } Property { name: "control1Y"; type: "double" } Property { name: "control2X"; type: "double" } @@ -2186,6 +2494,7 @@ Module { name: "QQuickPathInterpolator" prototype: "QObject" exports: ["QtQuick/PathInterpolator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "QQuickPath"; isPointer: true } Property { name: "progress"; type: "double" } Property { name: "x"; type: "double"; isReadonly: true } @@ -2196,17 +2505,20 @@ Module { name: "QQuickPathLine" prototype: "QQuickCurve" exports: ["QtQuick/PathLine 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathPercent" prototype: "QQuickPathElement" exports: ["QtQuick/PathPercent 2.0"] + exportMetaObjectRevisions: [0] Property { name: "value"; type: "double" } } Component { name: "QQuickPathQuad" prototype: "QQuickCurve" exports: ["QtQuick/PathQuad 2.0"] + exportMetaObjectRevisions: [0] Property { name: "controlX"; type: "double" } Property { name: "controlY"; type: "double" } Property { name: "relativeControlX"; type: "double" } @@ -2216,6 +2528,7 @@ Module { name: "QQuickPathSvg" prototype: "QQuickCurve" exports: ["QtQuick/PathSvg 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "string" } } Component { @@ -2223,6 +2536,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PathView 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPathViewAttached" Enum { name: "HighlightRangeMode" @@ -2313,6 +2627,7 @@ Module { name: "QQuickPauseAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PauseAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Signal { name: "durationChanged" @@ -2331,13 +2646,15 @@ Module { name: "QQuickPinch" prototype: "QObject" exports: ["QtQuick/Pinch 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Axis" values: { "NoDrag": 0, "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -2357,6 +2674,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PinchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } Signal { @@ -2383,6 +2701,7 @@ Module { name: "QQuickPropertyAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "properties"; type: "string" } @@ -2402,6 +2721,7 @@ Module { name: "QQuickPropertyAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Property { name: "from"; type: "QVariant" } Property { name: "to"; type: "QVariant" } @@ -2436,6 +2756,7 @@ Module { name: "QQuickPropertyChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/PropertyChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "restoreEntryValues"; type: "bool" } Property { name: "explicit"; type: "bool" } @@ -2445,6 +2766,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Rectangle 2.0"] + exportMetaObjectRevisions: [0] Property { name: "color"; type: "QColor" } Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } @@ -2455,6 +2777,7 @@ Module { defaultProperty: "delegate" prototype: "QQuickItem" exports: ["QtQuick/Repeater 2.0"] + exportMetaObjectRevisions: [0] Property { name: "model"; type: "QVariant" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "count"; type: "int"; isReadonly: true } @@ -2478,6 +2801,7 @@ Module { name: "QQuickRotation" prototype: "QQuickTransform" exports: ["QtQuick/Rotation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "angle"; type: "double" } Property { name: "axis"; type: "QVector3D" } @@ -2486,6 +2810,7 @@ Module { name: "QQuickRotationAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/RotationAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RotationDirection" values: { @@ -2504,6 +2829,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Row 2.0"] + exportMetaObjectRevisions: [0] Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } } @@ -2511,6 +2837,7 @@ Module { name: "QQuickScale" prototype: "QQuickTransform" exports: ["QtQuick/Scale 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "xScale"; type: "double" } Property { name: "yScale"; type: "double" } @@ -2530,6 +2857,7 @@ Module { name: "QQuickScriptAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/ScriptAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "scriptName"; type: "string" } } @@ -2538,12 +2866,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/SequentialAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickShaderEffect" defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffect 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "CullMode" values: { @@ -2572,6 +2902,7 @@ Module { name: "QQuickShaderEffectMesh" prototype: "QObject" exports: ["QtQuick/ShaderEffectMesh 2.0"] + exportMetaObjectRevisions: [0] Signal { name: "geometryChanged" } } Component { @@ -2579,6 +2910,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffectSource 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "WrapMode" values: { @@ -2612,6 +2944,7 @@ Module { name: "QQuickSmoothedAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SmoothedAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ReversingMode" values: { @@ -2628,6 +2961,7 @@ Module { name: "QQuickSpringAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SpringAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "velocity"; type: "double" } Property { name: "spring"; type: "double" } Property { name: "damping"; type: "double" } @@ -2640,6 +2974,7 @@ Module { name: "QQuickSprite" prototype: "QQuickStochasticState" exports: ["QtQuick/Sprite 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Property { name: "reverse"; type: "bool" } Property { name: "frameSync"; type: "bool" } @@ -2759,6 +3094,7 @@ Module { defaultProperty: "sprites" prototype: "QQuickItem" exports: ["QtQuick/SpriteSequence 2.0"] + exportMetaObjectRevisions: [0] Property { name: "running"; type: "bool" } Property { name: "interpolate"; type: "bool" } Property { name: "goalSprite"; type: "string" } @@ -2802,6 +3138,7 @@ Module { defaultProperty: "changes" prototype: "QObject" exports: ["QtQuick/State 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "when"; type: "QQmlBinding"; isPointer: true } Property { name: "extend"; type: "string" } @@ -2812,6 +3149,7 @@ Module { name: "QQuickStateChangeScript" prototype: "QQuickStateOperation" exports: ["QtQuick/StateChangeScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "name"; type: "string" } } @@ -2819,6 +3157,7 @@ Module { name: "QQuickStateGroup" prototype: "QObject" exports: ["QtQuick/StateGroup 2.0"] + exportMetaObjectRevisions: [0] Property { name: "state"; type: "string" } Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } @@ -2882,6 +3221,7 @@ Module { name: "QQuickSystemPalette" prototype: "QObject" exports: ["QtQuick/SystemPalette 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ColorGroup" values: { @@ -2912,6 +3252,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -3062,11 +3403,13 @@ Module { } Method { name: "doLayout" } } + Component { name: "QQuickTextDocument"; prototype: "QObject" } Component { name: "QQuickTextEdit" defaultProperty: "data" prototype: "QQuickImplicitSizeItem" - exports: ["QtQuick/TextEdit 2.0"] + exports: ["QtQuick/TextEdit 2.0", "QtQuick/TextEdit 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "HAlignment" values: { @@ -3144,6 +3487,7 @@ Module { Property { name: "persistentSelection"; type: "bool" } Property { name: "textMargin"; type: "double" } Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } Property { name: "selectByMouse"; type: "bool" } Property { name: "mouseSelectionMode"; type: "SelectionMode" } Property { name: "canPaste"; type: "bool"; isReadonly: true } @@ -3152,6 +3496,13 @@ Module { Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } Property { name: "baseUrl"; type: "QUrl" } Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } Signal { name: "contentSizeChanged" } Signal { name: "colorChanged" @@ -3201,6 +3552,11 @@ Module { name: "textMarginChanged" Parameter { name: "textMargin"; type: "double" } } + Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } Signal { name: "selectByMouseChanged" Parameter { name: "selectByMouse"; type: "bool" } @@ -3280,6 +3636,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/TextInput 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "EchoMode" values: { @@ -3482,6 +3839,7 @@ Module { name: "QQuickTouchPoint" prototype: "QObject" exports: ["QtQuick/TouchPoint 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pointId"; type: "int"; isReadonly: true } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "x"; type: "double"; isReadonly: true } @@ -3502,6 +3860,7 @@ Module { defaultProperty: "animations" prototype: "QObject" exports: ["QtQuick/Transition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "string" } Property { name: "to"; type: "string" } Property { name: "reversible"; type: "bool" } @@ -3513,6 +3872,7 @@ Module { name: "QQuickTranslate" prototype: "QQuickTransform" exports: ["QtQuick/Translate 2.0"] + exportMetaObjectRevisions: [0] Property { name: "x"; type: "double" } Property { name: "y"; type: "double" } } @@ -3520,6 +3880,7 @@ Module { name: "QQuickVector3dAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/Vector3dAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QVector3D" } Property { name: "to"; type: "QVector3D" } } @@ -3527,6 +3888,7 @@ Module { name: "QQuickViewSection" prototype: "QObject" exports: ["QtQuick/ViewSection 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "SectionCriteria" values: { @@ -3552,141 +3914,18 @@ Module { name: "QQuickViewTransitionAttached" prototype: "QObject" exports: ["QtQuick/ViewTransition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "index"; type: "int"; isReadonly: true } Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "destination"; type: "QPointF"; isReadonly: true } Property { name: "targetIndexes"; type: "QList"; isReadonly: true } Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true } } - Component { - name: "QQuickVisualDataGroup" - prototype: "QObject" - exports: ["QtQuick/VisualDataGroup 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "name"; type: "string" } - Property { name: "includeByDefault"; type: "bool" } - Signal { name: "defaultIncludeChanged" } - Signal { - name: "changed" - Parameter { name: "removed"; type: "QQmlV8Handle" } - Parameter { name: "inserted"; type: "QQmlV8Handle" } - } - Method { - name: "insert" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "create" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "resolve" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "remove" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "addGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "removeGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "setGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "move" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV8Handle" - Parameter { name: "index"; type: "int" } - } - } - Component { - name: "QQuickVisualDataModel" - defaultProperty: "delegate" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualDataModel 2.0"] - attachedType: "QQuickVisualDataModelAttached" - Property { name: "model"; type: "QVariant" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "filterOnGroup"; type: "string" } - Property { name: "items"; type: "QQuickVisualDataGroup"; isReadonly: true; isPointer: true } - Property { - name: "persistedItems" - type: "QQuickVisualDataGroup" - isReadonly: true - isPointer: true - } - Property { name: "groups"; type: "QQuickVisualDataGroup"; isList: true; isReadonly: true } - Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } - Property { name: "rootIndex"; type: "QVariant" } - Signal { name: "filterGroupChanged" } - Signal { name: "defaultGroupsChanged" } - Method { - name: "modelIndex" - type: "QVariant" - Parameter { name: "idx"; type: "int" } - } - Method { name: "parentModelIndex"; type: "QVariant" } - } - Component { - name: "QQuickVisualDataModelAttached" - prototype: "QObject" - Property { name: "model"; type: "QQuickVisualDataModel"; isReadonly: true; isPointer: true } - Property { name: "groups"; type: "QStringList" } - Property { name: "isUnresolved"; type: "bool"; isReadonly: true } - Signal { name: "unresolvedChanged" } - } - Component { name: "QQuickVisualDataModelParts"; prototype: "QObject" } - Component { - name: "QQuickVisualItemModel" - defaultProperty: "children" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualItemModel 2.0"] - attachedType: "QQuickVisualItemModelAttached" - Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } - } - Component { - name: "QQuickVisualItemModelAttached" - prototype: "QObject" - Property { name: "index"; type: "int"; isReadonly: true } - } - Component { - name: "QQuickVisualModel" - prototype: "QObject" - Property { name: "count"; type: "int"; isReadonly: true } - Signal { - name: "modelUpdated" - Parameter { name: "changeSet"; type: "QQuickChangeSet" } - Parameter { name: "reset"; type: "bool" } - } - Signal { - name: "createdItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "initItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "destroyingItem" - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - } Component { name: "QQuickWorkerScript" prototype: "QObject" exports: ["QtQuick/WorkerScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Signal { name: "message" @@ -3701,6 +3940,7 @@ Module { name: "QRegExpValidator" prototype: "QValidator" exports: ["QtQuick/RegExpValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "regExp"; type: "QRegExp" } Signal { name: "regExpChanged" @@ -3866,9 +4106,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -3907,9 +4149,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -4105,7 +4349,8 @@ Module { "AA_X11InitThreads": 10, "AA_SynthesizeTouchForUnhandledMouseEvents": 11, "AA_SynthesizeMouseForUnhandledTouchEvents": 12, - "AA_AttributeCount": 13 + "AA_UseHighDpiPixmaps": 13, + "AA_AttributeCount": 14 } } Enum { @@ -4789,6 +5034,15 @@ Module { "BottomRightCorner": 3 } } + Enum { + name: "Edge" + values: { + "TopEdge": 1, + "LeftEdge": 2, + "RightEdge": 4, + "BottomEdge": 8 + } + } Enum { name: "ConnectionType" values: { @@ -4916,6 +5170,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -4941,6 +5196,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -5010,7 +5266,8 @@ Module { "ItemIsDropEnabled": 8, "ItemIsUserCheckable": 16, "ItemIsEnabled": 32, - "ItemIsTristate": 64 + "ItemIsTristate": 64, + "ItemNeverHasChildren": 128 } } Enum { diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes index b79702edb6..59e69114e1 100644 --- a/src/imports/window/plugins.qmltypes +++ b/src/imports/window/plugins.qmltypes @@ -3,7 +3,7 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command '../../../bin/qmlplugindump.app/Contents/MacOS/qmlplugindump QtQuick.Window 2.1 -notrelocatable'. +// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.1 -notrelocatable'. Module { Component { @@ -23,15 +23,23 @@ Module { name: "QQuickScreen" prototype: "QObject" exports: ["QtQuick.Window/Screen 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickScreenAttached" } Component { name: "QQuickScreenAttached" prototype: "QObject" + Property { name: "name"; revision: 1; type: "string"; isReadonly: true } Property { name: "width"; type: "int"; isReadonly: true } Property { name: "height"; type: "int"; isReadonly: true } + Property { name: "desktopAvailableWidth"; revision: 1; type: "int"; isReadonly: true } + Property { name: "desktopAvailableHeight"; revision: 1; type: "int"; isReadonly: true } + Property { name: "logicalPixelDensity"; revision: 1; type: "double"; isReadonly: true } Property { name: "primaryOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true } Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true } + Signal { name: "nameChanged"; revision: 1 } + Signal { name: "desktopGeometryChanged"; revision: 1 } + Signal { name: "logicalPixelDensityChanged"; revision: 1 } Method { name: "angleBetween" type: "int" @@ -61,6 +69,11 @@ Module { Signal { name: "beforeSynchronizing" } Signal { name: "beforeRendering" } Signal { name: "afterRendering" } + Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } Signal { name: "colorChanged" Parameter { type: "QColor" } @@ -95,6 +108,7 @@ Module { Property { name: "maximumWidth"; revision: 1; type: "int" } Property { name: "maximumHeight"; revision: 1; type: "int" } Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } Property { name: "visibility"; revision: 1; type: "Visibility" } Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } Property { name: "opacity"; revision: 1; type: "double" } @@ -155,6 +169,7 @@ Module { revision: 1 Parameter { name: "visibility"; type: "QWindow::Visibility" } } + Signal { name: "activeChanged"; revision: 1 } Signal { name: "contentOrientationChanged" revision: 1 @@ -169,6 +184,7 @@ Module { revision: 1 Parameter { name: "opacity"; type: "double" } } + Method { name: "requestActivate"; revision: 1 } Method { name: "setVisible" Parameter { name: "visible"; type: "bool" } @@ -222,5 +238,9 @@ Module { revision: 1 Parameter { name: "h"; type: "int" } } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } } } -- cgit v1.2.1 From df7b44e2d91cf127a3e1777c92dfd8e006553c4a Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 24 May 2013 22:06:08 +0200 Subject: sync.profile: Point dependencies to an empty string This means that we are going to use the same branch name for the dependencies as the branch of the repository under test. If we are testing the 'stable' branch, all dependencies will point to the 'stable' branch as well. Change-Id: I0959eea83b620af805b2113422bae5ae306af120 Reviewed-by: Iikka Eklund --- sync.profile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sync.profile b/sync.profile index bddfd0f7f3..3efcbca8e1 100644 --- a/sync.profile +++ b/sync.profile @@ -15,9 +15,10 @@ # Each of the module version specifiers can take one of the following values: # - A specific Git revision. # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) +# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) # %dependencies = ( - "qtbase" => "refs/heads/stable", - "qtxmlpatterns" => "refs/heads/stable", - "qtjsbackend" => "refs/heads/stable", + "qtbase" => "", + "qtxmlpatterns" => "", + "qtjsbackend" => "", ); -- cgit v1.2.1 From e077f63682b3747bae25612bd78cbe4dc750d0af Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Mon, 27 May 2013 14:20:31 +0200 Subject: Doc: Add Qt Quick Dialogs to Qt Quick submodules list And add a landing page for Qt Quick Dialogs. Change-Id: I0c2611bf5cdbf9937b4fd94228915553d8b3bb77 Reviewed-by: Jerome Pasion Reviewed-by: Shawn Rutledge --- src/imports/dialogs/plugin.cpp | 29 ++++++++++++++++++++++- src/imports/dialogs/qquickplatformcolordialog.cpp | 2 +- src/imports/dialogs/qquickplatformfiledialog.cpp | 2 +- src/quick/doc/src/qtquick.qdoc | 2 ++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index 67653e5965..bee0ee00bc 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -55,9 +55,36 @@ QT_BEGIN_NAMESPACE + +/*! + \group dialogs + \title Dialogs +*/ + +/*! + \page qtquickdialogs-index.html + \title Qt Quick Dialogs + + \brief Qt Quick Dialogs submodule + + The submodule is new in Qt 5.1. + + \section1 Dialogs + + \annotatedlist dialogs + + \section1 Related information + + \section2 Reference + \list + \li \l{Qt Quick Dialogs QML Types}{Qt Quick Dialogs QML Types} + \endlist + +*/ + /*! \qmlmodule QtQuick.Dialogs 1 - \title Qt Quick Dialog QML Types + \title Qt Quick Dialogs QML Types \ingroup qmlmodules \brief Provides QML types for standard file, color picker and message dialogs diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp index 491a2e687c..ea3114c86e 100644 --- a/src/imports/dialogs/qquickplatformcolordialog.cpp +++ b/src/imports/dialogs/qquickplatformcolordialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype ColorDialog \instantiates QQuickPlatformColorDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing a color. \since Qt 5.1 diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp index d767f65499..5ae7fd0067 100644 --- a/src/imports/dialogs/qquickplatformfiledialog.cpp +++ b/src/imports/dialogs/qquickplatformfiledialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype FileDialog \instantiates QQuickPlatformFileDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing files from a local filesystem. \since Qt 5.1 diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index cafe10db45..7163baa819 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -125,6 +125,8 @@ Additional Qt Quick information: system for Qt Quick \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information + \li \l{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + interacting with system dialogs \endlist \li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick \li \l{Qt Quick Code Samples} - list of all Qt Quick examples -- cgit v1.2.1 From e2e5ba2ce28cb3d666bd1037506c081fa9165611 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 27 May 2013 14:46:54 +0200 Subject: Doc: Added Qt 5.1 information in Qt Quick's release notes. Change-Id: I97971f27d9ff7e94e14f442d1baf78b0e56ca312 Reviewed-by: Shawn Rutledge --- src/quick/doc/src/whatsnew.qdoc | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index baa0312aa4..2b865073d3 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -29,7 +29,35 @@ \title Qt Quick Release Notes \page qtquick-releasenotes.html -\section1 Qt Quick in Qt 5 +\section1 Qt Quick in Qt 5.1 + +\l{Qt Quick} 2.1 is new in Qt 5.1. This is a summary of improvements and new +features introduced by the new import and new classes in Qt 5.1: +\list +\li New threaded render loop for Mac, Linux, and Embedded. +\li New render loop for windows for smoother animations. +\li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight, + maximumWidth, maximumHeight, visibility, contentOrientation, and opacity. +\li New \l Item property: activeFocusOnTab. +\li New \l Grid properties: horizontalAlignment, verticalAlignment, and + effectiveHorizontalAlignment. +\li New \l TextEdit properties: selectByKeyboard and textDocument +\li A \l Window declared inside another Window or \l Item will automatically be + transient for (centered upon) the outer window. +\endlist + +\section2 New Submodules + +In Qt 5.1, there are several new modules which extend Qt Quick functionalities. +\list +\li \l{Qt Quick Dialogs} - contains types for creating and interacting with system dialogs +\li \l{Qt Quick Controls} - provides a set of reusable UI components +\li \l{Qt Quick Layouts} - contains types that are used to arrange items in the user interface +\endlist + +The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. + +\section1 Qt Quick in Qt 5.0 The \l {Qt Quick} module is new in Qt 5. It provides the visual canvas and scenegraph back-end as well as the \c QtQuick QML module for QML application development. -- cgit v1.2.1 From 63f83fbd095415145ad124c7215f07a4c3c6038f Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 27 May 2013 10:19:35 +0200 Subject: Prevent tab focus from wrapping endlessly If there was no item that accepted focus, it would go into an endless loop. This also changes the default behavior of QQuickWindow. When there is not any activeFocusItem in the whole window, it means the contentItem got focused. The Tab/BackTab key will now focus the next item in the tab focus chain. Autotest is included. Done-with: Frederik Gladhorn Task-number: QTBUG-31344 Change-Id: I854292f89a327c493eec21969907c94aa9cfddcb Reviewed-by: Jens Bache-Wiig Reviewed-by: Gabriel de Dietrich --- src/quick/items/qquickitem.cpp | 32 +++++++- .../quick/qquickitem2/data/activeFocusOnTab7.qml | 36 +++++++++ .../quick/qquickitem2/data/activeFocusOnTab8.qml | 36 +++++++++ tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 87 ++++++++++++++++++++++ 4 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml create mode 100644 tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index d6a663ab77..58e1612e19 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2050,7 +2050,10 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item) { bool result = true; - if (item->window() && item == item->window()->contentItem()) + if (!item->window()) + return false; + + if (item == item->window()->contentItem()) return true; #ifndef QT_NO_ACCESSIBILITY @@ -2093,7 +2096,6 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward) QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, bool forward) { Q_ASSERT(item); - Q_ASSERT(item->activeFocusOnTab()); bool all = QQuickItemPrivate::qt_tab_all_widgets(); @@ -2107,6 +2109,10 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo from = item->parentItem(); } bool skip = false; + const QQuickItem * const contentItem = item->window()->contentItem(); + const QQuickItem * const originalItem = item; + QQuickItem * startItem = item; + QQuickItem * firstFromItem = from; QQuickItem *current = item; do { skip = false; @@ -2157,8 +2163,25 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo skip = true; } } - from = last; + if (current == startItem && from == firstFromItem) { + // wrapped around, avoid endless loops + if (originalItem == contentItem) { +#ifdef FOCUS_DEBUG + qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem"; +#endif + return item->window()->contentItem(); + } else { +#ifdef FOCUS_DEBUG + qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem; +#endif + return startItem; + } + } + if (!firstFromItem) { //start from root + startItem = current; + firstFromItem = from; + } } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible() || !(all || QQuickItemPrivate::canAcceptTabFocus(current))); @@ -4375,7 +4398,8 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) return; //only care about KeyPress now - if (q->activeFocusOnTab() && e->type() == QEvent::KeyPress) { + if ((q == q->window()->contentItem() || q->activeFocusOnTab()) + && e->type() == QEvent::KeyPress) { bool res = false; if (!(e->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? if (e->key() == Qt::Key_Backtab diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml new file mode 100644 index 0000000000..e81d9be950 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml @@ -0,0 +1,36 @@ +import QtQuick 2.1 + +Item { + id: main + objectName: "main" + width: 300 + height: 300 + Item { + id: button1 + objectName: "button1" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Button + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.top: parent.top + anchors.left: parent.left + } + Item { + id: button2 + objectName: "button2" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Button + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.bottom: parent.bottom + anchors.left: parent.left + } +} diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml new file mode 100644 index 0000000000..641a39c1fa --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml @@ -0,0 +1,36 @@ +import QtQuick 2.1 + +Item { + id: main + objectName: "main" + width: 300 + height: 300 + Item { + id: button1 + objectName: "button1" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Table + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.top: parent.top + anchors.left: parent.left + } + Item { + id: button2 + objectName: "button2" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Table + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.bottom: parent.bottom + anchors.left: parent.left + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 9a6bed6dbe..992e81aa64 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -71,6 +71,8 @@ private slots: void activeFocusOnTab4(); void activeFocusOnTab5(); void activeFocusOnTab6(); + void activeFocusOnTab7(); + void activeFocusOnTab8(); void nextItemInFocusChain(); void nextItemInFocusChain2(); @@ -747,6 +749,91 @@ void tst_QQuickItem::activeFocusOnTab6() delete window; } +void tst_QQuickItem::activeFocusOnTab7() +{ + if (qt_tab_all_widgets()) + QSKIP("This function doesn't support iterating all."); + + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(300,300)); + + window->setSource(testFileUrl("activeFocusOnTab7.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QGuiApplication::focusWindow() == window); + + QQuickItem *item = findItem(window->rootObject(), "button1"); + QVERIFY(item); + item->forceActiveFocus(); + QVERIFY(item->hasActiveFocus()); + + // Tab: button1->button1 + QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(!key.isAccepted()); + + QVERIFY(item->hasActiveFocus()); + + // BackTab: button1->button1 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(!key.isAccepted()); + + QVERIFY(item->hasActiveFocus()); + + delete window; +} + +void tst_QQuickItem::activeFocusOnTab8() +{ + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(300,300)); + + window->setSource(testFileUrl("activeFocusOnTab8.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QGuiApplication::focusWindow() == window); + + QQuickItem *content = window->contentItem(); + QVERIFY(content); + QVERIFY(content->hasActiveFocus()); + + QQuickItem *button1 = findItem(window->rootObject(), "button1"); + QVERIFY(button1); + QVERIFY(!button1->hasActiveFocus()); + + QQuickItem *button2 = findItem(window->rootObject(), "button2"); + QVERIFY(button2); + QVERIFY(!button2->hasActiveFocus()); + + // Tab: contentItem->button1 + QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button1->hasActiveFocus()); + + // Tab: button1->button2 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button2->hasActiveFocus()); + QVERIFY(!button1->hasActiveFocus()); + + // BackTab: button2->button1 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button1->hasActiveFocus()); + QVERIFY(!button2->hasActiveFocus()); + + delete window; +} + void tst_QQuickItem::nextItemInFocusChain() { if (!qt_tab_all_widgets()) -- cgit v1.2.1 From 1ef4e4b156be8653af64dbccb47abcccc234246a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 8 Mar 2013 16:44:52 +0100 Subject: window and Screen example: new properties; splash screen Demonstrates the new properties, how to make a splash screen, and how to make a standalone app with an icon. Combined the Screen info into this example too. Change-Id: I5b731539b39c55327f4e5b93860a880a35835896 Reviewed-by: Richard Moe Gustavsen --- examples/quick/shared/images/qt-logo.png | Bin 0 -> 13923 bytes examples/quick/shared/shared.qrc | 2 + examples/quick/window/ScreenInfo.qml | 95 ++++++++++ examples/quick/window/Splash.qml | 74 ++++++++ .../quick/window/doc/images/qml-window-example.png | Bin 0 -> 9863 bytes examples/quick/window/doc/src/window.qdoc | 71 +++++++ examples/quick/window/main.cpp | 58 ++++++ examples/quick/window/resources/icon.icns | Bin 0 -> 59662 bytes examples/quick/window/resources/icon.ico | Bin 0 -> 11825 bytes examples/quick/window/resources/icon.svg | 208 +++++++++++++++++++++ examples/quick/window/resources/icon64.png | Bin 0 -> 3004 bytes examples/quick/window/resources/window.rc | 32 ++++ examples/quick/window/screen/screenInfo.qml | 91 --------- examples/quick/window/window.pro | 18 +- examples/quick/window/window.qml | 180 ++++++++++++++++++ examples/quick/window/window.qrc | 7 + examples/quick/window/window/Window.qml | 58 ------ examples/quick/window/window/nogui.qml | 50 ----- examples/quick/window/window/standalone.qml | 128 ------------- examples/quick/window/window/twowindows.qml | 89 --------- examples/quick/window/window/window.cpp | 58 ------ examples/quick/window/window/window.pro | 13 -- examples/quick/window/window/window.qrc | 5 - 23 files changed, 741 insertions(+), 496 deletions(-) create mode 100644 examples/quick/shared/images/qt-logo.png create mode 100644 examples/quick/window/ScreenInfo.qml create mode 100644 examples/quick/window/Splash.qml create mode 100644 examples/quick/window/doc/images/qml-window-example.png create mode 100644 examples/quick/window/doc/src/window.qdoc create mode 100644 examples/quick/window/main.cpp create mode 100644 examples/quick/window/resources/icon.icns create mode 100644 examples/quick/window/resources/icon.ico create mode 100644 examples/quick/window/resources/icon.svg create mode 100644 examples/quick/window/resources/icon64.png create mode 100644 examples/quick/window/resources/window.rc delete mode 100644 examples/quick/window/screen/screenInfo.qml create mode 100644 examples/quick/window/window.qml create mode 100644 examples/quick/window/window.qrc delete mode 100644 examples/quick/window/window/Window.qml delete mode 100644 examples/quick/window/window/nogui.qml delete mode 100644 examples/quick/window/window/standalone.qml delete mode 100644 examples/quick/window/window/twowindows.qml delete mode 100644 examples/quick/window/window/window.cpp delete mode 100644 examples/quick/window/window/window.pro delete mode 100644 examples/quick/window/window/window.qrc diff --git a/examples/quick/shared/images/qt-logo.png b/examples/quick/shared/images/qt-logo.png new file mode 100644 index 0000000000..7d3e97eb36 Binary files /dev/null and b/examples/quick/shared/images/qt-logo.png differ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 0b574ac879..8912c17831 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -8,5 +8,7 @@ CheckBox.qml images/back.png images/next.png + images/qt-logo.png + images/checkmark.png diff --git a/examples/quick/window/ScreenInfo.qml b/examples/quick/window/ScreenInfo.qml new file mode 100644 index 0000000000..e4abc8d69d --- /dev/null +++ b/examples/quick/window/ScreenInfo.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Window 2.1 + +Item { + id: root + width: 400 + height: propertyGrid.implicitHeight + 16 + + function orientationToString(o) { + switch (o) { + case Qt.PrimaryOrientation: + return "primary"; + case Qt.PortraitOrientation: + return "portrait"; + case Qt.LandscapeOrientation: + return "landscape"; + case Qt.InvertedPortraitOrientation: + return "inverted portrait"; + case Qt.InvertedLandscapeOrientation: + return "inverted landscape"; + } + return "unknown"; + } + + Grid { + id: propertyGrid + columns: 2 + spacing: 8 + x: spacing + y: spacing + + //! [screen] + Text { + text: "Screen \"" + Screen.name + "\":" + font.bold: true + } + Item { width: 1; height: 1 } // spacer + + Text { text: "dimensions" } + Text { text: Screen.width + "x" + Screen.height } + + Text { text: "logical pixel density" } + Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm" } + + Text { text: "available virtual desktop" } + Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight } + + Text { text: "orientation" } + Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" } + + Text { text: "primary orientation" } + Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" } + //! [screen] + } +} diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml new file mode 100644 index 0000000000..092e6e6fc2 --- /dev/null +++ b/examples/quick/window/Splash.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.1 + +//! [splash-properties] +Window { + visible: true + width: splashImage.width + height: splashImage.height + color: "transparent" + title: "Splash Window" + modality: Qt.ApplicationModal + flags: Qt.SplashScreen + property int timeout: 2000 +//! [splash-properties] +//! [screen-properties] + x: (Screen.width - splashImage.width) / 2 + y: (Screen.height - splashImage.height) / 2 +//! [screen-properties] + + Image { + id: splashImage + source: "../../shared/images/qt-logo.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + //! [timer] + Timer { + interval: timeout; running: true; repeat: false + onTriggered: visible = false + } + //! [timer] +} diff --git a/examples/quick/window/doc/images/qml-window-example.png b/examples/quick/window/doc/images/qml-window-example.png new file mode 100644 index 0000000000..72487b4d93 Binary files /dev/null and b/examples/quick/window/doc/images/qml-window-example.png differ diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc new file mode 100644 index 0000000000..07d2f115c1 --- /dev/null +++ b/examples/quick/window/doc/src/window.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Examples - Window and Screen + \example window + \brief This example demonstrates the Window and Screen types in QML + \image qml-window-example.png + \ingroup qtquickexamples + + This example shows you how to create a Window in QML, how to control its + \l {QQuickWindow::visibility} {visibility}, how to present a splash screen + during application startup, and how to access the properties of the + \l Screen. It also demonstrates how to package QML into + \l {The Qt Resource System} {resources} and provide an + \l {Setting the Application Icon} {icon} to create a standalone QML desktop application. + + A splash screen can be created with the \l {Qt::SplashScreen} {Qt.SplashScreen} flag, + and should be \l {Qt::ApplicationModal} {ApplicationModal} to prevent interaction + with the main window. If the splash window is also transparent, and showing a + partially transparent image, then it will look like a shaped window. + \snippet window/Splash.qml splash-properties + + In this example a \l Timer will automatically dismiss the splash screen, + but in a real application you might want to connect to a signal from the + application logic to hide the splash when initialization is complete. + \snippet window/Splash.qml timer + + The main window in this example is the control window, with some buttons + and checkboxes to control and provide feedback on the state of a secondary + window. Each checkbox has a binding to the property whose state it is + displaying, and also an onClicked handler to change the state. This is the + typical pattern to create a two-way binding while avoiding binding loops. + \snippet window/window.qml windowedCheckbox + + The \l Screen has several properties which are generally useful to applications + which need to rotate some content when the screen orientation changes, to position + windows on the screen or to convert real units to logical pixel units. ScreenInfo.qml + (which is displayed inline in window.qml, or can be run by itself with qmlscene) + simply displays the property values, while the splash screen uses them to + center the window on the screen. + \snippet window/Splash.qml screen-properties + + If a Window is nested inside an \l Item or another Window, the inner window + becomes "transient for" the outer one (see \l Window for more explanation). + But if you want to create multiple top-level windows as unrelated peers, you + can create them inside a non-visual \l QtObject root item, as this example does. +*/ diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp new file mode 100644 index 0000000000..2223c607b4 --- /dev/null +++ b/examples/quick/window/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc, argv); + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(QUrl("qrc:///window/window.qml")); + if ( component.isReady() ) + component.create(); + else + qWarning() << component.errorString(); + return app.exec(); +} diff --git a/examples/quick/window/resources/icon.icns b/examples/quick/window/resources/icon.icns new file mode 100644 index 0000000000..88b4b24449 Binary files /dev/null and b/examples/quick/window/resources/icon.icns differ diff --git a/examples/quick/window/resources/icon.ico b/examples/quick/window/resources/icon.ico new file mode 100644 index 0000000000..52af30a6ca Binary files /dev/null and b/examples/quick/window/resources/icon.ico differ diff --git a/examples/quick/window/resources/icon.svg b/examples/quick/window/resources/icon.svg new file mode 100644 index 0000000000..0b6153206d --- /dev/null +++ b/examples/quick/window/resources/icon.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/quick/window/resources/icon64.png b/examples/quick/window/resources/icon64.png new file mode 100644 index 0000000000..0fa324401f Binary files /dev/null and b/examples/quick/window/resources/icon64.png differ diff --git a/examples/quick/window/resources/window.rc b/examples/quick/window/resources/window.rc new file mode 100644 index 0000000000..4de84d297e --- /dev/null +++ b/examples/quick/window/resources/window.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON DISCARDABLE "icon.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)" + VALUE "FileDescription", "QtQuick Window Example" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)." + VALUE "InternalName", "window" + VALUE "OriginalFilename", "window.exe" + VALUE "ProductName", "QtQuick Window Example" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/examples/quick/window/screen/screenInfo.qml b/examples/quick/window/screen/screenInfo.qml deleted file mode 100644 index 33fbc5d88e..0000000000 --- a/examples/quick/window/screen/screenInfo.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Window 2.1 - -Item { - id: root - width: 400 - height: 200 - - function orientationToString(o) { - switch (o) { - case Qt.PrimaryOrientation: - return "primary"; - case Qt.PortraitOrientation: - return "portrait"; - case Qt.LandscapeOrientation: - return "landscape"; - case Qt.InvertedPortraitOrientation: - return "inverted portrait"; - case Qt.InvertedLandscapeOrientation: - return "inverted landscape"; - } - return "unknown"; - } - - Grid { - anchors.centerIn: parent - columns: 2 - spacing: 8 - - Text { - text: "Screen \"" + Screen.name + "\":" - font.bold: true - } - Item { width: 1; height: 1 } // spacer - - Text { text: "dimensions" } - Text { text: Screen.width + "x" + Screen.height } - - Text { text: "logical pixel density" } - Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm" } - - Text { text: "available virtual desktop" } - Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight } - - Text { text: "orientation" } - Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" } - - Text { text: "primary orientation" } - Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" } - } -} diff --git a/examples/quick/window/window.pro b/examples/quick/window/window.pro index 93e43fcd65..be35b24325 100644 --- a/examples/quick/window/window.pro +++ b/examples/quick/window/window.pro @@ -1,6 +1,16 @@ -TEMPLATE = subdirs -SUBDIRS += \ - window +TEMPLATE = app +QT += quick qml +SOURCES += main.cpp +RESOURCES += \ + window.qrc \ + ../shared/shared.qrc EXAMPLE_FILES = \ - screen + window.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/window +INSTALLS += target + +ICON = resources/icon64.png +macx: ICON = resources/icon.icns +win32: RC_FILE = resources/window.rc diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml new file mode 100644 index 0000000000..1d7282f7a1 --- /dev/null +++ b/examples/quick/window/window.qml @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.1 +import "../shared" as Shared + +QtObject { + property real defaultSpacing: 10 + property SystemPalette palette: SystemPalette { } + + property var splashWindow: Splash { } + + property var controlWindow: Window { + width: 400 + height: col.implicitHeight + defaultSpacing * 2 + color: palette.window + title: "Control Window" + visible: true + Column { + id: col + anchors.fill: parent + anchors.margins: defaultSpacing + spacing: defaultSpacing + property real cellWidth: col.width / 3 - spacing + Text { text: "Control the second window:" } + Grid { + id: grid + columns: 3 + spacing: defaultSpacing + width: parent.width + Shared.Button { + id: showButton + width: col.cellWidth + text: testWindow.visible ? "Hide" : "Show" + onClicked: testWindow.visible = !testWindow.visible + } + //! [windowedCheckbox] + Shared.CheckBox { + text: "Windowed" + height: showButton.height + width: col.cellWidth + Binding on checked { value: testWindow.visibility === Window.Windowed } + onClicked: testWindow.visibility = Window.Windowed + } + //! [windowedCheckbox] + Shared.CheckBox { + height: showButton.height + width: col.cellWidth + text: "Full Screen" + Binding on checked { value: testWindow.visibility === Window.FullScreen } + onClicked: testWindow.visibility = Window.FullScreen + } + Shared.Button { + id: autoButton + width: col.cellWidth + text: "Automatic" + onClicked: testWindow.visibility = Window.AutomaticVisibility + } + Shared.CheckBox { + height: autoButton.height + text: "Minimized" + Binding on checked { value: testWindow.visibility === Window.Minimized } + onClicked: testWindow.visibility = Window.Minimized + } + Shared.CheckBox { + height: autoButton.height + text: "Maximized" + Binding on checked { value: testWindow.visibility === Window.Maximized } + onClicked: testWindow.visibility = Window.Maximized + } + } + function visibilityToString(v) { + switch (v) { + case Window.Windowed: + return "windowed"; + case Window.Minimized: + return "minimized"; + case Window.Maximized: + return "maximized"; + case Window.FullScreen: + return "fullscreen"; + case Window.AutomaticVisibility: + return "automatic"; + case Window.Hidden: + return "hidden"; + } + return "unknown"; + } + Text { + text: "second window is " + (testWindow.visible ? "visible" : "invisible") + + " and has visibility " + parent.visibilityToString(testWindow.visibility) + } + Rectangle { + id: horizontalRule + color: "black" + width: parent.width + height: 1 + } + ScreenInfo { } + } + } + + property var testWindow: Window { + width: 320 + height: 240 + color: "#215400" + title: "Test Window with color " + color + Rectangle { + anchors.fill: parent + anchors.margins: defaultSpacing + Text { + anchors.centerIn: parent + text: "Second Window" + } + MouseArea { + anchors.fill: parent + onClicked: testWindow.color = "#e0c31e" + } + Shared.Button { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: defaultSpacing + text: testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen" + width: 150 + onClicked: { + if (testWindow.visibility === Window.FullScreen) + testWindow.visibility = Window.AutomaticVisibility + else + testWindow.visibility = Window.FullScreen + } + } + Shared.Button { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: defaultSpacing + text: "X" + width: 30 + onClicked: testWindow.visible = false + } + } + } +} diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc new file mode 100644 index 0000000000..dc211bdaaf --- /dev/null +++ b/examples/quick/window/window.qrc @@ -0,0 +1,7 @@ + + + window.qml + Splash.qml + ScreenInfo.qml + + diff --git a/examples/quick/window/window/Window.qml b/examples/quick/window/window/Window.qml deleted file mode 100644 index 07900930d3..0000000000 --- a/examples/quick/window/window/Window.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Window { - width: 640 - height: 480 - visible: true //It's false by default - property Component self - Component.onCompleted: self = Qt.createComponent("Window.qml") - Text{ - text: "Hello World!" - anchors.centerIn: parent - } - MouseArea{ - anchors.fill: parent - onClicked: self.createObject(); - } -} diff --git a/examples/quick/window/window/nogui.qml b/examples/quick/window/window/nogui.qml deleted file mode 100644 index 2a5734c773..0000000000 --- a/examples/quick/window/window/nogui.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQml 2.0 - -/* - This object's only functionality is to exist as a root object and - display nothing, proving that qmlscene can run without windows. - (A QtObject can't even have Component.onCompleted) -*/ -QtObject { - property string philosophy: "hello bleak windowless world" -} diff --git a/examples/quick/window/window/standalone.qml b/examples/quick/window/window/standalone.qml deleted file mode 100644 index db73bf66eb..0000000000 --- a/examples/quick/window/window/standalone.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Item { - width: 320 - height: 240 - // It's not possible to set an Item's windowTitle. If you want to modify - // window properties, you need to explicitly create a Window. - Text { - id: text1 - anchors.centerIn: parent - text: "First Window\n" + (Qt.application.supportsMultipleWindows ? - "click the button to open a second window" : "only one window is allowed") - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text1.bottom - anchors.horizontalCenter: text1.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti1 - focus: true // but the modal popup will prevent input while it is open - anchors.centerIn: parent - } - } - Rectangle { - border.color: "black" - color: childWindow.visible ? "goldenrod" : "beige" - radius: height / 4 - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 10 - width: text.implicitWidth + 20 - height: text.implicitHeight + 20 - visible: Qt.application.supportsMultipleWindows - Text { - id: text - text: "Pop up window" - anchors.centerIn: parent - } - MouseArea { - anchors.fill: parent - onClicked: childWindow.visible = !childWindow.visible - } - } - - Window { - id: childWindow - width: 320 - height: 240 - x: 220 - y: 120 - color: "beige" - title: "Second Window" - modality: Qt.ApplicationModal - flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint - Text { - id: text2 - anchors.centerIn: parent - text: "Modal Frameless Stay-on-Top Window" - } - Text { - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 10 - text: "X" - MouseArea{ - anchors.fill: parent - onClicked: childWindow.visible = false - } - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text2.bottom - anchors.horizontalCenter: text2.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti2 - focus: true - anchors.centerIn: parent - } - } - } -} diff --git a/examples/quick/window/window/twowindows.qml b/examples/quick/window/window/twowindows.qml deleted file mode 100644 index 4a8d2f4f1b..0000000000 --- a/examples/quick/window/window/twowindows.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -QtObject { - property var win1: Window { - width: 320 - height: 240 - x: 0 - y: 0 - visible: true - color: "#ccffff" - title: "First Window" - Text { - anchors.centerIn: parent - text: "First Window" - Text { - id: statusText - anchors.top: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: win2.visible = !win2.visible - } - } - property var win2: Window { - width: 320 - height: 240 - x: 220 - y: 120 - visible: true - color: "green" - title: "Second Window: " + color - Rectangle { - anchors.fill: parent - anchors.margins: 10 - Text { - anchors.centerIn: parent - text: "Second Window" - } - MouseArea { - anchors.fill: parent - onClicked: win2.color = "#ffffcc" - } - } - onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible") - } -} diff --git a/examples/quick/window/window/window.cpp b/examples/quick/window/window/window.cpp deleted file mode 100644 index 277effc20c..0000000000 --- a/examples/quick/window/window/window.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -int main(int argc, char* argv[]) -{ - QGuiApplication app(argc, argv); - QQmlEngine engine; - QQmlComponent component(&engine); - component.loadUrl(QUrl("qrc:///window/window/Window.qml")); - if ( component.isReady() ) - component.create(); - else - qWarning() << component.errorString(); - return app.exec(); -} diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro deleted file mode 100644 index 3525a893fa..0000000000 --- a/examples/quick/window/window/window.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app -QT += qml - -SOURCES += window.cpp -RESOURCES += window.qrc - -EXAMPLE_FILES = \ - nogui.qml \ - standalone.qml \ - twowindows.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window -INSTALLS = target diff --git a/examples/quick/window/window/window.qrc b/examples/quick/window/window/window.qrc deleted file mode 100644 index c203c140fc..0000000000 --- a/examples/quick/window/window/window.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - Window.qml - - -- cgit v1.2.1 From 43484528552cb2ba3dc1dabfcce22ed40bf4f8db Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 27 May 2013 18:44:34 +0200 Subject: Package dialogs examples into a single executable Introduced tabs and added the C++ boilerplate launcher. Change-Id: Ibb49a182e3928aba5dced097d5307eb7d1f4b42d Reviewed-by: Richard Moe Gustavsen --- examples/quick/dialogs/ColorDialogs.qml | 38 +++++++++++- examples/quick/dialogs/FileDialogs.qml | 77 ++++++++++++------------ examples/quick/dialogs/dialogs.pro | 17 ++++++ examples/quick/dialogs/dialogs.qml | 59 +++++++++++++++++++ examples/quick/dialogs/dialogs.qrc | 7 +++ examples/quick/dialogs/main.cpp | 41 +++++++++++++ examples/quick/quick.pro | 1 + examples/quick/shared/TabSet.qml | 101 ++++++++++++++++++++++++++++++++ examples/quick/shared/images/tab.png | Bin 0 -> 507 bytes examples/quick/shared/qmldir | 1 + examples/quick/shared/shared.h | 2 +- examples/quick/shared/shared.qrc | 2 + 12 files changed, 305 insertions(+), 41 deletions(-) create mode 100644 examples/quick/dialogs/dialogs.pro create mode 100644 examples/quick/dialogs/dialogs.qml create mode 100644 examples/quick/dialogs/dialogs.qrc create mode 100644 examples/quick/dialogs/main.cpp create mode 100644 examples/quick/shared/TabSet.qml create mode 100644 examples/quick/shared/images/tab.png diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml index 7817c8edf8..f3d253aa8c 100644 --- a/examples/quick/dialogs/ColorDialogs.qml +++ b/examples/quick/dialogs/ColorDialogs.qml @@ -46,8 +46,8 @@ Rectangle { width: 320 height: 200 color: palette.window - SystemPalette { id: palette } + clip: true ColorDialog { id: colorDialog @@ -62,7 +62,7 @@ Rectangle { Column { anchors.fill: parent - anchors.margins: 8 + anchors.margins: 12 spacing: 8 Text { font.bold: true @@ -106,4 +106,38 @@ Rectangle { } } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } } diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml index a6df29bb37..8ed64b0b3c 100644 --- a/examples/quick/dialogs/FileDialogs.qml +++ b/examples/quick/dialogs/FileDialogs.qml @@ -43,43 +43,11 @@ import QtQuick.Dialogs 1.0 import "../shared" Rectangle { - width: 580 - height: 360 + height: 400 color: palette.window SystemPalette { id: palette } - - Rectangle { - id: toolbar - width: parent.width - height: 40 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 8 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "/tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } + clip: true FileDialog { id: fileDialog @@ -97,10 +65,8 @@ Rectangle { } Column { - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolbar.bottom - anchors.margins: 8 + anchors.fill: parent + anchors.margins: 12 spacing: 8 Text { color: palette.windowText @@ -163,4 +129,39 @@ Rectangle { wrapMode: Text.Wrap } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } } diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro new file mode 100644 index 0000000000..b76f396e9d --- /dev/null +++ b/examples/quick/dialogs/dialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += dialogs.qrc ../shared/shared.qrc + +OTHER_FILES += \ + dialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/dialogs.qml new file mode 100644 index 0000000000..b5f9841a3f --- /dev/null +++ b/examples/quick/dialogs/dialogs.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" + +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } + + ColorDialogs { + property string title: "Color Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } +} diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc new file mode 100644 index 0000000000..efebfe4845 --- /dev/null +++ b/examples/quick/dialogs/dialogs.qrc @@ -0,0 +1,7 @@ + + + dialogs.qml + FileDialogs.qml + ColorDialogs.qml + + diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/main.cpp new file mode 100644 index 0000000000..bbf0c48104 --- /dev/null +++ b/examples/quick/dialogs/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index 2d8acb3345..311e264af1 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -20,6 +20,7 @@ SUBDIRS = accessibility \ customitems \ imageprovider \ window \ + dialogs \ particles \ demos diff --git a/examples/quick/shared/TabSet.qml b/examples/quick/shared/TabSet.qml new file mode 100644 index 0000000000..10263a70ac --- /dev/null +++ b/examples/quick/shared/TabSet.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: tabWidget + + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Property Binding" + // documentation for details on default properties. + default property alias content: stack.children + + property int current: 0 + + onCurrentChanged: setZOrders() + Component.onCompleted: setZOrders() + + function setZOrders() { + for (var i = 0; i < stack.children.length; ++i) + stack.children[i].z = (i == current ? 1 : 0) + } + + Row { + id: header + + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length; height: 36 + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "images/tab.png" + visible: tabWidget.current == index + } + Text { + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } + } + } + } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } +} diff --git a/examples/quick/shared/images/tab.png b/examples/quick/shared/images/tab.png new file mode 100644 index 0000000000..ad8021605f Binary files /dev/null and b/examples/quick/shared/images/tab.png differ diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir index cc4eb3c793..4f7c50540d 100644 --- a/examples/quick/shared/qmldir +++ b/examples/quick/shared/qmldir @@ -3,3 +3,4 @@ CheckBox 2.1 CheckBox.qml LauncherList 2.0 LauncherList.qml SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml Slider 2.0 Slider.qml +TabSet 2.1 TabSet.qml diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index eab15f3e0a..c59e858d47 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -47,9 +47,9 @@ QQuickView view;\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ - view.setResizeMode(QQuickView::SizeRootObjectToView);\ view.showFullScreen();\ } else {\ view.show();\ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 8912c17831..6aaeca5211 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -6,9 +6,11 @@ Slider.qml images/slider_handle.png CheckBox.qml + TabSet.qml images/back.png images/next.png images/qt-logo.png images/checkmark.png + images/tab.png -- cgit v1.2.1 From 17b4cf5e49b95f322b5dcb39f4c122b17fd3c39f Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 28 May 2013 15:06:25 +0200 Subject: Accessibility: Fix crash when accessing accessible children. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window would create new child interfaces every time it's children are queried. Instead properly use the crash. Task-number: QTBUG-31417 Change-Id: Ifc7bbdbdb9a506fe04a348fba643f1d52a6157e7 Reviewed-by: Jan Arve Sæther --- src/plugins/accessible/quick/qaccessiblequickview.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index b85f23c48b..1240b2ef4c 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -81,10 +81,8 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const QAccessibleInterface *QAccessibleQuickWindow::child(int index) const { - if (index == 0) { - if (QQuickItem *declarativeRoot = rootItem()) - return new QAccessibleQuickItem(declarativeRoot); - } + if (index == 0) + return QAccessible::queryAccessibleInterface(rootItem()); return 0; } -- cgit v1.2.1 From 493dea89672a8b4e4e1e3149283e93c0bfbe261c Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 28 May 2013 09:42:05 +0200 Subject: Do not draw negative-size ShaderEffect(Source) items. We were a bit inconsistent here. A negative size Image element would not render at all, a negative size ShaderEffect would render mirrored and a negative size ShaderEffectSource would trigger an assert. Be consistent and not draw any of them. DropShadow from QtGraphicalEffects uses both a ShaderEffectSource and a ShaderEffect together, so keeping the behavior in ShaderEffect would make it render incorrectly. Task-number: QTBUG-31383 Change-Id: Ied5568d7edbc2aed96b00adfdc6aae09b6f2a7d9 Reviewed-by: Mitch Curtis --- src/quick/items/qquickshadereffect.cpp | 4 ++-- src/quick/items/qquickshadereffectsource.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 102066704b..f39a15070c 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa { QQuickShaderEffectNode *node = static_cast(oldNode); - // In the case of a bad vertex shader, don't try to create a node... - if (m_common.attributes.isEmpty()) { + // In the case of zero-size or a bad vertex shader, don't try to create a node... + if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) { if (node) delete node; return 0; diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index bd0bb2348e..9debfe35b3 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources() QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) { + if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) { if (m_texture) m_texture->setItem(0); delete oldNode; -- cgit v1.2.1 From 56c1111d392ac6bfb33559f1ca4e09e4e258a777 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Tue, 28 May 2013 09:00:58 +0200 Subject: Dialogs: Create directory structure for documentation Change-Id: I5245a6931606673733130b1f168fddafe8def695 Reviewed-by: Jerome Pasion --- examples/quick/dialogs/ColorDialogs.qml | 143 ----------------- examples/quick/dialogs/FileDialogs.qml | 167 -------------------- .../dialogs/colorandfiledialogs/ColorDialogs.qml | 145 ++++++++++++++++++ .../dialogs/colorandfiledialogs/FileDialogs.qml | 169 +++++++++++++++++++++ .../colorandfiledialogs/colorandfiledialogs.pro | 17 +++ .../colorandfiledialogs/colorandfiledialogs.qrc | 7 + .../quick/dialogs/colorandfiledialogs/dialogs.qml | 59 +++++++ .../doc/images/qml-colorandfiledialogs-example.jpg | Bin 0 -> 47413 bytes .../doc/src/colorandfiledialogs.qdoc | 44 ++++++ .../quick/dialogs/colorandfiledialogs/main.cpp | 41 +++++ examples/quick/dialogs/dialogs.pro | 19 +-- examples/quick/dialogs/dialogs.qml | 59 ------- examples/quick/dialogs/dialogs.qrc | 7 - examples/quick/dialogs/main.cpp | 41 ----- src/imports/dialogs/dialogs.pro | 2 + src/imports/dialogs/doc/qtquickdialogs.qdocconf | 35 +++++ .../dialogs/doc/src/qtquickdialogs-examples.qdoc | 36 +++++ .../dialogs/doc/src/qtquickdialogs-index.qdoc | 58 +++++++ src/imports/dialogs/plugin.cpp | 27 ---- src/quick/doc/src/qtquick.qdoc | 2 +- 20 files changed, 617 insertions(+), 461 deletions(-) delete mode 100644 examples/quick/dialogs/ColorDialogs.qml delete mode 100644 examples/quick/dialogs/FileDialogs.qml create mode 100644 examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml create mode 100644 examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml create mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro create mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc create mode 100644 examples/quick/dialogs/colorandfiledialogs/dialogs.qml create mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg create mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc create mode 100644 examples/quick/dialogs/colorandfiledialogs/main.cpp delete mode 100644 examples/quick/dialogs/dialogs.qml delete mode 100644 examples/quick/dialogs/dialogs.qrc delete mode 100644 examples/quick/dialogs/main.cpp create mode 100644 src/imports/dialogs/doc/qtquickdialogs.qdocconf create mode 100644 src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc create mode 100644 src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml deleted file mode 100644 index f3d253aa8c..0000000000 --- a/examples/quick/dialogs/ColorDialogs.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 320 - height: 200 - color: palette.window - SystemPalette { id: palette } - clip: true - - ColorDialog { - id: colorDialog - visible: colorDialogVisible.checked - modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: "Choose a color" - color: "green" - showAlphaChannel: colorDialogAlpha.checked - onAccepted: { console.log("Accepted: " + color) } - onRejected: { console.log("Rejected") } - } - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - font.bold: true - text: "Color dialog properties:" - } - CheckBox { - id: colorDialogModal - text: "Modal" - checked: true - Binding on checked { value: colorDialog.modality != Qt.NonModal } - } - CheckBox { - id: colorDialogAlpha - text: "Show alpha channel" - Binding on checked { value: colorDialog.showAlphaChannel } - } - CheckBox { - id: colorDialogVisible - text: "Visible" - Binding on checked { value: colorDialog.visible } - } - Row { - id: colorRow - spacing: parent.spacing - height: colorLabel.implicitHeight * 2.0 - Rectangle { - color: colorDialog.color - height: parent.height - width: height * 2 - border.color: "black" - MouseArea { - anchors.fill: parent - onClicked: colorDialog.open() - } - } - Text { - id: colorLabel - color: palette.windowText - text: "current color: " + colorDialog.color - anchors.verticalCenter: parent.verticalCenter - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.close() - } - Button { - text: "set to green" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.color = "green" - } - } - } -} diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml deleted file mode 100644 index 8ed64b0b3c..0000000000 --- a/examples/quick/dialogs/FileDialogs.qml +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 580 - height: 400 - color: palette.window - SystemPalette { id: palette } - clip: true - - FileDialog { - id: fileDialog - visible: fileDialogVisible.checked - modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: fileDialogSelectFolder.checked ? "Choose a folder" : - (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") - selectExisting: fileDialogSelectExisting.checked - selectMultiple: fileDialogSelectMultiple.checked - selectFolder: fileDialogSelectFolder.checked - nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] - selectedNameFilter: "All files (*)" - onAccepted: { console.log("Accepted: " + fileUrls) } - onRejected: { console.log("Rejected") } - } - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - color: palette.windowText - font.bold: true - text: "File dialog properties:" - } - CheckBox { - id: fileDialogModal - text: "Modal" - checked: true - Binding on checked { value: fileDialog.modality != Qt.NonModal } - } - CheckBox { - id: fileDialogSelectFolder - text: "Select Folder" - Binding on checked { value: fileDialog.selectFolder } - } - CheckBox { - id: fileDialogSelectExisting - text: "Select Existing Files" - checked: true - Binding on checked { value: fileDialog.selectExisting } - } - CheckBox { - id: fileDialogSelectMultiple - text: "Select Multiple Files" - Binding on checked { value: fileDialog.selectMultiple } - } - CheckBox { - id: fileDialogVisible - text: "Visible" - Binding on checked { value: fileDialog.visible } - } - Text { - color: palette.windowText - text: "current view folder: " + fileDialog.folder - } - Text { - color: palette.windowText - text: "name filters: {" + fileDialog.nameFilters + "}" - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "current filter:" + fileDialog.selectedNameFilter - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen files: " + fileDialog.fileUrls - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen single path: " + fileDialog.fileUrl - width: parent.width - wrapMode: Text.Wrap - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "go to /tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml new file mode 100644 index 0000000000..6a0af7f730 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 320 + height: 200 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [colordialog] + ColorDialog { + id: colorDialog + visible: colorDialogVisible.checked + modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: "Choose a color" + color: "green" + showAlphaChannel: colorDialogAlpha.checked + onAccepted: { console.log("Accepted: " + color) } + onRejected: { console.log("Rejected") } + } + //! [colordialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + font.bold: true + text: "Color dialog properties:" + } + CheckBox { + id: colorDialogModal + text: "Modal" + checked: true + Binding on checked { value: colorDialog.modality != Qt.NonModal } + } + CheckBox { + id: colorDialogAlpha + text: "Show alpha channel" + Binding on checked { value: colorDialog.showAlphaChannel } + } + CheckBox { + id: colorDialogVisible + text: "Visible" + Binding on checked { value: colorDialog.visible } + } + Row { + id: colorRow + spacing: parent.spacing + height: colorLabel.implicitHeight * 2.0 + Rectangle { + color: colorDialog.color + height: parent.height + width: height * 2 + border.color: "black" + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + Text { + id: colorLabel + color: palette.windowText + text: "current color: " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } +} diff --git a/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml new file mode 100644 index 0000000000..d1278609f9 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 580 + height: 400 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [filedialog] + FileDialog { + id: fileDialog + visible: fileDialogVisible.checked + modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: fileDialogSelectFolder.checked ? "Choose a folder" : + (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") + selectExisting: fileDialogSelectExisting.checked + selectMultiple: fileDialogSelectMultiple.checked + selectFolder: fileDialogSelectFolder.checked + nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] + selectedNameFilter: "All files (*)" + onAccepted: { console.log("Accepted: " + fileUrls) } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + color: palette.windowText + font.bold: true + text: "File dialog properties:" + } + CheckBox { + id: fileDialogModal + text: "Modal" + checked: true + Binding on checked { value: fileDialog.modality != Qt.NonModal } + } + CheckBox { + id: fileDialogSelectFolder + text: "Select Folder" + Binding on checked { value: fileDialog.selectFolder } + } + CheckBox { + id: fileDialogSelectExisting + text: "Select Existing Files" + checked: true + Binding on checked { value: fileDialog.selectExisting } + } + CheckBox { + id: fileDialogSelectMultiple + text: "Select Multiple Files" + Binding on checked { value: fileDialog.selectMultiple } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Text { + color: palette.windowText + text: "current view folder: " + fileDialog.folder + } + Text { + color: palette.windowText + text: "name filters: {" + fileDialog.nameFilters + "}" + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "current filter:" + fileDialog.selectedNameFilter + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen files: " + fileDialog.fileUrls + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen single path: " + fileDialog.fileUrl + width: parent.width + wrapMode: Text.Wrap + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } +} diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro new file mode 100644 index 0000000000..3a7b25c91a --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += colorandfiledialogs.qrc ../../shared/shared.qrc + +OTHER_FILES += \ + dialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc new file mode 100644 index 0000000000..efebfe4845 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc @@ -0,0 +1,7 @@ + + + dialogs.qml + FileDialogs.qml + ColorDialogs.qml + + diff --git a/examples/quick/dialogs/colorandfiledialogs/dialogs.qml b/examples/quick/dialogs/colorandfiledialogs/dialogs.qml new file mode 100644 index 0000000000..b5f9841a3f --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/dialogs.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" + +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } + + ColorDialogs { + property string title: "Color Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } +} diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg new file mode 100644 index 0000000000..4517a39308 Binary files /dev/null and b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg differ diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc new file mode 100644 index 0000000000..e3d021dba8 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick ColorDialog and FileDialog Examples + \example colorandfiledialogs + \brief This example demonstrates the color and file dialog types in QML + \image qml-colorandfiledialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the color and file system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet dialogs/colorandfiledialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet dialogs/colorandfiledialogs/ColorDialogs.qml colordialog +*/ diff --git a/examples/quick/dialogs/colorandfiledialogs/main.cpp b/examples/quick/dialogs/colorandfiledialogs/main.cpp new file mode 100644 index 0000000000..e8c2ae6aaa --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro index b76f396e9d..275e36470f 100644 --- a/examples/quick/dialogs/dialogs.pro +++ b/examples/quick/dialogs/dialogs.pro @@ -1,17 +1,4 @@ -TEMPLATE = app +TEMPLATE = subdirs -QT += quick qml -SOURCES += main.cpp -RESOURCES += dialogs.qrc ../shared/shared.qrc - -OTHER_FILES += \ - dialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml - -EXAMPLE_FILES = \ - FileDialogs.qml \ - ColorDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs -INSTALLS += target +SUBDIRS = \ + colorandfiledialogs diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/dialogs.qml deleted file mode 100644 index b5f9841a3f..0000000000 --- a/examples/quick/dialogs/dialogs.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../shared" - -TabSet { - width: 580 - height: 440 - - FileDialogs { - property string title: "File Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } - - ColorDialogs { - property string title: "Color Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } -} diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc deleted file mode 100644 index efebfe4845..0000000000 --- a/examples/quick/dialogs/dialogs.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - dialogs.qml - FileDialogs.qml - ColorDialogs.qml - - diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/main.cpp deleted file mode 100644 index bbf0c48104..0000000000 --- a/examples/quick/dialogs/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index b7704dadda..53cad30cee 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -3,6 +3,8 @@ TARGET = dialogplugin TARGETPATH = QtQuick/Dialogs IMPORT_VERSION = 1.0 +QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf + SOURCES += \ qquickabstractfiledialog.cpp \ qquickplatformfiledialog.cpp \ diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf new file mode 100644 index 0000000000..8a4435cd41 --- /dev/null +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -0,0 +1,35 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickDialogs +description = Qt Quick Dialogs Reference Documentation +url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/ +version = $QT_VERSION + +qhp.projects = qtquickdialogs + +qhp.qtquickdialogs.file = qtquickdialogs.qhp +qhp.qtquickdialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG +qhp.qtquickdialogs.virtualFolder = qtquickdialogs +qhp.qtquickdialogs.indexTitle = Qt Quick Dialogs +qhp.qtquickdialogs.indexRoot = + +qhp.qtquickdialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc +qhp.qtquickdialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION +qhp.qtquickdialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION + +qhp.qtquickdialogs.subprojects = qtquickdialogsqmltypes +qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.title = QML Types +qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs +qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.selectors = class fake:headerfile +qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.sortPages = true +qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.type = manual + +depends = qtqml qtquick qtgui qtwidgets qtdoc + +exampledirs += ../../../../examples/quick/ + +headerdirs += ../ + +sourcedirs += ../ + +imagedirs += images diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc new file mode 100644 index 0000000000..ee277f48dc --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtquickdialog_examples + \ingroup qtquickexamples + \title Qt Quick Examples - Dialogs + \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML. + + These examples show how to use the \l{Qt Quick Dialogs}. +*/ + diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc new file mode 100644 index 0000000000..5a1223b04d --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group dialogs + \title Dialogs +*/ + +/*! + \page qtquickdialogs-index.html + \title Qt Quick Dialogs + + \brief Qt Quick Dialogs submodule + + The module is new in Qt 5.1. + + \section1 Dialogs + + \annotatedlist dialogs + + \section1 Related information + + \section2 Examples + \list + \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples} + \endlist + + \section2 Reference + \list + \li \l{Qt Quick Dialogs QML Types}{QML Types} + \endlist + +*/ + diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index bee0ee00bc..5502a65310 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -55,33 +55,6 @@ QT_BEGIN_NAMESPACE - -/*! - \group dialogs - \title Dialogs -*/ - -/*! - \page qtquickdialogs-index.html - \title Qt Quick Dialogs - - \brief Qt Quick Dialogs submodule - - The submodule is new in Qt 5.1. - - \section1 Dialogs - - \annotatedlist dialogs - - \section1 Related information - - \section2 Reference - \list - \li \l{Qt Quick Dialogs QML Types}{Qt Quick Dialogs QML Types} - \endlist - -*/ - /*! \qmlmodule QtQuick.Dialogs 1 \title Qt Quick Dialogs QML Types diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index 7163baa819..0a4d276cb8 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -125,7 +125,7 @@ Additional Qt Quick information: system for Qt Quick \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information - \li \l{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + \li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and interacting with system dialogs \endlist \li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick -- cgit v1.2.1 From 114c9a16e240558a8aea2004696369e78ef5ac80 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 28 May 2013 10:35:23 +0200 Subject: Animations: Avoid accessing invalid memory if stop() triggers deletion Return immediately if calling stop() results in the current object being deleted. Task-number: QTBUG-31247 Change-Id: I684a858bfb4cc53f415daa8cc1c4df96067daa1c Reviewed-by: Alan Alpert --- src/qml/animations/qsequentialanimationgroupjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index c649370680..b82e1850f7 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) if (atEnd()) { //we make sure that we don't exceed the duration here m_currentTime += m_currentAnimation->currentTime() - newCurrentTime; - stop(); + RETURN_IF_DELETED(stop()); } } else { //the only case where currentAnimation could be null //is when all animations have been removed Q_ASSERT(!firstChild()); m_currentTime = 0; - stop(); + RETURN_IF_DELETED(stop()); } m_previousLoop = m_currentLoop; -- cgit v1.2.1 From 3414cc6c7a4e021ec2c9a4f369acc2a0a0568c58 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 15 May 2013 17:28:35 +0200 Subject: Make sure tryCompare value argument is not undefined It happens often that people convert a compare(foo.bar, 3) to a tryCompare(foo.bar, 3) and unfortunately that succeeds but doesn't do what they expected This makes tryCompare fail if no third argument is given Task-number: QTBUG-31427 Change-Id: I0c9618dae9aad4be55aa35c3e2dcf3535728beaa Reviewed-by: Alan Alpert --- dist/changes-5.1.0 | 3 +++ src/imports/testlib/TestCase.qml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index 50bdc2f9f8..8633d22eef 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -43,6 +43,9 @@ Third party components as count, which are based off of the data model will no longer update immediately if queried. Updates are batched to happen once per frame (or when properties are being set). + + - tryCompare now correctly fails when it only gets two parameters + **************************************************************************** * Library * **************************************************************************** diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 7584241ca6..0bec4cddf2 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -291,6 +291,11 @@ Item { } function tryCompare(obj, prop, value, timeout) { + if (arguments.length == 2) { + qtest_results.fail("A value is required for tryCompare", + util.callerFile(), util.callerLine()) + throw new Error("QtQuickTest::fail") + } if (!timeout) timeout = 5000 if (!qtest_compareInternal(obj[prop], value)) -- cgit v1.2.1 From fee0ad70bf23287576f901b60e74de857c946dc2 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 28 May 2013 15:59:29 +0200 Subject: Doc: Excluded Dialogs directory from Qt Quick doc build. Qt Quick Dialogs is separate and should be excluded from the Qt Quick doc build. Task-number: QTBUG-30180 Change-Id: I6e63efc071d8d2e5673745f0dcd97d5b5f562d25 Reviewed-by: Alan Alpert Reviewed-by: Martin Smith --- src/quick/doc/qtquick.qdocconf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index fba4ff89df..96b6f839e9 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -58,3 +58,6 @@ sourcedirs += ../../imports #add plugins directory because of dependencies headerdirs += ../../plugins sourcedirs += ../../plugins + +#exclude certain directories +excludedirs = ../../imports/dialogs -- cgit v1.2.1 From c7915779e113e270a1fd862eda375aa8ffcbbf4a Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 29 May 2013 11:01:22 +0200 Subject: Doc: Fix various problems in Qt Quick Dialogs documentation This change fixes the following things in .qdocconf: - CamelCase for project name (required for generating valid tags in example manifest file). - Proper selector for QML Types topic - Fix exampledirs to not pull in all the Qt Quick examples - Add examplesinstallpath to make Qt Creator see the examples Also fixes the paths in example docs according to changed exampledirs. Change-Id: If18f7b5a3160d85814d508e1cbfb7bdb1a002c54 Reviewed-by: Caroline Chao Reviewed-by: Jerome Pasion Reviewed-by: Shawn Rutledge --- .../doc/src/colorandfiledialogs.qdoc | 4 +-- src/imports/dialogs/doc/qtquickdialogs.qdocconf | 38 ++++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc index e3d021dba8..68804649a9 100644 --- a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc +++ b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc @@ -36,9 +36,9 @@ A \l FileDialog is used to choose a single file, multiple files or a single directory, depending on how it is configured. - \snippet dialogs/colorandfiledialogs/FileDialogs.qml filedialog + \snippet colorandfiledialogs/FileDialogs.qml filedialog A \l ColorDialog is used to choose a color, with or without alpha (transparency) depending on how it is configured. - \snippet dialogs/colorandfiledialogs/ColorDialogs.qml colordialog + \snippet colorandfiledialogs/ColorDialogs.qml colordialog */ diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf index 8a4435cd41..5caa1c0588 100644 --- a/src/imports/dialogs/doc/qtquickdialogs.qdocconf +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -5,31 +5,33 @@ description = Qt Quick Dialogs Reference Documentation url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/ version = $QT_VERSION -qhp.projects = qtquickdialogs +qhp.projects = QtQuickDialogs -qhp.qtquickdialogs.file = qtquickdialogs.qhp -qhp.qtquickdialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG -qhp.qtquickdialogs.virtualFolder = qtquickdialogs -qhp.qtquickdialogs.indexTitle = Qt Quick Dialogs -qhp.qtquickdialogs.indexRoot = +qhp.QtQuickDialogs.file = qtquickdialogs.qhp +qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG +qhp.QtQuickDialogs.virtualFolder = qtquickdialogs +qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.indexRoot = -qhp.qtquickdialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc -qhp.qtquickdialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION -qhp.qtquickdialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION +qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc +qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION +qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION -qhp.qtquickdialogs.subprojects = qtquickdialogsqmltypes -qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.title = QML Types -qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs -qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.selectors = class fake:headerfile -qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.sortPages = true -qhp.qtquickdialogs.subprojects.qtquickdialogsqmltypes.type = manual +qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.type = manual depends = qtqml qtquick qtgui qtwidgets qtdoc -exampledirs += ../../../../examples/quick/ +exampledirs += ../../../../examples/quick/dialogs -headerdirs += ../ +examplesinstallpath = quick/dialogs -sourcedirs += ../ +headerdirs += .. + +sourcedirs += .. imagedirs += images -- cgit v1.2.1 From 4bb9519dc2d3622b7eaed5ff7c350e414a1a2fe4 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 29 May 2013 09:46:20 +0200 Subject: Doc: Fix links for ListModel and ListElement types Link to documentation under QtQml module. Change-Id: Id65d237558c235dcdda8ab206eddef23c2886a29 Reviewed-by: Jerome Pasion --- src/qml/types/qqmllistmodel.cpp | 8 ++++++-- src/quick/doc/src/qmltypereference.qdoc | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 9277b6ea8f..5ddc0f52bd 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1431,7 +1431,9 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru The ListModel is a simple container of ListElement definitions, each containing data roles. The contents can be defined dynamically, or explicitly in QML. - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListModel + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListModel}{Full documentation for ListModel} */ /*! \qmltype ListModel @@ -2540,7 +2542,9 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) List elements are defined inside ListModel definitions, and represent items in a list. - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListElement + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListElement}{Full documentation for ListElement} */ /*! \qmltype ListElement diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index d580ba8c96..bb488ac2f2 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -236,11 +236,11 @@ Animation paths Models And Model Data \list -\li \l {QtQuick2::ListModel}{ListModel} - Defines a list of data -\li \l {QtQuick2::ListElement}{ListElement} - Defines a data item in a \l {QtQuick2::ListModel}{ListModel} +\li \l {QtQml2::ListModel}{ListModel} - Defines a list of data +\li \l {QtQml2::ListElement}{ListElement} - Defines a data item in a \l {QtQml2::ListModel}{ListModel} \li \l {VisualItemModel} - Contains items that already defines its own visual delegate \li \l {VisualDataModel} - Encapsulates a model and a delegate -\li \l {VisualDataGroup} -Encapsulates a filtered set of visual data items +\li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items \li \l {XmlListModel} - Specifies a model using XPath expressions \li \l {XmlRole} - Specifies a role for an \l {XmlListModel} \endlist -- cgit v1.2.1 From 89225e99da19f905bd4f1319afefa82087885825 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 27 May 2013 15:01:51 +0200 Subject: Doc: Added Qt 5.1 details in Qt QML's release notes. Change-Id: Ie5a4199563b22c21d7be009aeb85206670b84642 Reviewed-by: Martin Smith --- src/qml/doc/src/whatsnew.qdoc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 6ca979db37..38713a1976 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -29,7 +29,28 @@ \title Qt QML Release Notes \page qtqml-releasenotes.html -\section1 Qt QML in Qt 5 +\section1 Qt QML in Qt 5.1 + +Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is +a summary of the new changes: +\list +\li New QQmlApplicationEngine convenience class for QML applications. +\li New Instantiatior type for generic, dynamic object creation. +\li New properties for \l Qt.application: arguments, name, and version. +\endlist + +\section2 New Submodules + +The Qt QML Models is a new submodule in Qt 5.1 and provides several QML types +for handling data with models and lists. + +\list +\li \l{QtQml.Models}{Models} +\endlist + +The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. + +\section1 Qt QML in Qt 5.0 The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and implements the QML language supporting infrastructure. -- cgit v1.2.1 From 124473935a99598bfe63538c5a388590cc1cc229 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 24 May 2013 16:56:26 +0200 Subject: Doc fixes to the Positioners/Layouts documentation * Add references to Qt Quick Layouts * Don't lie about that Positioners can resize the items * Rename title from "Item Layouts" to "Item Positioners" to avoid confusion with Qt Quick Layouts Change-Id: I43e3ad6e6d9e4b08a1233868c75f0efcab43f8c3 Reviewed-by: Caroline Chao Reviewed-by: Jerome Pasion --- src/quick/doc/qtquick.qdocconf | 2 +- src/quick/doc/src/concepts/positioning/layouts.qdoc | 8 ++++++-- src/quick/items/qquickitem.cpp | 4 ++-- src/quick/items/qquickpositioners.cpp | 14 +++++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 96b6f839e9..13b03d40e4 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtdoc +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc headerdirs += .. diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc index 785bcc6ca6..35be2f6235 100644 --- a/src/quick/doc/src/concepts/positioning/layouts.qdoc +++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc @@ -28,9 +28,9 @@ /*! \ingroup qtquick-positioners \page qtquick-positioning-layouts.html -\title Item Layouts +\title Item Positioners -Positioner items are container items that manage the positions and sizes of +Positioner items are container items that manage the positions of items in a declarative user interface. Positioners behave in a similar way to the \l{Widgets and Layouts}{layout managers} used with standard Qt widgets, except that they are also containers in their own right. @@ -38,6 +38,10 @@ except that they are also containers in their own right. Positioners make it easier to work with many items when they need to be arranged in a regular layout. +\l{Qt Quick Layouts} can also be used to arrange Qt Quick items in a user interface. +They manage both the positions and the sizes of items on a declarative user interface, +and are well suited for resizable user interfaces. + \section1 Positioners A set of standard positioners are provided in the basic set of Qt Quick diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 58e1612e19..110e14d266 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1363,7 +1363,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) \brief Property used to mirror layout behavior The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors}, - \l{Item Layouts}{positioner} types (such as \l Row and \l Grid) + \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and views (such as \l GridView and horizontal \l ListView). Mirroring is a visual change: left anchors become right anchors, and positioner types like \l Grid and \l Row reverse the horizontal layout of child items. @@ -1403,7 +1403,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) This property holds whether the item's layout is mirrored horizontally. Setting this to true horizontally reverses \l {anchor-layout}{anchor} settings such that left anchors become right, - and right anchors become left. For \l{Item Layouts}{positioner} types + and right anchors become left. For \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and view types (such as \l {GridView}{GridView} and \l {ListView}{ListView}) this also mirrors the horizontal layout direction of the item. diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 789d2e62aa..b07a38cdaf 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -626,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) more information about its position within the Column. For more information on using Column and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \section1 Using Transitions @@ -644,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \image verticalpositioner_transition.gif - \sa Row, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::populate @@ -795,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors() more information about its position within the Row. For more information on using Row and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Column, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::populate @@ -1028,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Grid and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Flow, Row, Column, Positioner, {Qt Quick Examples - Positioners} + \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::populate @@ -1570,7 +1570,7 @@ void QQuickGrid::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Flow and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners} */ -- cgit v1.2.1 From 251a267fb5a48790b1446b5eda3ee553cd4abfab Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 29 May 2013 10:58:38 +0200 Subject: window example: show only the splash screen until the timeout The window takes time to resize itself; we can avoid letting the user see that by delaying visibility of the main window. Change-Id: I81d656102b384a66b5539cbd879aadb85261ba33 Reviewed-by: Gabriel de Dietrich --- examples/quick/window/Splash.qml | 11 ++++++++--- examples/quick/window/window.qml | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml index 092e6e6fc2..c981bd2585 100644 --- a/examples/quick/window/Splash.qml +++ b/examples/quick/window/Splash.qml @@ -43,6 +43,7 @@ import QtQuick.Window 2.1 //! [splash-properties] Window { + id: splash visible: true width: splashImage.width height: splashImage.height @@ -50,7 +51,8 @@ Window { title: "Splash Window" modality: Qt.ApplicationModal flags: Qt.SplashScreen - property int timeout: 2000 + property int timeoutInterval: 2000 + signal timeout //! [splash-properties] //! [screen-properties] x: (Screen.width - splashImage.width) / 2 @@ -67,8 +69,11 @@ Window { } //! [timer] Timer { - interval: timeout; running: true; repeat: false - onTriggered: visible = false + interval: timeoutInterval; running: true; repeat: false + onTriggered: { + visible = false + splash.timeout() + } } //! [timer] } diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml index 1d7282f7a1..67e2ba40ff 100644 --- a/examples/quick/window/window.qml +++ b/examples/quick/window/window.qml @@ -46,14 +46,11 @@ QtObject { property real defaultSpacing: 10 property SystemPalette palette: SystemPalette { } - property var splashWindow: Splash { } - property var controlWindow: Window { width: 400 height: col.implicitHeight + defaultSpacing * 2 color: palette.window title: "Control Window" - visible: true Column { id: col anchors.fill: parent @@ -177,4 +174,8 @@ QtObject { } } } + + property var splashWindow: Splash { + onTimeout: controlWindow.visible = true + } } -- cgit v1.2.1 From 5e3d81ecfe0a14be2e1028a15df80df16d301db2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 29 May 2013 15:22:32 +0200 Subject: Fix various bugs in calqlatr It's still not a great example but at least it's somewhat usable now. - added files to .pro so you see them all in Creator - keypad is fixed size and the "tape" takes up the rest, so you can resize the window to be able to see long numbers - you can flick the ListView (MouseArea not on top of the whole thing!) - ListView scrolls to the bottom when you add numbers past the point that scrolling is necessary to see them - Clear, sqrt and +/- keys are functional Task-number: QTBUG-26556 Change-Id: I485e4123ad6c24ca64bad3efc3acfc14587268d8 Reviewed-by: Friedemann Kleint Reviewed-by: Alan Alpert --- examples/quick/demos/calqlatr/calqlatr.pro | 19 +++++++++++++++++++ examples/quick/demos/calqlatr/calqlatr.qml | 11 ++++++++--- examples/quick/demos/calqlatr/content/Display.qml | 20 ++++++++++++++++++-- examples/quick/demos/calqlatr/content/NumberPad.qml | 2 +- examples/quick/demos/calqlatr/content/calculator.js | 8 ++++---- 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro index 1b002a5f27..91d52a293e 100644 --- a/examples/quick/demos/calqlatr/calqlatr.pro +++ b/examples/quick/demos/calqlatr/calqlatr.pro @@ -6,5 +6,24 @@ SOURCES += main.cpp RESOURCES += calqlatr.qrc \ ../../shared/shared.qrc +OTHER_FILES = calqlatr.qml \ + content/Button.qml \ + content/Display.qml \ + content/NumberPad.qml \ + content/StyleLabel.qml \ + content/audio/touch.wav \ + content/calculator.js \ + content/images/icon-back.png \ + content/images/icon-close.png \ + content/images/icon-settings.png \ + content/images/logo.png \ + content/images/paper-edge-left.png \ + content/images/paper-edge-right.png \ + content/images/paper-grip.png \ + content/images/settings-selected-a.png \ + content/images/settings-selected-b.png \ + content/images/touch-green.png \ + content/images/touch-white.png + target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr INSTALLS += target diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml index 16b2e19724..0a092c25da 100644 --- a/examples/quick/demos/calqlatr/calqlatr.qml +++ b/examples/quick/demos/calqlatr/calqlatr.qml @@ -57,7 +57,7 @@ Rectangle { Item { id: pad - width: window.width * 0.58 + width: 180 NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } } @@ -77,7 +77,7 @@ Rectangle { Display { id: display x: -16 - width: window.width * 0.42 + width: window.width - pad.width height: parent.height MouseArea { @@ -85,7 +85,12 @@ Rectangle { property real oldP: 0 property bool rewind: false - anchors.fill: parent + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + } + height: 50 onPositionChanged: { var reverse = startX > window.width / 2 var mx = mapToItem(window, mouse.x).x diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml index 4a78a3ebcd..ec8edfea66 100644 --- a/examples/quick/demos/calqlatr/content/Display.qml +++ b/examples/quick/demos/calqlatr/content/Display.qml @@ -42,23 +42,38 @@ import QtQuick 2.0 Item { id: display + property bool enteringDigits: false function displayOperator(operator) { listView.model.append({ "operator": operator, "operand": "" }) + enteringDigits = true } function newLine(operator, operand) { listView.model.append({ "operator": operator, "operand": operand }) + enteringDigits = false + listView.positionViewAtEnd() } function appendDigit(digit) { - if (!listView.model.count) + if (!enteringDigits) listView.model.append({ "operator": "", "operand": "" }) var i = listView.model.count - 1; listView.model.get(i).operand = listView.model.get(i).operand + digit; + enteringDigits = true + } + + function clear() + { + if (enteringDigits) { + var i = listView.model.count - 1 + if (i >= 0) + listView.model.remove(i) + enteringDigits = false + } } Item { @@ -87,6 +102,7 @@ Item { } Image { + id: grip source: "images/paper-grip.png" anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom @@ -97,7 +113,7 @@ Item { id: listView x: 16; y: 30 width: display.width - height: display.height + height: display.height - 50 - y delegate: Item { height: 20 width: parent.width diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml index 3203e18431..c7f2680651 100644 --- a/examples/quick/demos/calqlatr/content/NumberPad.qml +++ b/examples/quick/demos/calqlatr/content/NumberPad.qml @@ -60,7 +60,7 @@ Grid { Button { text: "±"; color: "#6da43d"; operator: true } Button { text: "−"; color: "#6da43d"; operator: true } Button { text: "+"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } + Button { text: "√"; color: "#6da43d"; operator: true } Button { text: "÷"; color: "#6da43d"; operator: true } Button { text: "×"; color: "#6da43d"; operator: true } Button { text: "C"; color: "#6da43d"; operator: true } diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js index d86fecbf39..da8e940b16 100644 --- a/examples/quick/demos/calqlatr/content/calculator.js +++ b/examples/quick/demos/calqlatr/content/calculator.js @@ -84,7 +84,7 @@ function operatorPressed(op) } else if (previousOperator == "×") { digits = Number(curVal) * Number(digits.valueOf()) } else if (previousOperator == "÷") { - digits = Number(Number(curVal) / Number(digits.valueOf())).toString() + digits = Number(curVal) / Number(digits.valueOf()) } else if (previousOperator == "=") { } @@ -110,9 +110,9 @@ function operatorPressed(op) digits = (Math.abs(digits.valueOf())).toString() } else if (op == "Int") { digits = (Math.floor(digits.valueOf())).toString() - } else if (op == window.plusminus) { + } else if (op == "±") { digits = (digits.valueOf() * -1).toString() - } else if (op == window.squareRoot) { + } else if (op == "√") { digits = (Math.sqrt(digits.valueOf())).toString() } else if (op == "mc") { memory = 0; @@ -130,7 +130,7 @@ function operatorPressed(op) } else if (op == "Off") { Qt.quit(); } else if (op == "C") { - digits = "0" + display.clear() } else if (op == "AC") { curVal = 0 memory = 0 -- cgit v1.2.1 From 84adf4ff5b6b459c5dfc084b12f8ce6b58e5f5b7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 29 May 2013 10:29:08 +0200 Subject: Added QQuickWindow::setDefaultAlphaBuffer() All QQuickWindows will render using the same OpenGL context, so for a window to support transparency, the OpenGL context needs to be created with support for transparency from the very start. Therefore the application needs to call setDefaultAlphaBuffer() before creating windows. There are some relevant comments in QTBUG-20768 although the bug itself is not the same use case (it was already OK as long as the first window had a translucent color, because of setAlphaBufferSize in QQuickWindow::setColor()). Change-Id: I92e111c1a62c0d510821b646fd334e52254f8f57 Reviewed-by: Gunnar Sletta --- examples/quick/window/main.cpp | 2 ++ src/quick/items/qquickwindow.cpp | 31 +++++++++++++++++++++++++++++-- src/quick/items/qquickwindow.h | 3 +++ src/quick/items/qquickwindow_p.h | 2 ++ src/quick/scenegraph/qsgcontext.cpp | 3 +++ 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp index 2223c607b4..7872c7183c 100644 --- a/examples/quick/window/main.cpp +++ b/examples/quick/window/main.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,7 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine); + QQuickWindow::setDefaultAlphaBuffer(true); component.loadUrl(QUrl("qrc:///window/window.qml")); if ( component.isReady() ) component.create(); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4a34adabe8..7137bb165e 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); +bool QQuickWindowPrivate::defaultAlphaBuffer(0); + void QQuickWindowPrivate::updateFocusItemTransform() { Q_Q(QQuickWindow); @@ -2969,7 +2971,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create Setting the clear color has no effect when clearing is disabled. By default, the clear color is white. - \sa setClearBeforeRendering() + \sa setClearBeforeRendering(), setDefaultAlphaBuffer() */ void QQuickWindow::setColor(const QColor &color) @@ -2979,7 +2981,7 @@ void QQuickWindow::setColor(const QColor &color) return; if (color.alpha() != d->clearColor.alpha()) { - QSurfaceFormat fmt = format(); + QSurfaceFormat fmt = requestedFormat(); if (color.alpha() < 255) fmt.setAlphaBufferSize(8); else @@ -2996,6 +2998,31 @@ QColor QQuickWindow::color() const return d_func()->clearColor; } +/*! + \brief Returns whether to use alpha transparency on newly created windows. + + \since Qt 5.1 + \sa setDefaultAlphaBuffer() + */ +bool QQuickWindow::hasDefaultAlphaBuffer() +{ + return QQuickWindowPrivate::defaultAlphaBuffer; +} + +/*! + \brief \a useAlpha specifies whether to use alpha transparency on newly created windows. + \since Qt 5.1 + + In any application which expects to create translucent windows, it's + necessary to set this to true before creating the first QQuickWindow, + because all windows will share the same \l QOpenGLContext. The default + value is false. + */ +void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha) +{ + QQuickWindowPrivate::defaultAlphaBuffer = useAlpha; +} + /*! \qmlproperty string QtQuick.Window2::Window::title diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index fc148aabe6..a0bc832334 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -115,6 +115,9 @@ public: void setColor(const QColor &color); QColor color() const; + static bool hasDefaultAlphaBuffer(); + static void setDefaultAlphaBuffer(bool useAlpha); + void setPersistentOpenGLContext(bool persistent); bool isPersistentOpenGLContext() const; diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 9e3251b240..2465629778 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -219,6 +219,8 @@ public: mutable QQuickWindowIncubationController *incubationController; + static bool defaultAlphaBuffer; + static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event); // data property diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index d3710c7bd5..4ebae38699 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -398,6 +399,8 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); + if (QQuickWindow::hasDefaultAlphaBuffer()) + format.setAlphaBufferSize(8); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); return format; } -- cgit v1.2.1 From e840b9e2c56a786ef7c4232b8fb2f1df1b285da4 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Wed, 29 May 2013 14:03:23 +0200 Subject: Doc: Fix the positioning topic page Mention both Positioners and Qt Quick Layouts. Also add qtquickdialogs to qtquick.qdocconf. Change-Id: I19bc09a0a81be7c748af83ddf38f1111f0ecc81a Reviewed-by: Jerome Pasion --- src/quick/doc/qtquick.qdocconf | 2 +- src/quick/doc/src/concepts/positioning/topic.qdoc | 25 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 13b03d40e4..a27b0f82f7 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs headerdirs += .. diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc index 25fc6eaab7..bae6a7f71b 100644 --- a/src/quick/doc/src/concepts/positioning/topic.qdoc +++ b/src/quick/doc/src/concepts/positioning/topic.qdoc @@ -34,7 +34,7 @@ Visual items in QML can be positioned in a variety of ways. The most important positioning-related concept is that of anchoring, a form of relative positioning where items can be anchored (or attached) to each other at certain boundaries. Other positioning concepts include absolute positioning, -positioning with coordinate bindings, and layouts. +positioning with coordinate bindings, positioners, and layouts. \section1 Manual Positioning @@ -134,21 +134,20 @@ positioning, whereas a "contaminated" anchor layout is one which uses both anchoring and bindings (either on position-related [x,y] properties or on dimension-related [width,height] properties) to determine the position. -\section1 Layouts - -Qt Quick also provides some built-in layout items. For many use cases, the -best layout to use is a simple grid, row, or column, and Qt Quick provides -items which will layout children in these formations in the most efficient -manner possible. +\section1 Positioners -There are many well-known layouts which work well in user-interfaces, such as -grids and lists, rows and columns. Qt Quick supports these sort of pre-defined -layouts, which can often be more performant to draw than anchor or -binding-based layouts. See the documentation on -\l{qtquick-positioning-layouts.html}{layout types} for more -information about utilizing pre-defined layouts. +Qt Quick also provides some built-in positioner items. For many use cases, the best +positioner to use is a simple grid, row, or column, and Qt Quick provides items which +will position children in these formations in the most efficient manner possible. +See the documentation on \l{qtquick-positioning-layouts.html}{item positioners types} +for more information about utilizing pre-defined positioners. +\section1 Layouts +From Qt 5.1, the module \l {Qt Quick Layouts} can also be used to arrange Qt Quick +items in a user interface. Unlike positioners, the types in Qt Quick Layouts manage +both the positions and sizes of items in a declarative interface. They are well +suited for resizable user interfaces. \section1 Right-To-Left Support -- cgit v1.2.1 From 4ddeb6e460eba94bfc65b07559160c441545a8d4 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 19 Apr 2013 15:30:41 +0200 Subject: Precompile the most common materials Change-Id: Idfa76f9fcdbac61a248b38e1f793a6628af12552 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/scenegraph/qsgcontext.cpp | 28 ++++++++++++++++++++++++++++ src/quick/scenegraph/qsgcontext_p.h | 1 + 2 files changed, 29 insertions(+) diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 4ebae38699..61fb1bc5b9 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -47,7 +47,9 @@ #include #include #include +#include #include +#include #include #include @@ -263,9 +265,35 @@ void QSGContext::initialize(QOpenGLContext *context) Q_ASSERT(!d->gl); d->gl = context; + precompileMaterials(); + emit initialized(); } +#define QSG_PRECOMPILE_MATERIAL(name) { name m; prepareMaterial(&m); } + +/* + * Some glsl compilers take their time compiling materials, and + * the way the scene graph is being processed, these materials + * get compiled when they are first taken into use. This can + * easily lead to skipped frames. By precompiling the most + * common materials, we potentially add a few milliseconds to the + * start up, and reduce the chance of avoiding skipped frames + * later on. + */ +void QSGContext::precompileMaterials() +{ + if (qEnvironmentVariableIsEmpty("QSG_NO_MATERIAL_PRELOADING")) { + QSG_PRECOMPILE_MATERIAL(QSGVertexColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGFlatColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGOpaqueTextureMaterial); + QSG_PRECOMPILE_MATERIAL(QSGTextureMaterial); + QSG_PRECOMPILE_MATERIAL(SmoothTextureMaterial); + QSG_PRECOMPILE_MATERIAL(SmoothColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGDistanceFieldTextMaterial); + } +} + /*! Returns if the scene graph context is ready or not, meaning that it has a valid diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index b069c53dd3..bbc42674c6 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -90,6 +90,7 @@ public: bool isReady() const; + virtual void precompileMaterials(); QSGMaterialShader *prepareMaterial(QSGMaterial *material); virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId); -- cgit v1.2.1 From 474895df9c171964ec2170c1066fb0fef4fda7d2 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 31 May 2013 12:17:20 +0200 Subject: Stabilize tst_touchmouse Change-Id: I6d34571b85f99f780b03f7871f39dbf3be546006 Reviewed-by: Sergio Ahumada --- tests/auto/quick/touchmouse/tst_touchmouse.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 15a4f0cc27..4779942406 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -195,8 +195,9 @@ void tst_TouchMouse::simpleTouchEvent() window->setSource(testFileUrl("singleitem.qml")); window->show(); - window->requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(window)); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild("eventItem1"); @@ -344,7 +345,9 @@ void tst_TouchMouse::mouse() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild("eventItem1"); @@ -376,7 +379,9 @@ void tst_TouchMouse::touchOverMouse() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild("eventItem1"); @@ -417,7 +422,9 @@ void tst_TouchMouse::mouseOverTouch() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild("eventItem1"); @@ -461,7 +468,9 @@ void tst_TouchMouse::buttonOnFlickable() window->setSource(testFileUrl("buttononflickable.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickFlickable *flickable = window->rootObject()->findChild("flickable"); @@ -569,7 +578,9 @@ void tst_TouchMouse::buttonOnTouch() QQuickView *window = createView(); window->setSource(testFileUrl("buttonontouch.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild("pincharea"); @@ -691,7 +702,9 @@ void tst_TouchMouse::pinchOnFlickable() QQuickView *window = createView(); window->setSource(testFileUrl("pinchonflickable.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild("pincharea"); @@ -758,7 +771,9 @@ void tst_TouchMouse::flickableOnPinch() QQuickView *window = createView(); window->setSource(testFileUrl("flickableonpinch.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild("pincharea"); @@ -935,8 +950,9 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() window->setSource(testFileUrl("twoMouseAreas.qml")); window->show(); - window->requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(window)); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickMouseArea *bottomMouseArea = -- cgit v1.2.1 From d818575966e2e2000fe2b7ee390c620f595d9825 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 29 May 2013 11:14:51 +0200 Subject: Deprecate the with statement in QML It is generally considered deprecated in JavaScript and its use disables a whole range of optimizations that we would like to apply in the future. Therefore this patch will issue a warning if the with statement is detected. This change is also documented, along with the plan on enabling strict mode in the future. Change-Id: Ie60f0536e0bdd6ecc537d8e34efbd8868bcad743 Reviewed-by: Lars Knoll --- src/qml/doc/src/javascript/hostenvironment.qdoc | 9 +++++++++ src/qml/qml/parser/qqmljs.g | 4 ++++ src/qml/qml/parser/qqmljsparser.cpp | 4 ++++ src/qml/qml/qqmlscript.cpp | 6 ++++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc index a63ef617c0..3bd64ac115 100644 --- a/src/qml/doc/src/javascript/hostenvironment.qdoc +++ b/src/qml/doc/src/javascript/hostenvironment.qdoc @@ -166,6 +166,15 @@ Item { } \endqml +\li The \c with statement is deprecated. Using the \c with statement will issue a warning +at loading time and we plan on removing support for it in Qt 5.2. It is generally considered +a language feature that is not recommended for use due reducing the readability of code and disabling +many optimizations in the engine. It is also forbidden in ECMAScript 5 strict mode. + +\li JavaScript binding expressions are executed in non-strict mode. However we +plan on changing the default for bindings in Qt 5.2 to execute always in +ECMAScript 5 strict mode. + \endlist diff --git a/src/qml/qml/parser/qqmljs.g b/src/qml/qml/parser/qqmljs.g index ff4f54374b..5d279ef1a2 100644 --- a/src/qml/qml/parser/qqmljs.g +++ b/src/qml/qml/parser/qqmljs.g @@ -2615,6 +2615,10 @@ case $rule_number: { node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; + if (lexer->qmlMode()) { + const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!"); + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg)); + } } break; ./ diff --git a/src/qml/qml/parser/qqmljsparser.cpp b/src/qml/qml/parser/qqmljsparser.cpp index a0fa7a4711..46b5c041d4 100644 --- a/src/qml/qml/parser/qqmljsparser.cpp +++ b/src/qml/qml/parser/qqmljsparser.cpp @@ -1515,6 +1515,10 @@ case 311: { node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; + if (lexer->qmlMode()) { + const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!"); + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg)); + } } break; case 312: { diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp index 613ff24f20..ba2882f3e7 100644 --- a/src/qml/qml/qqmlscript.cpp +++ b/src/qml/qml/qqmlscript.cpp @@ -1318,13 +1318,15 @@ bool QQmlScript::Parser::parse(const QString &qmlcode, const QByteArray & /* pre QQmlJS::Parser parser(&data->engine); - if (! parser.parse() || !_errors.isEmpty()) { + if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) { // Extract errors from the parser foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) { - if (m.isWarning()) + if (m.isWarning()) { + qWarning("%s:%d : %s", qPrintable(_scriptFile), m.loc.startLine, qPrintable(m.message)); continue; + } QQmlError error; error.setUrl(url); -- cgit v1.2.1 From 84627464eb11ca1149d46946b12e3c82eb54a8bf Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Fri, 24 May 2013 10:46:39 +0300 Subject: Fallback to QMetaObject for properties not in QQmlPropertyCache QQmlOpenMetaObject does not update the QQmlPropertyCache when new properties are added, meaning that the QQmlPropertyCache might not contain all of the dynamic properties of an object. Therefore, make QQmlPropertyCache fallback to reading the QMetaObject when a property is not found. Task-number: QTBUG-31226 Change-Id: I760aaa155b1952f6f52ab9ce173fb9547f8e34a6 Reviewed-by: Alan Alpert --- src/qml/qml/qqmlpropertycache.cpp | 11 ++++++-- src/qml/qml/v8/qv8qobjectwrapper.cpp | 2 +- .../qml/qqmlpropertymap/tst_qqmlpropertymap.cpp | 29 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index b1ffc9a2d5..dee9f26c80 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1328,8 +1328,14 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS rv.load(p); return rv; } else { - while (cmo && cmo->propertyOffset() >= idx) + bool changed = false; + while (cmo && cmo->propertyOffset() >= idx) { cmo = cmo->superClass(); + changed = true; + } + /* If the "cmo" variable didn't change, set it to 0 to + * avoid running into an infinite loop */ + if (!changed) cmo = 0; } } else { cmo = 0; @@ -1395,7 +1401,8 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, const T &name, if (cache) { rv = cache->property(name, obj, context); - } else { + } + if (!rv) { local = qQmlPropertyCacheCreate(obj->metaObject(), qQmlPropertyCacheToString(name)); if (local.isValid()) rv = &local; diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index 0336457027..53f70ad132 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -524,7 +524,7 @@ v8::Handle QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject QQmlData *ddata = QQmlData::get(object, false); if (ddata && ddata->propertyCache) result = ddata->propertyCache->property(property, object, context); - else + if (!result) result = QQmlPropertyCache::property(engine->engine(), object, property, context, local); } diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 327716f1b5..2b772ba9c4 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -66,6 +66,7 @@ private slots: void crashBug(); void QTBUG_17868(); void metaObjectAccessibility(); + void QTBUG_31226(); }; void tst_QQmlPropertyMap::insert() @@ -312,6 +313,34 @@ void tst_QQmlPropertyMap::metaObjectAccessibility() QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); } +void tst_QQmlPropertyMap::QTBUG_31226() +{ + /* Instantiate a property map from QML, and verify that property changes + * made from C++ are visible from QML */ + QQmlEngine engine; + QQmlContext context(&engine); + qmlRegisterType("QTBUG_31226", 1, 0, "PropertyMap"); + QQmlComponent c(&engine); + c.setData("import QtQuick 2.0\nimport QTBUG_31226 1.0\n" + "Item {\n" + " property string myProp\n" + " PropertyMap { id: qmlPropertyMap; objectName: \"qmlPropertyMap\" }\n" + " Timer { interval: 5; running: true; onTriggered: { myProp = qmlPropertyMap.greeting; } }\n" + "}", + QUrl()); + QObject *obj = c.create(&context); + QVERIFY(obj); + + QQmlPropertyMap *qmlPropertyMap = obj->findChild(QString("qmlPropertyMap")); + QVERIFY(qmlPropertyMap); + + qmlPropertyMap->insert("greeting", QString("Hello world!")); + QTRY_COMPARE(obj->property("myProp").toString(), QString("Hello world!")); + + delete obj; + +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" -- cgit v1.2.1 From 843e222b17970c211dfab82215cf41adc4547ab5 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Wed, 29 May 2013 11:29:52 +0300 Subject: QQmlPropertyCache: check methods before properties When creating the QQmlPropertyData, search within the methods list before searching for properties. The reason is that if the meta object is dynamic, looking up a property will always return a result (if the property doesn't exist, it will be created) and therefore all methods will be obscured. By swapping the search order, we eliminate this risk (methods are not dynamically added). Task-number: QTBUG-29836 Change-Id: Ie367f757c37ef4bc834a6c1c009f27bcf344fe76 Reviewed-by: Matthew Vogt Reviewed-by: Alan Alpert --- src/qml/qml/qqmlpropertycache.cpp | 46 ++++++++++++---------- .../qml/qqmlpropertymap/tst_qqmlpropertymap.cpp | 32 ++++++++++++++- 2 files changed, 55 insertions(+), 23 deletions(-) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index dee9f26c80..4712fbd614 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1317,6 +1317,31 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS Q_ASSERT(metaObject); QQmlPropertyData rv; + + /* It's important to check the method list before checking for properties; + * otherwise, if the meta object is dynamic, a property will be created even + * if not found and it might obscure a method having the same name. */ + + //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML + static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); + static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()"); + static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()"); + + int methodCount = metaObject->methodCount(); + for (int ii = methodCount - 1; ii >= 0; --ii) { + if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx) + continue; + QMetaMethod m = metaObject->method(ii); + if (m.access() == QMetaMethod::Private) + continue; + QString methodName = QString::fromUtf8(m.name().constData()); + + if (methodName == property) { + rv.load(m); + return rv; + } + } + { const QMetaObject *cmo = metaObject; const QByteArray propertyName = property.toUtf8(); @@ -1342,27 +1367,6 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS } } } - - //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML - static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); - static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()"); - static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()"); - - int methodCount = metaObject->methodCount(); - for (int ii = methodCount - 1; ii >= 0; --ii) { - if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx) - continue; - QMetaMethod m = metaObject->method(ii); - if (m.access() == QMetaMethod::Private) - continue; - QString methodName = QString::fromUtf8(m.name().constData()); - - if (methodName == property) { - rv.load(m); - return rv; - } - } - return rv; } diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 2b772ba9c4..ca212d333b 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -67,6 +67,7 @@ private slots: void QTBUG_17868(); void metaObjectAccessibility(); void QTBUG_31226(); + void QTBUG_29836(); }; void tst_QQmlPropertyMap::insert() @@ -287,13 +288,17 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap { Q_OBJECT public: - MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0) {} + MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0), m_testSlotCalled(false) {} + bool testSlotCalled() const { return m_testSlotCalled; } signals: void testSignal(); public slots: - void testSlot() {} + void testSlot() { m_testSlotCalled = true; } + +private: + bool m_testSlotCalled; }; void tst_QQmlPropertyMap::metaObjectAccessibility() @@ -341,6 +346,29 @@ void tst_QQmlPropertyMap::QTBUG_31226() } +void tst_QQmlPropertyMap::QTBUG_29836() +{ + MyEnhancedPropertyMap map; + QCOMPARE(map.testSlotCalled(), false); + + QQmlEngine engine; + QQmlContext context(&engine); + context.setContextProperty("enhancedMap", &map); + QQmlComponent c(&engine); + c.setData("import QtQuick 2.0\n" + "Item {\n" + " Timer { interval: 5; running: true; onTriggered: enhancedMap.testSlot() }\n" + "}", + QUrl()); + QObject *obj = c.create(&context); + QVERIFY(obj); + + QTRY_COMPARE(map.testSlotCalled(), true); + + delete obj; + +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" -- cgit v1.2.1 From 6bee16477ab75acdb458d2f9c50f97cdc76e07b9 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Thu, 30 May 2013 10:36:09 +0300 Subject: Update Changes file Mention the behavioral change introduced by the fix for QTBUG-29836. Task-number: QTBUG-29836 Change-Id: I15ffd32fd5c0d537528f7b1386691103dab371c7 Reviewed-by: Sergio Ahumada --- dist/changes-5.1.0 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index 8633d22eef..eaf6d05094 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -46,6 +46,13 @@ Third party components - tryCompare now correctly fails when it only gets two parameters + - If a QObject has a property and a slot (or invokable method) with the same + name, in QML the previous behavior was to let the property obscure the + method; from Qt 5.1 things work in the opposite way, that is a property can + never obscure a method having the same name. This is especially important + for objects having dynamic properties, such as QQmlPropertyMap. This change + was a consequence of the fix for QTBUG-29836. + **************************************************************************** * Library * **************************************************************************** -- cgit v1.2.1 From 7020cba94a3a8c280681ad0053a514b30c806925 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 30 May 2013 11:09:13 +0200 Subject: Doc: Clarified members of QtQml.Models submodule. -Took out members of QtQml.Models submodule from Qt QML and Qt Quick. -Set up qdocconf files to include QtQml.Models to be part of Qt QML doc build. -Edited the sentences to make it clearer that list and model types are in QtQml.Models. -Placed the Visual* types back to QtQuick 2 module. -This patch removes several collision pages. Change-Id: I16e7045162af6852e5d6c3162b6f4cf97a42402b Reviewed-by: Alan Alpert --- src/imports/models/plugin.cpp | 5 +-- src/qml/doc/qtqml.qdocconf | 6 ++-- src/qml/doc/src/qmltypereference.qdoc | 9 +++-- src/qml/doc/src/qtqml.qdoc | 13 ++++++++ src/qml/doc/src/whatsnew.qdoc | 9 ++--- src/qml/types/qqmldelegatemodel.cpp | 58 +++++++++++++++++---------------- src/qml/types/qqmllistmodel.cpp | 36 ++++---------------- src/qml/types/qqmllistmodel_p_p.h | 7 +++- src/qml/types/qqmlobjectmodel.cpp | 2 +- src/quick/doc/qtquick.qdocconf | 3 +- src/quick/doc/src/qmltypereference.qdoc | 19 +++++++++-- src/quick/doc/src/whatsnew.qdoc | 9 +++++ 12 files changed, 102 insertions(+), 74 deletions(-) diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp index 2181562098..90e8a56399 100644 --- a/src/imports/models/plugin.cpp +++ b/src/imports/models/plugin.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmodule QtQml.Models 2 - \title Qt QML Model QML Types + \title Qt QML Models QML Types \ingroup qmlmodules \brief Provides QML types for data models \since 5.1 @@ -60,7 +60,8 @@ QT_BEGIN_NAMESPACE import QtQml.Models 2.1 \endcode - Note that QtQml.Models module started at version 2.1 to match the version of the parent module. + Note that QtQml.Models module started at version 2.1 to match the version + of the parent module, \l{Qt QML}. */ diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 84cf64eddd..dde43888e2 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -32,9 +32,11 @@ tagfile = ../../../doc/qtqml/qtqml.tags depends += qtcore qtxmlpatterns qtgui qtquick qtdoc -headerdirs += .. +headerdirs += .. \ + ../../imports/models -sourcedirs += .. +sourcedirs += .. \ + ../../imports/models exampledirs += ../../../examples/qml \ ../ \ diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc index f0aadbaf32..3def3209cc 100644 --- a/src/qml/doc/src/qmltypereference.qdoc +++ b/src/qml/doc/src/qmltypereference.qdoc @@ -58,8 +58,13 @@ follows: import QtQuick 2.0 \endqml -See the \l{Qt Quick} module documentation for more information about the -\c QtQuick namespace and what it provides to QML application developers. +See the \l{Qt Quick} module documentation for more information about the \c +QtQuick namespace and what it provides to QML application developers. + +The QML types for creating lists and models, such as \l ListModel and \l +ListElement, are moved to a submodule, \c QtQml.Models. The \l{Qt QML Models QML +Types}{Qt QML Models} page has more information. + The documentation for the types below applies equally to the types of the same name provided by the \l{Qt Quick} module, as they are in fact identical. diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 2c6bc640ff..26e4867bbc 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -84,6 +84,19 @@ various QML object types: \li \l Timer \endlist +\section2 Lists and Models + +New in Qt 5.1, the model types are moved to a submodule, \c QtQml.Models. The +\l{Qt QML Models QML Types}{Qt QML Models} page has more information. + +\list +\li \l DelegateModel +\li \l DelegateModelGroup +\li \l ListElement +\li \l ListModel +\li \l ObjectModel +\endlist + \section1 JavaScript Environment for QML Applications JavaScript expressions allow QML code to contain application logic. Qt QML diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 38713a1976..eece3bcaab 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -39,13 +39,14 @@ a summary of the new changes: \li New properties for \l Qt.application: arguments, name, and version. \endlist -\section2 New Submodules +\section2 New Submodule -The Qt QML Models is a new submodule in Qt 5.1 and provides several QML types -for handling data with models and lists. +The \l{Qt QML Models QML Types}{Qt QML Models} is a new submodule in Qt 5.1 and +provides several QML types for handling data with models and lists. These types +replace types such as \l VisualItem, \l VisualDataModel, and \l VisualDataGroup. \list -\li \l{QtQml.Models}{Models} +\li \l{Qt QML Models QML Types}{Models} \endlist The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 53b8a3c79d..279e2ea884 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -121,15 +121,16 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) /*! \qmltype VisualDataModel \instantiates QQmlDelegateModel - \inqmlmodule QtQml 2 + \inqmlmodule QtQuick 2 \ingroup qtquick-models \brief Encapsulates a model and delegate The VisualDataModel type encapsulates a model and the delegate that will be instantiated for items in a model. - This type is provided by \c {QtQuick 2} for compatibility reasons. The same implementation - is now primarily available as DelegateModel in the QtQml.Models module. + This type is provided by the \l{Qt QML} module due to compatibility reasons. + The same implementation is now primarily available as DelegateModel in the + \l{Qt QML Models QML Types}{Qt QML Models} module. \sa {QtQml.Models2::DelegateModel} */ @@ -142,12 +143,6 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) The DelegateModel type encapsulates a model and the delegate that will be instantiated for items in the model. - This element is also available as DelegateModel in the \c QtQuick module. For full details, - see the \l DelegateModel documentation. - - The DelegateModel type encapsulates a model and the delegate that will - be instantiated for items in the model. - It is usually not necessary to create a DelegateModel. However, it can be useful for manipulating and accessing the \l modelIndex when a QAbstractItemModel subclass is used as the @@ -158,6 +153,9 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) The example below illustrates using a DelegateModel with a ListView. \snippet delegatemodel/visualdatamodel.qml 0 + + \note This type is also available as \l VisualDataModel in the \l{Qt QML} + module due to compatibility reasons. */ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) @@ -2168,15 +2166,32 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) it->destroyingPackage(package); } +/*! + \qmltype VisualDataGroup + \instantiates QQmlDelegateModelGroup + \inqmlmodule QtQuick 2 + \ingroup qtquick-models + \brief Encapsulates a filtered set of visual data items + + The VisualDataGroup type provides a means to address the model data of a + model's delegate items, as well as sort and filter these delegate items. + + This type is provided by the \l{Qt QML} module due to compatibility reasons. + The same implementation is now primarily available as \l DelegateModelGroup + in the \l{Qt QML Models QML Types}{Qt QML Models} module. + + \sa {QtQml.Models2::DelegateModelGroup} +*/ /*! \qmltype DelegateModelGroup \instantiates QQmlDelegateModelGroup - \inqmlmodule QtQml 2 + \inqmlmodule QtQml.Models 2 \ingroup qtquick-models \brief Encapsulates a filtered set of visual data items - The DelegateModelGroup type provides a means to address the model data of a DelegateModel's - delegate items, as well as sort and filter these delegate items. + The DelegateModelGroup type provides a means to address the model data of a + DelegateModel's delegate items, as well as sort and filter these delegate + items. The initial set of instantiable delegate items in a DelegateModel is represented by its \l {QtQml.Models2::DelegateModel::items}{items} group, which normally directly reflects @@ -2200,24 +2215,11 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) type or to cherry-pick specific items that should be instantiated irregardless of whether they're currently within a view's visible area. - \sa {QML Dynamic View Ordering Tutorial} -*/ -/*! - \qmltype DelegateModelGroup - \instantiates QQmlDelegateModelGroup - \inqmlmodule QtQml.Models 2 - \brief Encapsulates a filtered set of visual data items - - The DelegateModelGroup type provides a means to address the model data of a DelegateModel's - delegate items, as well as sort and filter these delegate items. - - This element is also available as DelegateModelGroup in the \c QtQuick module. For full details, - see the \l DelegateModelGroup documentation. + \note This type is also available as \l VisualDataGroup in the \l{Qt QML} + module due to compatibility reasons. - \sa {QtQuick::DelegateModelGroup} + \sa {QML Dynamic View Ordering Tutorial} */ - - QQmlDelegateModelGroup::QQmlDelegateModelGroup(QObject *parent) : QObject(*new QQmlDelegateModelGroupPrivate, parent) { diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 5ddc0f52bd..0cfd9c6ccb 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1426,24 +1426,12 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru \qmltype ListModel \instantiates QQmlListModel \inqmlmodule QtQml.Models 2 - \brief Defines a free-form list data source - - The ListModel is a simple container of ListElement definitions, each containing data roles. - The contents can be defined dynamically, or explicitly in QML. - - This type is also available in the \c {QtQuick 2} import. - - \sa {QtQml2::ListModel}{Full documentation for ListModel} -*/ -/*! - \qmltype ListModel - \instantiates QQmlListModel - \inqmlmodule QtQml 2 - \brief Defines a free-form list data source \ingroup qtquick-models + \brief Defines a free-form list data source - The ListModel is a simple container of ListElement definitions, each containing data roles. - The contents can be defined dynamically, or explicitly in QML. + The ListModel is a simple container of ListElement definitions, each + containing data roles. The contents can be defined dynamically, or + explicitly in QML. The number of elements in the model can be obtained from its \l count property. A number of familiar methods are also provided to manipulate the contents of the @@ -1803,7 +1791,7 @@ QHash QQmlListModel::roleNames() const } /*! - \qmlproperty bool QtQml2::ListModel::dynamicRoles + \qmlproperty bool ListModel::dynamicRoles By default, the type of a role is fixed the first time the role is used. For example, if you create a role called @@ -1849,7 +1837,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) } /*! - \qmlproperty int QtQml2::ListModel::count + \qmlproperty int ListModel::count The number of data entries in the model. */ int QQmlListModel::count() const @@ -2539,18 +2527,6 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) \instantiates QQmlListElement \inqmlmodule QtQml.Models 2 \brief Defines a data item in a ListModel - - List elements are defined inside ListModel definitions, and represent items in a list. - - This type is also available in the \c {QtQuick 2} import. - - \sa {QtQml2::ListElement}{Full documentation for ListElement} -*/ -/*! - \qmltype ListElement - \instantiates QQmlListElement - \inqmlmodule QtQml 2 - \brief Defines a data item in a ListModel \ingroup qtquick-models List elements are defined inside ListModel definitions, and represent items in a diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 0190081320..44c349fbe6 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -229,6 +229,9 @@ private: QStringHash roleHash; }; +/*! +\internal +*/ class ListElement { public: @@ -292,6 +295,9 @@ private: friend class ListModel; }; +/*! +\internal +*/ class ListModel { public: @@ -375,4 +381,3 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(ListModel *); #endif // QQUICKLISTMODEL_P_P_H - diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 3e8a67a7d2..f2a7477c1b 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -169,7 +169,7 @@ public: /*! \qmltype VisualItemModel \instantiates QQmlObjectModel - \inqmlmodule QtQml 2 + \inqmlmodule QtQuick 2 \brief Defines a set of objects to be used as a model The VisualItemModel type encapsulates contains the objects to be used diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index a27b0f82f7..f20890c378 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -60,4 +60,5 @@ headerdirs += ../../plugins sourcedirs += ../../plugins #exclude certain directories -excludedirs = ../../imports/dialogs +excludedirs += ../../imports/dialogs \ + ../../imports/models diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index bb488ac2f2..da8b3129ac 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -234,13 +234,26 @@ Animation paths \section2 Model/View Types And Data Storage And Access -Models And Model Data +QML Lists and Models + +The \l{Qt QML Models QML Types}{Qt QML Models} submodule provides the types for +structuring data with models and lists. +\list +\li \l ListModel - Defines a list of data +\li \l ListElement - Defines a data item in a \l ListModel +\endlist + +These QML types are part of Qt Quick for backwards compatibility, but for +newer applications, \l{Qt QML Models QML Types}{Qt QML Models} provides +the same functionality. \list -\li \l {QtQml2::ListModel}{ListModel} - Defines a list of data -\li \l {QtQml2::ListElement}{ListElement} - Defines a data item in a \l {QtQml2::ListModel}{ListModel} \li \l {VisualItemModel} - Contains items that already defines its own visual delegate \li \l {VisualDataModel} - Encapsulates a model and a delegate \li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items +\endlist + +XML Lists +\list \li \l {XmlListModel} - Specifies a model using XPath expressions \li \l {XmlRole} - Specifies a role for an \l {XmlListModel} \endlist diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index 2b865073d3..973d41dca2 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -44,6 +44,15 @@ features introduced by the new import and new classes in Qt 5.1: \li New \l TextEdit properties: selectByKeyboard and textDocument \li A \l Window declared inside another Window or \l Item will automatically be transient for (centered upon) the outer window. +\li These types are now part of \l{Qt QML}: + \list + \li \l {VisualItemModel} + \li \l {VisualDataModel} - Encapsulates a model and a delegate + \li \l {VisualDataGroup} + \endlist + These types are kept due to compatibility reasons and are replaced by the + \l{Qt QML Models QML Types}{Qt QML Models} types. + \endlist \endlist \section2 New Submodules -- cgit v1.2.1 From cf737d265f0d507ae8e5a909a7b7d43a4aae7de3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 31 May 2013 15:33:45 +0200 Subject: qmlscene: if top-level is a QQuickWindow, set incubation controller The necessity for this is documented in the QQuickWindow::incubationController() accessor. Bug 31203 is about writing a custom main() with a QQmlApplicationEngine, not about qmlscene, but the same workaround is necessary for both. Hopefully soon we find a way to make it unnecessary, but for now it is. This fix also doesn't take care of the QtObject { Window { } } use case. Task-number: QTBUG-31203 Change-Id: Ic9a5e4a23ac918593138dc9cab3de6cd36453eaf Reviewed-by: Jens Bache-Wiig Reviewed-by: Alan Alpert --- tools/qmlscene/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index d572487218..8a48445d63 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -483,7 +483,9 @@ int main(int argc, char ** argv) QObject *topLevel = component->create(); QQuickWindow *window = qobject_cast(topLevel); QQuickView* qxView = 0; - if (!window) { + if (window) { + engine.setIncubationController(window->incubationController()); + } else { QQuickItem *contentItem = qobject_cast(topLevel); if (contentItem) { qxView = new QQuickView(&engine, NULL); -- cgit v1.2.1 From d9df24ef35e70b8bb866448c30eaacf188de57f5 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 4 Jun 2013 09:01:36 +0200 Subject: Stabilize tst_qquickanimatedimage::mirror_notRunning() Task-number: QTBUG-31370 Change-Id: I200d94dccd1314c891df92576b0d2b704e530e16 Reviewed-by: Sergio Ahumada --- .../qquickanimatedimage/tst_qquickanimatedimage.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 73474afbd7..0377eaa71d 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -190,9 +190,6 @@ void tst_qquickanimatedimage::mirror_running() QImage frame0_expected = frame0.transformed(transform); QImage frame1_expected = frame1.transformed(transform); -#ifdef Q_OS_MAC - QSKIP("QTBUG-31370 - sometimes fails on Mac"); -#endif QCOMPARE(frame0_flipped, frame0_expected); QCOMPARE(frame1_flipped, frame1_expected); @@ -204,29 +201,28 @@ void tst_qquickanimatedimage::mirror_notRunning() QFETCH(QUrl, fileUrl); QQuickView window; + window.setSource(fileUrl); window.show(); + QTRY_VERIFY(window.isExposed()); - window.setSource(fileUrl); QQuickAnimatedImage *anim = qobject_cast(window.rootObject()); QVERIFY(anim); int width = anim->property("width").toInt(); - QPixmap screenshot = QPixmap::fromImage(window.grabWindow()); + QImage screenshot = window.grabWindow(); QTransform transform; transform.translate(width, 0).scale(-1, 1.0); - QPixmap expected = screenshot.transformed(transform); + QImage expected = screenshot.transformed(transform); int frame = anim->currentFrame(); bool playing = anim->isPlaying(); bool paused = anim->isPlaying(); anim->setProperty("mirror", true); - screenshot = QPixmap::fromImage(window.grabWindow()); + screenshot = window.grabWindow(); -#ifdef Q_OS_MAC - QSKIP("QTBUG-31370 - sometimes fails on Mac"); -#endif + screenshot.save("screen.png"); QCOMPARE(screenshot, expected); // mirroring should not change the current frame or playing status -- cgit v1.2.1 From 65a9318f8fbfe6e3c1f33675fea435a76b869870 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Tue, 4 Jun 2013 10:08:22 +0200 Subject: Doc: Update Qt Quick Controls description Change-Id: Ifb67ae32fcb8abe49166346fa1017dc5c76bc485 Reviewed-by: Jerome Pasion --- src/quick/doc/src/qtquick.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index 0a4d276cb8..deb6aa164c 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -43,7 +43,7 @@ QML types for creating user interfaces with the QML language, and a \l{Qt Quick C++ Classes}{C++ API} for extending QML applications with C++ code. \note From Qt 5.1, a set of Qt Quick based UI controls is available to -create classic desktop-style user interfaces. Please see \l{Qt Quick Controls} +create user interfaces. Please see \l{Qt Quick Controls} for more information. For those new to QML and Qt Quick, please see -- cgit v1.2.1 From 6821932c2f42970ef5cb91f82d935ecbeaa098f8 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 4 Jun 2013 15:32:36 -0700 Subject: doc fix Task-number: QTBUG-31539 Change-Id: I527ed10231c112f8f1727fde093f7d661d492fa6 Reviewed-by: Jerome Pasion --- src/quick/items/context2d/qquickcontext2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 5709d58d58..c948d87cc0 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2624,7 +2624,7 @@ static v8::Handle ctx2d_createImageData(const v8::Arguments &args) } /*! - \qmlmethod CanvasImageData QtQuick2::Canvas::getImageData(real sx, real sy, real sw, real sh) + \qmlmethod CanvasImageData QtQuick2::Context2D::getImageData(real sx, real sy, real sw, real sh) Returns an CanvasImageData object containing the image data for the given rectangle of the canvas. */ static v8::Handle ctx2d_getImageData(const v8::Arguments &args) -- cgit v1.2.1 From 6658adda6f92f4b4f1690f1723f69f8f816a88eb Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Wed, 5 Jun 2013 14:15:10 +0200 Subject: Doc: Fixed QCH listings for Qt QML and Qt Quick Dialogs Qt QML: added QML types page as a child in the list Qt Quick Dialogs: "manual" as type taken out Change-Id: I95d77b7582a0f5729801e1e6fb8f5f3242a0b760 Reviewed-by: Caroline Chao Reviewed-by: Martin Smith --- src/imports/dialogs/doc/qtquickdialogs.qdocconf | 3 +-- src/qml/doc/qtqml.qdocconf | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf index 5caa1c0588..34f19b5ff3 100644 --- a/src/imports/dialogs/doc/qtquickdialogs.qdocconf +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -19,10 +19,9 @@ qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSIO qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types -qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true -qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.type = manual depends = qtqml qtquick qtgui qtwidgets qtdoc diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index dde43888e2..2198428a38 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -18,7 +18,7 @@ qhp.QtQml.indexRoot = qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION -qhp.QtQml.subprojects = classes examples +qhp.QtQml.subprojects = qmltypes classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes qhp.QtQml.subprojects.classes.selectors = class fake:headerfile @@ -26,6 +26,10 @@ qhp.QtQml.subprojects.classes.sortPages = true qhp.QtQml.subprojects.examples.title = Examples qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples qhp.QtQml.subprojects.examples.selectors = fake:example +qhp.QtQml.subprojects.qmltypes.title = QML Types +qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types +qhp.QtQml.subprojects.qmltypes.selectors = fake:qmlclass +qhp.QtQml.subprojects.qmltypes.sortPages = true tagfile = ../../../doc/qtqml/qtqml.tags -- cgit v1.2.1 From cfd4bf9d6cb8a932eab5ac99bae8973b9cedc803 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 6 Jun 2013 14:51:31 +0200 Subject: Doc: Fixed link to Qt Quick Layouts and made links consistent -better to use the "QML Types" pages as the version is not specified. Change-Id: I5b150bc8ada25c619dbecb5d68e70854dd9c14d6 Reviewed-by: Alan Alpert --- src/quick/doc/src/qmltypereference.qdoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index da8b3129ac..6863758455 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -56,19 +56,19 @@ information about the concepts which are central to \c QtQuick. Qt Quick includes several submodules which contain additional types. \list - \li \l{QtQuick.XmlListModel 2}{XML List Model} - contains types + \li \l{Qt Quick XmlListModel QML Types}{XML List Model} - contains types for creating models from XML data - \li \l{QtQuick.LocalStorage 2}{Local Storage} - a submodule + \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule containing a JavaScript interface for an SQLite database - \li \l{QtQuick.Particles 2}{Particles} - provides a particle + \li \l{Qt Quick Particles QML Types}{Particles} - provides a particle system for QML applications - \li \l{QtQuick.Window 2}{Window} - contains types for creating + \li \l{Qt Quick Window QML Types}{Window} - contains types for creating top-level windows and accessing screen information - \li \l{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + \li \l{Qt Quick Dialogs QML Types}{Dialogs} - contains types for creating and interacting with system dialogs - \li \l{QtQuick.Controls 1.0}{Controls} - provides a set of reusable + \li \l{Qt Quick Controls QML Types}{Controls} - provides a set of reusable UI components - \li \l{QtQuick.Layouts 1.0}{Layouts} - contains types that are used + \li \l{Qt Quick Layouts QML Types}{Layouts} - contains types that are used to arrange items in the user interface \endlist -- cgit v1.2.1 From 9d75626b1073113d77988bcb52e99215d5af4787 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 31 May 2013 10:38:33 -0700 Subject: Set incubation controller when a Window{} is loaded via QQmlApplicationEngine This was the one convenience that was lost when transitioning templates from QQuickView + Item{} to QQmlApplicationEngine + Window{}. As the default window incubation controller was tied to the first window's frameSwapped, we could easily run into a situation where a secondary window required incubation while the first window was idle. This would then starve the incubation controller. Instead make it so that the renderloop emits "timeToIncubate" once it is done with a renderpass over all windows, so the incubator gets to run once and exactly once per vsync when animating. The incubator logic was also flawed in that it could post a lot of events to itself as a result of incubatingObjectCountChanged and thus starve system events while processing incubation requests. Now we start a timer and don't start it again until we have completed an incubation pass. Task-number: QTBUG-31203 Change-Id: Iea9e2c81efb46bb7875c70ccda0cdc4b3b3e58e7 Reviewed-by: Alan Alpert Reviewed-by: Gunnar Sletta --- .../quick/customitems/painteditem/painteditem.pro | 3 ++ src/qml/qml/qqmlapplicationengine.cpp | 2 ++ src/quick/designer/designerwindowmanager_p.h | 2 +- src/quick/items/qquickwindow.cpp | 39 +++++++++++++--------- src/quick/items/qquickwindow_p.h | 1 + src/quick/items/qquickwindowmodule.cpp | 24 ++++++++++++- src/quick/scenegraph/qsgrenderloop.cpp | 2 +- src/quick/scenegraph/qsgrenderloop_p.h | 9 ++++- src/quick/scenegraph/qsgthreadedrenderloop.cpp | 10 ++++-- src/quick/scenegraph/qsgthreadedrenderloop_p.h | 6 ++-- src/quick/scenegraph/qsgwindowsrenderloop.cpp | 7 ++++ src/quick/scenegraph/qsgwindowsrenderloop_p.h | 6 ++-- 12 files changed, 84 insertions(+), 27 deletions(-) diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index 77e4d146e1..3ec6420abf 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -18,3 +18,6 @@ qmldir.files = TextBalloonPlugin/qmldir qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin INSTALLS += qmldir target + +OTHER_FILES += \ + textballoons.qml diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 25095a465e..25055ed81a 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -72,6 +72,7 @@ void QQmlApplicationEnginePrivate::init() QCoreApplication::installTranslator(qtTranslator); translators << qtTranslator; #endif + QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true)); } void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile) @@ -166,6 +167,7 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o) \list \li Connecting Qt.quit() to QCoreApplication::quit() \li Automatically loads translation files from an i18n directory adjacent to the main QML file. + \li Automatically sets an incubuation controller if the scene contains a QQuickWindow. \endlist The engine behavior can be further tweaked by using the inherited methods from QQmlEngine. diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h index 02aacf06bd..3bbd0c2825 100644 --- a/src/quick/designer/designerwindowmanager_p.h +++ b/src/quick/designer/designerwindowmanager_p.h @@ -67,7 +67,7 @@ class QSGContext; class QAnimationDriver; class QOpenGLContext; -class DesignerWindowManager : public QObject, public QSGRenderLoop +class DesignerWindowManager : public QSGRenderLoop { Q_OBJECT public: diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 7137bb165e..7b84168bb9 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -89,44 +89,49 @@ void QQuickWindowPrivate::updateFocusItemTransform() #endif } - class QQuickWindowIncubationController : public QObject, public QQmlIncubationController { Q_OBJECT public: - QQuickWindowIncubationController(const QQuickWindow *window) - : m_window(QQuickWindowPrivate::get(const_cast(window))) + QQuickWindowIncubationController(QSGRenderLoop *loop) + : m_renderLoop(loop), m_timer(0) { // Allow incubation for 1/3 of a frame. m_incubation_time = qMax(1, int(1000 / QGuiApplication::primaryScreen()->refreshRate()) / 3); - m_animation_driver = m_window->windowManager->animationDriver(); + m_animation_driver = m_renderLoop->animationDriver(); if (m_animation_driver) { connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped())); - connect(window, SIGNAL(frameSwapped()), this, SLOT(incubate())); + connect(m_renderLoop, SIGNAL(timeToIncubate()), this, SLOT(incubate())); } } protected: - virtual bool event(QEvent *e) + void timerEvent(QTimerEvent *e) { - if (e->type() == QEvent::User) { - incubate(); - return true; + killTimer(m_timer); + m_timer = 0; + incubate(); + } + + void incubateAgain() { + if (m_timer == 0) { + // Wait for a while before processing the next batch. Using a + // timer to avoid starvation of system events. + m_timer = startTimer(m_incubation_time); } - return QObject::event(e); } public slots: void incubate() { if (incubatingObjectCount()) { - if (m_animation_driver && m_animation_driver->isRunning()) { + if (m_renderLoop->interleaveIncubation()) { incubateFor(m_incubation_time); } else { incubateFor(m_incubation_time * 2); if (incubatingObjectCount()) - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); + incubateAgain(); } } } @@ -136,14 +141,15 @@ public slots: protected: virtual void incubatingObjectCountChanged(int count) { - if (count && (!m_animation_driver || !m_animation_driver->isRunning())) - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); + if (count && !m_renderLoop->interleaveIncubation()) + incubateAgain(); } private: - QQuickWindowPrivate *m_window; + QSGRenderLoop *m_renderLoop; int m_incubation_time; QAnimationDriver *m_animation_driver; + int m_timer; }; #include "qquickwindow.moc" @@ -349,6 +355,7 @@ QQuickWindowPrivate::QQuickWindowPrivate() , persistentGLContext(true) , persistentSceneGraph(true) , lastWheelEventAccepted(false) + , componentCompleted(true) , renderTarget(0) , renderTargetId(0) , incubationController(0) @@ -2779,7 +2786,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const Q_D(const QQuickWindow); if (!d->incubationController) - d->incubationController = new QQuickWindowIncubationController(this); + d->incubationController = new QQuickWindowIncubationController(d->windowManager); return d->incubationController; } diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 2465629778..2dddd9ab68 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -209,6 +209,7 @@ public: uint persistentSceneGraph : 1; uint lastWheelEventAccepted : 1; + bool componentCompleted : 1; QOpenGLFramebufferObject *renderTarget; uint renderTargetId; diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index f826a53a29..b91edc2fd5 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -42,18 +42,40 @@ #include "qquickwindowmodule_p.h" #include "qquickscreen_p.h" #include +#include +#include QT_BEGIN_NAMESPACE +class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus +{ + Q_INTERFACES(QQmlParserStatus) + Q_OBJECT +protected: + void classBegin() { + //Give QQuickView behavior when created from QML with QQmlApplicationEngine + if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) { + QQmlEngine* e = qmlEngine(this); + if (e && !e->incubationController()) + e->setIncubationController(incubationController()); + } + } + + void componentComplete() {} +}; + void QQuickWindowModule::defineModule() { const char uri[] = "QtQuick.Window"; qmlRegisterType(uri, 2, 0, "Window"); qmlRegisterRevision(uri, 2, 1); - qmlRegisterType(uri, 2, 1, "Window"); + qmlRegisterRevision(uri, 2, 1);//Type moved to a subclass, but also has new members + qmlRegisterType(uri, 2, 1, "Window"); qmlRegisterUncreatableType(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property.")); } +#include "qquickwindowmodule.moc" + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 3a608a911d..e099d94a53 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -82,7 +82,7 @@ QSGRenderLoop::~QSGRenderLoop() { } -class QSGGuiThreadRenderLoop : public QObject, public QSGRenderLoop +class QSGGuiThreadRenderLoop : public QSGRenderLoop { Q_OBJECT public: diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index b18e6f00ad..6ff9c4c5f9 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -51,8 +51,10 @@ class QQuickWindow; class QSGContext; class QAnimationDriver; -class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop +class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop : public QObject { + Q_OBJECT + public: virtual ~QSGRenderLoop(); @@ -77,6 +79,11 @@ public: static QSGRenderLoop *instance(); static void setInstance(QSGRenderLoop *instance); + virtual bool interleaveIncubation() const { return false; } + +signals: + void timeToIncubate(); + private: static QSGRenderLoop *s_instance; }; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index bd69fd5464..bfd9a2fb20 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -574,6 +574,7 @@ void QSGRenderThread::syncAndRender() int waitTime = vsyncDelta - (int) waitTimer.elapsed(); if (waitTime > 0) msleep(waitTime); + emit wm->timeToIncubate(); return; } @@ -600,6 +601,7 @@ void QSGRenderThread::syncAndRender() d->fireFrameSwapped(); } RLDEBUG(" Render: - rendering done"); + emit wm->timeToIncubate(); #ifndef QSG_NO_RENDER_TIMING if (qsg_render_timing) @@ -723,7 +725,7 @@ QSGContext *QSGThreadedRenderLoop::sceneGraphContext() const return m_thread->sg; } -bool QSGThreadedRenderLoop::anyoneShowing() +bool QSGThreadedRenderLoop::anyoneShowing() const { for (int i=0; iisRunning() && anyoneShowing(); +} + void QSGThreadedRenderLoop::animationStarted() { RLDEBUG("GUI: animationStarted()"); @@ -1011,7 +1018,6 @@ void QSGThreadedRenderLoop::polishAndSync() RLDEBUG("GUI: - animations advancing"); m_animation_driver->advance(); RLDEBUG("GUI: - animations done"); - // We need to trigger another sync to keep animations running... maybePostPolishRequest(); } else if (m_sync_triggered_update) { diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index aab0e8726f..6ff5cabf43 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QSGRenderThread; -class QSGThreadedRenderLoop : public QObject, public QSGRenderLoop +class QSGThreadedRenderLoop : public QSGRenderLoop { Q_OBJECT public: @@ -79,7 +79,7 @@ public: bool event(QEvent *); - void wakeup(); + bool interleaveIncubation() const; public slots: void animationStarted(); @@ -91,7 +91,7 @@ private: void releaseResources(QQuickWindow *window, bool inDestructor); bool checkAndResetForceUpdate(QQuickWindow *window); - bool anyoneShowing(); + bool anyoneShowing() const; void initialize(); void maybePostPolishRequest(); diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index ce43ccf531..8e97f65ea5 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -102,6 +102,11 @@ QSGWindowsRenderLoop::QSGWindowsRenderLoop() #endif } +bool QSGWindowsRenderLoop::interleaveIncubation() const +{ + return m_animationDriver->isRunning() && anyoneShowing(); +} + QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow *window) { for (int i=0; i m_windows; -- cgit v1.2.1 From 837b76fa4dd4a904e0c29f93fca5de1d642a84e3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 31 May 2013 10:43:04 -0700 Subject: Add future compatibility note File selectors are being delayed from releasing at the same time as QQmlApplicationEngine, but will need to be enabled by default (in QQmlApplicationEngine only) when they do arrive. Adding a note to the documentation to help forwards compatibility. Change-Id: Ia47a1da1afebd0da3bd1a97e7e4c8ee85f70b49a Reviewed-by: Lars Knoll Reviewed-by: Jerome Pasion --- src/qml/qml/qqmlapplicationengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 25055ed81a..9181dad519 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -171,6 +171,10 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o) \endlist The engine behavior can be further tweaked by using the inherited methods from QQmlEngine. + + \note In the future QQmlApplicationEngine may automatically apply file selectors. + To ensure forwards compatibility, do not use folder names containing a '+' character in your QML file + structure. */ /*! -- cgit v1.2.1 From e4fc75edaedead3092aace3a29a0aafdd0e86a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=A4nel?= Date: Mon, 3 Jun 2013 13:40:09 +0200 Subject: Fix null-pointer access in QQuickVisualDataModelPrivate I observed null cachItem->contextData which lead to null-pointer access on cacheItem->contextData->destroy(). Task-number: QTBUG-31439 Change-Id: I91f28a3ee1ac83446ecde1801a1cb7962fb883f3 Reviewed-by: Alan Alpert --- src/qml/types/qqmldelegatemodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 279e2ea884..747c9391e9 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -854,7 +854,8 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba delete cacheItem->object; cacheItem->object = 0; cacheItem->scriptRef -= 1; - cacheItem->contextData->destroy(); + if (cacheItem->contextData) + cacheItem->contextData->destroy(); cacheItem->contextData = 0; if (!cacheItem->isReferenced()) { -- cgit v1.2.1 From b45528f2e6d76372c74d2fd5db218261989bddcd Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 10 Jun 2013 11:54:03 +0200 Subject: Doc: Exclude Qt Quick Dialogs examples in qtquick.qdocconf file Qt Quick Dialogs has its own .qdocconf file where the example path is defined. This change removes the path from .qdocconf for Qt Quick module so qdoc doesn't try to parse it twice. Change-Id: I06ad6895d5929031c37e21bfa91a813ba60d86d2 Reviewed-by: Martin Smith Reviewed-by: Jerome Pasion --- src/quick/doc/qtquick.qdocconf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index f20890c378..30861d9b2e 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -61,4 +61,5 @@ sourcedirs += ../../plugins #exclude certain directories excludedirs += ../../imports/dialogs \ - ../../imports/models + ../../imports/models \ + ../../../examples/quick/dialogs -- cgit v1.2.1 From 5c7f57057027fc934c12b76c5cfb5bb81b7d6a41 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 10 Jun 2013 09:48:21 +0200 Subject: Fix compiler warning about unused parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix gcc compiler warning about unused parameter: qquickwindow.cpp:111:10: warning: unused parameter ‘e’ [-Wunused-parameter] This got introduced by commit 9d75626b Change-Id: Ia280fd9fdd584eed81f4d810311c56f5daee3e28 Reviewed-by: Friedemann Kleint --- src/quick/items/qquickwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 7b84168bb9..619c72afb8 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -108,7 +108,7 @@ public: } protected: - void timerEvent(QTimerEvent *e) + void timerEvent(QTimerEvent *) { killTimer(m_timer); m_timer = 0; -- cgit v1.2.1 From f64704fed878f74b9525304329cbabb94511090f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 7 Jun 2013 16:26:49 +0200 Subject: prepare for qt_module_pris.prf changes Change-Id: Iba75fccfc143f09d443d50bc8dc75cde5739af9b Reviewed-by: Joerg Bornemann --- src/qmldevtools/qmldevtools.pro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro index a65ef94da9..10e1ce0275 100644 --- a/src/qmldevtools/qmldevtools.pro +++ b/src/qmldevtools/qmldevtools.pro @@ -3,9 +3,10 @@ TARGET = QtQmlDevTools QT = core CONFIG += static no_module_headers internal_module -MODULE_PRIVATE_INCLUDES = \ +MODULE_INCLUDES = \ \$\$QT_MODULE_INCLUDE_BASE \ - \$\$QT_MODULE_INCLUDE_BASE/QtQml \ + \$\$QT_MODULE_INCLUDE_BASE/QtQml +MODULE_PRIVATE_INCLUDES = \ \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION \ \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION/QtQml -- cgit v1.2.1 From 5ce41d1e77db3f46c396834f698826f4fd998344 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 11 Jun 2013 09:55:14 +0200 Subject: Clean up qt quick dialogs example again I5245a6931606673733130b1f168fddafe8def695 took us the wrong direction: the intention was to put ALL dialogs in one example, because each example has some overhead (project, docs, screenshot, c++ launcher) and we don't want to have several more separate examples after the other dialog types are added. Color and file dialogs have no relationship to each other except that they happened to be implemented first. This is analogous to qtbase/examples/widgets/dialogs/standarddialogs And in fact, each dialog type is in a separate qml file, so you can run them individually with qmlscene anyway, which will keep this from becoming unwieldy and hard to understand. Change-Id: Id28d5718b4b7b475dcd7d62e31c4634219dc3ddc Reviewed-by: Jerome Pasion Reviewed-by: Caroline Chao --- examples/quick/dialogs/ColorDialogs.qml | 145 ++++++++++++++++++ examples/quick/dialogs/FileDialogs.qml | 169 +++++++++++++++++++++ .../dialogs/colorandfiledialogs/ColorDialogs.qml | 145 ------------------ .../dialogs/colorandfiledialogs/FileDialogs.qml | 169 --------------------- .../colorandfiledialogs/colorandfiledialogs.pro | 17 --- .../colorandfiledialogs/colorandfiledialogs.qrc | 7 - .../quick/dialogs/colorandfiledialogs/dialogs.qml | 59 ------- .../doc/images/qml-colorandfiledialogs-example.jpg | Bin 47413 -> 0 bytes .../doc/src/colorandfiledialogs.qdoc | 44 ------ .../quick/dialogs/colorandfiledialogs/main.cpp | 41 ----- examples/quick/dialogs/dialogs.pro | 19 ++- examples/quick/dialogs/dialogs.qml | 59 +++++++ examples/quick/dialogs/dialogs.qrc | 7 + .../quick/dialogs/doc/images/dialogs-example.jpg | Bin 0 -> 47413 bytes examples/quick/dialogs/doc/src/dialogs.qdoc | 44 ++++++ examples/quick/dialogs/main.cpp | 41 +++++ 16 files changed, 481 insertions(+), 485 deletions(-) create mode 100644 examples/quick/dialogs/ColorDialogs.qml create mode 100644 examples/quick/dialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro delete mode 100644 examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc delete mode 100644 examples/quick/dialogs/colorandfiledialogs/dialogs.qml delete mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg delete mode 100644 examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc delete mode 100644 examples/quick/dialogs/colorandfiledialogs/main.cpp create mode 100644 examples/quick/dialogs/dialogs.qml create mode 100644 examples/quick/dialogs/dialogs.qrc create mode 100644 examples/quick/dialogs/doc/images/dialogs-example.jpg create mode 100644 examples/quick/dialogs/doc/src/dialogs.qdoc create mode 100644 examples/quick/dialogs/main.cpp diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml new file mode 100644 index 0000000000..6a0af7f730 --- /dev/null +++ b/examples/quick/dialogs/ColorDialogs.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 320 + height: 200 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [colordialog] + ColorDialog { + id: colorDialog + visible: colorDialogVisible.checked + modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: "Choose a color" + color: "green" + showAlphaChannel: colorDialogAlpha.checked + onAccepted: { console.log("Accepted: " + color) } + onRejected: { console.log("Rejected") } + } + //! [colordialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + font.bold: true + text: "Color dialog properties:" + } + CheckBox { + id: colorDialogModal + text: "Modal" + checked: true + Binding on checked { value: colorDialog.modality != Qt.NonModal } + } + CheckBox { + id: colorDialogAlpha + text: "Show alpha channel" + Binding on checked { value: colorDialog.showAlphaChannel } + } + CheckBox { + id: colorDialogVisible + text: "Visible" + Binding on checked { value: colorDialog.visible } + } + Row { + id: colorRow + spacing: parent.spacing + height: colorLabel.implicitHeight * 2.0 + Rectangle { + color: colorDialog.color + height: parent.height + width: height * 2 + border.color: "black" + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + Text { + id: colorLabel + color: palette.windowText + text: "current color: " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } +} diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml new file mode 100644 index 0000000000..d1278609f9 --- /dev/null +++ b/examples/quick/dialogs/FileDialogs.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 580 + height: 400 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [filedialog] + FileDialog { + id: fileDialog + visible: fileDialogVisible.checked + modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: fileDialogSelectFolder.checked ? "Choose a folder" : + (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") + selectExisting: fileDialogSelectExisting.checked + selectMultiple: fileDialogSelectMultiple.checked + selectFolder: fileDialogSelectFolder.checked + nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] + selectedNameFilter: "All files (*)" + onAccepted: { console.log("Accepted: " + fileUrls) } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + color: palette.windowText + font.bold: true + text: "File dialog properties:" + } + CheckBox { + id: fileDialogModal + text: "Modal" + checked: true + Binding on checked { value: fileDialog.modality != Qt.NonModal } + } + CheckBox { + id: fileDialogSelectFolder + text: "Select Folder" + Binding on checked { value: fileDialog.selectFolder } + } + CheckBox { + id: fileDialogSelectExisting + text: "Select Existing Files" + checked: true + Binding on checked { value: fileDialog.selectExisting } + } + CheckBox { + id: fileDialogSelectMultiple + text: "Select Multiple Files" + Binding on checked { value: fileDialog.selectMultiple } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Text { + color: palette.windowText + text: "current view folder: " + fileDialog.folder + } + Text { + color: palette.windowText + text: "name filters: {" + fileDialog.nameFilters + "}" + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "current filter:" + fileDialog.selectedNameFilter + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen files: " + fileDialog.fileUrls + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen single path: " + fileDialog.fileUrl + width: parent.width + wrapMode: Text.Wrap + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } +} diff --git a/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml deleted file mode 100644 index 6a0af7f730..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 320 - height: 200 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [colordialog] - ColorDialog { - id: colorDialog - visible: colorDialogVisible.checked - modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: "Choose a color" - color: "green" - showAlphaChannel: colorDialogAlpha.checked - onAccepted: { console.log("Accepted: " + color) } - onRejected: { console.log("Rejected") } - } - //! [colordialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - font.bold: true - text: "Color dialog properties:" - } - CheckBox { - id: colorDialogModal - text: "Modal" - checked: true - Binding on checked { value: colorDialog.modality != Qt.NonModal } - } - CheckBox { - id: colorDialogAlpha - text: "Show alpha channel" - Binding on checked { value: colorDialog.showAlphaChannel } - } - CheckBox { - id: colorDialogVisible - text: "Visible" - Binding on checked { value: colorDialog.visible } - } - Row { - id: colorRow - spacing: parent.spacing - height: colorLabel.implicitHeight * 2.0 - Rectangle { - color: colorDialog.color - height: parent.height - width: height * 2 - border.color: "black" - MouseArea { - anchors.fill: parent - onClicked: colorDialog.open() - } - } - Text { - id: colorLabel - color: palette.windowText - text: "current color: " + colorDialog.color - anchors.verticalCenter: parent.verticalCenter - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.close() - } - Button { - text: "set to green" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.color = "green" - } - } - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml deleted file mode 100644 index d1278609f9..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 580 - height: 400 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [filedialog] - FileDialog { - id: fileDialog - visible: fileDialogVisible.checked - modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: fileDialogSelectFolder.checked ? "Choose a folder" : - (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") - selectExisting: fileDialogSelectExisting.checked - selectMultiple: fileDialogSelectMultiple.checked - selectFolder: fileDialogSelectFolder.checked - nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] - selectedNameFilter: "All files (*)" - onAccepted: { console.log("Accepted: " + fileUrls) } - onRejected: { console.log("Rejected") } - } - //! [filedialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - color: palette.windowText - font.bold: true - text: "File dialog properties:" - } - CheckBox { - id: fileDialogModal - text: "Modal" - checked: true - Binding on checked { value: fileDialog.modality != Qt.NonModal } - } - CheckBox { - id: fileDialogSelectFolder - text: "Select Folder" - Binding on checked { value: fileDialog.selectFolder } - } - CheckBox { - id: fileDialogSelectExisting - text: "Select Existing Files" - checked: true - Binding on checked { value: fileDialog.selectExisting } - } - CheckBox { - id: fileDialogSelectMultiple - text: "Select Multiple Files" - Binding on checked { value: fileDialog.selectMultiple } - } - CheckBox { - id: fileDialogVisible - text: "Visible" - Binding on checked { value: fileDialog.visible } - } - Text { - color: palette.windowText - text: "current view folder: " + fileDialog.folder - } - Text { - color: palette.windowText - text: "name filters: {" + fileDialog.nameFilters + "}" - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "current filter:" + fileDialog.selectedNameFilter - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen files: " + fileDialog.fileUrls - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen single path: " + fileDialog.fileUrl - width: parent.width - wrapMode: Text.Wrap - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "go to /tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro deleted file mode 100644 index 3a7b25c91a..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp -RESOURCES += colorandfiledialogs.qrc ../../shared/shared.qrc - -OTHER_FILES += \ - dialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml - -EXAMPLE_FILES = \ - FileDialogs.qml \ - ColorDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs -INSTALLS += target diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc deleted file mode 100644 index efebfe4845..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - dialogs.qml - FileDialogs.qml - ColorDialogs.qml - - diff --git a/examples/quick/dialogs/colorandfiledialogs/dialogs.qml b/examples/quick/dialogs/colorandfiledialogs/dialogs.qml deleted file mode 100644 index b5f9841a3f..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/dialogs.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../shared" - -TabSet { - width: 580 - height: 440 - - FileDialogs { - property string title: "File Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } - - ColorDialogs { - property string title: "Color Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } -} diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg deleted file mode 100644 index 4517a39308..0000000000 Binary files a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg and /dev/null differ diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc deleted file mode 100644 index 68804649a9..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \title Qt Quick ColorDialog and FileDialog Examples - \example colorandfiledialogs - \brief This example demonstrates the color and file dialog types in QML - \image qml-colorandfiledialogs-example.jpg - \ingroup qtquickdialog_examples - - This example demonstrates the color and file system dialogs in the \l{Qt Quick Dialogs} - module. The appearance and behavior is platform-dependent. - - A \l FileDialog is used to choose a single file, multiple files or a - single directory, depending on how it is configured. - \snippet colorandfiledialogs/FileDialogs.qml filedialog - - A \l ColorDialog is used to choose a color, with or without alpha (transparency) - depending on how it is configured. - \snippet colorandfiledialogs/ColorDialogs.qml colordialog -*/ diff --git a/examples/quick/dialogs/colorandfiledialogs/main.cpp b/examples/quick/dialogs/colorandfiledialogs/main.cpp deleted file mode 100644 index e8c2ae6aaa..0000000000 --- a/examples/quick/dialogs/colorandfiledialogs/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro index 275e36470f..b76f396e9d 100644 --- a/examples/quick/dialogs/dialogs.pro +++ b/examples/quick/dialogs/dialogs.pro @@ -1,4 +1,17 @@ -TEMPLATE = subdirs +TEMPLATE = app -SUBDIRS = \ - colorandfiledialogs +QT += quick qml +SOURCES += main.cpp +RESOURCES += dialogs.qrc ../shared/shared.qrc + +OTHER_FILES += \ + dialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/dialogs.qml new file mode 100644 index 0000000000..b5f9841a3f --- /dev/null +++ b/examples/quick/dialogs/dialogs.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" + +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } + + ColorDialogs { + property string title: "Color Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } +} diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc new file mode 100644 index 0000000000..efebfe4845 --- /dev/null +++ b/examples/quick/dialogs/dialogs.qrc @@ -0,0 +1,7 @@ + + + dialogs.qml + FileDialogs.qml + ColorDialogs.qml + + diff --git a/examples/quick/dialogs/doc/images/dialogs-example.jpg b/examples/quick/dialogs/doc/images/dialogs-example.jpg new file mode 100644 index 0000000000..4517a39308 Binary files /dev/null and b/examples/quick/dialogs/doc/images/dialogs-example.jpg differ diff --git a/examples/quick/dialogs/doc/src/dialogs.qdoc b/examples/quick/dialogs/doc/src/dialogs.qdoc new file mode 100644 index 0000000000..daac914c60 --- /dev/null +++ b/examples/quick/dialogs/doc/src/dialogs.qdoc @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Dialog Examples + \example dialogs + \brief This example demonstrates the dialog types in QML + \image dialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet dialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet dialogs/ColorDialogs.qml colordialog +*/ diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/main.cpp new file mode 100644 index 0000000000..bbf0c48104 --- /dev/null +++ b/examples/quick/dialogs/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) -- cgit v1.2.1 From 278139c5d7bfa338ff75c5225077976ece7490e0 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 11 Jun 2013 14:44:10 +0200 Subject: move quick dialogs example into an artificial subdirectory again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trouble with Id28d5718b4b7b475dcd7d62e31c4634219dc3ddc is that the build assumes that all example directories are subdirectories, so the examples-manifest.xml will point to the wrong place and creator ends up not having the example on the welcome page. That's more rigid than it should be, but we might as well use the opportunity to distinguish system dialogs from any QML-only dialogs that might be added to this module later on. Change-Id: I6e7261e096d75df560c6ce608af4c54b82e52d13 Reviewed-by: Topi Reiniö Reviewed-by: Caroline Chao --- examples/quick/dialogs/ColorDialogs.qml | 145 ------------------ examples/quick/dialogs/FileDialogs.qml | 169 --------------------- examples/quick/dialogs/dialogs.pro | 19 +-- examples/quick/dialogs/dialogs.qml | 59 ------- examples/quick/dialogs/dialogs.qrc | 7 - .../quick/dialogs/doc/images/dialogs-example.jpg | Bin 47413 -> 0 bytes examples/quick/dialogs/doc/src/dialogs.qdoc | 44 ------ examples/quick/dialogs/main.cpp | 41 ----- .../quick/dialogs/systemdialogs/ColorDialogs.qml | 145 ++++++++++++++++++ .../quick/dialogs/systemdialogs/FileDialogs.qml | 169 +++++++++++++++++++++ .../doc/images/systemdialogs-example.jpg | Bin 0 -> 47413 bytes .../systemdialogs/doc/src/systemdialogs.qdoc | 48 ++++++ examples/quick/dialogs/systemdialogs/main.cpp | 41 +++++ .../quick/dialogs/systemdialogs/systemdialogs.pro | 17 +++ .../quick/dialogs/systemdialogs/systemdialogs.qml | 59 +++++++ .../quick/dialogs/systemdialogs/systemdialogs.qrc | 7 + 16 files changed, 489 insertions(+), 481 deletions(-) delete mode 100644 examples/quick/dialogs/ColorDialogs.qml delete mode 100644 examples/quick/dialogs/FileDialogs.qml delete mode 100644 examples/quick/dialogs/dialogs.qml delete mode 100644 examples/quick/dialogs/dialogs.qrc delete mode 100644 examples/quick/dialogs/doc/images/dialogs-example.jpg delete mode 100644 examples/quick/dialogs/doc/src/dialogs.qdoc delete mode 100644 examples/quick/dialogs/main.cpp create mode 100644 examples/quick/dialogs/systemdialogs/ColorDialogs.qml create mode 100644 examples/quick/dialogs/systemdialogs/FileDialogs.qml create mode 100644 examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg create mode 100644 examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc create mode 100644 examples/quick/dialogs/systemdialogs/main.cpp create mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.pro create mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.qml create mode 100644 examples/quick/dialogs/systemdialogs/systemdialogs.qrc diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/ColorDialogs.qml deleted file mode 100644 index 6a0af7f730..0000000000 --- a/examples/quick/dialogs/ColorDialogs.qml +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 320 - height: 200 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [colordialog] - ColorDialog { - id: colorDialog - visible: colorDialogVisible.checked - modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: "Choose a color" - color: "green" - showAlphaChannel: colorDialogAlpha.checked - onAccepted: { console.log("Accepted: " + color) } - onRejected: { console.log("Rejected") } - } - //! [colordialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - font.bold: true - text: "Color dialog properties:" - } - CheckBox { - id: colorDialogModal - text: "Modal" - checked: true - Binding on checked { value: colorDialog.modality != Qt.NonModal } - } - CheckBox { - id: colorDialogAlpha - text: "Show alpha channel" - Binding on checked { value: colorDialog.showAlphaChannel } - } - CheckBox { - id: colorDialogVisible - text: "Visible" - Binding on checked { value: colorDialog.visible } - } - Row { - id: colorRow - spacing: parent.spacing - height: colorLabel.implicitHeight * 2.0 - Rectangle { - color: colorDialog.color - height: parent.height - width: height * 2 - border.color: "black" - MouseArea { - anchors.fill: parent - onClicked: colorDialog.open() - } - } - Text { - id: colorLabel - color: palette.windowText - text: "current color: " + colorDialog.color - anchors.verticalCenter: parent.verticalCenter - } - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.close() - } - Button { - text: "set to green" - anchors.verticalCenter: parent.verticalCenter - onClicked: colorDialog.color = "green" - } - } - } -} diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml deleted file mode 100644 index d1278609f9..0000000000 --- a/examples/quick/dialogs/FileDialogs.qml +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Dialogs 1.0 -import "../shared" - -Rectangle { - width: 580 - height: 400 - color: palette.window - SystemPalette { id: palette } - clip: true - - //! [filedialog] - FileDialog { - id: fileDialog - visible: fileDialogVisible.checked - modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal - title: fileDialogSelectFolder.checked ? "Choose a folder" : - (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") - selectExisting: fileDialogSelectExisting.checked - selectMultiple: fileDialogSelectMultiple.checked - selectFolder: fileDialogSelectFolder.checked - nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] - selectedNameFilter: "All files (*)" - onAccepted: { console.log("Accepted: " + fileUrls) } - onRejected: { console.log("Rejected") } - } - //! [filedialog] - - Column { - anchors.fill: parent - anchors.margins: 12 - spacing: 8 - Text { - color: palette.windowText - font.bold: true - text: "File dialog properties:" - } - CheckBox { - id: fileDialogModal - text: "Modal" - checked: true - Binding on checked { value: fileDialog.modality != Qt.NonModal } - } - CheckBox { - id: fileDialogSelectFolder - text: "Select Folder" - Binding on checked { value: fileDialog.selectFolder } - } - CheckBox { - id: fileDialogSelectExisting - text: "Select Existing Files" - checked: true - Binding on checked { value: fileDialog.selectExisting } - } - CheckBox { - id: fileDialogSelectMultiple - text: "Select Multiple Files" - Binding on checked { value: fileDialog.selectMultiple } - } - CheckBox { - id: fileDialogVisible - text: "Visible" - Binding on checked { value: fileDialog.visible } - } - Text { - color: palette.windowText - text: "current view folder: " + fileDialog.folder - } - Text { - color: palette.windowText - text: "name filters: {" + fileDialog.nameFilters + "}" - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "current filter:" + fileDialog.selectedNameFilter - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen files: " + fileDialog.fileUrls - width: parent.width - wrapMode: Text.Wrap - } - Text { - color: palette.windowText - text: "chosen single path: " + fileDialog.fileUrl - width: parent.width - wrapMode: Text.Wrap - } - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 50 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 12 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "go to /tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } -} diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro index b76f396e9d..538e75686c 100644 --- a/examples/quick/dialogs/dialogs.pro +++ b/examples/quick/dialogs/dialogs.pro @@ -1,17 +1,4 @@ -TEMPLATE = app +TEMPLATE = subdirs -QT += quick qml -SOURCES += main.cpp -RESOURCES += dialogs.qrc ../shared/shared.qrc - -OTHER_FILES += \ - dialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml - -EXAMPLE_FILES = \ - FileDialogs.qml \ - ColorDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs -INSTALLS += target +SUBDIRS = \ + systemdialogs diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/dialogs.qml deleted file mode 100644 index b5f9841a3f..0000000000 --- a/examples/quick/dialogs/dialogs.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "../shared" - -TabSet { - width: 580 - height: 440 - - FileDialogs { - property string title: "File Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } - - ColorDialogs { - property string title: "Color Dialog" - anchors.fill: parent - color: "#e3e3e3" // to match tab.png - } -} diff --git a/examples/quick/dialogs/dialogs.qrc b/examples/quick/dialogs/dialogs.qrc deleted file mode 100644 index efebfe4845..0000000000 --- a/examples/quick/dialogs/dialogs.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - dialogs.qml - FileDialogs.qml - ColorDialogs.qml - - diff --git a/examples/quick/dialogs/doc/images/dialogs-example.jpg b/examples/quick/dialogs/doc/images/dialogs-example.jpg deleted file mode 100644 index 4517a39308..0000000000 Binary files a/examples/quick/dialogs/doc/images/dialogs-example.jpg and /dev/null differ diff --git a/examples/quick/dialogs/doc/src/dialogs.qdoc b/examples/quick/dialogs/doc/src/dialogs.qdoc deleted file mode 100644 index daac914c60..0000000000 --- a/examples/quick/dialogs/doc/src/dialogs.qdoc +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \title Qt Quick Dialog Examples - \example dialogs - \brief This example demonstrates the dialog types in QML - \image dialogs-example.jpg - \ingroup qtquickdialog_examples - - This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} - module. The appearance and behavior is platform-dependent. - - A \l FileDialog is used to choose a single file, multiple files or a - single directory, depending on how it is configured. - \snippet dialogs/FileDialogs.qml filedialog - - A \l ColorDialog is used to choose a color, with or without alpha (transparency) - depending on how it is configured. - \snippet dialogs/ColorDialogs.qml colordialog -*/ diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/main.cpp deleted file mode 100644 index bbf0c48104..0000000000 --- a/examples/quick/dialogs/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/dialogs/systemdialogs/ColorDialogs.qml b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml new file mode 100644 index 0000000000..6a0af7f730 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 320 + height: 200 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [colordialog] + ColorDialog { + id: colorDialog + visible: colorDialogVisible.checked + modality: colorDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: "Choose a color" + color: "green" + showAlphaChannel: colorDialogAlpha.checked + onAccepted: { console.log("Accepted: " + color) } + onRejected: { console.log("Rejected") } + } + //! [colordialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + font.bold: true + text: "Color dialog properties:" + } + CheckBox { + id: colorDialogModal + text: "Modal" + checked: true + Binding on checked { value: colorDialog.modality != Qt.NonModal } + } + CheckBox { + id: colorDialogAlpha + text: "Show alpha channel" + Binding on checked { value: colorDialog.showAlphaChannel } + } + CheckBox { + id: colorDialogVisible + text: "Visible" + Binding on checked { value: colorDialog.visible } + } + Row { + id: colorRow + spacing: parent.spacing + height: colorLabel.implicitHeight * 2.0 + Rectangle { + color: colorDialog.color + height: parent.height + width: height * 2 + border.color: "black" + MouseArea { + anchors.fill: parent + onClicked: colorDialog.open() + } + } + Text { + id: colorLabel + color: palette.windowText + text: "current color: " + colorDialog.color + anchors.verticalCenter: parent.verticalCenter + } + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } +} diff --git a/examples/quick/dialogs/systemdialogs/FileDialogs.qml b/examples/quick/dialogs/systemdialogs/FileDialogs.qml new file mode 100644 index 0000000000..d1278609f9 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/FileDialogs.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Dialogs 1.0 +import "../shared" + +Rectangle { + width: 580 + height: 400 + color: palette.window + SystemPalette { id: palette } + clip: true + + //! [filedialog] + FileDialog { + id: fileDialog + visible: fileDialogVisible.checked + modality: fileDialogModal.checked ? Qt.WindowModal : Qt.NonModal + title: fileDialogSelectFolder.checked ? "Choose a folder" : + (fileDialogSelectMultiple.checked ? "Choose some files" : "Choose a file") + selectExisting: fileDialogSelectExisting.checked + selectMultiple: fileDialogSelectMultiple.checked + selectFolder: fileDialogSelectFolder.checked + nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] + selectedNameFilter: "All files (*)" + onAccepted: { console.log("Accepted: " + fileUrls) } + onRejected: { console.log("Rejected") } + } + //! [filedialog] + + Column { + anchors.fill: parent + anchors.margins: 12 + spacing: 8 + Text { + color: palette.windowText + font.bold: true + text: "File dialog properties:" + } + CheckBox { + id: fileDialogModal + text: "Modal" + checked: true + Binding on checked { value: fileDialog.modality != Qt.NonModal } + } + CheckBox { + id: fileDialogSelectFolder + text: "Select Folder" + Binding on checked { value: fileDialog.selectFolder } + } + CheckBox { + id: fileDialogSelectExisting + text: "Select Existing Files" + checked: true + Binding on checked { value: fileDialog.selectExisting } + } + CheckBox { + id: fileDialogSelectMultiple + text: "Select Multiple Files" + Binding on checked { value: fileDialog.selectMultiple } + } + CheckBox { + id: fileDialogVisible + text: "Visible" + Binding on checked { value: fileDialog.visible } + } + Text { + color: palette.windowText + text: "current view folder: " + fileDialog.folder + } + Text { + color: palette.windowText + text: "name filters: {" + fileDialog.nameFilters + "}" + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "current filter:" + fileDialog.selectedNameFilter + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen files: " + fileDialog.fileUrls + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "chosen single path: " + fileDialog.fileUrl + width: parent.width + wrapMode: Text.Wrap + } + } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" + } + } + } +} diff --git a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg new file mode 100644 index 0000000000..4517a39308 Binary files /dev/null and b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg differ diff --git a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc new file mode 100644 index 0000000000..9788be7343 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick System Dialog Examples + \example systemdialogs + \brief This example demonstrates the system dialog types in QML + \image systemdialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet systemdialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet systemdialogs/ColorDialogs.qml colordialog + + The example can be built as a standalone executable, but each + type of dialog is demonstrated in a separate QML file which can + also be run separately with qmlscene. +*/ diff --git a/examples/quick/dialogs/systemdialogs/main.cpp b/examples/quick/dialogs/systemdialogs/main.cpp new file mode 100644 index 0000000000..2119227c1f --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/systemdialogs) diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.pro b/examples/quick/dialogs/systemdialogs/systemdialogs.pro new file mode 100644 index 0000000000..e8c3e9857b --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += systemdialogs.qrc ../../shared/shared.qrc + +OTHER_FILES += \ + systemdialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qml b/examples/quick/dialogs/systemdialogs/systemdialogs.qml new file mode 100644 index 0000000000..b5f9841a3f --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" + +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } + + ColorDialogs { + property string title: "Color Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png + } +} diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc new file mode 100644 index 0000000000..b90b99f7f5 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc @@ -0,0 +1,7 @@ + + + systemdialogs.qml + FileDialogs.qml + ColorDialogs.qml + + -- cgit v1.2.1 From e2da7e662d591b13fd30d16c6670f64fba45c973 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 12 Jun 2013 15:42:54 +0200 Subject: QFileDialogHelper: Force QWindow before setting flags. Fixes a crash when clicking the dialog icon in the QtQuickControls gallery example. Change-Id: I7a3b2321f4a1bf179dced8e98598559f396386db Reviewed-by: Shawn Rutledge --- src/imports/widgets/qquickqfiledialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/imports/widgets/qquickqfiledialog.cpp b/src/imports/widgets/qquickqfiledialog.cpp index 672c6d1bf4..4c5e1b6e37 100644 --- a/src/imports/widgets/qquickqfiledialog.cpp +++ b/src/imports/widgets/qquickqfiledialog.cpp @@ -96,6 +96,7 @@ public: virtual void exec() { m_dialog.exec(); } virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) { + m_dialog.winId(); m_dialog.windowHandle()->setTransientParent(parent); m_dialog.windowHandle()->setFlags(f); m_dialog.setWindowModality(m); -- cgit v1.2.1 From 4455db6ad1a644124536135971825f1e88471522 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 14 Jun 2013 10:28:44 +0200 Subject: stabilize tst_touchmouse. The test relies on window activation, which means that it cannot be a parallel test. Change-Id: I15b1c1511c38345b160aa3d01d17667dffc58c87 Reviewed-by: Sergio Ahumada --- tests/auto/quick/touchmouse/touchmouse.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index bba0abdc17..378e199bf5 100644 --- a/tests/auto/quick/touchmouse/touchmouse.pro +++ b/tests/auto/quick/touchmouse/touchmouse.pro @@ -13,8 +13,6 @@ TESTDATA = data/* # OTHER_FILES += data/foo.qml -CONFIG += parallel_test - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac:CONFIG+=insignificant_test # QTBUG-27890 -- cgit v1.2.1 From 9f661cf327bc638d7584ba3832adaaa3d7c8734e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 13 Jun 2013 17:02:36 +0200 Subject: photosurface demo: behavior depends on initialization order The file dialog wasn't appearing on the mac. This way seems to work. We have a long-term bug here but this workaround will look better for the release. Change-Id: I8538ca5dc11a063591bc4557fd3779c5bb3768b5 Task-number: QTBUG-31699 Reviewed-by: Gunnar Sletta --- examples/quick/demos/photosurface/photosurface.qml | 5 +++-- tests/auto/quick/examples/tst_examples.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml index 53e0edffbe..4f7100358f 100644 --- a/examples/quick/demos/photosurface/photosurface.qml +++ b/examples/quick/demos/photosurface/photosurface.qml @@ -39,13 +39,14 @@ ****************************************************************************/ import QtQuick 2.0 import QtQuick.Dialogs 1.0 +import QtQuick.Window 2.1 import Qt.labs.folderlistmodel 1.0 -Rectangle { +Window { id: root + visible: true width: 1024; height: 600 color: "black" - visible: true property int highestZ: 0 property real defaultSize: 200 diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 9c5fb88af2..7ef07e4896 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -89,6 +89,7 @@ tst_examples::tst_examples() // Add files to exclude here excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528 excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem + excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) excludedDirs << "shared"; //Not an example -- cgit v1.2.1 From d6dc07f6151e8ff699a06dde6dc9b01a0c7d363c Mon Sep 17 00:00:00 2001 From: Venu Date: Tue, 18 Jun 2013 11:42:47 +0200 Subject: Doc: Changed the title to avoid name conflicts and linking errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-30173 Change-Id: Ibf6626cdfc205c48ca634491661c87414bbddf24 Reviewed-by: Jerome Pasion Reviewed-by: Topi Reiniö Reviewed-by: Martin Smith --- examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc | 2 +- examples/quick/particles/system/doc/src/system.qdoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc index 4fda13746a..ea94a4bc39 100644 --- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \title Qt Quick Particles Examples - Affectors + \title Qt Quick Particles Examples - Image Particles \example particles/imageparticle \brief This is a collection of examples using Affectors in the QML particle system. \image qml-imageparticle-example.png diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc index 99be23d9d1..385cd927da 100644 --- a/examples/quick/particles/system/doc/src/system.qdoc +++ b/examples/quick/particles/system/doc/src/system.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \title Qt Quick Particles Examples - Affectors + \title Qt Quick Particles Examples - System \example particles/system \brief This is a collection of examples using Affectors in the QML particle system. \image qml-system-example.png -- cgit v1.2.1 From 24947fb8cc1859d5d193b2d66746c1541f30ab9b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 19 Jun 2013 12:41:07 +0200 Subject: QColorDialogHelper: Force QWindow before setting flags This needs the same fix as the one in the QFileDialogHelper (change I7a3b2321f4a1bf179dced8e98598559f396386db). However to be even safer, we can check for a null pointer before calling any methods on the QWindow. Task-number: QTBUG-31834 Change-Id: I319326f06fb2c92dc898fd12be86b6c7b7f87e5a Reviewed-by: Friedemann Kleint --- src/imports/widgets/qquickqcolordialog.cpp | 7 +++++-- src/imports/widgets/qquickqfiledialog.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/imports/widgets/qquickqcolordialog.cpp b/src/imports/widgets/qquickqcolordialog.cpp index abe6ffd004..d10eacee60 100644 --- a/src/imports/widgets/qquickqcolordialog.cpp +++ b/src/imports/widgets/qquickqcolordialog.cpp @@ -68,8 +68,11 @@ public: virtual void exec() { m_dialog.exec(); } virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) { - m_dialog.windowHandle()->setTransientParent(parent); - m_dialog.windowHandle()->setFlags(f); + m_dialog.winId(); + QWindow *window = m_dialog.windowHandle(); + Q_ASSERT(window); + window->setTransientParent(parent); + window->setFlags(f); m_dialog.setWindowModality(m); m_dialog.setWindowTitle(QPlatformColorDialogHelper::options()->windowTitle()); m_dialog.setOptions((QColorDialog::ColorDialogOptions)((int)(QPlatformColorDialogHelper::options()->options()))); diff --git a/src/imports/widgets/qquickqfiledialog.cpp b/src/imports/widgets/qquickqfiledialog.cpp index 4c5e1b6e37..afb150b509 100644 --- a/src/imports/widgets/qquickqfiledialog.cpp +++ b/src/imports/widgets/qquickqfiledialog.cpp @@ -97,8 +97,10 @@ public: virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) { m_dialog.winId(); - m_dialog.windowHandle()->setTransientParent(parent); - m_dialog.windowHandle()->setFlags(f); + QWindow *window = m_dialog.windowHandle(); + Q_ASSERT(window); + window->setTransientParent(parent); + window->setFlags(f); m_dialog.setWindowModality(m); m_dialog.show(); return m_dialog.isVisible(); -- cgit v1.2.1 From 55ba0b974c920f7f3771f5e16b4af75be1c511a7 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Sat, 22 Jun 2013 20:10:51 -0700 Subject: Add missing Q_REVISION This invokable method is new in Qt 5.1/QtQuick 2.1 Change-Id: I7d0e332b52a815ac0722e39db68ef1f190534a57 Reviewed-by: Liang Qi --- src/quick/items/qquickitem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 84eafec1d7..d7256f3568 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -324,7 +324,7 @@ public: Q_INVOKABLE void mapToItem(QQmlV8Function*) const; Q_INVOKABLE void forceActiveFocus(); Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason); - Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); + Q_REVISION(1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const; #ifndef QT_NO_IM -- cgit v1.2.1 From cf01eac77c555fa559e52bdd32c71c960ac741f5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 24 Jun 2013 13:54:11 +0200 Subject: QQmlPlatform: rename "mac" to "osx" Change-Id: Ie458690b8008b211785cf9dcc0312a7e25c84f6b Reviewed-by: Jake Petroules Reviewed-by: Jens Bache-Wiig --- src/qml/qml/qqmlengine.cpp | 4 ++-- src/qml/qml/qqmlplatform.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 64662138e1..9998af3890 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -391,9 +391,9 @@ The following functions are also on the Qt object. \list \li \c "android" - Android \li \c "blackberry" - BlackBerry OS - \li \c "ios" - Apple iOS + \li \c "ios" - iOS \li \c "linux" - Linux - \li \c "mac" - Mac OS X + \li \c "osx" - OS X \li \c "unix" - Other Unix-based OS \li \c "windows" - Windows \li \c "wince" - Windows CE diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp index de48f60f56..04862379be 100644 --- a/src/qml/qml/qqmlplatform.cpp +++ b/src/qml/qml/qqmlplatform.cpp @@ -66,7 +66,7 @@ QString QQmlPlatform::os() #elif defined(Q_OS_IOS) return QLatin1String("ios"); #elif defined(Q_OS_MAC) - return QLatin1String("mac"); + return QLatin1String("osx"); #elif defined(Q_OS_WINCE) return QLatin1String("wince"); #elif defined(Q_OS_WIN) -- cgit v1.2.1 From a4754a30abc6f650885cbd20d0419da26a504220 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Sat, 22 Jun 2013 20:10:21 -0700 Subject: Update 5.1.0 changelog and what's new All the new features should now be listed in those two documents Change-Id: Ifa17581bf589f3a18b602f8a1d10683a5e48c70d Reviewed-by: Jens Bache-Wiig --- dist/changes-5.1.0 | 62 ++++++++++++++++++++++++++++++++++++++--- src/qml/doc/src/whatsnew.qdoc | 5 ++++ src/quick/doc/src/whatsnew.qdoc | 3 +- 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index eaf6d05094..528260e760 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -21,7 +21,12 @@ information about a particular change. General Improvements -------------------- - +- The Qt.application object in QML has gained the following new members + * arguments property, containing any command line arguments of the application + * name property, containing the string of the application name + * version property, containing the string of the application version + * aboutToQuit() signal, allowing last-minute cleanup +- New Qt.platform.os property exposes the current platform. Third party components ---------------------- @@ -42,9 +47,10 @@ Third party components - As part of a fix for QTBUG-30555, ListView and GridView properties, such as count, which are based off of the data model will no longer update immediately if queried. Updates are batched to happen once per frame (or - when properties are being set). + when properties are being set). You may manually update using the + forceLayout() method, new in QtQuick 2.1. - - tryCompare now correctly fails when it only gets two parameters + - For QML tests, tryCompare now correctly fails when it only gets two parameters - If a QObject has a property and a slot (or invokable method) with the same name, in QML the previous behavior was to let the property obscure the @@ -53,11 +59,41 @@ Third party components for objects having dynamic properties, such as QQmlPropertyMap. This change was a consequence of the fix for QTBUG-29836. + - The 'with' statement has been deprecated in the QML language. Using this + statement now produces a deprecation warning, and future versions of the + QML engine may not recognize it. + + - The implicit import is now only loaded for QML files if there are + unresolved types after loading all explicit imports. Applications where + the implicit import triggered code other than the registration of types + will now need to add import "." to their QML files. + **************************************************************************** * Library * **************************************************************************** +QtQml +------ + - New QML import version QtQml.Models 2.1 contains generic versions of the VisualModel + types. These new generic versions work with any QObject based delegate, + not just QQuickItem based delegates. + - New module version QtQml 2.1 provides the new Instantiator type, which + is a generic version of Repeater which works with any QObject based + delegate, not just QQuickItem based delegates. + - New convenience class QQmlApplicationEngine automatically provides + functionality common in the C++ shell of a primarily QML application. + - New qmlClearTypeRegistrations() function in qqml.h. This function drops all + static data generated by previous qmlRegisterType calls. + - New qmlRegisteredType function in qqml.h, allowing the registration of + composite types from C++. + +QtQuick +------ + - New QML import version QtQuick 2.1 contains no new types, but adds new + properties, methods and signals to existing types. See the release notes + in the QtQuick documentation for details. - QTBUG-30837: The Flickable type no longer fixes up the content area on startup to move it inside the viewport. + - QTBUG-28086: Remote image URLs now work as a source for AnimatedSprite **************************************************************************** @@ -68,7 +104,11 @@ Third party components **************************************************************************** * Platform Specific Changes * **************************************************************************** - + - New threaded render loop for Mac and Linux should lead to improved + graphical performance of QtQuick 2 on those platforms. + - New render loop on Windows should lead to smoother animations. + - assets: scheme supported on Android for urls inside QML + - Mac: "@2x" images are now loaded on "retina" systems. **************************************************************************** * Compiler Specific Changes * @@ -79,9 +119,23 @@ Third party components * Tools * **************************************************************************** +- qmlplugindump gains a -relocatable flag. **************************************************************************** * Plugins * **************************************************************************** +- New QML import QtQuick.Dialogs 1.0 contains types for more easily adding + dialogs to an application. Initially comes with FileDialog and ColorDialog + +- New QML import version QtQuick.Window 2.1 adds many new properties to both + the Screen and Window types. See the release notes in the QtQuick + documentation for further details. + +- QTBUG-30915: Animating emitRate on Emitter no longer fails for specific + animation timings. As a side effect, when emitting infinite particles + changing the particle count will no longer have an effect after initial + emission (previously it no longer had an effect after a certain point + into the animation). + diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index eece3bcaab..f1c69160b6 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -37,6 +37,11 @@ a summary of the new changes: \li New QQmlApplicationEngine convenience class for QML applications. \li New Instantiatior type for generic, dynamic object creation. \li New properties for \l Qt.application: arguments, name, and version. +\li The 'with' statement has been deprecated and is slated for removal in a + future version of the language. +\li New \l Qt.platform object with an os property +\li New \l qmlClearTypeRegistations() function drops all data from qmlRegisterType calls +\li New \l qmlRegisterType function for registering composite types. \endlist \section2 New Submodule diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index 973d41dca2..26d88699bc 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -38,7 +38,8 @@ features introduced by the new import and new classes in Qt 5.1: \li New render loop for windows for smoother animations. \li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight, maximumWidth, maximumHeight, visibility, contentOrientation, and opacity. -\li New \l Item property: activeFocusOnTab. +\li New \l Screen attached properties: name, desktopAvailableWidth, + desktopAvailableHeight, logicalPixelDensity \li New \l Grid properties: horizontalAlignment, verticalAlignment, and effectiveHorizontalAlignment. \li New \l TextEdit properties: selectByKeyboard and textDocument -- cgit v1.2.1 From 4e2153a1d5056249fc31e23890d8c525a3986e1b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 18 Apr 2013 12:30:20 +0200 Subject: Declarative dialog improvements for the non-Window use case Platforms like Android and EGL don't support multiple top-level windows, so we have to avoid trying to use widget-based dialogs (because a widget dialog on top of a scene graph will result in a second window), allow the QML dialog to be an Item, and decorate it to look like a window. Task-number: QTBUG-31898 Change-Id: I9af049f3265188e8be677a05a8bc6d1699b4cd00 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Richard Moe Gustavsen --- examples/quick/shared/Button.qml | 16 ++--- src/imports/dialogs/DefaultColorDialog.qml | 10 ++- src/imports/dialogs/DefaultFileDialog.qml | 10 +-- src/imports/dialogs/dialogs.pro | 2 + src/imports/dialogs/images/window_border.png | Bin 0 -> 588 bytes src/imports/dialogs/plugin.cpp | 31 ++++++--- src/imports/dialogs/qml/Button.qml | 15 ++-- .../dialogs/qml/DefaultWindowDecoration.qml | 68 ++++++++++++++++++ src/imports/dialogs/qml/TextField.qml | 4 +- src/imports/dialogs/qquickabstractdialog.cpp | 77 +++++++++++++++++---- src/imports/dialogs/qquickabstractdialog_p.h | 10 +++ 11 files changed, 193 insertions(+), 50 deletions(-) create mode 100644 src/imports/dialogs/images/window_border.png create mode 100644 src/imports/dialogs/qml/DefaultWindowDecoration.qml diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml index 9942a17b5c..551f7d6e04 100644 --- a/examples/quick/shared/Button.qml +++ b/examples/quick/shared/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.1 Item { id: container @@ -48,10 +48,10 @@ Item { signal clicked property alias containsMouse: mouseArea.containsMouse property alias pressed: mouseArea.pressed - implicitHeight: buttonLabel.implicitHeight - implicitWidth: buttonLabel.implicitWidth - height: buttonLabel.implicitHeight + 12 - width: Math.max(80, implicitWidth + 8) + implicitHeight: buttonLabel.implicitHeight * 1.2 + implicitWidth: buttonLabel.implicitWidth * 1.2 + height: implicitHeight + width: implicitWidth SystemPalette { id: palette } @@ -64,7 +64,7 @@ Item { GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } } antialiasing: true - radius: 5 + radius: height / 4 border.color: Qt.darker(palette.button, 1.5) border.width: 1 } @@ -78,10 +78,8 @@ Item { Text { id: buttonLabel - width: parent.width - horizontalAlignment: Text.Center text: container.text color: palette.buttonText - anchors.verticalCenter: parent.verticalCenter + anchors.centerIn: parent } } diff --git a/src/imports/dialogs/DefaultColorDialog.qml b/src/imports/dialogs/DefaultColorDialog.qml index 7322aa18e7..8636259957 100644 --- a/src/imports/dialogs/DefaultColorDialog.qml +++ b/src/imports/dialogs/DefaultColorDialog.qml @@ -39,6 +39,7 @@ *****************************************************************************/ import QtQuick 2.1 +import QtQuick.Window 2.1 import QtQuick.Dialogs 1.0 import "qml" @@ -47,14 +48,17 @@ AbstractColorDialog { Rectangle { id: content - width: 320 - height: (usePaletteMap ? width : 0) + bottomMinHeight + property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight) + implicitHeight: Math.max(maxSize, Screen.logicalPixelDensity * (usePaletteMap ? 10 : 5)) + implicitWidth: usePaletteMap ? implicitHeight - bottomMinHeight : implicitHeight * 1.5 color: palette.window property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3 property real spacing: 8 property real outerSpacing: 12 property bool usePaletteMap: true - property bool inited: false + + // set the preferred width based on height, to avoid "letterboxing" the paletteMap + onHeightChanged: implicitHeight = Math.max((usePaletteMap ? 480 : bottomMinHeight), height) SystemPalette { id: palette } diff --git a/src/imports/dialogs/DefaultFileDialog.qml b/src/imports/dialogs/DefaultFileDialog.qml index 5542e59cb5..a43b493a29 100644 --- a/src/imports/dialogs/DefaultFileDialog.qml +++ b/src/imports/dialogs/DefaultFileDialog.qml @@ -40,6 +40,7 @@ import QtQuick 2.1 import QtQuick.Dialogs 1.0 +import QtQuick.Window 2.1 import Qt.labs.folderlistmodel 2.0 import "qml" @@ -54,7 +55,7 @@ AbstractFileDialog { } property bool showFocusHighlight: false - property real textX: 28 + property real textX: titleBar.height property SystemPalette palette property var selectedIndices: [] property int lastClickedIdx: -1 @@ -117,11 +118,12 @@ AbstractFileDialog { } Rectangle { - width: 480 // TODO: QTBUG-29817 geometry from AbstractFileDialog - height: 320 + property int maxSize: Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight) + // TODO: QTBUG-29817 geometry from AbstractFileDialog + implicitWidth: Math.min(maxSize, Screen.logicalPixelDensity * 100) + implicitHeight: Math.min(maxSize, Screen.logicalPixelDensity * 80) id: window color: palette.window - anchors.centerIn: Qt.application.supportsMultipleWindows ? null : parent SystemPalette { id: palette } diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index 53cad30cee..e745d52e2b 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -31,6 +31,7 @@ QML_FILES += \ WidgetColorDialog.qml \ qml/Button.qml \ qml/ColorSlider.qml \ + qml/DefaultWindowDecoration.qml \ qml/TextField.qml \ qml/qmldir \ images/checkers.png \ @@ -38,6 +39,7 @@ QML_FILES += \ images/crosshairs.png \ images/slider_handle.png \ images/sunken_frame.png \ + images/window_border.png \ images/folder.png \ images/up.png diff --git a/src/imports/dialogs/images/window_border.png b/src/imports/dialogs/images/window_border.png new file mode 100644 index 0000000000..431af8545d Binary files /dev/null and b/src/imports/dialogs/images/window_border.png differ diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index 5502a65310..8d1501cd03 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -48,6 +48,7 @@ #include "qquickabstractcolordialog_p.h" #include "qquickplatformcolordialog_p.h" #include +#include //#define PURE_QML_ONLY @@ -78,9 +79,18 @@ class QtQuick2DialogsPlugin : public QQmlExtensionPlugin public: QtQuick2DialogsPlugin() : QQmlExtensionPlugin() { } + virtual void initializeEngine(QQmlEngine *engine, const char *uri) { + //qDebug() << Q_FUNC_INFO << uri << m_decorationComponentUrl; + QQuickAbstractDialog::m_decorationComponent = + new QQmlComponent(engine, m_decorationComponentUrl, QQmlComponent::Asynchronous); + } + virtual void registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs")); + bool hasTopLevelWindows = QGuiApplicationPrivate::platformIntegration()-> + hasCapability(QPlatformIntegration::MultipleWindows); QDir qmlDir(baseUrl().toLocalFile()); + m_decorationComponentUrl = QUrl::fromLocalFile(qmlDir.filePath(QString("qml/DefaultWindowDecoration.qml"))); QDir widgetsDir(baseUrl().toLocalFile()); // TODO: find the directory by searching rather than assuming a relative path widgetsDir.cd("../PrivateWidgets"); @@ -96,8 +106,7 @@ public: qmlRegisterType(uri, DIALOGS_MAJOR_MINOR, "FileDialog"); else #endif - registerWidgetOrQmlImplementation(widgetsDir, "WidgetFileDialog.qml", - qmlDir, "DefaultFileDialog.qml", "FileDialog", uri); + registerWidgetOrQmlImplementation(widgetsDir, qmlDir, "FileDialog", uri, hasTopLevelWindows); // ColorDialog #ifndef PURE_QML_ONLY @@ -105,35 +114,37 @@ public: qmlRegisterType(uri, DIALOGS_MAJOR_MINOR, "ColorDialog"); else #endif - registerWidgetOrQmlImplementation(widgetsDir, "WidgetColorDialog.qml", - qmlDir, "DefaultColorDialog.qml", "ColorDialog", uri); + registerWidgetOrQmlImplementation(widgetsDir, qmlDir, "ColorDialog", uri, hasTopLevelWindows); } protected: template - void registerWidgetOrQmlImplementation(QDir widgetsDir, QString widgetQmlFile, - QDir qmlDir, QString qmlFile, const char *qmlName, const char *uri) { + void registerWidgetOrQmlImplementation(QDir widgetsDir, QDir qmlDir, + const char *qmlName, const char *uri, bool hasTopLevelWindows) { + //qDebug() << Q_FUNC_INFO << qmlDir << qmlName << uri; bool needQml = true; + #ifndef PURE_QML_ONLY // If there is a qmldir and we have a QApplication instance (as opposed to a // widget-free QGuiApplication), assume that the widget-based dialog will work. - if (widgetsDir.exists("qmldir") && !widgetQmlFile.isEmpty() && + if (hasTopLevelWindows && widgetsDir.exists("qmldir") && !qstrcmp(QCoreApplication::instance()->metaObject()->className(), "QApplication")) { - QString dialogQmlPath = qmlDir.filePath(widgetQmlFile); + QString dialogQmlPath = qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)); if (qmlRegisterType(QUrl::fromLocalFile(dialogQmlPath), uri, DIALOGS_MAJOR_MINOR, qmlName) >= 0) needQml = false; - // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << needQml; + // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << !needQml; } #endif if (needQml) { - QString dialogQmlPath = qmlDir.filePath(qmlFile); QByteArray abstractTypeName = QByteArray("Abstract") + qmlName; qmlRegisterType(uri, DIALOGS_MAJOR_MINOR, abstractTypeName); // implementation wrapper + QString dialogQmlPath = qmlDir.filePath(QString("Default%1.qml").arg(qmlName)); // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << qmlRegisterType(QUrl::fromLocalFile(dialogQmlPath), uri, DIALOGS_MAJOR_MINOR, qmlName); } } + QUrl m_decorationComponentUrl; }; QT_END_NAMESPACE diff --git a/src/imports/dialogs/qml/Button.qml b/src/imports/dialogs/qml/Button.qml index 491dc2e251..4a0ec12cd3 100644 --- a/src/imports/dialogs/qml/Button.qml +++ b/src/imports/dialogs/qml/Button.qml @@ -39,6 +39,7 @@ *****************************************************************************/ import QtQuick 2.1 +import QtQuick.Window 2.1 Item { id: container @@ -48,10 +49,10 @@ Item { signal clicked property alias containsMouse: mouseArea.containsMouse property alias pressed: mouseArea.pressed - implicitHeight: buttonLabel.implicitHeight - implicitWidth: buttonLabel.implicitWidth - height: buttonLabel.implicitHeight + 12 - width: Math.max(80, implicitWidth + 8) + implicitHeight: buttonLabel.implicitHeight * 1.2 + implicitWidth: Math.max(Screen.logicalPixelDensity * 10, buttonLabel.implicitWidth * 1.2) + height: implicitHeight + width: implicitWidth SystemPalette { id: palette } @@ -64,7 +65,7 @@ Item { GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } } antialiasing: true - radius: 5 + radius: height / 4 border.color: Qt.darker(palette.button, 1.5) border.width: 1 } @@ -78,10 +79,8 @@ Item { Text { id: buttonLabel - width: parent.width - horizontalAlignment: Text.Center text: container.text color: palette.buttonText - anchors.verticalCenter: parent.verticalCenter + anchors.centerIn: parent } } diff --git a/src/imports/dialogs/qml/DefaultWindowDecoration.qml b/src/imports/dialogs/qml/DefaultWindowDecoration.qml new file mode 100644 index 0000000000..69a8658aba --- /dev/null +++ b/src/imports/dialogs/qml/DefaultWindowDecoration.qml @@ -0,0 +1,68 @@ +/***************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQuick.Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.1 + +Rectangle { + color: "#80000000" + anchors.fill: parent + z: 1000000 + property alias content: borderImage.content + property bool dismissOnOuterClick: true + signal dismissed + MouseArea { + anchors.fill: parent + enabled: dismissOnOuterClick + onClicked: dismissed() + BorderImage { + id: borderImage + property Item content + + width: content ? content.width + 15 : 0 + height: content ? content.height + 15 : 0 + onWidthChanged: content.x = 5 + onHeightChanged: content.y = 5 + border { left: 10; top: 10; right: 10; bottom: 10 } + source: "../images/window_border.png" + anchors.centerIn: parent + onContentChanged: if (content) content.parent = borderImage + } + } +} diff --git a/src/imports/dialogs/qml/TextField.qml b/src/imports/dialogs/qml/TextField.qml index baa469caa9..9a6427a105 100644 --- a/src/imports/dialogs/qml/TextField.qml +++ b/src/imports/dialogs/qml/TextField.qml @@ -45,10 +45,10 @@ Item { property alias textInput: textInput property alias text: textInput.text - property real implicitWidth: textInput.implicitWidth + rect.radius * 2 - property real implicitHeight: textInput.implicitHeight + rect.radius * 2 signal accepted signal downPressed + implicitWidth: textInput.implicitWidth + rect.radius * 2 + implicitHeight: textInput.implicitHeight function copyAll() { textInput.selectAll() diff --git a/src/imports/dialogs/qquickabstractdialog.cpp b/src/imports/dialogs/qquickabstractdialog.cpp index abdc9e067c..560cbaf3e0 100644 --- a/src/imports/dialogs/qquickabstractdialog.cpp +++ b/src/imports/dialogs/qquickabstractdialog.cpp @@ -44,11 +44,14 @@ #include #include +#include #include #include QT_BEGIN_NAMESPACE +QQmlComponent *QQuickAbstractDialog::m_decorationComponent(0); + QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent) : QObject(parent) , m_parentWindow(0) @@ -56,6 +59,10 @@ QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent) , m_modality(Qt::WindowModal) , m_qmlImplementation(0) , m_dialogWindow(0) + , m_contentItem(0) + , m_windowDecoration(0) + , m_hasNativeWindows(QGuiApplicationPrivate::platformIntegration()-> + hasCapability(QPlatformIntegration::MultipleWindows)) { } @@ -82,36 +89,47 @@ void QQuickAbstractDialog::setVisible(bool v) if (!m_dialogWindow) { m_dialogWindow = qobject_cast(m_qmlImplementation); if (!m_dialogWindow) { - QQuickItem *dlgItem = qobject_cast(m_qmlImplementation); - if (dlgItem) { - m_dialogWindow = dlgItem->window(); + m_contentItem = qobject_cast(m_qmlImplementation); + if (m_contentItem) { + m_dialogWindow = m_contentItem->window(); // An Item-based dialog implementation doesn't come with a window, so // we have to instantiate one iff the platform allows it. - if (!m_dialogWindow && QGuiApplicationPrivate::platformIntegration()-> - hasCapability(QPlatformIntegration::MultipleWindows)) { + if (!m_dialogWindow && m_hasNativeWindows) { QQuickWindow *win = new QQuickWindow; ((QObject *)win)->setParent(this); // memory management only m_dialogWindow = win; - dlgItem->setParentItem(win->contentItem()); - m_dialogWindow->setMinimumSize(QSize(dlgItem->width(), dlgItem->height())); + m_contentItem->setParentItem(win->contentItem()); + m_dialogWindow->setMinimumSize(QSize(m_contentItem->implicitWidth(), m_contentItem->implicitHeight())); connect(win, SIGNAL(widthChanged(int)), this, SLOT(windowGeometryChanged())); connect(win, SIGNAL(heightChanged(int)), this, SLOT(windowGeometryChanged())); } QQuickItem *parentItem = qobject_cast(parent()); - // qDebug() << "item implementation" << dlgItem << "has window" << m_dialogWindow << "and parent" << parentItem; // If the platform does not support multiple windows, but the dialog is - // implemented as an Item, then just reparent it and make it visible. - // TODO QTBUG-29818: put it into a fake Item-based window, when we have a reusable self-decorated one. - if (parentItem && !m_dialogWindow) - dlgItem->setParentItem(parentItem); + // implemented as an Item, then try to decorate it as a fake window and make it visible. + if (parentItem && !m_dialogWindow && !m_windowDecoration) { + if (m_decorationComponent) { + if (m_decorationComponent->isLoading()) + connect(m_decorationComponent, SIGNAL(statusChanged(QQmlComponent::Status)), + this, SLOT(decorationLoaded())); + else + decorationLoaded(); + } + // Window decoration wasn't possible, so just reparent it into the scene + else { + m_contentItem->setParentItem(parentItem); + m_contentItem->setZ(10000); + } + } } } if (m_dialogWindow) connect(m_dialogWindow, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool))); } - if (m_dialogWindow) { + if (m_windowDecoration) { + m_windowDecoration->setVisible(v); + } else if (m_dialogWindow) { if (v) { m_dialogWindow->setTransientParent(parentWindow()); m_dialogWindow->setTitle(title()); @@ -124,6 +142,38 @@ void QQuickAbstractDialog::setVisible(bool v) emit visibilityChanged(); } +void QQuickAbstractDialog::decorationLoaded() +{ + bool ok = false; + QQuickItem *parentItem = qobject_cast(parent()); + if (m_decorationComponent->isError()) { + qWarning() << m_decorationComponent->errors(); + } else { + QObject *decoration = m_decorationComponent->create(); + m_windowDecoration = qobject_cast(decoration); + if (m_windowDecoration) { + m_windowDecoration->setParentItem(parentItem); + // Give the window decoration its content to manage + QVariant contentVariant; + contentVariant.setValue(m_contentItem); + m_windowDecoration->setProperty("content", contentVariant); + connect(m_windowDecoration, SIGNAL(dismissed()), this, SLOT(reject())); + ok = true; + } else { + qWarning() << m_decorationComponent->url() << + "cannot be used as a window decoration because it's not an Item"; + delete m_windowDecoration; + delete m_decorationComponent; + m_decorationComponent = 0; + } + } + // Window decoration wasn't possible, so just reparent it into the scene + if (!ok) { + m_contentItem->setParentItem(parentItem); + m_contentItem->setZ(10000); + } +} + void QQuickAbstractDialog::setModality(Qt::WindowModality m) { if (m_modality == m) return; @@ -152,7 +202,6 @@ void QQuickAbstractDialog::visibleChanged(bool v) void QQuickAbstractDialog::windowGeometryChanged() { QQuickItem *content = qobject_cast(m_qmlImplementation); -qDebug() << Q_FUNC_INFO << m_dialogWindow << content; if (m_dialogWindow && content) { content->setWidth(m_dialogWindow->width()); content->setHeight(m_dialogWindow->height()); diff --git a/src/imports/dialogs/qquickabstractdialog_p.h b/src/imports/dialogs/qquickabstractdialog_p.h index 2ad24f98e0..ef20333479 100644 --- a/src/imports/dialogs/qquickabstractdialog_p.h +++ b/src/imports/dialogs/qquickabstractdialog_p.h @@ -66,6 +66,7 @@ class QQuickAbstractDialog : public QObject Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged) Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + Q_PROPERTY(bool isWindow READ isWindow CONSTANT) Q_PROPERTY(int x READ x WRITE setX NOTIFY geometryChanged) Q_PROPERTY(int y READ y WRITE setY NOTIFY geometryChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY geometryChanged) @@ -89,6 +90,7 @@ public: virtual void setModality(Qt::WindowModality m); virtual void setTitle(QString t) = 0; void setQmlImplementation(QObject* obj); + bool isWindow() const { return m_hasNativeWindows; } void setX(int arg); void setY(int arg); void setWidth(int arg); @@ -107,6 +109,7 @@ Q_SIGNALS: void rejected(); protected Q_SLOTS: + void decorationLoaded(); void accept(); void reject(); void visibleChanged(bool v); @@ -124,6 +127,13 @@ protected: protected: // variables for pure-QML implementations only QObject *m_qmlImplementation; QWindow *m_dialogWindow; + QQuickItem *m_contentItem; + QQuickItem *m_windowDecoration; + bool m_hasNativeWindows; + + static QQmlComponent *m_decorationComponent; + + friend class QtQuick2DialogsPlugin; Q_DISABLE_COPY(QQuickAbstractDialog) }; -- cgit v1.2.1 From 98a0fa014981c07102635d431bfe9bcf34fa1de9 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 20 Jun 2013 13:39:53 +0200 Subject: photosurface: add C++ boilerplate launcher; open button Creator refuses to build it for Android otherwise, and this is a good demo for tablets. Also added a button to re-open the FileDialog. Task-number: QTBUG-31898 Change-Id: I9f90de316fcaa2679484f8a875737ffafa774f31 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Venugopal Shivashankar --- examples/quick/demos/demos.pro | 2 +- examples/quick/demos/photosurface/main.cpp | 63 +++++++++++++++++++++ examples/quick/demos/photosurface/photosurface.pro | 13 +++++ examples/quick/demos/photosurface/photosurface.qml | 16 ++++++ examples/quick/demos/photosurface/photosurface.qrc | 6 ++ .../quick/demos/photosurface/resources/folder.png | Bin 0 -> 5851 bytes .../quick/demos/photosurface/resources/icon.png | Bin 0 -> 35894 bytes .../demos/photosurface/resources/photosurface.icns | Bin 0 -> 47407 bytes .../demos/photosurface/resources/photosurface.ico | Bin 0 -> 38623 bytes .../demos/photosurface/resources/photosurface.rc | 32 +++++++++++ 10 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 examples/quick/demos/photosurface/main.cpp create mode 100644 examples/quick/demos/photosurface/photosurface.pro create mode 100644 examples/quick/demos/photosurface/photosurface.qrc create mode 100644 examples/quick/demos/photosurface/resources/folder.png create mode 100644 examples/quick/demos/photosurface/resources/icon.png create mode 100644 examples/quick/demos/photosurface/resources/photosurface.icns create mode 100644 examples/quick/demos/photosurface/resources/photosurface.ico create mode 100644 examples/quick/demos/photosurface/resources/photosurface.rc diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro index 67128a905f..867dfa5a07 100644 --- a/examples/quick/demos/demos.pro +++ b/examples/quick/demos/demos.pro @@ -3,10 +3,10 @@ SUBDIRS = samegame \ calqlatr \ tweetsearch \ maroon \ + photosurface \ stocqt EXAMPLE_FILES = \ clocks \ photoviewer \ - photosurface \ rssnews diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp new file mode 100644 index 0000000000..90d6454211 --- /dev/null +++ b/examples/quick/demos/photosurface/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifdef QT_WIDGETS_LIB +#include +#else +#include +#endif +#include +#include +#include + +int main(int argc, char* argv[]) +{ + // The reason to use QApplication is that QWidget-based dialogs + // are the native dialogs on Qt-based platforms like KDE, + // but they cannot be instantiated if this is a QGuiApplication. +#ifdef QT_WIDGETS_LIB + QApplication app(argc, argv); +#else + QGuiApplication app(argc, argv); +#endif + QQuickWindow::setDefaultAlphaBuffer(true); + QQmlApplicationEngine engine(QUrl("qrc:///photosurface.qml")); + return app.exec(); +} diff --git a/examples/quick/demos/photosurface/photosurface.pro b/examples/quick/demos/photosurface/photosurface.pro new file mode 100644 index 0000000000..5e5b0f0815 --- /dev/null +++ b/examples/quick/demos/photosurface/photosurface.pro @@ -0,0 +1,13 @@ +TEMPLATE = app + +QT += qml quick +qtHaveModule(widgets): QT += widgets +SOURCES += main.cpp +RESOURCES += photosurface.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/photosurface +INSTALLS += target +ICON = resources/icon.png +macx: ICON = resources/photosurface.icns +win32: RC_FILE = resources/photosurface.rc + diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml index 4f7100358f..9d081de1e3 100644 --- a/examples/quick/demos/photosurface/photosurface.qml +++ b/examples/quick/demos/photosurface/photosurface.qml @@ -118,11 +118,27 @@ Window { } } } + + Image { + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 10 + source: "resources/folder.png" + MouseArea { + anchors.fill: parent + anchors.margins: -10 + onClicked: fileDialog.open() + } + } + Text { anchors.bottom: parent.bottom anchors.left: parent.left + anchors.right: parent.right anchors.margins: 10 color: "darkgrey" + wrapMode: Text.WordWrap + font.pointSize: 8 text: "On a touchscreen: use two fingers to zoom and rotate, one finger to drag\n" + "With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate" } diff --git a/examples/quick/demos/photosurface/photosurface.qrc b/examples/quick/demos/photosurface/photosurface.qrc new file mode 100644 index 0000000000..f8fafbb1ff --- /dev/null +++ b/examples/quick/demos/photosurface/photosurface.qrc @@ -0,0 +1,6 @@ + + + photosurface.qml + resources/folder.png + + diff --git a/examples/quick/demos/photosurface/resources/folder.png b/examples/quick/demos/photosurface/resources/folder.png new file mode 100644 index 0000000000..2aec3b6ebf Binary files /dev/null and b/examples/quick/demos/photosurface/resources/folder.png differ diff --git a/examples/quick/demos/photosurface/resources/icon.png b/examples/quick/demos/photosurface/resources/icon.png new file mode 100644 index 0000000000..f8ff553fcb Binary files /dev/null and b/examples/quick/demos/photosurface/resources/icon.png differ diff --git a/examples/quick/demos/photosurface/resources/photosurface.icns b/examples/quick/demos/photosurface/resources/photosurface.icns new file mode 100644 index 0000000000..c69ec41c4e Binary files /dev/null and b/examples/quick/demos/photosurface/resources/photosurface.icns differ diff --git a/examples/quick/demos/photosurface/resources/photosurface.ico b/examples/quick/demos/photosurface/resources/photosurface.ico new file mode 100644 index 0000000000..03bb7ee367 Binary files /dev/null and b/examples/quick/demos/photosurface/resources/photosurface.ico differ diff --git a/examples/quick/demos/photosurface/resources/photosurface.rc b/examples/quick/demos/photosurface/resources/photosurface.rc new file mode 100644 index 0000000000..ec18eb1cfc --- /dev/null +++ b/examples/quick/demos/photosurface/resources/photosurface.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON DISCARDABLE "photosurface.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)" + VALUE "FileDescription", "Photo Surface Demo" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)." + VALUE "InternalName", "photosurface" + VALUE "OriginalFilename", "photosurface.exe" + VALUE "ProductName", "Photo Surface Demo" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END -- cgit v1.2.1 From a73aae28ee43b7bfdf8e0d2cade8831ab814f554 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 26 Jun 2013 17:18:06 -0700 Subject: Undo presumably accidental line deletion Change-Id: I7ddb3ef9b45cfb95c48c2060dc62acd4ed9d64f9 Reviewed-by: Thiago Macieira --- src/qml/qml/qqmlextensionplugin.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qml/qml/qqmlextensionplugin.h b/src/qml/qml/qqmlextensionplugin.h index 170c7915a5..245651979b 100644 --- a/src/qml/qml/qqmlextensionplugin.h +++ b/src/qml/qml/qqmlextensionplugin.h @@ -68,6 +68,7 @@ public: virtual void registerTypes(const char *uri) = 0; virtual void initializeEngine(QQmlEngine *engine, const char *uri); +private: Q_DISABLE_COPY(QQmlExtensionPlugin) }; -- cgit v1.2.1 From a8e904c69a907742a5cc55c524c5432c7a35cba4 Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Wed, 26 Jun 2013 21:25:04 -0700 Subject: Switch to non-streaming version of qWarning() Allows us to drop the qdebug.h include in a public and frequently used header. Change-Id: I2cb05fbec6298ba600020db684e9eea4093ce663 Reviewed-by: Thiago Macieira Reviewed-by: Christopher Adams --- src/qml/qml/qqml.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index fb0133f305..b48a776b4f 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -49,7 +49,6 @@ #include #include -#include #define QML_VERSION 0x020000 #define QML_VERSION_STR "2.0" @@ -477,7 +476,7 @@ inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, i { if (url.isRelative()) { // User input check must go here, because QQmlPrivate::qmlregister is also used internally for composite types - qWarning() << "qmlRegisterType requires absolute URLs."; + qWarning("qmlRegisterType requires absolute URLs."); return 0; } -- cgit v1.2.1 From 74438ef7c14f19cecda0910a122eb8887dab649d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 26 Jun 2013 15:38:11 +0200 Subject: QtQuick.Dialogs: sync the docs with the implementation We've been using URLs instead of strings for some time now, just forgot to change the docs until now. Task-number: QTBUG-31847 Change-Id: I49a42282aeefb95e4d367397e2f290f4af65687e Reviewed-by: Jerome Pasion Reviewed-by: Venugopal Shivashankar --- src/imports/dialogs/qquickcolordialog.cpp | 10 ++-------- src/imports/dialogs/qquickfiledialog.cpp | 10 +++++----- src/imports/dialogs/qquickplatformcolordialog.cpp | 6 +++--- src/imports/dialogs/qquickplatformfiledialog.cpp | 20 ++++++++++---------- src/imports/widgets/qquickqfiledialog.cpp | 4 ++-- 5 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/imports/dialogs/qquickcolordialog.cpp b/src/imports/dialogs/qquickcolordialog.cpp index 39af99770e..d0e0e11b07 100644 --- a/src/imports/dialogs/qquickcolordialog.cpp +++ b/src/imports/dialogs/qquickcolordialog.cpp @@ -64,13 +64,13 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::AbstractColorDialog::accepted - The \a accepted signal is emitted by \l accept(). + This signal is emitted by \l accept(). */ /*! \qmlsignal QtQuick::Dialogs::AbstractColorDialog::rejected - The \a accepted signal is emitted by \l reject(). + This signal is emitted by \l reject(). */ /*! @@ -109,12 +109,6 @@ QQuickColorDialog::~QQuickColorDialog() This property holds whether the dialog is visible. By default this is false. */ -/*! - \qmlproperty bool AbstractColorDialog::filePaths - - A list of files to be populated as the user chooses. -*/ - /*! \qmlproperty QObject AbstractColorDialog::implementation diff --git a/src/imports/dialogs/qquickfiledialog.cpp b/src/imports/dialogs/qquickfiledialog.cpp index f78e8a6f8d..f5d1a06d04 100644 --- a/src/imports/dialogs/qquickfiledialog.cpp +++ b/src/imports/dialogs/qquickfiledialog.cpp @@ -64,13 +64,13 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::AbstractFileDialog::accepted - The \a accepted signal is emitted by \l accept(). + This signal is emitted by \l accept(). */ /*! \qmlsignal QtQuick::Dialogs::AbstractFileDialog::rejected - The \a accepted signal is emitted by \l reject(). + This signal is emitted by \l reject(). */ /*! @@ -118,13 +118,13 @@ QList QQuickFileDialog::fileUrls() */ /*! - \qmlproperty bool AbstractFileDialog::filePaths + \qmlproperty bool AbstractFileDialog::fileUrls A list of files to be populated as the user chooses. */ /*! - \brief Clears \l filePaths + \brief Clears \l fileUrls */ void QQuickFileDialog::clearSelection() { @@ -132,7 +132,7 @@ void QQuickFileDialog::clearSelection() } /*! - \brief Adds one file to \l filePaths + \brief Adds one file to \l fileUrls \l path should be given as an absolute file system path. If it is given as a file:// URL, it will be converted to a path. Returns true on success, diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp index ea3114c86e..8dc6d09f2c 100644 --- a/src/imports/dialogs/qquickplatformcolordialog.cpp +++ b/src/imports/dialogs/qquickplatformcolordialog.cpp @@ -102,8 +102,8 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::ColorDialog::accepted - The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a color property to get the selection. + This handler is called when the user has finished using the + dialog. You can then inspect the \l color property to get the selection. Example: @@ -117,7 +117,7 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::ColorDialog::rejected - The \a rejected signal is emitted when the user has dismissed the dialog, + This handler is called when the user has dismissed the dialog, either by closing the dialog window or by pressing the Cancel button. */ diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp index 5ae7fd0067..ec9f935738 100644 --- a/src/imports/dialogs/qquickplatformfiledialog.cpp +++ b/src/imports/dialogs/qquickplatformfiledialog.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE id: fileDialog title: "Please choose a file" onAccepted: { - console.log("You chose: " + fileDialog.filePaths) + console.log("You chose: " + fileDialog.fileUrls) Qt.quit() } onRejected: { @@ -103,15 +103,15 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::FileDialog::accepted - The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a filePath or \a filePaths properties to + This handler is called when the user has finished using the + dialog. You can then inspect the \l fileUrl or \l fileUrls properties to get the selection. Example: \qml FileDialog { - onAccepted: { console.log("Selected file: " + filePath) } + onAccepted: { console.log("Selected file: " + fileUrl) } } \endqml */ @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::FileDialog::rejected - The \a rejected signal is emitted when the user has dismissed the dialog, + This handler is called when the user has dismissed the dialog, either by closing the dialog window or by pressing the Cancel button. */ @@ -191,7 +191,7 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() containing the dialog's parent Item, modal with respect to the whole application, or non-modal. - By default it is \l WindowModal. + By default it is \c Qt.WindowModal. Modality does not mean that there are any blocking calls to wait for the dialog to be accepted or rejected; it's only that the user will be @@ -295,18 +295,18 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() */ /*! - \qmlproperty string FileDialog::filePath + \qmlproperty url FileDialog::fileUrl The path of the file which was selected by the user. \note This property is set only if exactly one file was selected. In all - other cases, it will return an empty string. + other cases, it will be empty. - \sa filePaths + \sa fileUrls */ /*! - \qmlproperty list FileDialog::filePaths + \qmlproperty list FileDialog::fileUrls The list of file paths which were selected by the user. */ diff --git a/src/imports/widgets/qquickqfiledialog.cpp b/src/imports/widgets/qquickqfiledialog.cpp index afb150b509..498e34a24c 100644 --- a/src/imports/widgets/qquickqfiledialog.cpp +++ b/src/imports/widgets/qquickqfiledialog.cpp @@ -135,14 +135,14 @@ private: \qmlsignal QtQuick::Dialogs::FileDialog::accepted The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a filePath or \a filePaths properties to + dialog. You can then inspect the \a fileUrl or \a fileUrls properties to get the selection. Example: \qml FileDialog { - onAccepted: { console.log("Selected file: " + filePath) } + onAccepted: { console.log("Selected file: " + fileUrl) } } \endqml */ -- cgit v1.2.1 From 87a4a3d095f4fbabb91dade7e7313cb844256b9b Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 26 Jun 2013 16:37:23 +0200 Subject: QtQml: document QQmlExtensionPlugin::baseUrl It was added here https://codereview.qt-project.org/#change,47532 without documentation. Also updated \since because for now qdoc seems to interpret \since 5.0 as QtQml 5.0. Task-number: QTBUG-31928 Change-Id: I652e9471f1ad8e83b355bffc8498a6565dc9aa2b Reviewed-by: Jerome Pasion Reviewed-by: Martin Smith --- dist/changes-5.1.0 | 2 ++ src/qml/doc/src/whatsnew.qdoc | 2 ++ src/qml/qml/qqmlextensionplugin.cpp | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index 528260e760..141c9a90e1 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -85,6 +85,8 @@ QtQml static data generated by previous qmlRegisterType calls. - New qmlRegisteredType function in qqml.h, allowing the registration of composite types from C++. + - New baseUrl() accessor in QQmlExtensionPlugin, in case a plugin + needs to load QML or other assets from the same directory. QtQuick ------ diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index f1c69160b6..9ad8c23a42 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -115,6 +115,8 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the \list \li Arbitrary functionality may be provided in a namespace through a singleton type. See qmlRegisterSingletonType() for more information. \li JavaScript (.js) files may now import QML modules and other JavaScript files using the ".import" syntax. +\li Plugins may now use QQmlExtensionPlugin::baseUrl to get the directory from which the plugin is loaded. + This will be useful if the plugin needs to load QML or other assets from the same directory. \endlist \section2 Other diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index f77b176404..30eca7b112 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE /*! - \since 5.0 + \since Qt 5.0 \inmodule QtQml \class QQmlExtensionPlugin \brief The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins. @@ -156,6 +156,13 @@ QQmlExtensionPlugin::~QQmlExtensionPlugin() { } +/*! + \since Qt 5.1 + \brief Returns the URL of the directory from which the extension is loaded. + + This is useful when the plugin also needs to load QML files or other + assets from the same directory. +*/ QUrl QQmlExtensionPlugin::baseUrl() const { Q_D(const QQmlExtensionPlugin); -- cgit v1.2.1 From 811337a73c160447e5218ae55e93df99ac3d9edd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 27 Jun 2013 13:08:08 +0200 Subject: FileDialog.folder property should also be a QUrl, for consistency In QtQuick we never use plain file paths, because URL is more general. Also use const references for string and URL setters, and fixed the dependency between the FolderListModel's folder, the field for editing it, and the folder property of the AbstractFileDialog. Change-Id: I6e965b80b73d4eb2473712a4f4d4f816b768d802 Reviewed-by: Frederik Gladhorn --- examples/quick/dialogs/systemdialogs/FileDialogs.qml | 2 +- src/imports/dialogs/DefaultFileDialog.qml | 17 +++++++++++------ src/imports/dialogs/plugins.qmltypes | 7 ++++--- src/imports/dialogs/qquickabstractcolordialog.cpp | 2 +- src/imports/dialogs/qquickabstractcolordialog_p.h | 2 +- src/imports/dialogs/qquickabstractdialog_p.h | 2 +- src/imports/dialogs/qquickabstractfiledialog.cpp | 17 +++++++++-------- src/imports/dialogs/qquickabstractfiledialog_p.h | 10 +++++----- src/imports/dialogs/qquickfiledialog.cpp | 19 +++++++------------ src/imports/dialogs/qquickfiledialog_p.h | 4 ++-- src/imports/dialogs/qquickplatformfiledialog.cpp | 2 +- src/imports/widgets/plugins.qmltypes | 5 +++-- 12 files changed, 46 insertions(+), 43 deletions(-) diff --git a/examples/quick/dialogs/systemdialogs/FileDialogs.qml b/examples/quick/dialogs/systemdialogs/FileDialogs.qml index d1278609f9..4a218853ef 100644 --- a/examples/quick/dialogs/systemdialogs/FileDialogs.qml +++ b/examples/quick/dialogs/systemdialogs/FileDialogs.qml @@ -162,7 +162,7 @@ Rectangle { text: "go to /tmp" anchors.verticalCenter: parent.verticalCenter // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" + onClicked: fileDialog.folder = "/tmp" // file:///tmp would also be OK } } } diff --git a/src/imports/dialogs/DefaultFileDialog.qml b/src/imports/dialogs/DefaultFileDialog.qml index a43b493a29..2cdb34cc03 100644 --- a/src/imports/dialogs/DefaultFileDialog.qml +++ b/src/imports/dialogs/DefaultFileDialog.qml @@ -53,13 +53,13 @@ AbstractFileDialog { currentPathField.visible = false } } + onFolderChanged: view.model.folder = folder property bool showFocusHighlight: false property real textX: titleBar.height property SystemPalette palette property var selectedIndices: [] property int lastClickedIdx: -1 - folder: urlToPath(view.model.folder) function dirDown(path) { view.model.folder = path @@ -107,10 +107,11 @@ AbstractFileDialog { selectedIndices.map(function(idx) { if (view.model.isFolder(idx)) { if (selectFolder) - addSelection(view.model.get(idx, "filePath")) + // TODO after QTBUG-32039: should not need to convert pathToUrl here + addSelection(pathToUrl(view.model.get(idx, "filePath"))) } else { if (!selectFolder) - addSelection(view.model.get(idx, "filePath")) + addSelection(pathToUrl(view.model.get(idx, "filePath"))) } }) } @@ -211,7 +212,12 @@ AbstractFileDialog { clip: true x: 0 width: parent.width - model: FolderListModel { } + model: FolderListModel { + onFolderChanged: { + root.folder = folder + currentPathField.text = root.urlToPath(view.model.folder) + } + } delegate: folderDelegate highlight: Rectangle { color: "transparent" @@ -305,10 +311,9 @@ AbstractFileDialog { anchors.leftMargin: textX; anchors.rightMargin: 4 visible: false focus: visible - text: root.urlToPath(view.model.folder) onAccepted: { root.clearSelection() - if (root.addSelection(text)) + if (root.addSelection(root.pathToUrl(text))) root.accept() else view.model.folder = root.pathFolder(text) diff --git a/src/imports/dialogs/plugins.qmltypes b/src/imports/dialogs/plugins.qmltypes index 80eb8bd291..4e7090b960 100644 --- a/src/imports/dialogs/plugins.qmltypes +++ b/src/imports/dialogs/plugins.qmltypes @@ -39,6 +39,7 @@ Module { Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "isWindow"; type: "bool"; isReadonly: true } Property { name: "x"; type: "int" } Property { name: "y"; type: "int" } Property { name: "width"; type: "int" } @@ -56,7 +57,7 @@ Module { Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } - Property { name: "folder"; type: "string" } + Property { name: "folder"; type: "QUrl" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } @@ -86,7 +87,7 @@ Module { } Method { name: "setFolder" - Parameter { name: "f"; type: "string" } + Parameter { name: "f"; type: "QUrl" } } Method { name: "setNameFilters" @@ -116,7 +117,7 @@ Module { Method { name: "addSelection" type: "bool" - Parameter { name: "path"; type: "string" } + Parameter { name: "path"; type: "QUrl" } } } } diff --git a/src/imports/dialogs/qquickabstractcolordialog.cpp b/src/imports/dialogs/qquickabstractcolordialog.cpp index 9a9f3bc11b..7cfd7ea692 100644 --- a/src/imports/dialogs/qquickabstractcolordialog.cpp +++ b/src/imports/dialogs/qquickabstractcolordialog.cpp @@ -91,7 +91,7 @@ bool QQuickAbstractColorDialog::showAlphaChannel() const return m_options->testOption(QColorDialogOptions::ShowAlphaChannel); } -void QQuickAbstractColorDialog::setTitle(QString t) +void QQuickAbstractColorDialog::setTitle(const QString &t) { if (m_options->windowTitle() == t) return; m_options->setWindowTitle(t); diff --git a/src/imports/dialogs/qquickabstractcolordialog_p.h b/src/imports/dialogs/qquickabstractcolordialog_p.h index 3301605c86..46f0f84acb 100644 --- a/src/imports/dialogs/qquickabstractcolordialog_p.h +++ b/src/imports/dialogs/qquickabstractcolordialog_p.h @@ -78,7 +78,7 @@ public: public Q_SLOTS: void setVisible(bool v); void setModality(Qt::WindowModality m); - void setTitle(QString t); + void setTitle(const QString &t); void setColor(QColor arg); void setShowAlphaChannel(bool arg); diff --git a/src/imports/dialogs/qquickabstractdialog_p.h b/src/imports/dialogs/qquickabstractdialog_p.h index ef20333479..5e3d9b43f7 100644 --- a/src/imports/dialogs/qquickabstractdialog_p.h +++ b/src/imports/dialogs/qquickabstractdialog_p.h @@ -88,7 +88,7 @@ public: virtual void setVisible(bool v); virtual void setModality(Qt::WindowModality m); - virtual void setTitle(QString t) = 0; + virtual void setTitle(const QString &t) = 0; void setQmlImplementation(QObject* obj); bool isWindow() const { return m_hasNativeWindows; } void setX(int arg); diff --git a/src/imports/dialogs/qquickabstractfiledialog.cpp b/src/imports/dialogs/qquickabstractfiledialog.cpp index 32442de41f..d8a75feb53 100644 --- a/src/imports/dialogs/qquickabstractfiledialog.cpp +++ b/src/imports/dialogs/qquickabstractfiledialog.cpp @@ -78,7 +78,7 @@ QString QQuickAbstractFileDialog::title() const return m_options->windowTitle(); } -void QQuickAbstractFileDialog::setTitle(QString t) +void QQuickAbstractFileDialog::setTitle(const QString &t) { if (m_options->windowTitle() == t) return; m_options->setWindowTitle(t); @@ -106,18 +106,19 @@ void QQuickAbstractFileDialog::setSelectFolder(bool selectFolder) updateModes(); } -QString QQuickAbstractFileDialog::folder() +QUrl QQuickAbstractFileDialog::folder() { if (m_dlgHelper && !m_dlgHelper->directory().isEmpty()) - return m_dlgHelper->directory(); - return m_options->initialDirectory(); + return QUrl::fromLocalFile(m_dlgHelper->directory()); + return QUrl::fromLocalFile(m_options->initialDirectory()); } -void QQuickAbstractFileDialog::setFolder(QString f) +void QQuickAbstractFileDialog::setFolder(const QUrl &f) { + QString dir = f.path(); if (m_dlgHelper) - m_dlgHelper->setDirectory(f); - m_options->setInitialDirectory(f); + m_dlgHelper->setDirectory(dir); + m_options->setInitialDirectory(dir); emit folderChanged(); } @@ -141,7 +142,7 @@ QString QQuickAbstractFileDialog::selectedNameFilter() return ret; } -void QQuickAbstractFileDialog::selectNameFilter(QString f) +void QQuickAbstractFileDialog::selectNameFilter(const QString &f) { // This should work whether the dialog is currently being shown already, or ahead of time. m_options->setInitiallySelectedNameFilter(f); diff --git a/src/imports/dialogs/qquickabstractfiledialog_p.h b/src/imports/dialogs/qquickabstractfiledialog_p.h index 965f1a7029..5ce48e8055 100644 --- a/src/imports/dialogs/qquickabstractfiledialog_p.h +++ b/src/imports/dialogs/qquickabstractfiledialog_p.h @@ -67,7 +67,7 @@ class QQuickAbstractFileDialog : public QQuickAbstractDialog Q_PROPERTY(bool selectExisting READ selectExisting WRITE setSelectExisting NOTIFY fileModeChanged) Q_PROPERTY(bool selectMultiple READ selectMultiple WRITE setSelectMultiple NOTIFY fileModeChanged) Q_PROPERTY(bool selectFolder READ selectFolder WRITE setSelectFolder NOTIFY fileModeChanged) - Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) + Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged) Q_PROPERTY(QString selectedNameFilter READ selectedNameFilter WRITE selectNameFilter NOTIFY filterSelected) Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY selectionAccepted) @@ -81,7 +81,7 @@ public: bool selectExisting() const { return m_selectExisting; } bool selectMultiple() const { return m_selectMultiple; } bool selectFolder() const { return m_selectFolder; } - QString folder(); + QUrl folder(); QStringList nameFilters() const { return m_options->nameFilters(); } QString selectedNameFilter(); QUrl fileUrl(); @@ -89,13 +89,13 @@ public: public Q_SLOTS: void setVisible(bool v); - void setTitle(QString t); + void setTitle(const QString &t); void setSelectExisting(bool s); void setSelectMultiple(bool s); void setSelectFolder(bool s); - void setFolder(QString f); + void setFolder(const QUrl &f); void setNameFilters(const QStringList &f); - void selectNameFilter(QString f); + void selectNameFilter(const QString &f); Q_SIGNALS: void folderChanged(); diff --git a/src/imports/dialogs/qquickfiledialog.cpp b/src/imports/dialogs/qquickfiledialog.cpp index f5d1a06d04..2ee4afc5d2 100644 --- a/src/imports/dialogs/qquickfiledialog.cpp +++ b/src/imports/dialogs/qquickfiledialog.cpp @@ -105,10 +105,7 @@ QQuickFileDialog::~QQuickFileDialog() QList QQuickFileDialog::fileUrls() { - QList ret; - foreach (QString path, m_selections) - ret << QUrl::fromLocalFile(path); - return ret; + return m_selections; } /*! @@ -134,18 +131,16 @@ void QQuickFileDialog::clearSelection() /*! \brief Adds one file to \l fileUrls - \l path should be given as an absolute file system path. If it is given as a - file:// URL, it will be converted to a path. Returns true on success, - false if the given path is not valid given the current setting properties. + \l path should be given as an absolute file:// path URL. + Returns true on success, false if the given path is + not valid given the current property settings. */ -bool QQuickFileDialog::addSelection(QString path) +bool QQuickFileDialog::addSelection(const QUrl &path) { - if (path.startsWith("file:")) - path = QUrl(path).toLocalFile(); - QFileInfo info(path); + QFileInfo info(path.toLocalFile()); if (info.exists() && ((info.isDir() && m_selectFolder) || !info.isDir())) { if (m_selectFolder) - m_selections.append(pathFolder(path).toLocalFile()); + m_selections.append(pathFolder(path.toLocalFile())); else m_selections.append(path); return true; diff --git a/src/imports/dialogs/qquickfiledialog_p.h b/src/imports/dialogs/qquickfiledialog_p.h index 93e11f9e3e..0176bc3fe4 100644 --- a/src/imports/dialogs/qquickfiledialog_p.h +++ b/src/imports/dialogs/qquickfiledialog_p.h @@ -72,7 +72,7 @@ signals: public Q_SLOTS: void clearSelection(); - bool addSelection(QString path); + bool addSelection(const QUrl &path); protected: virtual QPlatformFileDialogHelper *helper() { return 0; } @@ -81,7 +81,7 @@ protected: Q_INVOKABLE QUrl pathFolder(const QString &path); private: - QStringList m_selections; + QList m_selections; Q_DISABLE_COPY(QQuickFileDialog) }; diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp index ec9f935738..3da9f6c3b2 100644 --- a/src/imports/dialogs/qquickplatformfiledialog.cpp +++ b/src/imports/dialogs/qquickplatformfiledialog.cpp @@ -252,7 +252,7 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() */ /*! - \qmlproperty string FileDialog::folder + \qmlproperty url FileDialog::folder The path to the currently selected folder. Setting this property before invoking open() will cause the file browser to be initially positioned on diff --git a/src/imports/widgets/plugins.qmltypes b/src/imports/widgets/plugins.qmltypes index 583a36a357..9e73330c12 100644 --- a/src/imports/widgets/plugins.qmltypes +++ b/src/imports/widgets/plugins.qmltypes @@ -39,6 +39,7 @@ Module { Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "isWindow"; type: "bool"; isReadonly: true } Property { name: "x"; type: "int" } Property { name: "y"; type: "int" } Property { name: "width"; type: "int" } @@ -56,7 +57,7 @@ Module { Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } - Property { name: "folder"; type: "string" } + Property { name: "folder"; type: "QUrl" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } @@ -86,7 +87,7 @@ Module { } Method { name: "setFolder" - Parameter { name: "f"; type: "string" } + Parameter { name: "f"; type: "QUrl" } } Method { name: "setNameFilters" -- cgit v1.2.1