aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf3
-rw-r--r--dist/changes-5.3.068
-rw-r--r--examples/quick/dialogs/dialogs.pro4
-rw-r--r--examples/quick/dialogs/systemdialogs/ColorDialogs.qml146
-rw-r--r--examples/quick/dialogs/systemdialogs/FileDialogs.qml180
-rw-r--r--examples/quick/dialogs/systemdialogs/FontDialogs.qml153
-rw-r--r--examples/quick/dialogs/systemdialogs/MessageDialogs.qml307
-rw-r--r--examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpgbin47413 -> 0 bytes
-rw-r--r--examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc48
-rw-r--r--examples/quick/dialogs/systemdialogs/systemdialogs.pro15
-rw-r--r--examples/quick/dialogs/systemdialogs/systemdialogs.qrc9
-rw-r--r--examples/quick/quick.pro1
-rw-r--r--examples/quick/views/listview/displaymargin.qml (renamed from examples/quick/dialogs/systemdialogs/systemdialogs.qml)66
-rw-r--r--examples/quick/views/views.qml1
-rw-r--r--examples/quick/views/views.qrc1
-rw-r--r--src/imports/dialogs-private/dialogs-private.pro17
-rw-r--r--src/imports/dialogs-private/qmldir4
-rw-r--r--src/imports/dialogs-private/qquickfontlistmodel.cpp290
-rw-r--r--src/imports/dialogs-private/qquickfontlistmodel_p.h125
-rw-r--r--src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp176
-rw-r--r--src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h100
-rw-r--r--src/imports/dialogs/DefaultColorDialog.qml362
-rw-r--r--src/imports/dialogs/DefaultFileDialog.qml385
-rw-r--r--src/imports/dialogs/DefaultFontDialog.qml483
-rw-r--r--src/imports/dialogs/DefaultMessageDialog.qml330
-rw-r--r--src/imports/dialogs/WidgetColorDialog.qml44
-rw-r--r--src/imports/dialogs/WidgetFileDialog.qml44
-rw-r--r--src/imports/dialogs/WidgetFontDialog.qml44
-rw-r--r--src/imports/dialogs/WidgetMessageDialog.qml44
-rw-r--r--src/imports/dialogs/dialogs.pro97
-rw-r--r--src/imports/dialogs/doc/images/critical.pngbin253 -> 0 bytes
-rw-r--r--src/imports/dialogs/doc/images/information.pngbin254 -> 0 bytes
-rw-r--r--src/imports/dialogs/doc/images/question.pngbin257 -> 0 bytes
-rw-r--r--src/imports/dialogs/doc/images/replacefile.pngbin4304 -> 0 bytes
-rw-r--r--src/imports/dialogs/doc/images/warning.pngbin224 -> 0 bytes
-rw-r--r--src/imports/dialogs/doc/qtquickdialogs.qdocconf41
-rw-r--r--src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc36
-rw-r--r--src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc58
-rw-r--r--src/imports/dialogs/images/checkers.pngbin149 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/checkmark.pngbin809 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/copy.pngbin1338 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/critical.pngbin253 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/crosshairs.pngbin876 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/folder.pngbin1841 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/information.pngbin254 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/question.pngbin257 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/slider_handle.pngbin1551 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/sunken_frame.pngbin623 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/up.pngbin662 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/warning.pngbin224 -> 0 bytes
-rw-r--r--src/imports/dialogs/images/window_border.pngbin588 -> 0 bytes
-rw-r--r--src/imports/dialogs/plugin.cpp214
-rw-r--r--src/imports/dialogs/plugins.qmltypes654
-rw-r--r--src/imports/dialogs/qml/Button.qml86
-rw-r--r--src/imports/dialogs/qml/CheckBox.qml96
-rwxr-xr-xsrc/imports/dialogs/qml/ColorSlider.qml138
-rw-r--r--src/imports/dialogs/qml/DefaultWindowDecoration.qml71
-rw-r--r--src/imports/dialogs/qml/EdgeFade.qml63
-rw-r--r--src/imports/dialogs/qml/TextField.qml89
-rw-r--r--src/imports/dialogs/qml/qmldir5
-rw-r--r--src/imports/dialogs/qmldir4
-rw-r--r--src/imports/dialogs/qquickabstractcolordialog.cpp134
-rw-r--r--src/imports/dialogs/qquickabstractcolordialog_p.h113
-rw-r--r--src/imports/dialogs/qquickabstractdialog.cpp337
-rw-r--r--src/imports/dialogs/qquickabstractdialog_p.h145
-rw-r--r--src/imports/dialogs/qquickabstractfiledialog.cpp194
-rw-r--r--src/imports/dialogs/qquickabstractfiledialog_p.h122
-rw-r--r--src/imports/dialogs/qquickabstractfontdialog.cpp150
-rw-r--r--src/imports/dialogs/qquickabstractfontdialog_p.h113
-rw-r--r--src/imports/dialogs/qquickabstractmessagedialog.cpp179
-rw-r--r--src/imports/dialogs/qquickabstractmessagedialog_p.h165
-rw-r--r--src/imports/dialogs/qquickcolordialog.cpp119
-rw-r--r--src/imports/dialogs/qquickcolordialog_p.h80
-rw-r--r--src/imports/dialogs/qquickdialogassets_p.h65
-rw-r--r--src/imports/dialogs/qquickfiledialog.cpp172
-rw-r--r--src/imports/dialogs/qquickfiledialog_p.h93
-rw-r--r--src/imports/dialogs/qquickfontdialog.cpp120
-rw-r--r--src/imports/dialogs/qquickfontdialog_p.h80
-rw-r--r--src/imports/dialogs/qquickmessagedialog.cpp181
-rw-r--r--src/imports/dialogs/qquickmessagedialog_p.h86
-rw-r--r--src/imports/dialogs/qquickplatformcolordialog.cpp254
-rw-r--r--src/imports/dialogs/qquickplatformcolordialog_p.h78
-rw-r--r--src/imports/dialogs/qquickplatformfiledialog.cpp314
-rw-r--r--src/imports/dialogs/qquickplatformfontdialog.cpp252
-rw-r--r--src/imports/dialogs/qquickplatformfontdialog_p.h78
-rw-r--r--src/imports/dialogs/qquickplatformmessagedialog.cpp398
-rw-r--r--src/imports/dialogs/qquickplatformmessagedialog_p.h78
-rw-r--r--src/imports/imports.pro4
-rw-r--r--src/imports/localstorage/plugin.cpp2
-rw-r--r--src/imports/settings/qqmlsettings.cpp3
-rw-r--r--src/imports/widgets/plugins.qmltypes302
-rw-r--r--src/imports/widgets/qmessageboxhelper_p.h107
-rw-r--r--src/imports/widgets/qmldir4
-rw-r--r--src/imports/widgets/qquickqcolordialog.cpp175
-rw-r--r--src/imports/widgets/qquickqcolordialog_p.h78
-rw-r--r--src/imports/widgets/qquickqfiledialog.cpp211
-rw-r--r--src/imports/widgets/qquickqfiledialog_p.h107
-rw-r--r--src/imports/widgets/qquickqfontdialog.cpp178
-rw-r--r--src/imports/widgets/qquickqfontdialog_p.h78
-rw-r--r--src/imports/widgets/qquickqmessagebox.cpp144
-rw-r--r--src/imports/widgets/qquickqmessagebox_p.h77
-rw-r--r--src/imports/widgets/widgets.pro32
-rw-r--r--src/imports/widgets/widgetsplugin.cpp89
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp8
-rw-r--r--src/plugins/accessible/shared/qqmlaccessible.cpp2
-rw-r--r--src/qml/compiler/compiler.pri6
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp75
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h10
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp1116
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h188
-rw-r--r--src/qml/compiler/qv4compileddata_p.h2
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp13
-rw-r--r--src/qml/compiler/qv4regalloc.cpp3
-rw-r--r--src/qml/jsapi/qjsvalue.cpp2
-rw-r--r--src/qml/jsruntime/jsruntime.pri2
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp40
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h5
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp563
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h242
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp195
-rw-r--r--src/qml/jsruntime/qv4arrayobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4context.cpp17
-rw-r--r--src/qml/jsruntime/qv4context_p.h4
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp1
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h5
-rw-r--r--src/qml/jsruntime/qv4engine.cpp24
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp5
-rw-r--r--src/qml/jsruntime/qv4errorobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp22
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp2
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp26
-rw-r--r--src/qml/jsruntime/qv4jsonobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp9
-rw-r--r--src/qml/jsruntime/qv4lookup_p.h1
-rw-r--r--src/qml/jsruntime/qv4managed.cpp19
-rw-r--r--src/qml/jsruntime/qv4managed_p.h120
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp10
-rw-r--r--src/qml/jsruntime/qv4mathobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4mm.cpp2
-rw-r--r--src/qml/jsruntime/qv4object.cpp635
-rw-r--r--src/qml/jsruntime/qv4object_p.h224
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp4
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp62
-rw-r--r--src/qml/jsruntime/qv4property_p.h2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp7
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexp_p.h1
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp13
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h1
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp77
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp9
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp8
-rw-r--r--src/qml/jsruntime/qv4string.cpp18
-rw-r--r--src/qml/jsruntime/qv4string_p.h9
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp34
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h1
-rw-r--r--src/qml/jsruntime/qv4value_p.h4
-rw-r--r--src/qml/parser/qqmljsmemorypool_p.h2
-rw-r--r--src/qml/qml/qqmlcompiler.cpp2
-rw-r--r--src/qml/qml/qqmlcompiler_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp6
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp23
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h2
-rw-r--r--src/qml/qml/qqmlincubator.cpp17
-rw-r--r--src/qml/qml/qqmlincubator_p.h5
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp2
-rw-r--r--src/qml/qml/qqmllocale.cpp10
-rw-r--r--src/qml/qml/qqmlmetatype.cpp2
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp818
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h101
-rw-r--r--src/qml/qml/qqmlparserstatus.h1
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp176
-rw-r--r--src/qml/qml/qqmltypeloader_p.h5
-rw-r--r--src/qml/qml/v8/qv8engine.cpp36
-rw-r--r--src/qml/qml/v8/qv8engine_p.h4
-rw-r--r--src/qml/types/qqmlconnections.cpp38
-rw-r--r--src/qml/types/qqmlconnections_p.h1
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp62
-rw-r--r--src/qml/types/qqmllistmodel.cpp10
-rw-r--r--src/qml/types/qqmllistmodel_p.h4
-rw-r--r--src/qml/util/qqmladaptormodel.cpp7
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp6
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp2
-rw-r--r--src/quick/items/qquickgridview.cpp40
-rw-r--r--src/quick/items/qquickimage.cpp11
-rw-r--r--src/quick/items/qquickitem.cpp246
-rw-r--r--src/quick/items/qquickitem.h6
-rw-r--r--src/quick/items/qquickitem_p.h17
-rw-r--r--src/quick/items/qquickitemsmodule.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp40
-rw-r--r--src/quick/items/qquickitemview_p.h10
-rw-r--r--src/quick/items/qquickitemview_p_p.h2
-rw-r--r--src/quick/items/qquicklistview.cpp43
-rw-r--r--src/quick/items/qquickmousearea.cpp5
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp5
-rw-r--r--src/quick/items/qquickrectangle.cpp14
-rw-r--r--src/quick/items/qquicktext.cpp62
-rw-r--r--src/quick/items/qquicktext_p.h1
-rw-r--r--src/quick/items/qquicktext_p_p.h9
-rw-r--r--src/quick/items/qquicktextedit.cpp4
-rw-r--r--src/quick/items/qquicktranslate.cpp75
-rw-r--r--src/quick/items/qquicktranslate_p.h23
-rw-r--r--src/quick/items/qquickview.cpp27
-rw-r--r--src/quick/items/qquickview_p.h22
-rw-r--r--src/quick/items/qquickwindow.cpp78
-rw-r--r--src/quick/util/qquickbehavior.cpp11
-rw-r--r--src/quick/util/qquickglobal.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/signalHandlers.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp5
-rw-r--r--tests/auto/qml/qqmlerror/tst_qqmlerror.cpp2
-rw-r--r--tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp2
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp2
-rw-r--r--tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp6
-rw-r--r--tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp6
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp6
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp4
-rw-r--r--tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml (renamed from examples/quick/dialogs/systemdialogs/main.cpp)36
-rw-r--r--tests/auto/quick/qquickbehaviors/data/qtbug21549.qml18
-rw-r--r--tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp54
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml9
-rw-r--r--tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml15
-rw-r--r--tests/auto/quick/qquickgridview/data/displayMargin.qml (renamed from src/imports/dialogs/qquickplatformfiledialog_p.h)71
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp39
-rw-r--r--tests/auto/quick/qquickitem/data/visualParentOwnership.qml14
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp65
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp4
-rw-r--r--tests/auto/quick/qquicklistview/data/displayMargin.qml (renamed from src/imports/dialogs-private/dialogsprivateplugin.cpp)56
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp38
-rw-r--r--tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp57
-rw-r--r--tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml20
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp47
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp4
-rw-r--r--tests/auto/quick/qquickview/tst_qquickview.cpp2
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp97
240 files changed, 4437 insertions, 13025 deletions
diff --git a/.qmake.conf b/.qmake.conf
index a0d132328a..88d13d1eef 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,5 +2,4 @@ load(qt_build_config)
CONFIG += qt_example_installs
CONFIG += warning_clean
-MODULE_VERSION = 5.2.1
-
+MODULE_VERSION = 5.3.0
diff --git a/dist/changes-5.3.0 b/dist/changes-5.3.0
new file mode 100644
index 0000000000..5cda809d97
--- /dev/null
+++ b/dist/changes-5.3.0
@@ -0,0 +1,68 @@
+Qt 5.3 introduces many new features and improvements as well as bugfixes
+over the 5.2.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5.2
+
+The Qt version 5.3 series is binary compatible with the 5.2.x series.
+Applications compiled for 5.2 will continue to run with 5.3.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* General *
+****************************************************************************
+
+General Improvements
+--------------------
+
+Third party components
+----------------------
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+- Signals declared in QML that take "var" parameters, are now using QJSValue
+ as C++ type for these parameters, instead of QVariant.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtQml
+------
+
+QtQuick
+------
+
+****************************************************************************
+* Database Drivers *
+****************************************************************************
+
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+
+****************************************************************************
+* Compiler Specific Changes *
+****************************************************************************
+
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+
+****************************************************************************
+* Plugins *
+****************************************************************************
+
diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro
deleted file mode 100644
index 538e75686c..0000000000
--- a/examples/quick/dialogs/dialogs.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS = \
- systemdialogs
diff --git a/examples/quick/dialogs/systemdialogs/ColorDialogs.qml b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml
deleted file mode 100644
index 0cb42a01aa..0000000000
--- a/examples/quick/dialogs/systemdialogs/ColorDialogs.qml
+++ /dev/null
@@ -1,146 +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: 240
- 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: "<b>current color:</b> " + colorDialog.color
- anchors.verticalCenter: parent.verticalCenter
- }
- }
- }
-
- Rectangle {
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- height: buttonRow.height * 1.2
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
- Row {
- id: buttonRow
- spacing: 6
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 12
- height: implicitHeight
- 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
deleted file mode 100644
index d6ee1a13ca..0000000000
--- a/examples/quick/dialogs/systemdialogs/FileDialogs.qml
+++ /dev/null
@@ -1,180 +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 QtQuick.Window 2.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)
- if (fileDialogOpenFiles.checked)
- for (var i = 0; i < fileUrls.length; ++i)
- Qt.openUrlExternally(fileUrls[i])
- }
- 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: fileDialogOpenFiles
- text: "Open Files After Accepting"
- }
- CheckBox {
- id: fileDialogVisible
- text: "Visible"
- Binding on checked { value: fileDialog.visible }
- }
- Text {
- color: palette.windowText
- text: "<b>current view folder:</b> " + fileDialog.folder
- }
- Text {
- color: palette.windowText
- text: "<b>name filters:</b> {" + fileDialog.nameFilters + "}"
- width: parent.width
- wrapMode: Text.Wrap
- }
- Text {
- color: palette.windowText
- text: "<b>current filter:</b>" + fileDialog.selectedNameFilter
- width: parent.width
- wrapMode: Text.Wrap
- }
- Text {
- color: palette.windowText
- text: "<b>chosen files:</b> " + fileDialog.fileUrls
- width: parent.width
- wrapMode: Text.Wrap
- }
- Text {
- color: palette.windowText
- text: "<b>chosen single path:</b> " + fileDialog.fileUrl
- width: parent.width
- wrapMode: Text.Wrap
- }
- }
-
- Rectangle {
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- height: buttonRow.height * 1.2
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
- Row {
- id: buttonRow
- spacing: 6
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 12
- height: implicitHeight
- 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 = (Qt.platform.os === "windows" ? "/c:/temp" : "/tmp")
- }
- }
- }
-}
diff --git a/examples/quick/dialogs/systemdialogs/FontDialogs.qml b/examples/quick/dialogs/systemdialogs/FontDialogs.qml
deleted file mode 100644
index 7d4328994b..0000000000
--- a/examples/quick/dialogs/systemdialogs/FontDialogs.qml
+++ /dev/null
@@ -1,153 +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.2
-import QtQuick.Dialogs 1.1
-import "../../shared"
-
-Rectangle {
- width: 320
- height: 360
- color: palette.window
- SystemPalette { id: palette }
- clip: true
-
- FontDialog {
- id: fontDialog
- visible: fontDialogVisible.checked
- modality: fontDialogModal.checked ? Qt.WindowModal : Qt.NonModal
- scalableFonts: fontDialogScalableFonts.checked
- nonScalableFonts: fontDialogNonScalableFonts.checked
- monospacedFonts: fontDialogMonospacedFonts.checked
- proportionalFonts: fontDialogProportionalFonts.checked
- title: "Choose a font"
- font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
- onAccepted: { console.log("Accepted: " + font) }
- onRejected: { console.log("Rejected") }
- }
-
- Column {
- id: optionsColumn
- anchors.fill: parent
- anchors.margins: 12
- spacing: 8
- Text {
- font.bold: true
- text: "Font dialog properties:"
- }
- CheckBox {
- id: fontDialogModal
- text: "Modal"
- checked: true
- Binding on checked { value: fontDialog.modality != Qt.NonModal }
- }
- CheckBox {
- id: fontDialogScalableFonts
- text: "Scalable fonts"
- Binding on checked { value: fontDialog.scalableFonts }
- }
- CheckBox {
- id: fontDialogNonScalableFonts
- text: "Non scalable fonts"
- Binding on checked { value: fontDialog.nonScalableFonts }
- }
- CheckBox {
- id: fontDialogMonospacedFonts
- text: "Monospaced fonts"
- Binding on checked { value: fontDialog.monospacedFonts }
- }
- CheckBox {
- id: fontDialogProportionalFonts
- text: "Proportional fonts"
- Binding on checked { value: fontDialog.proportionalFonts }
- }
- CheckBox {
- id: fontDialogVisible
- text: "Visible"
- Binding on checked { value: fontDialog.visible }
- }
- Text {
- text: "Current font:"
- }
- Text {
- id: fontLabel
- color: palette.windowText
- text: "<b>" + fontDialog.font.family + " - " + fontDialog.font.pointSize + "</b>"
- MouseArea {
- anchors.fill: parent
- onClicked: fontDialog.open()
- }
- }
- }
-
- Rectangle {
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- height: buttonRow.height * 1.2
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
- Row {
- id: buttonRow
- spacing: 6
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 12
- width: parent.width
- Button {
- text: "Open"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: fontDialog.open()
- }
- Button {
- text: "Close"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: fontDialog.close()
- }
- Button {
- text: "set to default"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: fontDialog.font = Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
- }
- }
- }
-}
diff --git a/examples/quick/dialogs/systemdialogs/MessageDialogs.qml b/examples/quick/dialogs/systemdialogs/MessageDialogs.qml
deleted file mode 100644
index 9c70228046..0000000000
--- a/examples/quick/dialogs/systemdialogs/MessageDialogs.qml
+++ /dev/null
@@ -1,307 +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.Dialogs 1.1
-import QtQuick.Window 2.0
-import "../../shared"
-
-Rectangle {
- width: 580
- height: 400
- color: palette.window
- SystemPalette { id: palette }
- clip: true
-
- //! [messagedialog]
- MessageDialog {
- id: messageDialog
- visible: messageDialogVisible.checked
- modality: messageDialogModal.checked ? Qt.WindowModal : Qt.NonModal
- title: windowTitleField.text
- text: customizeText.checked ? textField.text : ""
- informativeText: customizeInformativeText.checked ? informativeTextField.text : ""
- detailedText: customizeDetailedText.checked ? detailedTextField.text : ""
- onButtonClicked: console.log("clicked button " + clickedButton)
- onAccepted: lastChosen.text = "Accepted " +
- (clickedButton == StandardButton.Ok ? "(OK)" : (clickedButton == StandardButton.Retry ? "(Retry)" : "(Ignore)"))
- onRejected: lastChosen.text = "Rejected " +
- (clickedButton == StandardButton.Close ? "(Close)" : (clickedButton == StandardButton.Abort ? "(Abort)" : "(Cancel)"))
- onHelp: lastChosen.text = "Yelped for help!"
- onYes: lastChosen.text = (clickedButton == StandardButton.Yes ? "Yeessss!!" : "Yes, now and always")
- onNo: lastChosen.text = (clickedButton == StandardButton.No ? "Oh No." : "No, no, a thousand times no!")
- onApply: lastChosen.text = "Apply"
- onReset: lastChosen.text = "Reset"
- }
- //! [messagedialog]
-
- Column {
- anchors.fill: parent
- anchors.margins: 12
- spacing: 8
- Text {
- color: palette.windowText
- font.bold: true
- text: "Message dialog properties:"
- }
- CheckBox {
- id: messageDialogModal
- text: "Modal"
- checked: true
- Binding on checked { value: messageDialog.modality != Qt.NonModal }
- }
- CheckBox {
- id: customizeTitle
- text: "Window Title"
- checked: true
- width: parent.width
- TextField {
- id: windowTitleField
- anchors.right: parent.right
- width: informativeTextField.width
- text: "Alert"
- }
- }
- Row {
- spacing: 8
- property bool updating: false
- function updateIcon(icon, checked) {
- if (updating) return
- updating = true
- messageDialog.icon = (checked ? icon : StandardIcon.NoIcon)
- for (var i = 0; i < children.length; ++i)
- if (children[i].icon !== icon)
- children[i].checked = false
- updating = false
- }
-
- CheckBox {
- id: iconInformation
- text: "Information"
- property int icon: StandardIcon.Information
- onCheckedChanged: parent.updateIcon(icon, checked)
- }
-
- CheckBox {
- id: iconWarning
- text: "Warning"
- checked: true
- property int icon: StandardIcon.Warning
- onCheckedChanged: parent.updateIcon(icon, checked)
- Component.onCompleted: parent.updateIcon(icon, true)
- }
-
- CheckBox {
- id: iconCritical
- text: "Critical"
- property int icon: StandardIcon.Critical
- onCheckedChanged: parent.updateIcon(icon, checked)
- }
-
- CheckBox {
- id: iconQuestion
- text: "Question"
- property int icon: StandardIcon.Question
- onCheckedChanged: parent.updateIcon(icon, checked)
- }
- }
-
- CheckBox {
- id: customizeText
- text: "Primary Text"
- checked: true
- width: parent.width
- TextField {
- id: textField
- anchors.right: parent.right
- width: informativeTextField.width
- text: "Attention Please"
- }
- }
- CheckBox {
- id: customizeInformativeText
- text: "Informative Text"
- checked: true
- width: parent.width
- TextField {
- id: informativeTextField
- anchors.right: parent.right
- width: parent.width - parent.row.spacing - parent.row.width
- text: "Be alert!"
- }
- }
- Text {
- text: "Buttons:"
- }
- Flow {
- spacing: 8
- width: parent.width
- property bool updating: false
- function updateButtons(button, checked) {
- if (updating) return
- updating = true
- var buttons = 0
- for (var i = 0; i < children.length; ++i)
- if (children[i].checked)
- buttons |= children[i].button
- if (!buttons)
- buttons = StandardButton.Ok
- messageDialog.standardButtons = buttons
- updating = false
- }
-
- CheckBox {
- text: "Help"
- property int button: StandardButton.Help
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Abort"
- property int button: StandardButton.Abort
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Close"
- property int button: StandardButton.Close
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Cancel"
- property int button: StandardButton.Cancel
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "NoToAll"
- property int button: StandardButton.NoToAll
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "No"
- property int button: StandardButton.No
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "YesToAll"
- property int button: StandardButton.YesToAll
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Yes"
- property int button: StandardButton.Yes
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Ignore"
- property int button: StandardButton.Ignore
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "Retry"
- property int button: StandardButton.Retry
- onCheckedChanged: parent.updateButtons(button, checked)
- }
-
- CheckBox {
- text: "OK"
- checked: true
- property int button: StandardButton.Ok
- onCheckedChanged: parent.updateButtons(button, checked)
- }
- }
- CheckBox {
- id: customizeDetailedText
- text: "Detailed Text"
- checked: true
- width: parent.width
- TextField {
- id: detailedTextField
- anchors.right: parent.right
- width: informativeTextField.width
- text: "The world needs more lerts."
- }
- }
- CheckBox {
- id: messageDialogVisible
- text: "Visible"
- Binding on checked { value: messageDialog.visible }
- }
- Text {
- id: lastChosen
- }
- }
-
- Rectangle {
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- height: buttonRow.height * 1.2
- color: Qt.darker(palette.window, 1.1)
- border.color: Qt.darker(palette.window, 1.3)
- Row {
- id: buttonRow
- spacing: 6
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 12
- width: parent.width
- Button {
- text: "Open"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: messageDialog.open()
- }
- Button {
- text: "Close"
- anchors.verticalCenter: parent.verticalCenter
- onClicked: messageDialog.close()
- }
- }
- }
-}
diff --git a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg
deleted file mode 100644
index 4517a39308..0000000000
--- a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc
deleted file mode 100644
index 9788be7343..0000000000
--- a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc
+++ /dev/null
@@ -1,48 +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 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/systemdialogs.pro b/examples/quick/dialogs/systemdialogs/systemdialogs.pro
deleted file mode 100644
index 323ea2fac7..0000000000
--- a/examples/quick/dialogs/systemdialogs/systemdialogs.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-TEMPLATE = app
-
-QT += quick qml
-SOURCES += main.cpp
-RESOURCES += systemdialogs.qrc ../../shared/shared.qrc
-
-OTHER_FILES += \
- systemdialogs.qml \
- FileDialogs.qml \
- ColorDialogs.qml \
- FontDialogs.qml \
- MessageDialogs.qml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs/systemdialogs
-INSTALLS += target
diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc
deleted file mode 100644
index 2193088cb9..0000000000
--- a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
- <qresource prefix="/dialogs/systemdialogs">
- <file>systemdialogs.qml</file>
- <file>FileDialogs.qml</file>
- <file>ColorDialogs.qml</file>
- <file>FontDialogs.qml</file>
- <file>MessageDialogs.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro
index c6b7ee1c34..186988716c 100644
--- a/examples/quick/quick.pro
+++ b/examples/quick/quick.pro
@@ -21,7 +21,6 @@ SUBDIRS = quick-accessibility \
customitems \
imageprovider \
window \
- dialogs \
particles \
demos
diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qml b/examples/quick/views/listview/displaymargin.qml
index 1600e88812..c3402f6baa 100644
--- a/examples/quick/dialogs/systemdialogs/systemdialogs.qml
+++ b/examples/quick/views/listview/displaymargin.qml
@@ -37,35 +37,57 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+import QtQuick 2.3
-import QtQuick 2.2
-import "../../shared"
+Item {
+ width: 480; height: 320
-TabSet {
- width: 580
- height: 440
+ ListView {
+ id: view
+ anchors.top: header.bottom
+ anchors.bottom: footer.top
+ width: parent.width
- FileDialogs {
- property string title: "File Dialog"
- anchors.fill: parent
- color: "#e3e3e3" // to match tab.png
- }
+ cacheBuffer: 0
+ displayMarginBeginning: 40
+ displayMarginEnd: 40
- ColorDialogs {
- property string title: "Color Dialog"
- anchors.fill: parent
- color: "#e3e3e3" // to match tab.png
+ model: 100
+ delegate: Rectangle {
+ objectName: "delegate"
+ width: parent.width
+ height: 25
+ color: index % 2 ? "steelblue" : "lightsteelblue"
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ text: "Item " + (index + 1)
+ }
+ }
}
- FontDialogs {
- property string title: "Font Dialog"
- anchors.fill: parent
- color: "#e3e3e3" // to match tab.png
+ Rectangle {
+ id: header
+ width: parent.width; height: 40
+ color: "#AAFF0000"
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 24
+ text: "Header"
+ }
}
- MessageDialogs {
- property string title: "Message Dialog"
- anchors.fill: parent
- color: "#e3e3e3" // to match tab.png
+ Rectangle {
+ id: footer
+ anchors.bottom: parent.bottom
+ width: parent.width; height: 40
+ color: "#AAFF0000"
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 24
+ text: "Footer"
+ }
}
}
diff --git a/examples/quick/views/views.qml b/examples/quick/views/views.qml
index 1bc6f6a3d8..2fbf9c5470 100644
--- a/examples/quick/views/views.qml
+++ b/examples/quick/views/views.qml
@@ -58,6 +58,7 @@ Item {
addExample("Packages", "Transitions between a ListView and GridView", Qt.resolvedUrl("package/view.qml"))
addExample("PathView", "A simple PathView", Qt.resolvedUrl("pathview/pathview-example.qml"))
addExample("ObjectModel", "Using a ObjectModel", Qt.resolvedUrl("objectmodel/objectmodel.qml"))
+ addExample("Display Margins", "A ListView with display margins", Qt.resolvedUrl("listview/displaymargin.qml"))
}
}
}
diff --git a/examples/quick/views/views.qrc b/examples/quick/views/views.qrc
index 434fa788bf..52abb68659 100644
--- a/examples/quick/views/views.qrc
+++ b/examples/quick/views/views.qrc
@@ -65,5 +65,6 @@
<file>visualdatamodel/dragselection.qml</file>
<file>objectmodel/objectmodel.qml</file>
<file>views.qml</file>
+ <file>listview/displaymargin.qml</file>
</qresource>
</RCC>
diff --git a/src/imports/dialogs-private/dialogs-private.pro b/src/imports/dialogs-private/dialogs-private.pro
deleted file mode 100644
index 7f04617ef5..0000000000
--- a/src/imports/dialogs-private/dialogs-private.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-CXX_MODULE = qml
-TARGET = dialogsprivateplugin
-TARGETPATH = QtQuick/Dialogs/Private
-IMPORT_VERSION = 1.1
-
-SOURCES += \
- qquickfontlistmodel.cpp \
- qquickwritingsystemlistmodel.cpp \
- dialogsprivateplugin.cpp
-
-HEADERS += \
- qquickfontlistmodel_p.h \
- qquickwritingsystemlistmodel_p.h
-
-QT += gui-private core-private qml-private
-
-load(qml_plugin)
diff --git a/src/imports/dialogs-private/qmldir b/src/imports/dialogs-private/qmldir
deleted file mode 100644
index c371f8bb8c..0000000000
--- a/src/imports/dialogs-private/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQuick.Dialogs.Private
-plugin dialogsprivateplugin
-typeinfo plugins.qmltypes
-classname QtQuick2DialogsPrivatePlugin
diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp
deleted file mode 100644
index 96d1824ef6..0000000000
--- a/src/imports/dialogs-private/qquickfontlistmodel.cpp
+++ /dev/null
@@ -1,290 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickfontlistmodel_p.h"
-#include <QtGui/qfontdatabase.h>
-#include <QtQml/qqmlcontext.h>
-#include <private/qqmlengine_p.h>
-#include <private/qv8engine_p.h>
-#include <private/qv4value_p.h>
-#include <private/qv4engine_p.h>
-#include <private/qv4object_p.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QV4;
-
-class QQuickFontListModelPrivate
-{
- Q_DECLARE_PUBLIC(QQuickFontListModel)
-
-public:
- QQuickFontListModelPrivate(QQuickFontListModel *q)
- : q_ptr(q), ws(QFontDatabase::Any)
- , options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
- {}
-
- QQuickFontListModel *q_ptr;
- QFontDatabase db;
- QFontDatabase::WritingSystem ws;
- QSharedPointer<QFontDialogOptions> options;
- QStringList families;
- QHash<int, QByteArray> roleNames;
- ~QQuickFontListModelPrivate() {}
- void init();
-};
-
-
-void QQuickFontListModelPrivate::init()
-{
- Q_Q(QQuickFontListModel);
-
- families = db.families();
-
- emit q->rowCountChanged();
- emit q->writingSystemChanged();
-}
-
-QQuickFontListModel::QQuickFontListModel(QObject *parent)
- : QAbstractListModel(parent), d_ptr(new QQuickFontListModelPrivate(this))
-{
- Q_D(QQuickFontListModel);
- d->roleNames[FontFamilyRole] = "family";
- d->init();
-}
-
-QQuickFontListModel::~QQuickFontListModel()
-{
-}
-
-QVariant QQuickFontListModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const QQuickFontListModel);
- QVariant rv;
-
- if (index.row() >= d->families.size())
- return rv;
-
- switch (role)
- {
- case FontFamilyRole:
- rv = d->families.at(index.row());
- break;
- default:
- break;
- }
- return rv;
-}
-
-QHash<int, QByteArray> QQuickFontListModel::roleNames() const
-{
- Q_D(const QQuickFontListModel);
- return d->roleNames;
-}
-
-int QQuickFontListModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const QQuickFontListModel);
- Q_UNUSED(parent);
- return d->families.size();
-}
-
-QModelIndex QQuickFontListModel::index(int row, int , const QModelIndex &) const
-{
- return createIndex(row, 0);
-}
-
-QString QQuickFontListModel::writingSystem() const
-{
- Q_D(const QQuickFontListModel);
- return QFontDatabase::writingSystemName(d->ws);
-}
-
-void QQuickFontListModel::setWritingSystem(const QString &wSystem)
-{
- Q_D(QQuickFontListModel);
-
- if (wSystem == writingSystem())
- return;
-
- QList<QFontDatabase::WritingSystem> wss;
- wss << QFontDatabase::Any;
- wss << d->db.writingSystems();
- QFontDatabase::WritingSystem ws;
- foreach (ws, wss) {
- if (wSystem == QFontDatabase::writingSystemName(ws)) {
- d->ws = ws;
- updateFamilies();
- return;
- }
- }
-}
-
-void QQuickFontListModel::updateFamilies()
-{
- Q_D(QQuickFontListModel);
-
- beginResetModel();
- const QFontDialogOptions::FontDialogOptions scalableMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ScalableFonts | QFontDialogOptions::NonScalableFonts);
- const QFontDialogOptions::FontDialogOptions spacingMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ProportionalFonts | QFontDialogOptions::MonospacedFonts);
- const QFontDialogOptions::FontDialogOptions options = d->options->options();
-
- d->families.clear();
- foreach (const QString &family, d->db.families(d->ws)) {
- if ((options & scalableMask) && (options & scalableMask) != scalableMask) {
- if (bool(options & QFontDialogOptions::ScalableFonts) != d->db.isSmoothlyScalable(family))
- continue;
- }
- if ((options & spacingMask) && (options & spacingMask) != spacingMask) {
- if (bool(options & QFontDialogOptions::MonospacedFonts) != d->db.isFixedPitch(family))
- continue;
- }
- d->families << family;
- }
- endResetModel();
-}
-
-bool QQuickFontListModel::scalableFonts() const
-{
- Q_D(const QQuickFontListModel);
- return d->options->testOption(QFontDialogOptions::ScalableFonts);
-}
-
-bool QQuickFontListModel::nonScalableFonts() const
-{
- Q_D(const QQuickFontListModel);
- return d->options->testOption(QFontDialogOptions::NonScalableFonts);
-}
-
-bool QQuickFontListModel::monospacedFonts() const
-{
- Q_D(const QQuickFontListModel);
- return d->options->testOption(QFontDialogOptions::MonospacedFonts);
-}
-
-bool QQuickFontListModel::proportionalFonts() const
-{
- Q_D(const QQuickFontListModel);
- return d->options->testOption(QFontDialogOptions::ProportionalFonts);
-}
-
-QQmlV4Handle QQuickFontListModel::get(int idx) const
-{
- Q_D(const QQuickFontListModel);
-
- if (idx < 0 || idx >= count())
- return QQmlV4Handle(Encode::undefined());
-
- QQmlEngine *engine = qmlContext(this)->engine();
- QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
- Scope scope(v4engine);
- ScopedObject o(scope, v4engine->newObject());
- ScopedString s(scope);
- for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) {
- Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes());
- p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1));
- }
-
- return QQmlV4Handle(o);
-}
-
-QQmlV4Handle QQuickFontListModel::pointSizes()
-{
- QQmlEngine *engine = qmlContext(this)->engine();
- QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
- Scope scope(v4engine);
-
- QList<int> pss = QFontDatabase::standardSizes();
- int size = pss.size();
-
- Scoped<QV4::ArrayObject> a(scope, v4engine->newArrayObject());
- a->arrayReserve(size);
- a->arrayDataLen = size;
- for (int i = 0; i < size; ++i)
- a->arrayData[i].value = Primitive::fromInt32(pss.at(i));
- a->setArrayLengthUnchecked(size);
-
- return QQmlV4Handle(ScopedValue(scope, a.asReturnedValue()));
-}
-
-void QQuickFontListModel::classBegin()
-{
-}
-
-void QQuickFontListModel::componentComplete()
-{
-}
-
-void QQuickFontListModel::setScalableFonts(bool arg)
-{
- Q_D(QQuickFontListModel);
- d->options->setOption(QFontDialogOptions::ScalableFonts, arg);
- updateFamilies();
- emit scalableFontsChanged();
-}
-
-void QQuickFontListModel::setNonScalableFonts(bool arg)
-{
- Q_D(QQuickFontListModel);
- d->options->setOption(QFontDialogOptions::NonScalableFonts, arg);
- updateFamilies();
- emit nonScalableFontsChanged();
-}
-
-void QQuickFontListModel::setMonospacedFonts(bool arg)
-{
- Q_D(QQuickFontListModel);
- d->options->setOption(QFontDialogOptions::MonospacedFonts, arg);
- updateFamilies();
- emit monospacedFontsChanged();
-}
-
-void QQuickFontListModel::setProportionalFonts(bool arg)
-{
- Q_D(QQuickFontListModel);
- d->options->setOption(QFontDialogOptions::ProportionalFonts, arg);
- updateFamilies();
- emit proportionalFontsChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs-private/qquickfontlistmodel_p.h b/src/imports/dialogs-private/qquickfontlistmodel_p.h
deleted file mode 100644
index 3e2e7f7132..0000000000
--- a/src/imports/dialogs-private/qquickfontlistmodel_p.h
+++ /dev/null
@@ -1,125 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKFONTLISTMODEL_P_H
-#define QQUICKFONTLISTMODEL_P_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qabstractitemmodel.h>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <QtQml/qqmlparserstatus.h>
-#include <private/qv8engine_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QModelIndex;
-
-class QQuickFontListModelPrivate;
-
-class QQuickFontListModel : public QAbstractListModel, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QString writingSystem READ writingSystem WRITE setWritingSystem NOTIFY writingSystemChanged)
-
- Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
- Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
- Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
- Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
-
- Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
-
-public:
- QQuickFontListModel(QObject *parent = 0);
- ~QQuickFontListModel();
-
- enum Roles {
- FontFamilyRole = Qt::UserRole + 1
- };
-
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual QHash<int, QByteArray> roleNames() const;
-
- int count() const { return rowCount(QModelIndex()); }
-
- QString writingSystem() const;
- void setWritingSystem(const QString& writingSystem);
-
- bool scalableFonts() const;
- bool nonScalableFonts() const;
- bool monospacedFonts() const;
- bool proportionalFonts() const;
-
- Q_INVOKABLE QQmlV4Handle get(int index) const;
- Q_INVOKABLE QQmlV4Handle pointSizes();
-
- virtual void classBegin();
- virtual void componentComplete();
-
-public Q_SLOTS:
- void setScalableFonts(bool arg);
- void setNonScalableFonts(bool arg);
- void setMonospacedFonts(bool arg);
- void setProportionalFonts(bool arg);
-
-Q_SIGNALS:
- void scalableFontsChanged();
- void nonScalableFontsChanged();
- void monospacedFontsChanged();
- void proportionalFontsChanged();
- void writingSystemChanged();
- void rowCountChanged() const;
-
-protected:
- void updateFamilies();
-
-private:
- Q_DISABLE_COPY(QQuickFontListModel)
- Q_DECLARE_PRIVATE(QQuickFontListModel)
- QScopedPointer<QQuickFontListModelPrivate> d_ptr;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKFONTLISTMODEL_P_H
diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
deleted file mode 100644
index f2b4ff8b8f..0000000000
--- a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp
+++ /dev/null
@@ -1,176 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickwritingsystemlistmodel_p.h"
-#include <QtGui/qfontdatabase.h>
-#include <QtQml/qqmlcontext.h>
-#include <private/qqmlengine_p.h>
-#include <private/qv8engine_p.h>
-#include <private/qv4value_p.h>
-#include <private/qv4engine_p.h>
-#include <private/qv4object_p.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace QV4;
-
-class QQuickWritingSystemListModelPrivate
-{
- Q_DECLARE_PUBLIC(QQuickWritingSystemListModel)
-
-public:
- QQuickWritingSystemListModelPrivate(QQuickWritingSystemListModel *q)
- : q_ptr(q)
- {}
-
- QQuickWritingSystemListModel *q_ptr;
- QList<QFontDatabase::WritingSystem> wss;
- QHash<int, QByteArray> roleNames;
- ~QQuickWritingSystemListModelPrivate() {}
- void init();
-};
-
-
-void QQuickWritingSystemListModelPrivate::init()
-{
- Q_Q(QQuickWritingSystemListModel);
- wss << QFontDatabase::Any;
- QFontDatabase db;
- wss << db.writingSystems();
-
- emit q->rowCountChanged();
- emit q->writingSystemsChanged();
-}
-
-QQuickWritingSystemListModel::QQuickWritingSystemListModel(QObject *parent)
- : QAbstractListModel(parent), d_ptr(new QQuickWritingSystemListModelPrivate(this))
-{
- Q_D(QQuickWritingSystemListModel);
- d->roleNames[WritingSystemNameRole] = "name";
- d->roleNames[WritingSystemSampleRole] = "sample";
- d->init();
-}
-
-QQuickWritingSystemListModel::~QQuickWritingSystemListModel()
-{
-}
-
-QVariant QQuickWritingSystemListModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const QQuickWritingSystemListModel);
- QVariant rv;
-
- if (index.row() >= d->wss.size())
- return rv;
-
- switch (role)
- {
- case WritingSystemNameRole:
- rv = QFontDatabase::writingSystemName(d->wss.at(index.row()));
- break;
- case WritingSystemSampleRole:
- rv = QFontDatabase::writingSystemSample(d->wss.at(index.row()));
- break;
- default:
- break;
- }
- return rv;
-}
-
-QHash<int, QByteArray> QQuickWritingSystemListModel::roleNames() const
-{
- Q_D(const QQuickWritingSystemListModel);
- return d->roleNames;
-}
-
-int QQuickWritingSystemListModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const QQuickWritingSystemListModel);
- Q_UNUSED(parent);
- return d->wss.size();
-}
-
-QModelIndex QQuickWritingSystemListModel::index(int row, int , const QModelIndex &) const
-{
- return createIndex(row, 0);
-}
-
-QStringList QQuickWritingSystemListModel::writingSystems() const
-{
- Q_D(const QQuickWritingSystemListModel);
- QStringList result;
- QFontDatabase::WritingSystem ws;
- foreach (ws, d->wss)
- result.append(QFontDatabase::writingSystemName(ws));
-
- return result;
-}
-
-QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const
-{
- Q_D(const QQuickWritingSystemListModel);
-
- if (idx < 0 || idx >= count())
- return QQmlV4Handle(Encode::undefined());
-
- QQmlEngine *engine = qmlContext(this)->engine();
- QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
- Scope scope(v4engine);
- ScopedObject o(scope, v4engine->newObject());
- ScopedString s(scope);
- for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) {
- Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes());
- p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1));
- }
-
- return QQmlV4Handle(o);
-}
-
-void QQuickWritingSystemListModel::classBegin()
-{
-}
-
-void QQuickWritingSystemListModel::componentComplete()
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h b/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h
deleted file mode 100644
index 31058bbf78..0000000000
--- a/src/imports/dialogs-private/qquickwritingsystemlistmodel_p.h
+++ /dev/null
@@ -1,100 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKWRITINGSYSTEMLISTMODEL_P_H
-#define QQUICKWRITINGSYSTEMLISTMODEL_P_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qabstractitemmodel.h>
-#include <QtQml/qqmlparserstatus.h>
-#include <private/qv8engine_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QModelIndex;
-
-class QQuickWritingSystemListModelPrivate;
-
-class QQuickWritingSystemListModel : public QAbstractListModel, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QStringList writingSystems READ writingSystems NOTIFY writingSystemsChanged)
-
- Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
-
-public:
- QQuickWritingSystemListModel(QObject *parent = 0);
- ~QQuickWritingSystemListModel();
-
- enum Roles {
- WritingSystemNameRole = Qt::UserRole + 1,
- WritingSystemSampleRole = Qt::UserRole + 2
- };
-
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual QHash<int, QByteArray> roleNames() const;
-
- int count() const { return rowCount(QModelIndex()); }
-
- QStringList writingSystems() const;
-
- Q_INVOKABLE QQmlV4Handle get(int index) const;
-
- virtual void classBegin();
- virtual void componentComplete();
-
-Q_SIGNALS:
- void writingSystemsChanged();
- void rowCountChanged() const;
-
-private:
- Q_DISABLE_COPY(QQuickWritingSystemListModel)
- Q_DECLARE_PRIVATE(QQuickWritingSystemListModel)
- QScopedPointer<QQuickWritingSystemListModelPrivate> d_ptr;
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKWRITINGSYSTEMLISTMODEL_P_H
diff --git a/src/imports/dialogs/DefaultColorDialog.qml b/src/imports/dialogs/DefaultColorDialog.qml
deleted file mode 100644
index 4913e332d7..0000000000
--- a/src/imports/dialogs/DefaultColorDialog.qml
+++ /dev/null
@@ -1,362 +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 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
-import QtQuick.Window 2.1
-import QtQuick.Dialogs 1.0
-import "qml"
-
-AbstractColorDialog {
- id: root
- property bool __valueSet: true // guard to prevent binding loops
- function __setControlsFromColor() {
- __valueSet = false
- hueSlider.value = root.currentHue
- saturationSlider.value = root.currentSaturation
- lightnessSlider.value = root.currentLightness
- alphaSlider.value = root.currentAlpha
- crosshairs.x = root.currentLightness * paletteMap.width
- crosshairs.y = (1.0 - root.currentSaturation) * paletteMap.height
- __valueSet = true
- }
- onCurrentColorChanged: __setControlsFromColor()
- onSelectionAccepted: root.color = root.currentColor
-
- Rectangle {
- id: content
- property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
- implicitHeight: Math.min(maxSize, Screen.pixelDensity * (usePaletteMap ? 100 : 50))
- implicitWidth: usePaletteMap ? implicitHeight - bottomMinHeight : implicitHeight * 1.5
- color: palette.window
- focus: root.visible
- property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3
- property real spacing: 8
- property real outerSpacing: 12
- property bool usePaletteMap: true
-
- Keys.onPressed: {
- event.accepted = true
- switch (event.key) {
- case Qt.Key_Return:
- case Qt.Key_Select:
- accept()
- break
- case Qt.Key_Escape:
- case Qt.Key_Back:
- reject()
- break
- case Qt.Key_C:
- if (event.modifiers & Qt.ControlModifier)
- colorField.copyAll()
- break
- case Qt.Key_V:
- if (event.modifiers & Qt.ControlModifier) {
- colorField.paste()
- root.currentColor = colorField.text
- }
- break
- default:
- // do nothing
- event.accepted = false
- break
- }
- }
-
- // set the preferred width based on height, to avoid "letterboxing" the paletteMap
- onHeightChanged: implicitHeight = Math.max((usePaletteMap ? 480 : bottomMinHeight), height)
-
- SystemPalette { id: palette }
-
- Item {
- id: paletteFrame
- visible: content.usePaletteMap
- anchors {
- top: parent.top
- left: parent.left
- right: parent.right
- margins: content.outerSpacing
- }
- height: Math.min(content.height - content.bottomMinHeight, content.width - content.outerSpacing * 2)
-
- Image {
- id: paletteMap
- x: (parent.width - width) / 2
- width: height
- onWidthChanged: root.__setControlsFromColor()
- height: parent.height
- source: "images/checkers.png"
- fillMode: Image.Tile
-
- // note we smoothscale the shader from a smaller version to improve performance
- ShaderEffect {
- id: map
- width: 64
- height: 64
- opacity: alphaSlider.value
- scale: paletteMap.width / width;
- layer.enabled: true
- layer.smooth: true
- anchors.centerIn: parent
- property real hue: hueSlider.value
-
- fragmentShader: "
- varying mediump vec2 qt_TexCoord0;
- uniform highp float qt_Opacity;
- uniform highp float hue;
-
- highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
- h = fract(h);
- if (h < 1.0 / 6.0)
- return v1 + (v2 - v1) * 6.0 * h;
- else if (h < 1.0 / 2.0)
- return v2;
- else if (h < 2.0 / 3.0)
- return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
-
- return v1;
- }
-
- highp vec3 HSLtoRGB(highp vec3 color) {
- highp float h = color.x;
- highp float l = color.z;
- highp float s = color.y;
-
- if (s < 1.0 / 256.0)
- return vec3(l, l, l);
-
- highp float v1;
- highp float v2;
- if (l < 0.5)
- v2 = l * (1.0 + s);
- else
- v2 = (l + s) - (s * l);
-
- v1 = 2.0 * l - v2;
-
- highp float d = 1.0 / 3.0;
- highp float r = hueToIntensity(v1, v2, h + d);
- highp float g = hueToIntensity(v1, v2, h);
- highp float b = hueToIntensity(v1, v2, h - d);
- return vec3(r, g, b);
- }
-
- void main() {
- lowp vec4 c = vec4(1.0);
- c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
- gl_FragColor = c * qt_Opacity;
- }
- "
- }
-
- MouseArea {
- id: mapMouseArea
- anchors.fill: parent
- onPositionChanged: {
- if (pressed && containsMouse) {
- var xx = Math.max(0, Math.min(mouse.x, parent.width))
- var yy = Math.max(0, Math.min(mouse.y, parent.height))
- saturationSlider.value = 1.0 - yy / parent.height
- lightnessSlider.value = xx / parent.width
- // TODO if we constrain the movement here, can avoid the containsMouse test
- crosshairs.x = mouse.x - crosshairs.radius
- crosshairs.y = mouse.y - crosshairs.radius
- }
- }
- onPressed: positionChanged(mouse)
- }
-
- Image {
- id: crosshairs
- property int radius: width / 2 // truncated to int
- source: "images/crosshairs.png"
- }
-
- BorderImage {
- anchors.fill: parent
- anchors.margins: -1
- anchors.leftMargin: -2
- source: "images/sunken_frame.png"
- border.left: 8
- border.right: 8
- border.top: 8
- border.bottom: 8
- }
- }
- }
-
- Column {
- id: sliders
- anchors {
- top: paletteFrame.bottom
- left: parent.left
- right: parent.right
- margins: content.outerSpacing
- }
- spacing: content.spacing
-
- ColorSlider {
- id: hueSlider
- value: 0.5
- onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
- text: qsTr("Hue")
- trackDelegate: Rectangle {
- rotation: -90
- transformOrigin: Item.TopLeft
- gradient: Gradient {
- GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)}
- GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)}
- GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)}
- GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)}
- GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)}
- GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)}
- GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)}
- }
- }
- }
-
- ColorSlider {
- id: saturationSlider
- visible: !content.usePaletteMap
- value: 0.5
- onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
- text: qsTr("Saturation")
- trackDelegate: Rectangle {
- rotation: -90
- transformOrigin: Item.TopLeft
- gradient: Gradient {
- GradientStop { position: 0; color: Qt.hsla(hueSlider.value, 0.0, lightnessSlider.value, 1.0) }
- GradientStop { position: 1; color: Qt.hsla(hueSlider.value, 1.0, lightnessSlider.value, 1.0) }
- }
- }
- }
-
- ColorSlider {
- id: lightnessSlider
- visible: !content.usePaletteMap
- value: 0.5
- onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
- text: qsTr("Luminosity")
- trackDelegate: Rectangle {
- rotation: -90
- transformOrigin: Item.TopLeft
- gradient: Gradient {
- GradientStop { position: 0; color: "black" }
- GradientStop { position: 0.5; color: Qt.hsla(hueSlider.value, saturationSlider.value, 0.5, 1.0) }
- GradientStop { position: 1; color: "white" }
- }
- }
- }
-
- ColorSlider {
- id: alphaSlider
- minimum: 0.0
- maximum: 1.0
- value: 1.0
- onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
- text: qsTr("Alpha")
- visible: root.showAlphaChannel
- trackDelegate: Item {
- rotation: -90
- transformOrigin: Item.TopLeft
- Image {
- anchors {fill: parent}
- source: "images/checkers.png"
- fillMode: Image.TileVertically
- }
- Rectangle {
- anchors.fill: parent
- gradient: Gradient {
- GradientStop { position: 0; color: "transparent" }
- GradientStop { position: 1; color: Qt.hsla(hueSlider.value,
- saturationSlider.value,
- lightnessSlider.value, 1.0) }
- } }
- }
- }
- }
-
- Item {
- id: buttonRow
- height: Math.max(buttonsOnly.height, copyIcon.height)
- width: parent.width
- anchors {
- left: parent.left
- right: parent.right
- bottom: content.bottom
- margins: content.outerSpacing
- }
- Row {
- spacing: content.spacing
- height: parent.height
- TextField {
- id: colorField
- text: root.currentColor.toString()
- anchors.verticalCenter: parent.verticalCenter
- onAccepted: root.currentColor = text
- Component.onCompleted: width = implicitWidth + 10
- }
- Image {
- id: copyIcon
- anchors.verticalCenter: parent.verticalCenter
- source: "images/copy.png"
- MouseArea {
- anchors.fill: parent
- onClicked: colorField.copyAll()
- }
- }
- }
- Row {
- id: buttonsOnly
- spacing: content.spacing
- anchors.right: parent.right
- Button {
- id: cancelButton
- text: "Cancel"
- onClicked: root.reject()
- }
- Button {
- id: okButton
- text: "OK"
- onClicked: root.accept()
- }
- }
- }
- }
-}
diff --git a/src/imports/dialogs/DefaultFileDialog.qml b/src/imports/dialogs/DefaultFileDialog.qml
deleted file mode 100644
index 0a5eabddf2..0000000000
--- a/src/imports/dialogs/DefaultFileDialog.qml
+++ /dev/null
@@ -1,385 +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 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
-import QtQuick.Dialogs 1.0
-import QtQuick.Window 2.1
-import Qt.labs.folderlistmodel 2.0
-import "qml"
-
-AbstractFileDialog {
- id: root
- onVisibleChanged: {
- if (visible) {
- __selectedIndices = []
- __lastClickedIdx = -1
- currentPathField.visible = false
- }
- }
- onFolderChanged: view.model.folder = folder
-
- property real __textX: titleBar.height
- property SystemPalette __palette
- property var __selectedIndices: []
- property int __lastClickedIdx: -1
-
- function __dirDown(path) {
- view.model.folder = path
- __lastClickedIdx = -1
- __selectedIndices = []
- }
- function __dirUp() {
- view.model.folder = view.model.parentFolder
- __lastClickedIdx = -1
- __selectedIndices = []
- }
- function __up(extend) {
- if (view.currentIndex > 0)
- --view.currentIndex
- else
- view.currentIndex = 0
- if (extend) {
- if (__selectedIndices.indexOf(view.currentIndex) < 0) {
- var selCopy = __selectedIndices
- selCopy.push(view.currentIndex)
- __selectedIndices = selCopy
- }
- } else
- __selectedIndices = [view.currentIndex]
- }
- function __down(extend) {
- if (view.currentIndex < view.model.count - 1)
- ++view.currentIndex
- else
- view.currentIndex = view.model.count - 1
- if (extend) {
- if (__selectedIndices.indexOf(view.currentIndex) < 0) {
- var selCopy = __selectedIndices
- selCopy.push(view.currentIndex)
- __selectedIndices = selCopy
- }
- } else
- __selectedIndices = [view.currentIndex]
- }
- function __acceptSelection() {
- clearSelection()
- if (selectFolder && __selectedIndices.length == 0)
- addSelection(folder)
- else if (__selectedIndices.length > 0) {
- __selectedIndices.map(function(idx) {
- if (view.model.isFolder(idx)) {
- if (selectFolder)
- addSelection(view.model.get(idx, "fileURL"))
- } else {
- if (!selectFolder)
- addSelection(view.model.get(idx, "fileURL"))
- }
- })
- } else {
- addSelection(pathToUrl(currentPathField.text))
- }
- accept()
- }
-
- Rectangle {
- id: content
- property int maxSize: Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
- // TODO: QTBUG-29817 geometry from AbstractFileDialog
- implicitWidth: Math.min(maxSize, Screen.pixelDensity * 100)
- implicitHeight: Math.min(maxSize, Screen.pixelDensity * 80)
- color: __palette.window
- focus: root.visible && !currentPathField.visible
- property real spacing: 6
- property real outerSpacing: 12
- SystemPalette { id: __palette }
-
- Component {
- id: folderDelegate
- Rectangle {
- id: wrapper
- function launch() {
- if (view.model.isFolder(index)) {
- __dirDown(filePath)
- } else {
- root.__acceptSelection()
- }
- }
- width: content.width
- height: nameText.implicitHeight * 1.5
- color: "transparent"
- Rectangle {
- id: itemHighlight
- visible: root.__selectedIndices.indexOf(index) >= 0
- anchors.fill: parent
- color: __palette.highlight
- }
- Image {
- id: icon
- source: "images/folder.png"
- height: wrapper.height - y * 2; width: height
- x: (root.__textX - width) / 2
- y: 2
- visible: view.model.isFolder(index)
- }
- Text {
- id: nameText
- anchors.fill: parent; verticalAlignment: Text.AlignVCenter
- text: fileName
- anchors.leftMargin: root.__textX
- color: itemHighlight.visible ? __palette.highlightedText : __palette.windowText
- elide: Text.ElideRight
- }
- MouseArea {
- id: mouseRegion
- anchors.fill: parent
- onDoubleClicked: {
- __selectedIndices = [index]
- root.__lastClickedIdx = index
- launch()
- }
- onClicked: {
- view.currentIndex = index
- if (mouse.modifiers & Qt.ControlModifier && root.selectMultiple) {
- // modifying the contents of __selectedIndices doesn't notify,
- // so we have to re-assign the variable
- var selCopy = __selectedIndices
- var existingIdx = selCopy.indexOf(index)
- if (existingIdx >= 0)
- selCopy.splice(existingIdx, 1)
- else
- selCopy.push(index)
- __selectedIndices = selCopy
- } else if (mouse.modifiers & Qt.ShiftModifier && root.selectMultiple) {
- if (root.__lastClickedIdx >= 0) {
- var sel = []
- if (index > __lastClickedIdx) {
- for (var i = root.__lastClickedIdx; i <= index; i++)
- sel.push(i)
- } else {
- for (var i = root.__lastClickedIdx; i >= index; i--)
- sel.push(i)
- }
- __selectedIndices = sel
- }
- } else {
- __selectedIndices = [index]
- root.__lastClickedIdx = index
- }
- }
- }
- }
- }
-
- Keys.onPressed: {
- event.accepted = true
- switch (event.key) {
- case Qt.Key_Up:
- root.__up(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
- break
- case Qt.Key_Down:
- root.__down(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
- break
- case Qt.Key_Left:
- root.__dirUp()
- break
- case Qt.Key_Return:
- case Qt.Key_Select:
- case Qt.Key_Right:
- if (view.currentItem)
- view.currentItem.launch()
- else
- root.__acceptSelection()
- break
- case Qt.Key_Back:
- case Qt.Key_Escape:
- reject()
- break
- case Qt.Key_C:
- if (event.modifiers & Qt.ControlModifier)
- currentPathField.copyAll()
- break
- case Qt.Key_V:
- if (event.modifiers & Qt.ControlModifier) {
- currentPathField.visible = true
- currentPathField.paste()
- }
- break
- default:
- // do nothing
- event.accepted = false
- break
- }
- }
-
- ListView {
- id: view
- anchors.top: titleBar.bottom
- anchors.bottom: bottomBar.top
- clip: true
- x: 0
- width: parent.width
- model: FolderListModel {
- onFolderChanged: {
- root.folder = folder
- currentPathField.text = root.urlToPath(view.model.folder)
- }
- }
- delegate: folderDelegate
- highlight: Rectangle {
- color: "transparent"
- border.color: Qt.darker(__palette.window, 1.3)
- }
- highlightMoveDuration: 0
- highlightMoveVelocity: -1
- }
-
- MouseArea {
- anchors.fill: view
- enabled: currentPathField.visible
- onClicked: currentPathField.visible = false
- }
-
-
- Item {
- id: titleBar
- width: parent.width
- height: currentPathField.height * 1.5
- Rectangle {
- anchors.fill: parent
- color: Qt.darker(__palette.window, 1.1)
- border.color: Qt.darker(__palette.window, 1.3)
- }
- Rectangle {
- id: upButton
- width: root.__textX
- height: titleBar.height
- color: "transparent"
-
- Image {
- id: upButtonImage
- anchors.centerIn: parent; source: "images/up.png"
- }
- MouseArea { id: upRegion; anchors.centerIn: parent
- width: 56
- height: parent.height
- onClicked: if (view.model.parentFolder !== "") __dirUp()
- }
- states: [
- State {
- name: "pressed"
- when: upRegion.pressed
- PropertyChanges { target: upButton; color: __palette.highlight }
- }
- ]
- }
- Text {
- id: currentPathText
- anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
- anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
- text: root.urlToPath(view.model.folder)
- color: __palette.text
- elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
- MouseArea {
- anchors.fill: parent
- onClicked: currentPathField.visible = true
- }
- }
- TextField {
- id: currentPathField
- anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
- anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
- visible: false
- focus: visible
- onAccepted: {
- root.clearSelection()
- if (root.addSelection(root.pathToUrl(text)))
- root.accept()
- else
- view.model.folder = root.pathFolder(text)
- }
- onDownPressed: currentPathField.visible = false
- onBackPressed: reject()
- onEscapePressed: reject()
- }
- }
- Rectangle {
- id: bottomBar
- width: parent.width
- height: buttonRow.height + buttonRow.spacing * 2
- anchors.bottom: parent.bottom
- color: Qt.darker(__palette.window, 1.1)
- border.color: Qt.darker(__palette.window, 1.3)
-
- Row {
- id: buttonRow
- anchors.right: parent.right
- anchors.rightMargin: spacing
- anchors.verticalCenter: parent.verticalCenter
- spacing: content.spacing
- TextField {
- id: filterField
- text: root.selectedNameFilter
- visible: !selectFolder
- width: bottomBar.width - cancelButton.width - okButton.width - parent.spacing * 5
- anchors.verticalCenter: parent.verticalCenter
- onAccepted: {
- root.selectNameFilter(text)
- view.model.nameFilters = text
- }
- }
- Button {
- id: cancelButton
- text: "Cancel"
- onClicked: root.reject()
- }
- Button {
- id: okButton
- text: "OK"
- onClicked: {
- if (view.model.isFolder(view.currentIndex) && !selectFolder)
- __dirDown(view.model.get(view.currentIndex, "filePath"))
- else
- root.__acceptSelection()
- }
- }
- }
- }
- }
-}
diff --git a/src/imports/dialogs/DefaultFontDialog.qml b/src/imports/dialogs/DefaultFontDialog.qml
deleted file mode 100644
index 29feed342f..0000000000
--- a/src/imports/dialogs/DefaultFontDialog.qml
+++ /dev/null
@@ -1,483 +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 QtQuick.Dialogs module of 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
-import QtQuick.Dialogs 1.1
-import QtQuick.Dialogs.Private 1.1
-import "qml"
-
-AbstractFontDialog {
- id: root
-
- property alias font: content.externalFont
-
- Rectangle {
- id: content
- implicitWidth: Math.min(Screen.desktopAvailableWidth, implicitHeight * 1.2)
- implicitHeight: Math.min(Screen.desktopAvailableHeight, settingsBottom.implicitHeight * 3)
- color: palette.window
- focus: root.visible
- property real spacing: 6
- property real outerSpacing: 12
- property real listMargins: 4
- property real delegateHeightMultiplier: 1.5
- property real extraWidth: width > 400 ? width - 400 : 0
- property real extraHeight: height > initialHeight ? height - initialHeight : 0
- property real initialHeight: -1
- onHeightChanged: if (visible && initialHeight < 0) initialHeight = height
-
- property color borderColor: Qt.darker(palette.button, 1.5)
-
- property font font: Qt.font({ family: "Helvetica", pointSize: 24, weight: Font.Normal })
- property font externalFont
- property string writingSystem
- property string writingSystemSample
- property var pointSizes
-
- onFontChanged: externalFont = font
-
- onExternalFontChanged: {
- if (content.font != content.externalFont) {
- font = externalFont
- wsListView.reset()
- fontListView.reset()
- weightListView.reset()
- }
- }
-
- Keys.onPressed: {
- event.accepted = true
- switch (event.key) {
- case Qt.Key_Return:
- case Qt.Key_Select:
- root.font = content.font
- root.accept()
- break
- case Qt.Key_Escape:
- case Qt.Key_Back:
- reject()
- break
- default:
- // do nothing
- event.accepted = false
- break
- }
- }
-
- SystemPalette { id: palette }
-
- Column {
- id: contentColumn
- anchors.fill: parent
- anchors.margins: content.outerSpacing
- spacing: content.outerSpacing
-
- Grid {
- id: settingsTop
- columns: 3
- spacing: content.spacing
- width: parent.width
- height: parent.height - buttonRow.height - settingsBottom.height - parent.spacing * 2
- property real columnHeight: height - writingSystemLabel.height - spacing
-
- Text { id: writingSystemLabel; text: qsTr("Writing System"); font.bold: true }
- Text { id: fontNameLabel; text: qsTr("Font"); font.bold: true }
- Text { id: sizeLabel; text: qsTr("Size"); font.bold: true }
- Rectangle {
- id: wsColumn
- radius: 3
- color: palette.window
- border.color: content.borderColor
- implicitWidth: Math.max(writingSystemLabel.implicitWidth, 100) + content.extraWidth / 5
- height: parent.columnHeight
- clip: true
- ListView {
- id: wsListView
- anchors.fill: parent
- anchors.margins: content.listMargins
- anchors.topMargin: 2
- highlightMoveDuration: 0
- onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
- function reset() {
- if (wsModel.count > 0) {
- content.writingSystem = wsModel.get(0).name;
- fontModel.writingSystem = content.writingSystem;
- content.writingSystemSample = wsModel.get(0).sample;
- }
- }
-
- model: WritingSystemListModel {
- id: wsModel
- Component.onCompleted: wsListView.reset()
- }
- highlight: Rectangle {
- color: palette.highlight
- x: 2 - wsListView.anchors.margins
- width: wsListView.parent.width - 4
- }
- delegate: Item {
- width: parent.width
- height: wsText.height * content.delegateHeightMultiplier
- Text {
- id: wsText
- text: name
- width: parent.width
- elide: Text.ElideRight
- color: index === wsListView.currentIndex ? palette.highlightedText : palette.windowText
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- wsListView.currentIndex = index;
- content.writingSystem = wsModel.get(wsListView.currentIndex).name;
- fontModel.writingSystem = content.writingSystem;
- content.writingSystemSample = wsModel.get(wsListView.currentIndex).sample;
- }
- }
- }
- }
- }
- Rectangle {
- radius: 3
- color: palette.window
- border.color: content.borderColor
- implicitWidth: Math.max(fontNameLabel.implicitWidth, parent.width - wsColumn.implicitWidth - pointSizesColumn.implicitWidth - parent.spacing * 2)
- height: parent.columnHeight
- clip: true
- ListView {
- id: fontListView
- anchors.fill: parent
- anchors.margins: content.listMargins
- anchors.topMargin: 2
- highlightMoveDuration: 0
- onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
- function reset() {
- fontModel.findIndex()
- content.pointSizes = fontModel.pointSizes()
- fontModel.findPointSizesIndex()
- }
-
- model: FontListModel {
- id: fontModel
- scalableFonts: root.scalableFonts
- nonScalableFonts: root.nonScalableFonts
- monospacedFonts: root.monospacedFonts
- proportionalFonts: root.proportionalFonts
- Component.onCompleted: fontListView.reset()
- onModelReset: { findIndex(); }
- function findIndex() {
- if (fontModel.count <= 0)
- return
-
- if (content.font.family == "") {
- content.font.family = fontModel.get(0).family
- fontListView.currentIndex = 0
- } else {
- var find = false
- for (var i = 0; i < fontModel.count; ++i) {
- if (content.font.family == fontModel.get(i).family) {
- find = true
- fontListView.currentIndex = i
- break
- }
- }
- if (find == false) {
- content.font.family = fontModel.get(0).family
- fontListView.currentIndex = 0
- }
- }
- }
- function findPointSizesIndex() {
- if (content.pointSizes.length <= 0)
- return
-
- var find = false
- for (var i = 0; i < content.pointSizes.length; ++i) {
- if (content.font.pointSize == content.pointSizes[i]) {
- find = true
- pointSizesListView.currentIndex = i
- break
- }
- }
- if (find == false) {
- content.font.pointSize = content.pointSizes[0]
- pointSizesListView.currentIndex = 0
- }
- }
- }
- highlight: Rectangle {
- color: palette.highlight
- x: 2 - fontListView.anchors.margins
- width: fontListView.parent.width - 4
- }
- delegate: Item {
- width: parent.width
- height: fontText.height * content.delegateHeightMultiplier
- Text {
- id: fontText
- text: family
- width: parent.width
- elide: Text.ElideRight
- color: index === fontListView.currentIndex ? palette.highlightedText : palette.windowText
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- fontListView.currentIndex = index
- content.font.family = fontModel.get(fontListView.currentIndex).family
- }
- }
- }
- }
- }
- Rectangle {
- id: pointSizesColumn
- radius: 3
- color: palette.window
- border.color: content.borderColor
- implicitWidth:sizeLabel.implicitWidth * 2
- height: parent.columnHeight
- clip: true
- ListView {
- id: pointSizesListView
- anchors.fill: parent
- anchors.margins: content.listMargins
- anchors.topMargin: 2
- highlightMoveDuration: 0
- onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
- model: content.pointSizes
- highlight: Rectangle {
- color: palette.highlight
- x: 2 - pointSizesListView.anchors.margins
- width: pointSizesListView.parent.width - 4
- }
- delegate: Item {
- width: parent.width
- height: pointSizesText.height * content.delegateHeightMultiplier
- Text {
- id: pointSizesText
- text: content.pointSizes[index]
- width: parent.width
- elide: Text.ElideRight
- color: index === pointSizesListView.currentIndex ? palette.highlightedText : palette.windowText
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- pointSizesListView.currentIndex = index
- content.font.pointSize = content.pointSizes[pointSizesListView.currentIndex]
- }
- }
- }
- }
- }
- }
-
- Grid {
- id: settingsBottom
- columns: 3
- spacing: content.spacing
- width: parent.width
- height: initialHeight + content.extraHeight / 4
- property real initialHeight
- property real secondRowHeight: height - weightLabel.height - spacing
- Component.onCompleted: initialHeight = implicitHeight
-
- Text { id: weightLabel; text: qsTr("Weight"); font.bold: true }
- Text { id: optionsLabel; text: qsTr("Style"); font.bold: true }
- Text { id: sampleLabel; text: qsTr("Sample"); font.bold: true }
- Rectangle {
- id: weightColumn
- radius: 3
- color: palette.window
- border.color: content.borderColor
- implicitWidth: optionsColumn.implicitWidth
- implicitHeight: optionsColumn.implicitHeight
- height: parent.secondRowHeight
- clip: true
- ListView {
- id: weightListView
- anchors.fill: parent
- anchors.margins: content.listMargins
- anchors.topMargin: 2
- highlightMoveDuration: 0
- onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
- function reset() {
- weightModel.findIndex()
- }
-
- model: ListModel {
- id: weightModel
- ListElement {
- name: "Light"
- weight: Font.Light
- }
- ListElement {
- name: "Normal"
- weight: Font.Normal
- }
- ListElement {
- name: "DemiBold"
- weight: Font.DemiBold
- }
- ListElement {
- name: "Bold"
- weight: Font.Bold
- }
- ListElement {
- name: "Black"
- weight: Font.Black
- }
- Component.onCompleted: weightListView.reset()
- function findIndex() {
- var find = false
- for (var i = 0; i < weightModel.count; ++i) {
- if (content.font.weight == weightModel.get(i).weight) {
- find = true
- weightListView.currentIndex = i
- break
- }
- }
- if (find == false) {
- content.font.weight = weightModel.get(1).family
- fontListView.currentIndex = 1
- }
- }
- }
- highlight: Rectangle {
- color: palette.highlight
- x: 2 - weightListView.anchors.margins
- width: weightListView.parent.width - 4
- }
- delegate: Item {
- width: parent.width
- height: weightText.height * content.delegateHeightMultiplier
- Text {
- id: weightText
- text: name
- width: parent.width
- elide: Text.ElideRight
- color: index === weightListView.currentIndex ? palette.highlightedText : palette.windowText
- anchors.verticalCenter: parent.verticalCenter
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- weightListView.currentIndex = index
- content.font.weight = weightModel.get(weightListView.currentIndex).weight
- }
- }
- }
- }
- }
- Column {
- id: optionsColumn
- spacing: 4
- CheckBox {
- id: italicCheckBox
- text: qsTr("Italic")
- checked: content.font.italic
- onClicked: { content.font.italic = italicCheckBox.checked }
- }
- CheckBox {
- id: underlineCheckBox
- text: qsTr("Underline")
- checked: content.font.underline
- onClicked: { content.font.underline = underlineCheckBox.checked }
- }
- CheckBox {
- id: overlineCheckBox
- text: qsTr("Overline")
- checked: content.font.overline
- onClicked: { content.font.overline = overlineCheckBox.checked }
- }
- CheckBox {
- id: strikeoutCheckBox
- text: qsTr("Strikeout")
- checked: content.font.strikeout
- onClicked: { content.font.strikeout = strikeoutCheckBox.checked }
- }
- }
- Rectangle {
- clip: true
- implicitWidth: sample.implicitWidth + parent.spacing
- implicitHeight: optionsColumn.implicitHeight
- width: parent.width - weightColumn.width - optionsColumn.width - parent.spacing * 2
- height: parent.secondRowHeight
- color: palette.window
- border.color: content.borderColor
- Text {
- id: sample
- anchors.centerIn: parent
- font: content.font
- text: content.writingSystemSample
- }
- }
- }
-
- Item {
- id: buttonRow
- height: buttonsOnly.height
- width: parent.width
- Row {
- id: buttonsOnly
- spacing: content.spacing
- anchors.right: parent.right
- Button {
- text: qsTr("Cancel")
- onClicked: root.reject()
- }
- Button {
- text: qsTr("OK")
- onClicked: {
- root.font = content.font
- root.accept()
- }
- }
- }
- }
- }
- }
-}
-
diff --git a/src/imports/dialogs/DefaultMessageDialog.qml b/src/imports/dialogs/DefaultMessageDialog.qml
deleted file mode 100644
index ba29469b5e..0000000000
--- a/src/imports/dialogs/DefaultMessageDialog.qml
+++ /dev/null
@@ -1,330 +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 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
-import QtQuick.Window 2.1
-import QtQuick.Dialogs 1.1
-import "qml"
-
-AbstractMessageDialog {
- id: root
-
- Rectangle {
- id: content
- property real spacing: 6
- property real outerSpacing: 12
- property real buttonsRowImplicitWidth: Screen.pixelDensity * 50
- implicitHeight: contentColumn.implicitHeight + outerSpacing * 2
- onImplicitHeightChanged: root.height = implicitHeight
- implicitWidth: Math.min(Screen.desktopAvailableWidth * 0.9, Math.max(
- mainText.implicitWidth, buttonsRowImplicitWidth) + outerSpacing * 2);
- onImplicitWidthChanged: root.width = implicitWidth
- color: palette.window
- focus: root.visible
- Keys.onPressed: {
- event.accepted = true
- if (event.modifiers === Qt.ControlModifier)
- switch (event.key) {
- case Qt.Key_A:
- detailedText.selectAll()
- break
- case Qt.Key_C:
- detailedText.copy()
- break
- } else switch (event.key) {
- case Qt.Key_Escape:
- case Qt.Key_Back:
- reject()
- break
- case Qt.Key_Enter:
- case Qt.Key_Return:
- accept()
- break
- }
- }
-
- Column {
- id: contentColumn
- spacing: content.spacing
- anchors {
- top: parent.top
- left: parent.left
- right: parent.right
- margins: content.outerSpacing
- }
-
- SystemPalette { id: palette }
-
- Item {
- width: parent.width
- height: Math.max(icon.height, mainText.height + informativeText.height + content.spacing)
- Image {
- id: icon
- source: root.standardIconSource
- }
-
- Text {
- id: mainText
- anchors {
- left: icon.right
- leftMargin: content.spacing
- right: parent.right
- }
- text: root.text
- font.weight: Font.Bold
- wrapMode: Text.WordWrap
- }
-
- Text {
- id: informativeText
- anchors {
- left: icon.right
- right: parent.right
- top: mainText.bottom
- leftMargin: content.spacing
- topMargin: content.spacing
- }
- text: root.informativeText
- wrapMode: Text.WordWrap
- }
- }
-
-
- Flow {
- id: buttons
- spacing: content.spacing
- layoutDirection: Qt.RightToLeft
- width: parent.width + content.outerSpacing
- x: -content.outerSpacing
- Button {
- id: okButton
- text: "OK"
- onClicked: root.click(StandardButton.Ok)
- visible: root.standardButtons & StandardButton.Ok
- }
- Button {
- id: openButton
- text: "Open"
- onClicked: root.click(StandardButton.Open)
- visible: root.standardButtons & StandardButton.Open
- }
- Button {
- id: saveButton
- text: "Save"
- onClicked: root.click(StandardButton.Save)
- visible: root.standardButtons & StandardButton.Save
- }
- Button {
- id: saveAllButton
- text: "Save All"
- onClicked: root.click(StandardButton.SaveAll)
- visible: root.standardButtons & StandardButton.SaveAll
- }
- Button {
- id: retryButton
- text: "Retry"
- onClicked: root.click(StandardButton.Retry)
- visible: root.standardButtons & StandardButton.Retry
- }
- Button {
- id: ignoreButton
- text: "Ignore"
- onClicked: root.click(StandardButton.Ignore)
- visible: root.standardButtons & StandardButton.Ignore
- }
- Button {
- id: applyButton
- text: "Apply"
- onClicked: root.click(StandardButton.Apply)
- visible: root.standardButtons & StandardButton.Apply
- }
- Button {
- id: yesButton
- text: "Yes"
- onClicked: root.click(StandardButton.Yes)
- visible: root.standardButtons & StandardButton.Yes
- }
- Button {
- id: yesAllButton
- text: "Yes to All"
- onClicked: root.click(StandardButton.YesToAll)
- visible: root.standardButtons & StandardButton.YesToAll
- }
- Button {
- id: noButton
- text: "No"
- onClicked: root.click(StandardButton.No)
- visible: root.standardButtons & StandardButton.No
- }
- Button {
- id: noAllButton
- text: "No to All"
- onClicked: root.click(StandardButton.NoToAll)
- visible: root.standardButtons & StandardButton.NoToAll
- }
- Button {
- id: discardButton
- text: "Discard"
- onClicked: root.click(StandardButton.Discard)
- visible: root.standardButtons & StandardButton.Discard
- }
- Button {
- id: resetButton
- text: "Reset"
- onClicked: root.click(StandardButton.Reset)
- visible: root.standardButtons & StandardButton.Reset
- }
- Button {
- id: restoreDefaultsButton
- text: "Restore Defaults"
- onClicked: root.click(StandardButton.RestoreDefaults)
- visible: root.standardButtons & StandardButton.RestoreDefaults
- }
- Button {
- id: cancelButton
- text: "Cancel"
- onClicked: root.click(StandardButton.Cancel)
- visible: root.standardButtons & StandardButton.Cancel
- }
- Button {
- id: abortButton
- text: "Abort"
- onClicked: root.click(StandardButton.Abort)
- visible: root.standardButtons & StandardButton.Abort
- }
- Button {
- id: closeButton
- text: "Close"
- onClicked: root.click(StandardButton.Close)
- visible: root.standardButtons & StandardButton.Close
- }
- Button {
- id: moreButton
- text: "Show Details..."
- onClicked: content.state = (content.state === "" ? "expanded" : "")
- visible: root.detailedText.length > 0
- }
- Button {
- id: helpButton
- text: "Help"
- onClicked: root.click(StandardButton.Help)
- visible: root.standardButtons & StandardButton.Help
- }
- onVisibleChildrenChanged: calculateImplicitWidth()
- }
- }
-
- Item {
- id: details
- width: parent.width
- implicitHeight: detailedText.implicitHeight + content.spacing
- height: 0
- clip: true
-
- anchors {
- left: parent.left
- right: parent.right
- top: contentColumn.bottom
- topMargin: content.spacing
- leftMargin: content.outerSpacing
- rightMargin: content.outerSpacing
- }
-
- Flickable {
- id: flickable
- contentHeight: detailedText.height
- anchors.fill: parent
- anchors.topMargin: content.spacing
- anchors.bottomMargin: content.outerSpacing
- TextEdit {
- id: detailedText
- text: root.detailedText
- width: details.width
- wrapMode: Text.WordWrap
- readOnly: true
- selectByMouse: true
- }
- }
-
- Component {
- id: edgeFade
- EdgeFade {
- fadeColor: palette.window
- topThreshold: flickable.atYBeginning ? 0 : content.spacing * 3
- bottomThreshold: flickable.atYEnd ? 0 : content.spacing * 3
- }
- }
-
- Loader {
- sourceComponent: flickable.height < flickable.contentHeight ? edgeFade : undefined
- anchors.fill: parent
- }
-
- }
-
- states: [
- State {
- name: "expanded"
- PropertyChanges {
- target: details
- height: content.height - contentColumn.height - content.spacing - content.outerSpacing
- }
- PropertyChanges {
- target: content
- implicitHeight: contentColumn.implicitHeight + content.spacing * 2 +
- detailedText.implicitHeight + content.outerSpacing * 2
- }
- PropertyChanges {
- target: moreButton
- text: "Hide Details"
- }
- }
- ]
- }
- function calculateImplicitWidth() {
- if (buttons.visibleChildren.length < 2)
- return;
- var calcWidth = 0;
- for (var i = 0; i < buttons.visibleChildren.length; ++i)
- calcWidth += Math.max(100, buttons.visibleChildren[i].implicitWidth) + content.spacing
- content.buttonsRowImplicitWidth = content.outerSpacing + calcWidth
- }
- Component.onCompleted: calculateImplicitWidth()
-}
diff --git a/src/imports/dialogs/WidgetColorDialog.qml b/src/imports/dialogs/WidgetColorDialog.qml
deleted file mode 100644
index ed7c7ab77a..0000000000
--- a/src/imports/dialogs/WidgetColorDialog.qml
+++ /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 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
-import QtQuick.PrivateWidgets 1.0
-
-QtColorDialog { }
diff --git a/src/imports/dialogs/WidgetFileDialog.qml b/src/imports/dialogs/WidgetFileDialog.qml
deleted file mode 100644
index c8f59d20a7..0000000000
--- a/src/imports/dialogs/WidgetFileDialog.qml
+++ /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 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
-import QtQuick.PrivateWidgets 1.0
-
-QtFileDialog { }
diff --git a/src/imports/dialogs/WidgetFontDialog.qml b/src/imports/dialogs/WidgetFontDialog.qml
deleted file mode 100644
index 69f98b28a2..0000000000
--- a/src/imports/dialogs/WidgetFontDialog.qml
+++ /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 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.2
-import QtQuick.PrivateWidgets 1.1
-
-QtFontDialog { }
diff --git a/src/imports/dialogs/WidgetMessageDialog.qml b/src/imports/dialogs/WidgetMessageDialog.qml
deleted file mode 100644
index 8bc3eccfd7..0000000000
--- a/src/imports/dialogs/WidgetMessageDialog.qml
+++ /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 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
-import QtQuick.PrivateWidgets 1.1
-
-QtMessageDialog { }
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro
deleted file mode 100644
index 1abad55883..0000000000
--- a/src/imports/dialogs/dialogs.pro
+++ /dev/null
@@ -1,97 +0,0 @@
-CXX_MODULE = qml
-TARGET = dialogplugin
-TARGETPATH = QtQuick/Dialogs
-IMPORT_VERSION = 1.1
-
-QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
-
-SOURCES += \
- qquickabstractmessagedialog.cpp \
- qquickplatformmessagedialog.cpp \
- qquickmessagedialog.cpp \
- qquickabstractfiledialog.cpp \
- qquickplatformfiledialog.cpp \
- qquickfiledialog.cpp \
- qquickabstractcolordialog.cpp \
- qquickplatformcolordialog.cpp \
- qquickcolordialog.cpp \
- qquickabstractfontdialog.cpp \
- qquickplatformfontdialog.cpp \
- qquickfontdialog.cpp \
- qquickabstractdialog.cpp \
- plugin.cpp
-
-HEADERS += \
- qquickabstractmessagedialog_p.h \
- qquickplatformmessagedialog_p.h \
- qquickmessagedialog_p.h \
- qquickdialogassets_p.h \
- qquickabstractfiledialog_p.h \
- qquickplatformfiledialog_p.h \
- qquickfiledialog_p.h \
- qquickabstractcolordialog_p.h \
- qquickplatformcolordialog_p.h \
- qquickcolordialog_p.h \
- qquickabstractfontdialog_p.h \
- qquickplatformfontdialog_p.h \
- qquickfontdialog_p.h \
- qquickabstractdialog_p.h
-
-DIALOGS_QML_FILES += \
- DefaultMessageDialog.qml \
- WidgetMessageDialog.qml \
- DefaultFileDialog.qml \
- WidgetFileDialog.qml \
- DefaultColorDialog.qml \
- WidgetColorDialog.qml \
- DefaultFontDialog.qml \
- WidgetFontDialog.qml \
- qml/Button.qml \
- qml/CheckBox.qml \
- qml/ColorSlider.qml \
- qml/EdgeFade.qml \
- qml/DefaultWindowDecoration.qml \
- qml/TextField.qml \
- qml/qmldir \
- images/critical.png \
- images/information.png \
- images/question.png \
- images/warning.png \
- images/checkers.png \
- images/checkmark.png \
- images/copy.png \
- images/crosshairs.png \
- images/slider_handle.png \
- images/sunken_frame.png \
- images/window_border.png \
- images/folder.png \
- images/up.png
-
-QT += quick-private gui gui-private core core-private qml
-
-# Create the resource file
-GENERATED_RESOURCE_FILE = $$OUT_PWD/dialogs.qrc
-
-RESOURCE_CONTENT = \
- "<RCC>" \
- "<qresource prefix=\"/QtQuick/Dialogs\">"
-
-for(resourcefile, DIALOGS_QML_FILES) {
- resourcefileabsolutepath = $$absolute_path($$resourcefile)
- relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
- relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
- RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
-}
-
-RESOURCE_CONTENT += \
- "</qresource>" \
- "</RCC>"
-
-write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
-
-RESOURCES += $$GENERATED_RESOURCE_FILE
-
-# In case of a debug build, deploy the QML files too
-CONFIG(debug, debug|release): QML_FILES += $$DIALOGS_QML_FILES
-
-load(qml_plugin)
diff --git a/src/imports/dialogs/doc/images/critical.png b/src/imports/dialogs/doc/images/critical.png
deleted file mode 100644
index dc9c5aebf4..0000000000
--- a/src/imports/dialogs/doc/images/critical.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/doc/images/information.png b/src/imports/dialogs/doc/images/information.png
deleted file mode 100644
index 0a2eb87d10..0000000000
--- a/src/imports/dialogs/doc/images/information.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/doc/images/question.png b/src/imports/dialogs/doc/images/question.png
deleted file mode 100644
index 2dd92fd791..0000000000
--- a/src/imports/dialogs/doc/images/question.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/doc/images/replacefile.png b/src/imports/dialogs/doc/images/replacefile.png
deleted file mode 100644
index d1479fa944..0000000000
--- a/src/imports/dialogs/doc/images/replacefile.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/doc/images/warning.png b/src/imports/dialogs/doc/images/warning.png
deleted file mode 100644
index cba78f6bea..0000000000
--- a/src/imports/dialogs/doc/images/warning.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf
deleted file mode 100644
index 1bad67790f..0000000000
--- a/src/imports/dialogs/doc/qtquickdialogs.qdocconf
+++ /dev/null
@@ -1,41 +0,0 @@
-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
-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 QML Types
-qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass
-qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
-
-depends = qtqml qtquick qtgui qtwidgets qtdoc
-
-exampledirs += ../../../../examples/quick/dialogs
-
-examplesinstallpath = quick/dialogs
-
-headerdirs += ..
-
-sourcedirs += ..
-
-imagedirs += images
-
-excludedirs += ../qml
-
-navigation.landingpage = "Qt Quick Dialogs"
-navigation.qmltypespage = "Qt Quick Dialogs QML Types"
diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc
deleted file mode 100644
index ee277f48dc..0000000000
--- a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc
+++ /dev/null
@@ -1,36 +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$
-**
-****************************************************************************/
-
-/*!
- \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
deleted file mode 100644
index 5a1223b04d..0000000000
--- a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc
+++ /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 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/images/checkers.png b/src/imports/dialogs/images/checkers.png
deleted file mode 100644
index 458d33de9d..0000000000
--- a/src/imports/dialogs/images/checkers.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/checkmark.png b/src/imports/dialogs/images/checkmark.png
deleted file mode 100644
index 821aafccdd..0000000000
--- a/src/imports/dialogs/images/checkmark.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/copy.png b/src/imports/dialogs/images/copy.png
deleted file mode 100644
index 2aeb28288f..0000000000
--- a/src/imports/dialogs/images/copy.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/critical.png b/src/imports/dialogs/images/critical.png
deleted file mode 100644
index dc9c5aebf4..0000000000
--- a/src/imports/dialogs/images/critical.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/crosshairs.png b/src/imports/dialogs/images/crosshairs.png
deleted file mode 100644
index 9a61946eca..0000000000
--- a/src/imports/dialogs/images/crosshairs.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/folder.png b/src/imports/dialogs/images/folder.png
deleted file mode 100644
index e53e2ad464..0000000000
--- a/src/imports/dialogs/images/folder.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/information.png b/src/imports/dialogs/images/information.png
deleted file mode 100644
index 0a2eb87d10..0000000000
--- a/src/imports/dialogs/images/information.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/question.png b/src/imports/dialogs/images/question.png
deleted file mode 100644
index 2dd92fd791..0000000000
--- a/src/imports/dialogs/images/question.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/slider_handle.png b/src/imports/dialogs/images/slider_handle.png
deleted file mode 100644
index e3b9654392..0000000000
--- a/src/imports/dialogs/images/slider_handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/sunken_frame.png b/src/imports/dialogs/images/sunken_frame.png
deleted file mode 100644
index 178c3092d2..0000000000
--- a/src/imports/dialogs/images/sunken_frame.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/up.png b/src/imports/dialogs/images/up.png
deleted file mode 100644
index b05f8025d0..0000000000
--- a/src/imports/dialogs/images/up.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/warning.png b/src/imports/dialogs/images/warning.png
deleted file mode 100644
index cba78f6bea..0000000000
--- a/src/imports/dialogs/images/warning.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/images/window_border.png b/src/imports/dialogs/images/window_border.png
deleted file mode 100644
index 431af8545d..0000000000
--- a/src/imports/dialogs/images/window_border.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp
deleted file mode 100644
index 70e12093b6..0000000000
--- a/src/imports/dialogs/plugin.cpp
+++ /dev/null
@@ -1,214 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqml.h>
-#include <QtQml/qqmlextensionplugin.h>
-#include "qquickmessagedialog_p.h"
-#include "qquickabstractmessagedialog_p.h"
-#include "qquickdialogassets_p.h"
-#include "qquickplatformmessagedialog_p.h"
-#include "qquickfiledialog_p.h"
-#include "qquickabstractfiledialog_p.h"
-#include "qquickplatformfiledialog_p.h"
-#include "qquickcolordialog_p.h"
-#include "qquickabstractcolordialog_p.h"
-#include "qquickplatformcolordialog_p.h"
-#include "qquickfontdialog_p.h"
-#include "qquickabstractfontdialog_p.h"
-#include "qquickplatformfontdialog_p.h"
-#include <private/qguiapplication_p.h>
-#include <qpa/qplatformintegration.h>
-
-//#define PURE_QML_ONLY
-//#define DEBUG_REGISTRATION
-
-static void initResources()
-{
- Q_INIT_RESOURCE(dialogs);
-}
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlmodule QtQuick.Dialogs 1.1
- \title Qt Quick Dialogs QML Types
- \ingroup qmlmodules
- \brief Provides QML types for standard file, color picker and message dialogs
-
- This QML module contains types for creating and interacting with system dialogs.
-
- To use the types in this module, import the module with the following line:
-
- \code
- import QtQuick.Dialogs 1.1
- \endcode
-*/
-
-class QtQuick2DialogsPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
-
-public:
- QtQuick2DialogsPlugin() : QQmlExtensionPlugin(), m_useResources(true) { }
-
- virtual void initializeEngine(QQmlEngine *engine, const char * uri) {
-#ifdef DEBUG_REGISTRATION
- qDebug() << Q_FUNC_INFO << uri << m_decorationComponentUrl;
-#else
- Q_UNUSED(uri)
-#endif
- QQuickAbstractDialog::m_decorationComponent =
- new QQmlComponent(engine, m_decorationComponentUrl, QQmlComponent::Asynchronous);
- }
-
- virtual void registerTypes(const char *uri) {
- initResources();
-
-#ifdef DEBUG_REGISTRATION
- qDebug() << Q_FUNC_INFO << uri;
-#endif
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs"));
- bool hasTopLevelWindows = QGuiApplicationPrivate::platformIntegration()->
- hasCapability(QPlatformIntegration::MultipleWindows);
- QDir qmlDir(baseUrl().toLocalFile());
- QDir widgetsDir(baseUrl().toLocalFile());
- // TODO: find the directory by searching rather than assuming a relative path
- widgetsDir.cd("../PrivateWidgets");
-
- // If at least one file was actually installed, then use installed qml files instead of resources.
- // This makes debugging and incremental development easier, whereas the "normal" installation
- // uses resources to save space and cut down on the number of files to deploy.
- if (qmlDir.exists(QString("DefaultFileDialog.qml")))
- m_useResources = false;
- m_decorationComponentUrl = m_useResources ?
- QUrl("qrc:/QtQuick/Dialogs/qml/DefaultWindowDecoration.qml") :
- QUrl::fromLocalFile(qmlDir.filePath(QString("qml/DefaultWindowDecoration.qml")));
-
- // Prefer the QPA dialog helpers if the platform supports them.
- // Else if there is a QWidget-based implementation, check whether it's
- // possible to instantiate it from Qt Quick.
- // Otherwise fall back to a pure-QML implementation.
-
- // MessageDialog
- qmlRegisterUncreatableType<QQuickStandardButton>(uri, 1, 1, "StandardButton",
- QLatin1String("Do not create objects of type StandardButton"));
- qmlRegisterUncreatableType<QQuickStandardIcon>(uri, 1, 1, "StandardIcon",
- QLatin1String("Do not create objects of type StandardIcon"));
-#ifndef PURE_QML_ONLY
- if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::MessageDialog))
- qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
- else
-#endif
- registerWidgetOrQmlImplementation<QQuickMessageDialog>(widgetsDir, qmlDir, "MessageDialog", uri, hasTopLevelWindows, 1, 1);
-
- // FileDialog
-#ifndef PURE_QML_ONLY
- if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
- qmlRegisterType<QQuickPlatformFileDialog>(uri, 1, 0, "FileDialog");
- else
-#endif
- registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, qmlDir, "FileDialog", uri, hasTopLevelWindows, 1, 0);
-
- // ColorDialog
-#ifndef PURE_QML_ONLY
- if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::ColorDialog))
- qmlRegisterType<QQuickPlatformColorDialog>(uri, 1, 0, "ColorDialog");
- else
-#endif
- registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, qmlDir, "ColorDialog", uri, hasTopLevelWindows, 1, 0);
-
- // FontDialog
-#ifndef PURE_QML_ONLY
- if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FontDialog))
- qmlRegisterType<QQuickPlatformFontDialog>(uri, 1, 1, "FontDialog");
- else
-#endif
- registerWidgetOrQmlImplementation<QQuickFontDialog>(widgetsDir, qmlDir, "FontDialog", uri, hasTopLevelWindows, 1, 1);
- }
-
-protected:
- template <class WrapperType>
- void registerWidgetOrQmlImplementation(QDir widgetsDir, QDir qmlDir,
- const char *qmlName, const char *uri, bool hasTopLevelWindows, int versionMajor, int versionMinor) {
- // qDebug() << "QtQuick2DialogsPlugin::registerWidgetOrQmlImplementation" << uri << qmlName << ": QML in" << qmlDir.absolutePath()
- // << "using resources?" << m_useResources << "; widgets in" << widgetsDir.absolutePath();
- bool needQmlImplementation = true;
-
-#ifdef PURE_QML_ONLY
- Q_UNUSED(widgetsDir)
- Q_UNUSED(hasTopLevelWindows)
-#else
- // 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 (hasTopLevelWindows && widgetsDir.exists("qmldir") &&
- QCoreApplication::instance()->inherits("QApplication")) {
- QUrl dialogQmlPath = m_useResources ?
- QUrl(QString("qrc:/QtQuick/Dialogs/Widget%1.qml").arg(qmlName)) :
- QUrl::fromLocalFile(qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)));
- if (qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName) >= 0) {
- needQmlImplementation = false;
-#ifdef DEBUG_REGISTRATION
- qDebug() << " registering" << qmlName << " as " << dialogQmlPath << "success?" << !needQmlImplementation;
-#endif
- }
- }
-#endif
- if (needQmlImplementation) {
- QByteArray abstractTypeName = QByteArray("Abstract") + qmlName;
- qmlRegisterType<WrapperType>(uri, versionMajor, versionMinor, abstractTypeName); // implementation wrapper
- QUrl dialogQmlPath = m_useResources ?
- QUrl(QString("qrc:/QtQuick/Dialogs/Default%1.qml").arg(qmlName)) :
- QUrl::fromLocalFile(qmlDir.filePath(QString("Default%1.qml").arg(qmlName)));
-#ifdef DEBUG_REGISTRATION
- qDebug() << " registering" << qmlName << " as " << dialogQmlPath << "success?" <<
-#endif
- qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName);
- }
- }
-
- QUrl m_decorationComponentUrl;
- bool m_useResources;
-};
-
-QT_END_NAMESPACE
-
-#include "plugin.moc"
diff --git a/src/imports/dialogs/plugins.qmltypes b/src/imports/dialogs/plugins.qmltypes
deleted file mode 100644
index d5db4b93bd..0000000000
--- a/src/imports/dialogs/plugins.qmltypes
+++ /dev/null
@@ -1,654 +0,0 @@
-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 by:
-// 'qmlplugindump -nonrelocatable -omit-prefix=__ QtQuick.Dialogs 1.1'
-
-Module {
- Component {
- name: "QQuickAbstractColorDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "showAlphaChannel"; type: "bool" }
- Property { name: "color"; type: "QColor" }
- Property { name: "currentColor"; type: "QColor" }
- Property { name: "currentHue"; type: "double"; isReadonly: true }
- Property { name: "currentSaturation"; type: "double"; isReadonly: true }
- Property { name: "currentLightness"; type: "double"; isReadonly: true }
- Property { name: "currentAlpha"; type: "double"; isReadonly: true }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setColor"
- Parameter { name: "arg"; type: "QColor" }
- }
- Method {
- name: "setCurrentColor"
- Parameter { name: "currentColor"; type: "QColor" }
- }
- Method {
- name: "setShowAlphaChannel"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAbstractDialog"
- prototype: "QObject"
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- }
- Component {
- name: "QQuickAbstractFileDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "selectExisting"; type: "bool" }
- Property { name: "selectMultiple"; type: "bool" }
- Property { name: "selectFolder"; type: "bool" }
- Property { name: "folder"; type: "QUrl" }
- Property { name: "nameFilters"; type: "QStringList" }
- Property { name: "selectedNameFilter"; type: "string" }
- Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
- Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
- Signal { name: "filterSelected" }
- Signal { name: "fileModeChanged" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setSelectExisting"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectMultiple"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectFolder"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setFolder"
- Parameter { name: "f"; type: "QUrl" }
- }
- Method {
- name: "setNameFilters"
- Parameter { name: "f"; type: "QStringList" }
- }
- Method {
- name: "selectNameFilter"
- Parameter { name: "f"; type: "string" }
- }
- }
- Component {
- name: "QQuickAbstractFontDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "scalableFonts"; type: "bool" }
- Property { name: "nonScalableFonts"; type: "bool" }
- Property { name: "monospacedFonts"; type: "bool" }
- Property { name: "proportionalFonts"; type: "bool" }
- Property { name: "font"; type: "QFont" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setFont"
- Parameter { name: "arg"; type: "QFont" }
- }
- Method {
- name: "setScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setNonScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setMonospacedFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setProportionalFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAbstractMessageDialog"
- prototype: "QQuickAbstractDialog"
- Enum {
- name: "Icon"
- values: {
- "NoIcon": 0,
- "Information": 1,
- "Warning": 2,
- "Critical": 3,
- "Question": 4
- }
- }
- Enum {
- name: "StandardButton"
- values: {
- "NoButton": 0,
- "Ok": 1024,
- "Save": 2048,
- "SaveAll": 4096,
- "Open": 8192,
- "Yes": 16384,
- "YesToAll": 32768,
- "No": 65536,
- "NoToAll": 131072,
- "Abort": 262144,
- "Retry": 524288,
- "Ignore": 1048576,
- "Close": 2097152,
- "Cancel": 4194304,
- "Discard": 8388608,
- "Help": 16777216,
- "Apply": 33554432,
- "Reset": 67108864,
- "RestoreDefaults": 134217728
- }
- }
- Enum {
- name: "StandardButtons"
- values: {
- "NoButton": 0,
- "Ok": 1024,
- "Save": 2048,
- "SaveAll": 4096,
- "Open": 8192,
- "Yes": 16384,
- "YesToAll": 32768,
- "No": 65536,
- "NoToAll": 131072,
- "Abort": 262144,
- "Retry": 524288,
- "Ignore": 1048576,
- "Close": 2097152,
- "Cancel": 4194304,
- "Discard": 8388608,
- "Help": 16777216,
- "Apply": 33554432,
- "Reset": 67108864,
- "RestoreDefaults": 134217728
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "informativeText"; type: "string" }
- Property { name: "detailedText"; type: "string" }
- Property { name: "icon"; type: "Icon" }
- Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
- Property { name: "standardButtons"; type: "StandardButtons" }
- Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
- Signal { name: "buttonClicked" }
- Signal { name: "discard" }
- Signal { name: "help" }
- Signal { name: "yes" }
- Signal { name: "no" }
- Signal { name: "apply" }
- Signal { name: "reset" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setInformativeText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setDetailedText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setIcon"
- Parameter { name: "icon"; type: "Icon" }
- }
- Method {
- name: "setStandardButtons"
- Parameter { name: "buttons"; type: "StandardButtons" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
- Parameter { type: "QMessageDialogOptions::ButtonRole" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
- }
- }
- Component {
- name: "QQuickColorDialog"
- defaultProperty: "implementation"
- prototype: "QQuickAbstractColorDialog"
- exports: ["QtQuick.Dialogs/AbstractColorDialog 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
- Component {
- name: "QQuickFileDialog"
- defaultProperty: "implementation"
- prototype: "QQuickAbstractFileDialog"
- exports: ["QtQuick.Dialogs/AbstractFileDialog 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- Method { name: "clearSelection" }
- Method {
- name: "addSelection"
- type: "bool"
- Parameter { name: "path"; type: "QUrl" }
- }
- }
- Component {
- name: "QQuickFontDialog"
- defaultProperty: "implementation"
- prototype: "QQuickAbstractFontDialog"
- exports: ["QtQuick.Dialogs/AbstractFontDialog 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
- Component {
- name: "QQuickMessageDialog"
- defaultProperty: "implementation"
- prototype: "QQuickAbstractMessageDialog"
- exports: ["QtQuick.Dialogs/AbstractMessageDialog 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
- Component {
- name: "QQuickStandardButton"
- exports: ["QtQuick.Dialogs/StandardButton 1.1"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickStandardIcon"
- exports: ["QtQuick.Dialogs/StandardIcon 1.1"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.Dialogs/ColorDialog"
- exports: ["QtQuick.Dialogs/ColorDialog 1.0"]
- exportMetaObjectRevisions: [0]
- defaultProperty: "implementation"
- Property { name: "showAlphaChannel"; type: "bool" }
- Property { name: "color"; type: "QColor" }
- Property { name: "currentColor"; type: "QColor" }
- Property { name: "currentHue"; type: "double"; isReadonly: true }
- Property { name: "currentSaturation"; type: "double"; isReadonly: true }
- Property { name: "currentLightness"; type: "double"; isReadonly: true }
- Property { name: "currentAlpha"; type: "double"; isReadonly: true }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setColor"
- Parameter { name: "arg"; type: "QColor" }
- }
- Method {
- name: "setCurrentColor"
- Parameter { name: "currentColor"; type: "QColor" }
- }
- Method {
- name: "setShowAlphaChannel"
- Parameter { name: "arg"; type: "bool" }
- }
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.Dialogs/FileDialog"
- exports: ["QtQuick.Dialogs/FileDialog 1.0"]
- exportMetaObjectRevisions: [0]
- defaultProperty: "implementation"
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Property { name: "selectExisting"; type: "bool" }
- Property { name: "selectMultiple"; type: "bool" }
- Property { name: "selectFolder"; type: "bool" }
- Property { name: "folder"; type: "QUrl" }
- Property { name: "nameFilters"; type: "QStringList" }
- Property { name: "selectedNameFilter"; type: "string" }
- Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
- Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
- Signal { name: "filterSelected" }
- Signal { name: "fileModeChanged" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setSelectExisting"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectMultiple"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectFolder"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setFolder"
- Parameter { name: "f"; type: "QUrl" }
- }
- Method {
- name: "setNameFilters"
- Parameter { name: "f"; type: "QStringList" }
- }
- Method {
- name: "selectNameFilter"
- Parameter { name: "f"; type: "string" }
- }
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- Method { name: "clearSelection" }
- Method {
- name: "addSelection"
- type: "bool"
- Parameter { name: "path"; type: "QUrl" }
- }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.Dialogs/FontDialog"
- exports: ["QtQuick.Dialogs/FontDialog 1.1"]
- exportMetaObjectRevisions: [1]
- defaultProperty: "implementation"
- Property { name: "font"; type: "QFont" }
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Property { name: "scalableFonts"; type: "bool" }
- Property { name: "nonScalableFonts"; type: "bool" }
- Property { name: "monospacedFonts"; type: "bool" }
- Property { name: "proportionalFonts"; type: "bool" }
- Property { name: "font"; type: "QFont" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setFont"
- Parameter { name: "arg"; type: "QFont" }
- }
- Method {
- name: "setScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setNonScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setMonospacedFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setProportionalFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
- Component {
- prototype: "QObject"
- name: "QtQuick.Dialogs/MessageDialog"
- exports: ["QtQuick.Dialogs/MessageDialog 1.1"]
- exportMetaObjectRevisions: [1]
- defaultProperty: "implementation"
- Method { name: "calculateImplicitWidth"; type: "QVariant" }
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Property { name: "text"; type: "string" }
- Property { name: "informativeText"; type: "string" }
- Property { name: "detailedText"; type: "string" }
- Property { name: "icon"; type: "Icon" }
- Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
- Property { name: "standardButtons"; type: "StandardButtons" }
- Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
- Signal { name: "buttonClicked" }
- Signal { name: "discard" }
- Signal { name: "help" }
- Signal { name: "yes" }
- Signal { name: "no" }
- Signal { name: "apply" }
- Signal { name: "reset" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setInformativeText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setDetailedText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setIcon"
- Parameter { name: "icon"; type: "Icon" }
- }
- Method {
- name: "setStandardButtons"
- Parameter { name: "buttons"; type: "StandardButtons" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
- Parameter { type: "QMessageDialogOptions::ButtonRole" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
- }
- Property { name: "implementation"; type: "QObject"; isPointer: true }
- }
-}
diff --git a/src/imports/dialogs/qml/Button.qml b/src/imports/dialogs/qml/Button.qml
deleted file mode 100644
index f48264d5ff..0000000000
--- a/src/imports/dialogs/qml/Button.qml
+++ /dev/null
@@ -1,86 +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 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
-import QtQuick.Window 2.1
-
-Item {
- id: container
-
- property alias text: buttonLabel.text
- property alias label: buttonLabel
- signal clicked
- property alias containsMouse: mouseArea.containsMouse
- property alias pressed: mouseArea.pressed
- implicitHeight: Math.max(Screen.pixelDensity * 7, buttonLabel.implicitHeight * 1.2)
- implicitWidth: visible ? Math.max(Screen.pixelDensity * 11, buttonLabel.implicitWidth * 1.3) : 0
- height: implicitHeight
- width: implicitWidth
-
- SystemPalette { id: palette }
-
- Rectangle {
- id: frame
- anchors.fill: parent
- color: palette.button
- gradient: Gradient {
- GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button }
- GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) }
- }
- antialiasing: true
- radius: height / 6
- border.color: Qt.darker(palette.button, 1.5)
- border.width: 1
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: container.clicked()
- hoverEnabled: true
- }
-
- Text {
- id: buttonLabel
- text: container.text
- color: palette.buttonText
- anchors.centerIn: parent
- }
-}
diff --git a/src/imports/dialogs/qml/CheckBox.qml b/src/imports/dialogs/qml/CheckBox.qml
deleted file mode 100644
index 32b0e6ff70..0000000000
--- a/src/imports/dialogs/qml/CheckBox.qml
+++ /dev/null
@@ -1,96 +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 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
-
-Item {
- id: root
- implicitHeight: frame.height
- implicitWidth: row.implicitWidth
- width: implicitWidth
- height: implicitHeight
- property alias text: label.text
- property bool checked
- property alias pressed: mouseArea.pressed
- signal clicked
-
- SystemPalette { id: palette }
-
- Row {
- id: row
- anchors.verticalCenter: parent.verticalCenter
- spacing: 6
- Rectangle {
- id: frame
- gradient: Gradient {
- GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button }
- GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) }
- }
- height: label.implicitHeight * 1.5
- width: height
- anchors.margins: 1
- radius: 3
- antialiasing: true
- border.color: Qt.darker(palette.button, 1.5)
- Image {
- id: theX
- source: "../images/checkmark.png"
- anchors.fill: frame
- anchors.margins: frame.width / 5
- fillMode: Image.PreserveAspectFit
- smooth: true
- visible: checked
- }
- }
- Text {
- id: label
- color: palette.text
- anchors.verticalCenter: frame.verticalCenter
- }
- }
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- parent.checked = !parent.checked
- parent.clicked()
- }
- }
-}
diff --git a/src/imports/dialogs/qml/ColorSlider.qml b/src/imports/dialogs/qml/ColorSlider.qml
deleted file mode 100755
index 8fc9717380..0000000000
--- a/src/imports/dialogs/qml/ColorSlider.qml
+++ /dev/null
@@ -1,138 +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 Qt Graphical Effects module.
-**
-** $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
-
-Item {
- id: colorSlider
-
- property real value: 1
- property real maximum: 1
- property real minimum: 0
- property string text: ""
- property bool pressed: mouseArea.pressed
- property bool integer: false
- property Component trackDelegate
- property string handleSource: "../images/slider_handle.png"
-
- width: parent.width
- height: handle.height + textText.implicitHeight
-
- function updatePos() {
- if (maximum > minimum) {
- var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5;
- return Math.min(Math.max(pos, 5), track.width - 5) - 10;
- } else {
- return 5;
- }
- }
-
- SystemPalette { id: palette }
-
- Column {
- id: column
- width: parent.width
- spacing: 12
- Text {
- id: textText
- anchors.horizontalCenter: parent.horizontalCenter
- text: colorSlider.text
- anchors.left: parent.left
- color: palette.windowText
- }
-
- Item {
- id: track
- height: 8
- anchors.left: parent.left
- anchors.right: parent.right
-
- Loader {
- sourceComponent: trackDelegate
- width: parent.height
- height: parent.width
- y: width
- }
-
- BorderImage {
- source: "../images/sunken_frame.png"
- border.left: 8
- border.right: 8
- border.top:8
- border.bottom: 8
- anchors.fill: track
- anchors.margins: -1
- anchors.topMargin: -2
- anchors.leftMargin: -2
- }
-
- Image {
- id: handle
- anchors.verticalCenter: parent.verticalCenter
- smooth: true
- source: "../images/slider_handle.png"
- x: updatePos() - 8
- z: 1
- }
-
- MouseArea {
- id: mouseArea
- anchors {left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
- height: handle.height
- width: handle.width
- preventStealing: true
-
- onPressed: {
- var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
- var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
- value = colorSlider.integer ? Math.round(realValue) : realValue;
- }
-
- onPositionChanged: {
- if (pressed) {
- var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
- var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
- value = colorSlider.integer ? Math.round(realValue) : realValue;
- }
- }
- }
- }
- }
-}
diff --git a/src/imports/dialogs/qml/DefaultWindowDecoration.qml b/src/imports/dialogs/qml/DefaultWindowDecoration.qml
deleted file mode 100644
index ec930101d2..0000000000
--- a/src/imports/dialogs/qml/DefaultWindowDecoration.qml
+++ /dev/null
@@ -1,71 +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 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
-
- MouseArea { anchors.fill: parent }
-
- 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 }
- clip: true
- source: "../images/window_border.png"
- anchors.centerIn: parent
- onContentChanged: if (content) content.parent = borderImage
- }
- }
-}
diff --git a/src/imports/dialogs/qml/EdgeFade.qml b/src/imports/dialogs/qml/EdgeFade.qml
deleted file mode 100644
index 376aa151e6..0000000000
--- a/src/imports/dialogs/qml/EdgeFade.qml
+++ /dev/null
@@ -1,63 +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 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
-
-ShaderEffect {
- property color fadeColor
- property real topThreshold: 10
- property real bottomThreshold: 10
- property real _topRatio: topThreshold / height
- property real _bottomRatio: bottomThreshold / height
- z: 1
- fragmentShader: "
- varying lowp vec2 qt_TexCoord0;
- uniform lowp vec4 fadeColor;
- uniform highp float _topRatio;
- uniform highp float _bottomRatio;
-
- void main() {
- highp float bottomEnd = 1. - _bottomRatio;
- gl_FragColor = fadeColor *
- (qt_TexCoord0.y < _topRatio ? 1. - qt_TexCoord0.y / _topRatio :
- (qt_TexCoord0.y > bottomEnd ? (qt_TexCoord0.y - bottomEnd) / _bottomRatio : 0.));
- }
- "
-}
diff --git a/src/imports/dialogs/qml/TextField.qml b/src/imports/dialogs/qml/TextField.qml
deleted file mode 100644
index e67155086c..0000000000
--- a/src/imports/dialogs/qml/TextField.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 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
-
-Item {
- id: root
-
- property alias textInput: textInput
- property alias text: textInput.text
- signal accepted
- signal downPressed
- signal backPressed
- signal escapePressed
- implicitWidth: textInput.implicitWidth + rect.radius * 2
- implicitHeight: textInput.implicitHeight
-
- function copyAll() {
- textInput.selectAll()
- textInput.copy()
- }
-
- function paste() {
- textInput.selectAll()
- textInput.paste()
- }
-
- SystemPalette { id: palette }
- height: textInput.implicitHeight + 8
- clip: true
-
- Rectangle {
- id: rect
- anchors.fill: parent
- radius: height / 4
- color: palette.button
- border.color: Qt.darker(palette.button, 1.5)
- }
-
- TextInput {
- id: textInput
- color: palette.text
- anchors.fill: parent
- anchors.leftMargin: rect.radius
- anchors.rightMargin: rect.radius
- verticalAlignment: Text.AlignVCenter
- onAccepted: root.accepted()
- Keys.onDownPressed: root.downPressed()
- Keys.onBackPressed: root.backPressed()
- Keys.onEscapePressed: root.escapePressed()
- }
-}
diff --git a/src/imports/dialogs/qml/qmldir b/src/imports/dialogs/qml/qmldir
deleted file mode 100644
index 9d273b1c4b..0000000000
--- a/src/imports/dialogs/qml/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-Button 1.0 Button.qml
-CheckBox 1.1 CheckBox.qml
-ColorSlider 1.0 ColorSlider.qml
-EdgeFade 1.0 EdgeFade.qml
-TextField 1.0 TextField.qml
diff --git a/src/imports/dialogs/qmldir b/src/imports/dialogs/qmldir
deleted file mode 100644
index b4ae1a059c..0000000000
--- a/src/imports/dialogs/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQuick.Dialogs
-plugin dialogplugin
-classname QtQuick2DialogsPlugin
-typeinfo plugins.qmltypes
diff --git a/src/imports/dialogs/qquickabstractcolordialog.cpp b/src/imports/dialogs/qquickabstractcolordialog.cpp
deleted file mode 100644
index 1931bde905..0000000000
--- a/src/imports/dialogs/qquickabstractcolordialog.cpp
+++ /dev/null
@@ -1,134 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractcolordialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-QQuickAbstractColorDialog::QQuickAbstractColorDialog(QObject *parent)
- : QQuickAbstractDialog(parent)
- , m_dlgHelper(0)
- , m_options(QSharedPointer<QColorDialogOptions>(new QColorDialogOptions()))
-{
- // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
- m_modality = Qt::NonModal;
- connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
-}
-
-QQuickAbstractColorDialog::~QQuickAbstractColorDialog()
-{
-}
-
-void QQuickAbstractColorDialog::setVisible(bool v)
-{
- if (helper() && v) {
- m_dlgHelper->setOptions(m_options);
- // Due to the fact that QColorDialogOptions doesn't have currentColor...
- m_dlgHelper->setCurrentColor(m_color);
- }
- QQuickAbstractDialog::setVisible(v);
- // QTBUG-35206
-#if defined(Q_OS_WIN)
- if (m_dialogWindow)
- m_dialogWindow->setWidth(m_dialogWindow->width() + 1);
-#endif
-}
-
-void QQuickAbstractColorDialog::setModality(Qt::WindowModality m)
-{
-#ifdef Q_OS_MAC
- // On the Mac, modality doesn't work unless you call exec()
- m_modality = Qt::NonModal;
- emit modalityChanged();
- return;
-#endif
- QQuickAbstractDialog::setModality(m);
-}
-
-QString QQuickAbstractColorDialog::title() const
-{
- return m_options->windowTitle();
-}
-
-bool QQuickAbstractColorDialog::showAlphaChannel() const
-{
- return m_options->testOption(QColorDialogOptions::ShowAlphaChannel);
-}
-
-void QQuickAbstractColorDialog::setTitle(const QString &t)
-{
- if (m_options->windowTitle() == t) return;
- m_options->setWindowTitle(t);
- emit titleChanged();
-}
-
-void QQuickAbstractColorDialog::setColor(QColor arg)
-{
- if (m_dlgHelper)
- m_dlgHelper->setCurrentColor(arg);
- // m_options->setCustomColor or setStandardColor don't make sense here
- if (m_color != arg) {
- m_color = arg;
- emit colorChanged();
- }
- setCurrentColor(arg);
-}
-
-void QQuickAbstractColorDialog::setCurrentColor(QColor currentColor)
-{
- if (m_currentColor != currentColor) {
- m_currentColor = currentColor;
- emit currentColorChanged();
- }
-}
-
-void QQuickAbstractColorDialog::setShowAlphaChannel(bool arg)
-{
- m_options->setOption(QColorDialogOptions::ShowAlphaChannel, arg);
- emit showAlphaChannelChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractcolordialog_p.h b/src/imports/dialogs/qquickabstractcolordialog_p.h
deleted file mode 100644
index ad2c7ce1ed..0000000000
--- a/src/imports/dialogs/qquickabstractcolordialog_p.h
+++ /dev/null
@@ -1,113 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTCOLORDIALOG_P_H
-#define QQUICKABSTRACTCOLORDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml>
-#include <QQuickView>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <qpa/qplatformtheme.h>
-#include "qquickabstractdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractColorDialog : public QQuickAbstractDialog
-{
- Q_OBJECT
- Q_PROPERTY(bool showAlphaChannel READ showAlphaChannel WRITE setShowAlphaChannel NOTIFY showAlphaChannelChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged)
- Q_PROPERTY(qreal currentHue READ currentHue NOTIFY currentColorChanged)
- Q_PROPERTY(qreal currentSaturation READ currentSaturation NOTIFY currentColorChanged)
- Q_PROPERTY(qreal currentLightness READ currentLightness NOTIFY currentColorChanged)
- Q_PROPERTY(qreal currentAlpha READ currentAlpha NOTIFY currentColorChanged)
-
-public:
- QQuickAbstractColorDialog(QObject *parent = 0);
- virtual ~QQuickAbstractColorDialog();
-
- virtual QString title() const;
- bool showAlphaChannel() const;
- QColor color() const { return m_color; }
- QColor currentColor() const { return m_currentColor; }
- qreal currentHue() const { return m_currentColor.hslHueF(); }
- qreal currentSaturation() const { return m_currentColor.hslSaturationF(); }
- qreal currentLightness() const { return m_currentColor.lightnessF(); }
- qreal currentAlpha() const { return m_currentColor.alphaF(); }
-
-public Q_SLOTS:
- void setVisible(bool v);
- void setModality(Qt::WindowModality m);
- void setTitle(const QString &t);
- void setColor(QColor arg);
- void setCurrentColor(QColor currentColor);
- void setShowAlphaChannel(bool arg);
-
-Q_SIGNALS:
- void showAlphaChannelChanged();
- void colorChanged();
- void currentColorChanged();
- void selectionAccepted();
-
-protected:
- QPlatformColorDialogHelper *m_dlgHelper;
- QSharedPointer<QColorDialogOptions> m_options;
- QColor m_color;
- QColor m_currentColor;
-
- Q_DISABLE_COPY(QQuickAbstractColorDialog)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTCOLORDIALOG_P_H
diff --git a/src/imports/dialogs/qquickabstractdialog.cpp b/src/imports/dialogs/qquickabstractdialog.cpp
deleted file mode 100644
index 9bb2388741..0000000000
--- a/src/imports/dialogs/qquickabstractdialog.cpp
+++ /dev/null
@@ -1,337 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractdialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQmlComponent>
-#include <QQuickWindow>
-#include <qpa/qplatformintegration.h>
-
-QT_BEGIN_NAMESPACE
-
-QQmlComponent *QQuickAbstractDialog::m_decorationComponent(0);
-
-QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent)
- : QObject(parent)
- , m_parentWindow(0)
- , m_visible(false)
- , m_modality(Qt::WindowModal)
- , m_qmlImplementation(0)
- , m_dialogWindow(0)
- , m_contentItem(0)
- , m_windowDecoration(0)
- , m_hasNativeWindows(QGuiApplicationPrivate::platformIntegration()->
- hasCapability(QPlatformIntegration::MultipleWindows) &&
- QGuiApplicationPrivate::platformIntegration()->
- hasCapability(QPlatformIntegration::WindowManagement))
- , m_hasAspiredPosition(false)
-{
-}
-
-QQuickAbstractDialog::~QQuickAbstractDialog()
-{
-}
-
-void QQuickAbstractDialog::setVisible(bool v)
-{
- if (m_visible == v) return;
- m_visible = v;
- if (helper()) {
- if (v) {
- Qt::WindowFlags flags = Qt::Dialog;
- if (!title().isEmpty())
- flags |= Qt::WindowTitleHint;
- m_visible = helper()->show(flags, m_modality, parentWindow());
- } else {
- helper()->hide();
- }
- } else {
- // For a pure QML implementation, there is no helper.
- // But m_implementation is probably either an Item or a Window at this point.
- if (!m_dialogWindow) {
- m_dialogWindow = qobject_cast<QWindow *>(m_qmlImplementation);
- if (!m_dialogWindow) {
- m_contentItem = qobject_cast<QQuickItem *>(m_qmlImplementation);
- if (m_contentItem) {
- if (m_hasNativeWindows)
- 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 && m_hasNativeWindows) {
- QQuickWindow *win = new QQuickWindow;
- ((QObject *)win)->setParent(this); // memory management only
- m_dialogWindow = win;
- 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<QQuickItem *>(parent());
-
- // If the platform does not support multiple windows, but the dialog is
- // 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) {
- // "grow up" to the size and position expected to achieve
- if (!m_sizeAspiration.isNull()) {
- if (m_hasAspiredPosition)
- m_dialogWindow->setGeometry(m_sizeAspiration);
- else {
- if (m_sizeAspiration.width() > 0)
- m_dialogWindow->setWidth(m_sizeAspiration.width());
- if (m_sizeAspiration.height() > 0)
- m_dialogWindow->setHeight(m_sizeAspiration.height());
- }
- }
- connect(m_dialogWindow, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool)));
- connect(m_dialogWindow, SIGNAL(xChanged(int)), this, SLOT(setX(int)));
- connect(m_dialogWindow, SIGNAL(yChanged(int)), this, SLOT(setY(int)));
- connect(m_dialogWindow, SIGNAL(widthChanged(int)), this, SLOT(setWidth(int)));
- connect(m_dialogWindow, SIGNAL(heightChanged(int)), this, SLOT(setHeight(int)));
- }
- }
- if (m_windowDecoration) {
- m_windowDecoration->setVisible(v);
- } else if (m_dialogWindow) {
- if (v) {
- m_dialogWindow->setTransientParent(parentWindow());
- m_dialogWindow->setTitle(title());
- m_dialogWindow->setModality(m_modality);
- }
- m_dialogWindow->setVisible(v);
- }
- }
-
- emit visibilityChanged();
-}
-
-void QQuickAbstractDialog::decorationLoaded()
-{
- bool ok = false;
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- while (parentItem->parentItem() && !parentItem->parentItem()->inherits("QQuickRootItem"))
- parentItem = parentItem->parentItem();
- if (m_decorationComponent->isError()) {
- qWarning() << m_decorationComponent->errors();
- } else {
- QObject *decoration = m_decorationComponent->create();
- m_windowDecoration = qobject_cast<QQuickItem *>(decoration);
- if (m_windowDecoration) {
- m_windowDecoration->setParentItem(parentItem);
- // Give the window decoration its content to manage
- QVariant contentVariant;
- contentVariant.setValue<QQuickItem*>(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;
- m_modality = m;
- emit modalityChanged();
-}
-
-void QQuickAbstractDialog::accept()
-{
- setVisible(false);
- emit accepted();
-}
-
-void QQuickAbstractDialog::reject()
-{
- setVisible(false);
- emit rejected();
-}
-
-void QQuickAbstractDialog::visibleChanged(bool v)
-{
- m_visible = v;
- emit visibilityChanged();
-}
-
-void QQuickAbstractDialog::windowGeometryChanged()
-{
- QQuickItem *content = qobject_cast<QQuickItem*>(m_qmlImplementation);
- if (m_dialogWindow && content) {
- content->setWidth(m_dialogWindow->width());
- content->setHeight(m_dialogWindow->height());
- }
-}
-
-QQuickWindow *QQuickAbstractDialog::parentWindow()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
- return m_parentWindow;
-}
-
-void QQuickAbstractDialog::setQmlImplementation(QObject *obj)
-{
- m_qmlImplementation = obj;
- if (m_dialogWindow) {
- disconnect(this, SLOT(visibleChanged(bool)));
- // Can't necessarily delete because m_dialogWindow might have been provided by the QML.
- m_dialogWindow = 0;
- }
-}
-
-int QQuickAbstractDialog::x() const
-{
- if (m_dialogWindow)
- return m_dialogWindow->x();
- return m_sizeAspiration.x();
-}
-
-int QQuickAbstractDialog::y() const
-{
- if (m_dialogWindow)
- return m_dialogWindow->y();
- return m_sizeAspiration.y();
-}
-
-int QQuickAbstractDialog::width() const
-{
- if (m_dialogWindow)
- return m_dialogWindow->width();
- return m_sizeAspiration.width();
-}
-
-int QQuickAbstractDialog::height() const
-{
- if (m_dialogWindow)
- return m_dialogWindow->height();
- return m_sizeAspiration.height();
-}
-
-void QQuickAbstractDialog::setX(int arg)
-{
- m_hasAspiredPosition = true;
- m_sizeAspiration.setX(arg);
- if (helper()) {
- // TODO
- } else if (m_dialogWindow) {
- if (sender() != m_dialogWindow)
- m_dialogWindow->setX(arg);
- } else if (m_contentItem) {
- m_contentItem->setX(arg);
- }
- emit geometryChanged();
-}
-
-void QQuickAbstractDialog::setY(int arg)
-{
- m_hasAspiredPosition = true;
- m_sizeAspiration.setY(arg);
- if (helper()) {
- // TODO
- } else if (m_dialogWindow) {
- if (sender() != m_dialogWindow)
- m_dialogWindow->setY(arg);
- } else if (m_contentItem) {
- m_contentItem->setY(arg);
- }
- emit geometryChanged();
-}
-
-void QQuickAbstractDialog::setWidth(int arg)
-{
- m_sizeAspiration.setWidth(arg);
- if (helper()) {
- // TODO
- } else if (m_dialogWindow) {
- if (sender() != m_dialogWindow)
- m_dialogWindow->setWidth(arg);
- } else if (m_contentItem) {
- m_contentItem->setWidth(arg);
- }
- emit geometryChanged();
-}
-
-void QQuickAbstractDialog::setHeight(int arg)
-{
- m_sizeAspiration.setHeight(arg);
- if (helper()) {
- // TODO
- } else if (m_dialogWindow) {
- if (sender() != m_dialogWindow)
- m_dialogWindow->setHeight(arg);
- } else if (m_contentItem) {
- m_contentItem->setHeight(arg);
- }
- emit geometryChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractdialog_p.h b/src/imports/dialogs/qquickabstractdialog_p.h
deleted file mode 100644
index 8ffa166c5b..0000000000
--- a/src/imports/dialogs/qquickabstractdialog_p.h
+++ /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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTDIALOG_P_H
-#define QQUICKABSTRACTDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml>
-#include <QQuickView>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractDialog : public QObject
-{
- Q_OBJECT
- 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)
- Q_PROPERTY(int height READ height WRITE setHeight NOTIFY geometryChanged)
-
-public:
- QQuickAbstractDialog(QObject *parent = 0);
- virtual ~QQuickAbstractDialog();
-
- bool isVisible() const { return m_visible; }
- Qt::WindowModality modality() const { return m_modality; }
- virtual QString title() const = 0;
- QObject* qmlImplementation() { return m_qmlImplementation; }
-
- int x() const;
- int y() const;
- int width() const;
- int height() const;
-
- virtual void setVisible(bool v);
- virtual void setModality(Qt::WindowModality m);
- virtual void setTitle(const QString &t) = 0;
- void setQmlImplementation(QObject* obj);
- bool isWindow() const { return m_hasNativeWindows; }
-
-public Q_SLOTS:
- void open() { setVisible(true); }
- void close() { setVisible(false); }
- void setX(int arg);
- void setY(int arg);
- void setWidth(int arg);
- void setHeight(int arg);
-
-Q_SIGNALS:
- void visibilityChanged();
- void geometryChanged();
- void modalityChanged();
- void titleChanged();
- void accepted();
- void rejected();
-
-protected Q_SLOTS:
- void decorationLoaded();
- virtual void accept();
- virtual void reject();
- void visibleChanged(bool v);
- void windowGeometryChanged();
-
-protected:
- virtual QPlatformDialogHelper *helper() = 0;
- QQuickWindow *parentWindow();
-
-protected:
- QQuickWindow *m_parentWindow;
- bool m_visible;
- Qt::WindowModality m_modality;
-
-protected: // variables for pure-QML implementations only
- QObject *m_qmlImplementation;
- QWindow *m_dialogWindow;
- QQuickItem *m_contentItem;
- QQuickItem *m_windowDecoration;
- bool m_hasNativeWindows;
- QRect m_sizeAspiration;
- bool m_hasAspiredPosition;
-
- static QQmlComponent *m_decorationComponent;
-
- friend class QtQuick2DialogsPlugin;
-
- Q_DISABLE_COPY(QQuickAbstractDialog)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickabstractfiledialog.cpp b/src/imports/dialogs/qquickabstractfiledialog.cpp
deleted file mode 100644
index 0cac801311..0000000000
--- a/src/imports/dialogs/qquickabstractfiledialog.cpp
+++ /dev/null
@@ -1,194 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractfiledialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-QQuickAbstractFileDialog::QQuickAbstractFileDialog(QObject *parent)
- : QQuickAbstractDialog(parent)
- , m_dlgHelper(0)
- , m_options(QSharedPointer<QFileDialogOptions>(new QFileDialogOptions()))
- , m_selectExisting(true)
- , m_selectMultiple(false)
- , m_selectFolder(false)
-{
- updateModes();
- connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
-}
-
-QQuickAbstractFileDialog::~QQuickAbstractFileDialog()
-{
-}
-
-void QQuickAbstractFileDialog::setVisible(bool v)
-{
- if (helper() && v) {
- m_dlgHelper->setOptions(m_options);
- m_dlgHelper->setFilter();
- emit filterSelected();
- }
- QQuickAbstractDialog::setVisible(v);
-}
-
-QString QQuickAbstractFileDialog::title() const
-{
- return m_options->windowTitle();
-}
-
-void QQuickAbstractFileDialog::setTitle(const QString &t)
-{
- if (m_options->windowTitle() == t) return;
- m_options->setWindowTitle(t);
- emit titleChanged();
-}
-
-void QQuickAbstractFileDialog::setSelectExisting(bool selectExisting)
-{
- if (selectExisting == m_selectExisting) return;
- m_selectExisting = selectExisting;
- updateModes();
-}
-
-void QQuickAbstractFileDialog::setSelectMultiple(bool selectMultiple)
-{
- if (selectMultiple == m_selectMultiple) return;
- m_selectMultiple = selectMultiple;
- updateModes();
-}
-
-void QQuickAbstractFileDialog::setSelectFolder(bool selectFolder)
-{
- if (selectFolder == m_selectFolder) return;
- m_selectFolder = selectFolder;
- updateModes();
-}
-
-QUrl QQuickAbstractFileDialog::folder()
-{
- if (m_dlgHelper && !m_dlgHelper->directory().isEmpty())
- return m_dlgHelper->directory();
- return m_options->initialDirectory();
-}
-
-void QQuickAbstractFileDialog::setFolder(const QUrl &f)
-{
- if (m_dlgHelper)
- m_dlgHelper->setDirectory(f);
- m_options->setInitialDirectory(f);
- emit folderChanged();
-}
-
-void QQuickAbstractFileDialog::setNameFilters(const QStringList &f)
-{
- m_options->setNameFilters(f);
- if (f.isEmpty())
- selectNameFilter(QString());
- else if (!f.contains(selectedNameFilter()))
- selectNameFilter(f.first());
- emit nameFiltersChanged();
-}
-
-QString QQuickAbstractFileDialog::selectedNameFilter()
-{
- QString ret;
- if (m_dlgHelper)
- ret = m_dlgHelper->selectedNameFilter();
- if (ret.isEmpty())
- return m_options->initiallySelectedNameFilter();
- return ret;
-}
-
-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);
- if (m_dlgHelper)
- m_dlgHelper->selectNameFilter(f);
- emit filterSelected();
-}
-
-QUrl QQuickAbstractFileDialog::fileUrl()
-{
- QList<QUrl> urls = fileUrls();
- return (urls.count() == 1) ? urls[0] : QUrl();
-}
-
-QList<QUrl> QQuickAbstractFileDialog::fileUrls()
-{
- if (m_dlgHelper)
- return m_dlgHelper->selectedFiles();
- return QList<QUrl>();
-}
-
-void QQuickAbstractFileDialog::updateModes()
-{
- // The 4 possible modes are AnyFile, ExistingFile, Directory, ExistingFiles
- // Assume AnyFile until we find a reason to the contrary
- QFileDialogOptions::FileMode mode = QFileDialogOptions::AnyFile;
-
- if (m_selectFolder) {
- mode = QFileDialogOptions::Directory;
- m_options->setOption(QFileDialogOptions::ShowDirsOnly);
- m_selectMultiple = false;
- m_selectExisting = true;
- setNameFilters(QStringList());
- } else if (m_selectExisting) {
- mode = m_selectMultiple ?
- QFileDialogOptions::ExistingFiles : QFileDialogOptions::ExistingFile;
- m_options->setOption(QFileDialogOptions::ShowDirsOnly, false);
- } else if (m_selectMultiple) {
- m_selectExisting = true;
- }
- if (!m_selectExisting)
- m_selectMultiple = false;
- m_options->setFileMode(mode);
- m_options->setAcceptMode(m_selectExisting ?
- QFileDialogOptions::AcceptOpen : QFileDialogOptions::AcceptSave);
- emit fileModeChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractfiledialog_p.h b/src/imports/dialogs/qquickabstractfiledialog_p.h
deleted file mode 100644
index 5ce48e8055..0000000000
--- a/src/imports/dialogs/qquickabstractfiledialog_p.h
+++ /dev/null
@@ -1,122 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTFILEDIALOG_P_H
-#define QQUICKABSTRACTFILEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml>
-#include <QQuickView>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <qpa/qplatformtheme.h>
-#include "qquickabstractdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractFileDialog : public QQuickAbstractDialog
-{
- Q_OBJECT
- 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(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)
- Q_PROPERTY(QList<QUrl> fileUrls READ fileUrls NOTIFY selectionAccepted)
-
-public:
- QQuickAbstractFileDialog(QObject *parent = 0);
- virtual ~QQuickAbstractFileDialog();
-
- virtual QString title() const;
- bool selectExisting() const { return m_selectExisting; }
- bool selectMultiple() const { return m_selectMultiple; }
- bool selectFolder() const { return m_selectFolder; }
- QUrl folder();
- QStringList nameFilters() const { return m_options->nameFilters(); }
- QString selectedNameFilter();
- QUrl fileUrl();
- virtual QList<QUrl> fileUrls();
-
-public Q_SLOTS:
- void setVisible(bool v);
- void setTitle(const QString &t);
- void setSelectExisting(bool s);
- void setSelectMultiple(bool s);
- void setSelectFolder(bool s);
- void setFolder(const QUrl &f);
- void setNameFilters(const QStringList &f);
- void selectNameFilter(const QString &f);
-
-Q_SIGNALS:
- void folderChanged();
- void nameFiltersChanged();
- void filterSelected();
- void fileModeChanged();
- void selectionAccepted();
-
-protected:
- void updateModes();
-
-protected:
- QPlatformFileDialogHelper *m_dlgHelper;
- QSharedPointer<QFileDialogOptions> m_options;
- bool m_selectExisting;
- bool m_selectMultiple;
- bool m_selectFolder;
-
- Q_DISABLE_COPY(QQuickAbstractFileDialog)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTFILEDIALOG_P_H
diff --git a/src/imports/dialogs/qquickabstractfontdialog.cpp b/src/imports/dialogs/qquickabstractfontdialog.cpp
deleted file mode 100644
index 29dd15e8cc..0000000000
--- a/src/imports/dialogs/qquickabstractfontdialog.cpp
+++ /dev/null
@@ -1,150 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractfontdialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-QQuickAbstractFontDialog::QQuickAbstractFontDialog(QObject *parent)
- : QQuickAbstractDialog(parent)
- , m_dlgHelper(0)
- , m_options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
-{
- // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
- m_modality = Qt::NonModal;
- connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
-}
-
-QQuickAbstractFontDialog::~QQuickAbstractFontDialog()
-{
-}
-
-void QQuickAbstractFontDialog::setVisible(bool v)
-{
- if (helper() && v) {
- m_dlgHelper->setOptions(m_options);
- // Due to the fact that QFontDialogOptions doesn't have currentFont...
- m_dlgHelper->setCurrentFont(m_font);
- }
- QQuickAbstractDialog::setVisible(v);
-}
-
-void QQuickAbstractFontDialog::setModality(Qt::WindowModality m)
-{
-#ifdef Q_OS_MAC
- // On the Mac, modality doesn't work unless you call exec()
- m_modality = Qt::NonModal;
- emit modalityChanged();
- return;
-#endif
- QQuickAbstractDialog::setModality(m);
-}
-
-QString QQuickAbstractFontDialog::title() const
-{
- return m_options->windowTitle();
-}
-
-bool QQuickAbstractFontDialog::scalableFonts() const
-{
- return m_options->testOption(QFontDialogOptions::ScalableFonts);
-}
-
-bool QQuickAbstractFontDialog::nonScalableFonts() const
-{
- return m_options->testOption(QFontDialogOptions::NonScalableFonts);
-}
-
-bool QQuickAbstractFontDialog::monospacedFonts() const
-{
- return m_options->testOption(QFontDialogOptions::MonospacedFonts);
-}
-
-bool QQuickAbstractFontDialog::proportionalFonts() const
-{
- return m_options->testOption(QFontDialogOptions::ProportionalFonts);
-}
-
-void QQuickAbstractFontDialog::setTitle(const QString &t)
-{
- if (m_options->windowTitle() == t) return;
- m_options->setWindowTitle(t);
- emit titleChanged();
-}
-
-void QQuickAbstractFontDialog::setFont(const QFont &arg)
-{
- if (m_font != arg) {
- m_font = arg;
- emit fontChanged();
- }
-}
-
-void QQuickAbstractFontDialog::setScalableFonts(bool arg)
-{
- m_options->setOption(QFontDialogOptions::ScalableFonts, arg);
- emit scalableFontsChanged();
-}
-
-void QQuickAbstractFontDialog::setNonScalableFonts(bool arg)
-{
- m_options->setOption(QFontDialogOptions::NonScalableFonts, arg);
- emit nonScalableFontsChanged();
-}
-
-void QQuickAbstractFontDialog::setMonospacedFonts(bool arg)
-{
- m_options->setOption(QFontDialogOptions::MonospacedFonts, arg);
- emit monospacedFontsChanged();
-}
-
-void QQuickAbstractFontDialog::setProportionalFonts(bool arg)
-{
- m_options->setOption(QFontDialogOptions::ProportionalFonts, arg);
- emit proportionalFontsChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractfontdialog_p.h b/src/imports/dialogs/qquickabstractfontdialog_p.h
deleted file mode 100644
index 858a0d3eac..0000000000
--- a/src/imports/dialogs/qquickabstractfontdialog_p.h
+++ /dev/null
@@ -1,113 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTFONTDIALOG_P_H
-#define QQUICKABSTRACTFONTDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml>
-#include <QQuickView>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <QtGui/qfont.h>
-#include <qpa/qplatformtheme.h>
-#include "qquickabstractdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractFontDialog : public QQuickAbstractDialog
-{
- Q_OBJECT
- Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
- Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
- Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
- Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
-
-public:
- QQuickAbstractFontDialog(QObject *parent = 0);
- virtual ~QQuickAbstractFontDialog();
-
- virtual QString title() const;
- bool scalableFonts() const;
- bool nonScalableFonts() const;
- bool monospacedFonts() const;
- bool proportionalFonts() const;
- QFont font() const { return m_font; }
-
-public Q_SLOTS:
- void setVisible(bool v);
- void setModality(Qt::WindowModality m);
- void setTitle(const QString &t);
- void setFont(const QFont &arg);
- void setScalableFonts(bool arg);
- void setNonScalableFonts(bool arg);
- void setMonospacedFonts(bool arg);
- void setProportionalFonts(bool arg);
-
-Q_SIGNALS:
- void scalableFontsChanged();
- void nonScalableFontsChanged();
- void monospacedFontsChanged();
- void proportionalFontsChanged();
- void fontChanged();
- void selectionAccepted();
-
-protected:
- QPlatformFontDialogHelper *m_dlgHelper;
- QSharedPointer<QFontDialogOptions> m_options;
- QFont m_font;
-
- Q_DISABLE_COPY(QQuickAbstractFontDialog)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTFONTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickabstractmessagedialog.cpp b/src/imports/dialogs/qquickabstractmessagedialog.cpp
deleted file mode 100644
index a44464962a..0000000000
--- a/src/imports/dialogs/qquickabstractmessagedialog.cpp
+++ /dev/null
@@ -1,179 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractmessagedialog_p.h"
-#include <QtGui/qpa/qplatformdialoghelper.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickAbstractMessageDialog::QQuickAbstractMessageDialog(QObject *parent)
- : QQuickAbstractDialog(parent)
- , m_dlgHelper(0)
- , m_options(QSharedPointer<QMessageDialogOptions>(new QMessageDialogOptions()))
- , m_clickedButton(NoButton)
-{
-}
-
-QQuickAbstractMessageDialog::~QQuickAbstractMessageDialog()
-{
-}
-
-void QQuickAbstractMessageDialog::setVisible(bool v)
-{
- if (helper() && v)
- m_dlgHelper->setOptions(m_options);
- if (v)
- m_clickedButton = NoButton;
- QQuickAbstractDialog::setVisible(v);
-}
-
-void QQuickAbstractMessageDialog::setTitle(const QString &arg)
-{
- if (arg != m_options->windowTitle()) {
- m_options->setWindowTitle(arg);
- emit titleChanged();
- }
-}
-
-void QQuickAbstractMessageDialog::setText(const QString &arg)
-{
- if (arg != m_options->text()) {
- m_options->setText(arg);
- emit textChanged();
- }
-}
-
-void QQuickAbstractMessageDialog::setInformativeText(const QString &arg)
-{
- if (arg != m_options->informativeText()) {
- m_options->setInformativeText(arg);
- emit informativeTextChanged();
- }
-}
-
-void QQuickAbstractMessageDialog::setDetailedText(const QString &arg)
-{
- if (arg != m_options->detailedText()) {
- m_options->setDetailedText(arg);
- emit detailedTextChanged();
- }
-}
-
-void QQuickAbstractMessageDialog::setIcon(QQuickAbstractMessageDialog::Icon icon)
-{
- if (static_cast<int>(icon) != static_cast<int>(m_options->icon())) {
- m_options->setIcon(static_cast<QMessageDialogOptions::Icon>(icon));
- emit iconChanged();
- }
-}
-
-QUrl QQuickAbstractMessageDialog::standardIconSource()
-{
- switch (m_options->icon()) {
- case QMessageDialogOptions::Information:
- return QUrl("images/information.png");
- break;
- case QMessageDialogOptions::Warning:
- return QUrl("images/warning.png");
- break;
- case QMessageDialogOptions::Critical:
- return QUrl("images/critical.png");
- break;
- case QMessageDialogOptions::Question:
- return QUrl("images/question.png");
- break;
- default:
- return QUrl();
- break;
- }
-}
-
-void QQuickAbstractMessageDialog::setStandardButtons(StandardButtons buttons)
-{
- if (buttons != m_options->standardButtons()) {
- m_options->setStandardButtons(static_cast<QMessageDialogOptions::StandardButtons>(static_cast<int>(buttons)));
- emit standardButtonsChanged();
- }
-}
-
-void QQuickAbstractMessageDialog::click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role)
-{
- setVisible(false);
- m_clickedButton = static_cast<StandardButton>(button);
- emit buttonClicked();
- switch (role) {
- case QMessageDialogOptions::AcceptRole:
- emit accept();
- break;
- case QMessageDialogOptions::RejectRole:
- emit reject();
- break;
- case QMessageDialogOptions::DestructiveRole:
- emit discard();
- break;
- case QMessageDialogOptions::HelpRole:
- emit help();
- break;
- case QMessageDialogOptions::YesRole:
- emit yes();
- break;
- case QMessageDialogOptions::NoRole:
- emit no();
- break;
- case QMessageDialogOptions::ApplyRole:
- emit apply();
- break;
- case QMessageDialogOptions::ResetRole:
- emit reset();
- break;
- default:
- qWarning("unhandled MessageDialog button %d with role %d", button, role);
- }
-}
-
-void QQuickAbstractMessageDialog::click(QQuickAbstractMessageDialog::StandardButton button)
-{
- click(static_cast<QMessageDialogOptions::StandardButton>(button),
- static_cast<QMessageDialogOptions::ButtonRole>(
- QMessageDialogOptions::buttonRole(static_cast<QMessageDialogOptions::StandardButton>(button))));
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickabstractmessagedialog_p.h b/src/imports/dialogs/qquickabstractmessagedialog_p.h
deleted file mode 100644
index f2427bb2e0..0000000000
--- a/src/imports/dialogs/qquickabstractmessagedialog_p.h
+++ /dev/null
@@ -1,165 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTMESSAGEDIALOG_P_H
-#define QQUICKABSTRACTMESSAGEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml>
-#include <QQuickView>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include <qpa/qplatformtheme.h>
-#include "qquickabstractdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractMessageDialog : public QQuickAbstractDialog
-{
- Q_OBJECT
-
- Q_ENUMS(Icon)
- Q_ENUMS(StandardButton)
- Q_FLAGS(StandardButtons)
-
- Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
- Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged)
- Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged)
- Q_PROPERTY(Icon icon READ icon WRITE setIcon NOTIFY iconChanged)
- Q_PROPERTY(QUrl standardIconSource READ standardIconSource NOTIFY iconChanged)
- Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged)
- Q_PROPERTY(StandardButton clickedButton READ clickedButton NOTIFY buttonClicked)
-
-public:
- QQuickAbstractMessageDialog(QObject *parent = 0);
- virtual ~QQuickAbstractMessageDialog();
-
- virtual QString title() const { return m_options->windowTitle(); }
- QString text() const { return m_options->text(); }
- QString informativeText() const { return m_options->informativeText(); }
- QString detailedText() const { return m_options->detailedText(); }
-
- enum Icon {
- NoIcon = QMessageDialogOptions::NoIcon,
- Information = QMessageDialogOptions::Information,
- Warning = QMessageDialogOptions::Warning,
- Critical = QMessageDialogOptions::Critical,
- Question = QMessageDialogOptions::Question
- };
-
- Icon icon() const { return static_cast<Icon>(m_options->icon()); }
-
- QUrl standardIconSource();
-
- enum StandardButton {
- NoButton = QMessageDialogOptions::NoButton,
- Ok = QMessageDialogOptions::Ok,
- Save = QMessageDialogOptions::Save,
- SaveAll = QMessageDialogOptions::SaveAll,
- Open = QMessageDialogOptions::Open,
- Yes = QMessageDialogOptions::Yes,
- YesToAll = QMessageDialogOptions::YesToAll,
- No = QMessageDialogOptions::No,
- NoToAll = QMessageDialogOptions::NoToAll,
- Abort = QMessageDialogOptions::Abort,
- Retry = QMessageDialogOptions::Retry,
- Ignore = QMessageDialogOptions::Ignore,
- Close = QMessageDialogOptions::Close,
- Cancel = QMessageDialogOptions::Cancel,
- Discard = QMessageDialogOptions::Discard,
- Help = QMessageDialogOptions::Help,
- Apply = QMessageDialogOptions::Apply,
- Reset = QMessageDialogOptions::Reset,
- RestoreDefaults = QMessageDialogOptions::RestoreDefaults
- };
- Q_DECLARE_FLAGS(StandardButtons, StandardButton)
-
- StandardButtons standardButtons() const { return static_cast<StandardButtons>(static_cast<int>(m_options->standardButtons())); }
-
- StandardButton clickedButton() const { return m_clickedButton; }
-
-public Q_SLOTS:
- virtual void setVisible(bool v);
- virtual void setTitle(const QString &arg);
- void setText(const QString &arg);
- void setInformativeText(const QString &arg);
- void setDetailedText(const QString &arg);
- void setIcon(Icon icon);
- void setStandardButtons(StandardButtons buttons);
- void click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole);
- void click(QQuickAbstractMessageDialog::StandardButton button);
-
-Q_SIGNALS:
- void textChanged();
- void informativeTextChanged();
- void detailedTextChanged();
- void iconChanged();
- void standardButtonsChanged();
- void buttonClicked();
- void discard();
- void help();
- void yes();
- void no();
- void apply();
- void reset();
-
-protected:
- QPlatformMessageDialogHelper *m_dlgHelper;
- QSharedPointer<QMessageDialogOptions> m_options;
- StandardButton m_clickedButton;
-
- Q_DISABLE_COPY(QQuickAbstractMessageDialog)
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractMessageDialog::StandardButtons)
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTMESSAGEDIALOG_P_H
diff --git a/src/imports/dialogs/qquickcolordialog.cpp b/src/imports/dialogs/qquickcolordialog.cpp
deleted file mode 100644
index d0e0e11b07..0000000000
--- a/src/imports/dialogs/qquickcolordialog.cpp
+++ /dev/null
@@ -1,119 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcolordialog_p.h"
-#include <QQuickItem>
-#include <private/qguiapplication_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype AbstractColorDialog
- \instantiates QQuickColorDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
- \brief API wrapper for QML file dialog implementations
- \since 5.1
- \internal
-
- AbstractColorDialog provides only the API for implementing a color dialog.
- The implementation (e.g. a Window or preferably an Item, in case it is
- shown on a device that doesn't support multiple windows) can be provided as
- \l implementation, which is the default property (the only allowed child
- element).
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractColorDialog::accepted
-
- This signal is emitted by \l accept().
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractColorDialog::rejected
-
- This signal is emitted by \l reject().
-*/
-
-/*!
- \class QQuickColorDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- The QQuickColorDialog class is a concrete subclass of
- \l QQuickAbstractColorDialog, but it is abstract from the QML perspective
- because it needs to enclose a graphical implementation. It exists in order
- to provide accessors and helper functions which the QML implementation will
- need.
-
- \since 5.1
-*/
-
-/*!
- Constructs a file dialog wrapper with parent window \a parent.
-*/
-QQuickColorDialog::QQuickColorDialog(QObject *parent)
- : QQuickAbstractColorDialog(parent)
-{
-}
-
-
-/*!
- Destroys the file dialog wrapper.
-*/
-QQuickColorDialog::~QQuickColorDialog()
-{
-}
-
-/*!
- \qmlproperty bool AbstractColorDialog::visible
-
- This property holds whether the dialog is visible. By default this is false.
-*/
-
-/*!
- \qmlproperty QObject AbstractColorDialog::implementation
-
- The QML object which implements the actual file dialog. Should be either a
- \l Window or an \l Item.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickcolordialog_p.h b/src/imports/dialogs/qquickcolordialog_p.h
deleted file mode 100644
index ff6953fc0f..0000000000
--- a/src/imports/dialogs/qquickcolordialog_p.h
+++ /dev/null
@@ -1,80 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCOLORDIALOG_P_H
-#define QQUICKCOLORDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractcolordialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickColorDialog : public QQuickAbstractColorDialog
-{
- Q_OBJECT
- Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
- Q_CLASSINFO("DefaultProperty", "implementation") // AbstractColorDialog in QML can have only one child
-
-public:
- explicit QQuickColorDialog(QObject *parent = 0);
- ~QQuickColorDialog();
-
-protected:
- virtual QPlatformColorDialogHelper *helper() { return 0; }
-
- Q_DISABLE_COPY(QQuickColorDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickColorDialog *)
-
-#endif // QQUICKCOLORDIALOG_P_H
diff --git a/src/imports/dialogs/qquickdialogassets_p.h b/src/imports/dialogs/qquickdialogassets_p.h
deleted file mode 100644
index 406b68a66d..0000000000
--- a/src/imports/dialogs/qquickdialogassets_p.h
+++ /dev/null
@@ -1,65 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKDIALOGASSETS_P_H
-#define QQUICKDIALOGASSETS_P_H
-
-#include <private/qtquickglobal_p.h>
-#include <QtGui/qpa/qplatformdialoghelper.h>
-#include "qquickabstractmessagedialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickStandardButton
-{
- Q_GADGET
- Q_ENUMS(QQuickAbstractMessageDialog::StandardButton)
-};
-
-class QQuickStandardIcon
-{
- Q_GADGET
- Q_ENUMS(QQuickAbstractMessageDialog::Icon)
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKDIALOGASSETS_P_H
diff --git a/src/imports/dialogs/qquickfiledialog.cpp b/src/imports/dialogs/qquickfiledialog.cpp
deleted file mode 100644
index 2ee4afc5d2..0000000000
--- a/src/imports/dialogs/qquickfiledialog.cpp
+++ /dev/null
@@ -1,172 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickfiledialog_p.h"
-#include <QQuickItem>
-#include <private/qguiapplication_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype AbstractFileDialog
- \instantiates QQuickFileDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
- \brief API wrapper for QML file dialog implementations
- \since 5.1
- \internal
-
- AbstractFileDialog provides only the API for implementing a file dialog.
- The implementation (e.g. a Window or preferably an Item, in case it is
- shown on a device that doesn't support multiple windows) can be provided as
- \l implementation, which is the default property (the only allowed child
- element).
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractFileDialog::accepted
-
- This signal is emitted by \l accept().
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractFileDialog::rejected
-
- This signal is emitted by \l reject().
-*/
-
-/*!
- \class QQuickFileDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- The QQuickFileDialog class is a concrete subclass of
- \l QQuickAbstractFileDialog, but it is abstract from the QML perspective
- because it needs to enclose a graphical implementation. It exists in order
- to provide accessors and helper functions which the QML implementation will
- need.
-
- \since 5.1
-*/
-
-/*!
- Constructs a file dialog wrapper with parent window \a parent.
-*/
-QQuickFileDialog::QQuickFileDialog(QObject *parent)
- : QQuickAbstractFileDialog(parent)
-{
-}
-
-
-/*!
- Destroys the file dialog wrapper.
-*/
-QQuickFileDialog::~QQuickFileDialog()
-{
-}
-
-QList<QUrl> QQuickFileDialog::fileUrls()
-{
- return m_selections;
-}
-
-/*!
- \qmlproperty bool AbstractFileDialog::visible
-
- This property holds whether the dialog is visible. By default this is false.
-*/
-
-/*!
- \qmlproperty bool AbstractFileDialog::fileUrls
-
- A list of files to be populated as the user chooses.
-*/
-
-/*!
- \brief Clears \l fileUrls
-*/
-void QQuickFileDialog::clearSelection()
-{
- m_selections.clear();
-}
-
-/*!
- \brief Adds one file to \l fileUrls
-
- \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(const QUrl &path)
-{
- QFileInfo info(path.toLocalFile());
- if (info.exists() && ((info.isDir() && m_selectFolder) || !info.isDir())) {
- if (m_selectFolder)
- m_selections.append(pathFolder(path.toLocalFile()));
- else
- m_selections.append(path);
- return true;
- }
- return false;
-}
-
-/*!
- \brief get a file's directory as a URL
-
- If \a path points to a directory, just convert it to a URL.
- If \a path points to a file, convert the file's directory to a URL.
-*/
-QUrl QQuickFileDialog::pathFolder(const QString &path)
-{
- QFileInfo info(path);
- if (info.exists() && info.isDir())
- return QUrl::fromLocalFile(path);
- return QUrl::fromLocalFile(QFileInfo(path).absolutePath());
-}
-
-/*!
- \qmlproperty QObject AbstractFileDialog::implementation
-
- The QML object which implements the actual file dialog. Should be either a
- \l Window or an \l Item.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickfiledialog_p.h b/src/imports/dialogs/qquickfiledialog_p.h
deleted file mode 100644
index a4c7939fda..0000000000
--- a/src/imports/dialogs/qquickfiledialog_p.h
+++ /dev/null
@@ -1,93 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKFILEDIALOG_P_H
-#define QQUICKFILEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractfiledialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickFileDialog : public QQuickAbstractFileDialog
-{
- Q_OBJECT
- Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
- Q_CLASSINFO("DefaultProperty", "implementation") // AbstractFileDialog in QML can have only one child
-
-public:
- explicit QQuickFileDialog(QObject *parent = 0);
- ~QQuickFileDialog();
- virtual QList<QUrl> fileUrls();
-
-Q_SIGNALS:
-
-public Q_SLOTS:
- void clearSelection();
- bool addSelection(const QUrl &path);
-
-protected:
- virtual QPlatformFileDialogHelper *helper() { return 0; }
- Q_INVOKABLE QString urlToPath(const QUrl &url) { return url.toLocalFile(); }
- Q_INVOKABLE QUrl pathToUrl(const QString &path) { return QUrl::fromLocalFile(path); }
- Q_INVOKABLE QUrl pathFolder(const QString &path);
-
-private:
- QList<QUrl> m_selections;
-
- Q_DISABLE_COPY(QQuickFileDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickFileDialog *)
-
-#endif // QQUICKFILEDIALOG_P_H
diff --git a/src/imports/dialogs/qquickfontdialog.cpp b/src/imports/dialogs/qquickfontdialog.cpp
deleted file mode 100644
index 2f3c6d83bb..0000000000
--- a/src/imports/dialogs/qquickfontdialog.cpp
+++ /dev/null
@@ -1,120 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickfontdialog_p.h"
-#include <QQuickItem>
-#include <private/qguiapplication_p.h>
-#include <qpa/qplatformintegration.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype AbstractFontDialog
- \instantiates QQuickFontDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
- \brief API wrapper for QML font dialog implementations
- \since 5.2
- \internal
-
- AbstractFontDialog provides only the API for implementing a font dialog.
- The implementation (e.g. a Window or preferably an Item, in case it is
- shown on a device that doesn't support multiple windows) can be provided as
- \l implementation, which is the default property (the only allowed child
- element).
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractFontDialog::accepted
-
- The \a accepted signal is emitted by \l accept().
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractFontDialog::rejected
-
- The \a accepted signal is emitted by \l reject().
-*/
-
-/*!
- \class QQuickFontDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- The QQuickFontDialog class is a concrete subclass of \l
- QQuickAbstractFontDialog, but it is abstract from the QML perspective
- because it needs to enclose a graphical implementation. It exists in order
- to provide accessors and helper functions which the QML implementation will
- need.
-
- \since 5.2
-*/
-
-/*!
- Constructs a font dialog wrapper with parent window \a parent.
-*/
-QQuickFontDialog::QQuickFontDialog(QObject *parent)
- : QQuickAbstractFontDialog(parent)
-{
-}
-
-
-/*!
- Destroys the font dialog wrapper.
-*/
-QQuickFontDialog::~QQuickFontDialog()
-{
-}
-
-/*!
- \qmlproperty bool AbstractFontDialog::visible
-
- This property holds whether the dialog is visible. By default this is false.
-*/
-
-/*!
- \qmlproperty QObject AbstractFontDialog::implementation
-
- The QML object which implements the actual font dialog. Should be either a
- \l Window or an \l Item.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickfontdialog_p.h b/src/imports/dialogs/qquickfontdialog_p.h
deleted file mode 100644
index a8e2d82e6f..0000000000
--- a/src/imports/dialogs/qquickfontdialog_p.h
+++ /dev/null
@@ -1,80 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKFONTDIALOG_P_H
-#define QQUICKFONTDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractfontdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickFontDialog : public QQuickAbstractFontDialog
-{
- Q_OBJECT
- Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
- Q_CLASSINFO("DefaultProperty", "implementation")
-
-public:
- explicit QQuickFontDialog(QObject *parent = 0);
- ~QQuickFontDialog();
-
-protected:
- virtual QPlatformFontDialogHelper *helper() { return 0; }
-
- Q_DISABLE_COPY(QQuickFontDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickFontDialog *)
-
-#endif // QQUICKFONTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickmessagedialog.cpp b/src/imports/dialogs/qquickmessagedialog.cpp
deleted file mode 100644
index 43b6ca09b4..0000000000
--- a/src/imports/dialogs/qquickmessagedialog.cpp
+++ /dev/null
@@ -1,181 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickmessagedialog_p.h"
-#include <QQuickItem>
-#include <private/qguiapplication_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype AbstractMessageDialog
- \instantiates QQuickMessageDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
- \brief API wrapper for QML message dialog implementations
- \since 5.2
- \internal
-
- AbstractMessageDialog provides only the API for implementing a message dialog.
- The implementation (e.g. a Window or preferably an Item, in case it is
- shown on a device that doesn't support multiple windows) can be provided as
- \l implementation, which is the default property (the only allowed child
- element).
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractMessageDialog::accepted
-
- This signal is emitted by \l accept().
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::AbstractMessageDialog::rejected
-
- This signal is emitted by \l reject().
-*/
-
-/*!
- \class QQuickMessageDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- The QQuickMessageDialog class is a concrete subclass of
- \l QQuickAbstractMessageDialog, but it is abstract from the QML perspective
- because it needs to enclose a graphical implementation. It exists in order
- to provide accessors and helper functions which the QML implementation will
- need.
-
- \since 5.2
-*/
-
-/*!
- Constructs a message dialog wrapper with parent window \a parent.
-*/
-QQuickMessageDialog::QQuickMessageDialog(QObject *parent)
- : QQuickAbstractMessageDialog(parent)
-{
- connect(this, SIGNAL(buttonClicked()), this, SLOT(clicked()));
-}
-
-
-/*!
- Destroys the message dialog wrapper.
-*/
-QQuickMessageDialog::~QQuickMessageDialog()
-{
-}
-
-/*!
- \qmlproperty bool AbstractMessageDialog::visible
-
- This property holds whether the dialog is visible. By default this is false.
-*/
-
-/*!
- \qmlproperty QObject AbstractMessageDialog::implementation
-
- The QML object which implements the actual message dialog. Should be either a
- \l Window or an \l Item.
-*/
-
-
-void QQuickMessageDialog::clicked() {
- switch (m_clickedButton) {
- // This mapping from buttons to roles is the same as
- // documented for enum QMessageBox::StandardButton
- case Ok:
- case Open:
- case Save:
- case SaveAll:
- case Retry:
- case Ignore:
- accept();
- break;
- case Cancel:
- case Close:
- case Abort:
- reject();
- break;
- case Discard:
- emit discard();
- close();
- break;
- case Help:
- emit help();
- break;
- case Yes:
- case YesToAll:
- emit yes();
- close();
- break;
- case No:
- case NoToAll:
- emit no();
- close();
- break;
- case Apply:
- emit apply();
- break;
- case Reset:
- case RestoreDefaults:
- emit reset();
- break;
- default:
- qWarning("StandardButton %d has no role", m_clickedButton);
- }
-}
-
-void QQuickMessageDialog::accept() {
- // enter key is treated like OK
- if (m_clickedButton == NoButton)
- m_clickedButton = Ok;
- QQuickAbstractMessageDialog::accept();
-}
-
-void QQuickMessageDialog::reject() {
- // escape key is treated like cancel
- if (m_clickedButton == NoButton)
- m_clickedButton = Cancel;
- QQuickAbstractMessageDialog::reject();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickmessagedialog_p.h b/src/imports/dialogs/qquickmessagedialog_p.h
deleted file mode 100644
index b21d8cba42..0000000000
--- a/src/imports/dialogs/qquickmessagedialog_p.h
+++ /dev/null
@@ -1,86 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKMESSAGEDIALOG_P_H
-#define QQUICKMESSAGEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractmessagedialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickMessageDialog : public QQuickAbstractMessageDialog
-{
- Q_OBJECT
- Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
- Q_CLASSINFO("DefaultProperty", "implementation") // AbstractMessageDialog in QML can have only one child
-
-public:
- explicit QQuickMessageDialog(QObject *parent = 0);
- ~QQuickMessageDialog();
-
-protected:
- virtual QPlatformDialogHelper *helper() { return 0; }
-
-protected Q_SLOTS:
- virtual void accept();
- virtual void reject();
- void clicked();
-
-private:
- Q_DISABLE_COPY(QQuickMessageDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickMessageDialog *)
-
-#endif // QQUICKMESSAGEDIALOG_P_H
diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp
deleted file mode 100644
index 11ddbfe6c7..0000000000
--- a/src/imports/dialogs/qquickplatformcolordialog.cpp
+++ /dev/null
@@ -1,254 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickplatformcolordialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickView>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ColorDialog
- \instantiates QQuickPlatformColorDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup dialogs
- \brief Dialog component for choosing a color.
- \since 5.1
-
- ColorDialog allows the user to select a color. The dialog is initially
- invisible. You need to set the properties as desired first, then set
- \l visible to true or call \l open().
-
- Here is a minimal example to open a color dialog and exit after the user
- chooses a color:
-
- \qml
- import QtQuick 2.1
- import QtQuick.Dialogs 1.0
-
- ColorDialog {
- id: colorDialog
- title: "Please choose a color"
- onAccepted: {
- console.log("You chose: " + colorDialog.color)
- Qt.quit()
- }
- onRejected: {
- console.log("Canceled")
- Qt.quit()
- }
- Component.onCompleted: visible = true
- }
- \endqml
-
- A ColorDialog window is automatically transient for its parent window. So
- whether you declare the dialog inside an \l Item or inside a \l Window, the
- dialog will appear centered over the window containing the item, or over
- the Window that you declared.
-
- The implementation of ColorDialog will be a platform color dialog if
- possible. If that isn't possible, then it will try to instantiate a
- \l QColorDialog. If that also isn't possible, then it will fall back to a QML
- implementation, DefaultColorDialog.qml. In that case you can customize the
- appearance by editing this file. DefaultColorDialog.qml contains a Rectangle
- to hold the dialog's contents, because certain embedded systems do not
- support multiple top-level windows. When the dialog becomes visible, it
- will automatically be wrapped in a Window if possible, or simply reparented
- on top of the main window if there can only be one window.
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::ColorDialog::accepted
-
- 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:
-
- \qml
- ColorDialog {
- onAccepted: { console.log("Selected color: " + color) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::ColorDialog::rejected
-
- This handler is called when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickPlatformColorDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- \brief The QQuickPlatformColorDialog class provides a color dialog
-
- The dialog is implemented via the QPlatformColorDialogHelper when possible;
- otherwise it falls back to a QColorDialog or a QML implementation.
-
- \since 5.1
-*/
-
-/*!
- Constructs a color dialog with parent window \a parent.
-*/
-QQuickPlatformColorDialog::QQuickPlatformColorDialog(QObject *parent) :
- QQuickAbstractColorDialog(parent)
-{
-}
-
-/*!
- Destroys the color dialog.
-*/
-QQuickPlatformColorDialog::~QQuickPlatformColorDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformColorDialogHelper *QQuickPlatformColorDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
- usePlatformNativeDialog(QPlatformTheme::ColorDialog) ) {
- m_dlgHelper = static_cast<QPlatformColorDialogHelper *>(QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(QPlatformTheme::ColorDialog));
- if (!m_dlgHelper)
- return m_dlgHelper;
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- connect(m_dlgHelper, SIGNAL(currentColorChanged(QColor)), this, SLOT(setCurrentColor(QColor)));
- connect(m_dlgHelper, SIGNAL(colorSelected(QColor)), this, SLOT(setColor(QColor)));
- }
-
- return m_dlgHelper;
-}
-
-/*!
- \qmlproperty bool ColorDialog::visible
-
- This property holds whether the dialog is visible. By default this is
- false.
-
- \sa modality
-*/
-
-/*!
- \qmlproperty Qt::WindowModality ColorDialog::modality
-
- Whether the dialog should be shown modal with respect to the window
- containing the dialog's parent Item, modal with respect to the whole
- application, or non-modal.
-
- By default it is \l NonModal.
-
- 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
- prevented from interacting with the parent window and/or the application
- windows at the same time.
-
- On MacOS the color dialog is only allowed to be non-modal.
-*/
-
-/*!
- \qmlmethod void ColorDialog::open()
-
- Shows the dialog to the user. It is equivalent to setting \l visible to
- true.
-*/
-
-/*!
- \qmlmethod void ColorDialog::close()
-
- Closes the dialog.
-*/
-
-/*!
- \qmlproperty string ColorDialog::title
-
- The title of the dialog window.
-*/
-
-/*!
- \qmlproperty bool ColorDialog::showAlphaChannel
-
- Whether the dialog will provide a means of changing the opacity.
-
- By default, this property is true. This property must be set to the desired
- value before opening the dialog. Usually the alpha channel is represented
- by an additional slider control.
-*/
-
-/*!
- \qmlproperty color ColorDialog::color
-
- The color which the user selected.
-
- \note This color is not always the same as the color held by the
- currentColor property since the user can choose different colors before
- finally selecting the one to use.
-
- \sa currentColor
-*/
-
-/*!
- \qmlproperty color ColorDialog::currentColor
-
- The color which the user has currently selected.
-
- For the color that is set when the dialog is accepted, use the \l color
- property.
-
- \sa color
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformcolordialog_p.h b/src/imports/dialogs/qquickplatformcolordialog_p.h
deleted file mode 100644
index 55d301da8b..0000000000
--- a/src/imports/dialogs/qquickplatformcolordialog_p.h
+++ /dev/null
@@ -1,78 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPLATFORMCOLORDIALOG_P_H
-#define QQUICKPLATFORMCOLORDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractcolordialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPlatformColorDialog : public QQuickAbstractColorDialog
-{
- Q_OBJECT
-
-public:
- QQuickPlatformColorDialog(QObject *parent = 0);
- virtual ~QQuickPlatformColorDialog();
-
-protected:
- QPlatformColorDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickPlatformColorDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPlatformColorDialog *)
-
-#endif // QQUICKPLATFORMCOLORDIALOG_P_H
diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp
deleted file mode 100644
index 066aabe336..0000000000
--- a/src/imports/dialogs/qquickplatformfiledialog.cpp
+++ /dev/null
@@ -1,314 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickplatformfiledialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickView>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype FileDialog
- \instantiates QQuickPlatformFileDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup dialogs
- \brief Dialog component for choosing files from a local filesystem.
- \since 5.1
-
- FileDialog provides a basic file chooser: it allows the user to select
- existing files and/or directories, or create new filenames. The dialog is
- initially invisible. You need to set the properties as desired first, then
- set \l visible to true or call \l open().
-
- Here is a minimal example to open a file dialog and exit after the user
- chooses a file:
-
- \qml
- import QtQuick 2.1
- import QtQuick.Dialogs 1.0
-
- FileDialog {
- id: fileDialog
- title: "Please choose a file"
- onAccepted: {
- console.log("You chose: " + fileDialog.fileUrls)
- Qt.quit()
- }
- onRejected: {
- console.log("Canceled")
- Qt.quit()
- }
- Component.onCompleted: visible = true
- }
- \endqml
-
- A FileDialog window is automatically transient for its parent window. So
- whether you declare the dialog inside an \l Item or inside a \l Window, the
- dialog will appear centered over the window containing the item, or over
- the Window that you declared.
-
- The implementation of FileDialog will be a platform file dialog if
- possible. If that isn't possible, then it will try to instantiate a
- \l QFileDialog. If that also isn't possible, then it will fall back to a QML
- implementation, DefaultFileDialog.qml. In that case you can customize the
- appearance by editing this file. DefaultFileDialog.qml contains a Rectangle
- to hold the dialog's contents, because certain embedded systems do not
- support multiple top-level windows. When the dialog becomes visible, it
- will automatically be wrapped in a Window if possible, or simply reparented
- on top of the main window if there can only be one window.
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FileDialog::accepted
-
- 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: " + fileUrl) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FileDialog::rejected
-
- This handler is called when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickPlatformFileDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- \brief The QQuickPlatformFileDialog class provides a file dialog
-
- The dialog is implemented via the QPlatformFileDialogHelper when possible;
- otherwise it falls back to a QFileDialog or a QML implementation.
-
- \since 5.1
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickPlatformFileDialog::QQuickPlatformFileDialog(QObject *parent) :
- QQuickAbstractFileDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickPlatformFileDialog::~QQuickPlatformFileDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
- usePlatformNativeDialog(QPlatformTheme::FileDialog) ) {
- m_dlgHelper = static_cast<QPlatformFileDialogHelper *>(QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(QPlatformTheme::FileDialog));
- if (!m_dlgHelper)
- return m_dlgHelper;
- connect(m_dlgHelper, SIGNAL(directoryEntered(QUrl)), this, SIGNAL(folderChanged()));
- connect(m_dlgHelper, SIGNAL(filterSelected(QString)), this, SIGNAL(filterSelected()));
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- }
-
- return m_dlgHelper;
-}
-
-/*!
- \qmlproperty bool FileDialog::visible
-
- This property holds whether the dialog is visible. By default this is
- false.
-
- \sa modality
-*/
-
-/*!
- \qmlproperty Qt::WindowModality FileDialog::modality
-
- Whether the dialog should be shown modal with respect to the window
- containing the dialog's parent Item, modal with respect to the whole
- application, or non-modal.
-
- 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
- prevented from interacting with the parent window and/or the application
- windows at the same time. You probably need to write an onAccepted handler
- to actually load or save the chosen file.
-*/
-
-/*!
- \qmlmethod void FileDialog::open()
-
- Shows the dialog to the user. It is equivalent to setting \l visible to
- true.
-*/
-
-/*!
- \qmlmethod void FileDialog::close()
-
- Closes the dialog.
-*/
-
-/*!
- \qmlproperty string FileDialog::title
-
- The title of the dialog window.
-*/
-
-/*!
- \qmlproperty bool FileDialog::selectExisting
-
- Whether only existing files or directories can be selected.
-
- By default, this property is true. This property must be set to the desired
- value before opening the dialog. Setting this property to false implies
- that the dialog is for naming a file to which to save something, or naming
- a folder to be created; therefore \l selectMultiple must be false.
-*/
-
-/*!
- \qmlproperty bool FileDialog::selectMultiple
-
- Whether more than one filename can be selected.
-
- By default, this property is false. This property must be set to the
- desired value before opening the dialog. Setting this property to true
- implies that \l selectExisting must be true.
-*/
-
-/*!
- \qmlproperty bool FileDialog::selectFolder
-
- Whether the selected item should be a folder.
-
- By default, this property is false. This property must be set to the
- desired value before opening the dialog. Setting this property to true
- implies that \l selectMultiple must be false and \l selectExisting must be
- true.
-*/
-
-/*!
- \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
- the specified folder.
-
- The value of this property is also updated after the dialog is closed.
-
- By default, this property is false.
-*/
-
-/*!
- \qmlproperty list<string> FileDialog::nameFilters
-
- A list of strings to be used as file name filters. Each string can be a
- space-separated list of filters; filters may include the ? and * wildcards.
- The list of filters can also be enclosed in parentheses and a textual
- description of the filter can be provided.
-
- For example:
-
- \qml
- FileDialog {
- nameFilters: [ "Image files (*.jpg *.png)", "All files (*)" ]
- }
- \endqml
-
- \note Directories are not excluded by filters.
- \sa selectedNameFilter
-*/
-
-/*!
- \qmlproperty string FileDialog::selectedNameFilter
-
- Which of the \l nameFilters is currently selected.
-
- This property can be set before the dialog is visible, to set the default
- name filter, and can also be set while the dialog is visible to set the
- current name filter. It is also updated when the user selects a different
- filter.
-*/
-
-/*!
- \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 be empty.
-
- \sa fileUrls
-*/
-
-/*!
- \qmlproperty list<url> FileDialog::fileUrls
-
- The list of file paths which were selected by the user.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformfontdialog.cpp b/src/imports/dialogs/qquickplatformfontdialog.cpp
deleted file mode 100644
index 46ad5eb8df..0000000000
--- a/src/imports/dialogs/qquickplatformfontdialog.cpp
+++ /dev/null
@@ -1,252 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickplatformfontdialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickView>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype FontDialog
- \instantiates QQuickPlatformFontDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup qtquick-visual
- \ingroup dialogs
- \brief Dialog component for choosing a font.
- \since 5.2
-
- FontDialog allows the user to select a font. The dialog is initially
- invisible. You need to set the properties as desired first, then set
- \l visible to true or call \l open().
-
- Here is a minimal example to open a font dialog and exit after the user
- chooses a font:
-
- \qml
- import QtQuick 2.2
- import QtQuick.Dialogs 1.1
-
- FontDialog {
- id: fontDialog
- title: "Please choose a font"
- font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
- onAccepted: {
- console.log("You chose: " + fontDialog.font)
- Qt.quit()
- }
- onRejected: {
- console.log("Canceled")
- Qt.quit()
- }
- Component.onCompleted: visible = true
- }
- \endqml
-
- A FontDialog window is automatically transient for its parent window. So
- whether you declare the dialog inside an \l Item or inside a \l Window, the
- dialog will appear centered over the window containing the item, or over
- the Window that you declared.
-
- The implementation of FontDialog will be a platform font dialog if
- possible. If that isn't possible, then it will try to instantiate a
- \l QFontDialog. If that also isn't possible, then it will fall back to a QML
- implementation, DefaultFontDialog.qml. In that case you can customize the
- appearance by editing this file. DefaultFontDialog.qml contains a Rectangle
- to hold the dialog's contents, because certain embedded systems do not
- support multiple top-level windows. When the dialog becomes visible, it
- will automatically be wrapped in a Window if possible, or simply reparented
- on top of the main window if there can only be one window.
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FontDialog::accepted
-
- The \a accepted signal is emitted when the user has finished using the
- dialog. You can then inspect the \a font property to get the selection.
-
- Example:
-
- \qml
- FontDialog {
- onAccepted: { console.log("Selected font: " + font) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FontDialog::rejected
-
- The \a rejected signal is emitted when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickPlatformFontDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- \brief The QQuickPlatformFontDialog class provides a font dialog
-
- The dialog is implemented via the QQuickPlatformFontDialogHelper when possible;
- otherwise it falls back to a QFontDialog or a QML implementation.
-
- \since 5.2
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent) :
- QQuickAbstractFontDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickPlatformFontDialog::~QQuickPlatformFontDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformFontDialogHelper *QQuickPlatformFontDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
- usePlatformNativeDialog(QPlatformTheme::FontDialog) ) {
- m_dlgHelper = static_cast<QPlatformFontDialogHelper *>(QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(QPlatformTheme::FontDialog));
- if (!m_dlgHelper)
- return m_dlgHelper;
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(setFont(const QFont&)));
- connect(m_dlgHelper, SIGNAL(fontSelected(const QFont&)), this, SLOT(setFont(const QFont&)));
- }
-
- return m_dlgHelper;
-}
-
-/*!
- \qmlproperty bool FontDialog::visible
-
- This property holds whether the dialog is visible. By default this is
- false.
-
- \sa modality
-*/
-
-/*!
- \qmlproperty Qt::WindowModality FontDialog::modality
-
- Whether the dialog should be shown modal with respect to the window
- containing the dialog's parent Item, modal with respect to the whole
- application, or non-modal.
-
- By default it is \l 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
- prevented from interacting with the parent window and/or the application
- windows at the same time. You probably need to write an onAccepted handler
- to actually load or save the chosen file.
-*/
-
-/*!
- \qmlmethod void FontDialog::open()
-
- Shows the dialog to the user. It is equivalent to setting \l visible to
- true.
-*/
-
-/*!
- \qmlmethod void FontDialog::close()
-
- Closes the dialog.
-*/
-
-/*!
- \qmlproperty string FontDialog::title
-
- The title of the dialog window.
-*/
-
-/*!
- \qmlproperty bool FontDialog::scalableFonts
-
- Whether the dialog will show scalable fonts or not.
-*/
-
-/*!
- \qmlproperty bool FontDialog::nonScalableFonts
-
- Whether the dialog will show non scalable fonts or not.
-*/
-
-/*!
- \qmlproperty bool FontDialog::monospacedFonts
-
- Whether the dialog will show monospaced fonts or not.
-*/
-
-/*!
- \qmlproperty bool FontDialog::proportionalFonts
-
- Whether the dialog will show proportional fonts or not.
-*/
-
-/*!
- \qmlproperty font FontDialog::font
-
- The font which the user selected.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformfontdialog_p.h b/src/imports/dialogs/qquickplatformfontdialog_p.h
deleted file mode 100644
index 743b24ad87..0000000000
--- a/src/imports/dialogs/qquickplatformfontdialog_p.h
+++ /dev/null
@@ -1,78 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPLATFORMFONTDIALOG_P_H
-#define QQUICKPLATFORMFONTDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractfontdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPlatformFontDialog : public QQuickAbstractFontDialog
-{
- Q_OBJECT
-
-public:
- QQuickPlatformFontDialog(QObject *parent = 0);
- virtual ~QQuickPlatformFontDialog();
-
-protected:
- QPlatformFontDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickPlatformFontDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPlatformFontDialog *)
-
-#endif // QQUICKPLATFORMFONTDIALOG_P_H
diff --git a/src/imports/dialogs/qquickplatformmessagedialog.cpp b/src/imports/dialogs/qquickplatformmessagedialog.cpp
deleted file mode 100644
index 65114100d2..0000000000
--- a/src/imports/dialogs/qquickplatformmessagedialog.cpp
+++ /dev/null
@@ -1,398 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickplatformmessagedialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <QWindow>
-#include <QQuickView>
-#include <QQuickWindow>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype MessageDialog
- \instantiates QQuickPlatformMessageDialog
- \inqmlmodule QtQuick.Dialogs 1
- \ingroup dialogs
- \brief Dialog component for displaying popup messages.
- \since 5.2
-
- The most basic use case for a MessageDialog is a popup alert. It also
- allows the user to respond in various ways depending on which buttons are
- enabled. The dialog is initially invisible. You need to set the properties
- as desired first, then set \l visible to \c true or call \l open().
-
- Here is a minimal example to show an alert and exit after the user
- responds:
-
- \qml
- import QtQuick 2.2
- import QtQuick.Dialogs 1.1
-
- MessageDialog {
- id: messageDialog
- title: "May I have your attention please"
- text: "It's so cool that you are using Qt Quick."
- onAccepted: {
- console.log("And of course you could only agree.")
- Qt.quit()
- }
- Component.onCompleted: visible = true
- }
- \endqml
-
- There are several possible handlers depending on which \l standardButtons
- the dialog has and the \l {QMessageBox::ButtonRole} {ButtonRole} of each.
- For example, the \l {rejected} {onRejected} handler will be called if the
- user presses a \gui Cancel, \gui Close or \gui Abort button.
-
- A MessageDialog window is automatically transient for its parent window. So
- whether you declare the dialog inside an \l Item or inside a \l Window, the
- dialog will appear centered over the window containing the item, or over
- the Window that you declared.
-
- The implementation of MessageDialog will be a platform message dialog if
- possible. If that isn't possible, then it will try to instantiate a
- \l QMessageBox. If that also isn't possible, then it will fall back to a QML
- implementation, \c DefaultMessageDialog.qml. In that case you can customize
- the appearance by editing this file. \c DefaultMessageDialog.qml contains a
- \l Rectangle to hold the dialog's contents, because certain embedded systems
- do not support multiple top-level windows. When the dialog becomes visible,
- it will automatically be wrapped in a \l Window if possible, or simply
- reparented on top of the main window if there can only be one window.
-*/
-
-/*!
- \qmlsignal MessageDialog::accepted()
-
- This handler is called when the user has pressed any button which has the
- \l {QMessageBox::AcceptRole} {AcceptRole}: \gui OK, \gui Open, \gui Save,
- \gui {Save All}, \gui Retry or \gui Ignore.
-*/
-
-/*!
- \qmlsignal MessageDialog::rejected()
-
- This handler is called when the user has dismissed the dialog, by closing
- the dialog window, by pressing a \gui Cancel, \gui Close or \gui Abort
- button on the dialog, or by pressing the back button or the escape key.
-*/
-
-/*!
- \qmlsignal MessageDialog::discard()
-
- This handler is called when the user has pressed the \gui Discard button.
-*/
-
-/*!
- \qmlsignal MessageDialog::help()
-
- This handler is called when the user has pressed the \gui Help button.
- Depending on platform, the dialog may not be automatically dismissed
- because the help that your application provides may need to be relevant to
- the text shown in this dialog in order to assist the user in making a
- decision. However on other platforms it's not possible to show a dialog and
- a help window at the same time. If you want to be sure that the dialog will
- close, you can set \l visible to \c false in your handler.
-*/
-
-/*!
- \qmlsignal MessageDialog::yes()
-
- This handler is called when the user has pressed any button which has
- the \l {QMessageBox::YesRole} {YesRole}: \gui Yes or \gui {Yes to All}.
-*/
-
-/*!
- \qmlsignal MessageDialog::no()
-
- This handler is called when the user has pressed any button which has
- the \l {QMessageBox::NoRole} {NoRole}: \gui No or \gui {No to All}.
-*/
-
-/*!
- \qmlsignal MessageDialog::apply()
-
- This handler is called when the user has pressed the \gui Apply button.
-*/
-
-/*!
- \qmlsignal MessageDialog::reset()
-
- This handler is called when the user has pressed any button which has
- the \l {QMessageBox::ResetRole} {ResetRole}: \gui Reset or \gui {Restore Defaults}.
-*/
-
-/*!
- \class QQuickPlatformMessageDialog
- \inmodule QtQuick.Dialogs
- \internal
-
- \brief The QQuickPlatformMessageDialog class provides a message dialog
-
- The dialog is implemented via the QPlatformMessageDialogHelper when possible;
- otherwise it falls back to a QMessageBox or a QML implementation.
-
- \since 5.2
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickPlatformMessageDialog::QQuickPlatformMessageDialog(QObject *parent) :
- QQuickAbstractMessageDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickPlatformMessageDialog::~QQuickPlatformMessageDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformMessageDialogHelper *QQuickPlatformMessageDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
- usePlatformNativeDialog(QPlatformTheme::MessageDialog) ) {
- m_dlgHelper = static_cast<QPlatformMessageDialogHelper *>(QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(QPlatformTheme::MessageDialog));
- if (!m_dlgHelper)
- return m_dlgHelper;
- // accept() shouldn't be emitted. reject() happens only if the dialog is
- // dismissed by closing the window rather than by one of its button widgets.
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- connect(m_dlgHelper, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
- this, SLOT(click(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
- }
-
- return m_dlgHelper;
-}
-
-/*!
- \qmlproperty bool MessageDialog::visible
-
- This property holds whether the dialog is visible. By default this is
- \c false.
-
- \sa modality
-*/
-
-/*!
- \qmlproperty Qt::WindowModality MessageDialog::modality
-
- Whether the dialog should be shown modal with respect to the window
- containing the dialog's parent Item, modal with respect to the whole
- application, or non-modal.
-
- 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
- prevented from interacting with the parent window and/or the application
- windows until the dialog is dismissed.
-*/
-
-/*!
- \qmlmethod void MessageDialog::open()
-
- Shows the dialog to the user. It is equivalent to setting \l visible to
- \c true.
-*/
-
-/*!
- \qmlmethod void MessageDialog::close()
-
- Closes the dialog.
-*/
-
-/*!
- \qmlproperty string MessageDialog::title
-
- The title of the dialog window.
-*/
-
-/*!
- \qmlproperty string MessageDialog::text
-
- The primary text to be displayed.
-*/
-
-/*!
- \qmlproperty string MessageDialog::informativeText
-
- The informative text that provides a fuller description for the message.
-
- Informative text can be used to supplement the \c text to give more
- information to the user. Depending on the platform, it may appear in a
- smaller font below the text, or simply appended to the text.
-
- \sa {MessageDialog::text}{text}
-*/
-
-/*!
- \qmlproperty string MessageDialog::detailedText
-
- The text to be displayed in the details area, which is hidden by default.
- The user will then be able to press the \gui {Show Details...} button to
- make it visible.
-
- \sa {MessageDialog::text}{text}
-*/
-
-/*!
- \enum QQuickStandardIcon::Icon
-
- This enum specifies a standard icon to be used on a dialog.
-*/
-
-/*!
- \qmlproperty QQuickStandardIcon::Icon MessageDialog::icon
-
- The icon of the message box can be specified with one of these values:
-
- \table
- \row
- \li no icon
- \li \l StandardIcon.NoIcon
- \li For an unadorned text alert.
- \row
- \li \inlineimage ../images/question.png "Question icon"
- \li \l StandardIcon.Question
- \li For asking a question during normal operations.
- \row
- \li \image information.png
- \li \l StandardIcon.Information
- \li For reporting information about normal operations.
- \row
- \li \image warning.png
- \li \l StandardIcon.Warning
- \li For reporting non-critical errors.
- \row
- \li \image critical.png
- \li \l StandardIcon.Critical
- \li For reporting critical errors.
- \endtable
-
- The default is \c StandardIcon.NoIcon.
-
- The enum values are the same as in \l QMessageBox::Icon.
-*/
-
-// TODO after QTBUG-35019 is fixed: fix links to this module's enums
-// rather than linking to those in QMessageBox
-/*!
- \enum QQuickStandardButton::StandardButton
-
- This enum specifies a button with a standard label to be used on a dialog.
-*/
-
-/*!
- \qmlproperty StandardButtons MessageDialog::standardButtons
-
- The MessageDialog has a row of buttons along the bottom, each of which has
- a \l {QMessageBox::ButtonRole} {ButtonRole} that determines which signal
- will be emitted when the button is pressed. You can also find out which
- specific button was pressed after the fact via the \l clickedButton
- property. You can control which buttons are available by setting
- standardButtons to a bitwise-or combination of the following flags:
-
- \table
- \row \li StandardButton.Ok \li An \gui OK button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \row \li StandardButton.Open \li An \gui Open button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \row \li StandardButton.Save \li A \gui Save button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \row \li StandardButton.Cancel \li A \gui Cancel button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
- \row \li StandardButton.Close \li A \gui Close button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
- \row \li StandardButton.Discard \li A \gui Discard or \gui {Don't Save} button, depending on the platform,
- defined with the \l {QMessageBox::DestructiveRole} {DestructiveRole}.
- \row \li StandardButton.Apply \li An \gui Apply button defined with the \l {QMessageBox::ApplyRole} {ApplyRole}.
- \row \li StandardButton.Reset \li A \gui Reset button defined with the \l {QMessageBox::ResetRole} {ResetRole}.
- \row \li StandardButton.RestoreDefaults \li A \gui {Restore Defaults} button defined with the \l {QMessageBox::ResetRole} {ResetRole}.
- \row \li StandardButton.Help \li A \gui Help button defined with the \l {QMessageBox::HelpRole} {HelpRole}.
- \row \li StandardButton.SaveAll \li A \gui {Save All} button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \row \li StandardButton.Yes \li A \gui Yes button defined with the \l {QMessageBox::YesRole} {YesRole}.
- \row \li StandardButton.YesToAll \li A \gui {Yes to All} button defined with the \l {QMessageBox::YesRole} {YesRole}.
- \row \li StandardButton.No \li A \gui No button defined with the \l {QMessageBox::NoRole} {NoRole}.
- \row \li StandardButton.NoToAll \li A \gui {No to All} button defined with the \l {QMessageBox::NoRole} {NoRole}.
- \row \li StandardButton.Abort \li An \gui Abort button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
- \row \li StandardButton.Retry \li A \gui Retry button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \row \li StandardButton.Ignore \li An \gui Ignore button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
- \endtable
-
- For example the following dialog will ask a question with 5 possible answers:
-
- \qml
- import QtQuick 2.2
- import QtQuick.Dialogs 1.1
-
- MessageDialog {
- title: "Overwrite?"
- icon: StandardIcon.Question
- text: "file.txt already exists. Replace?"
- detailedText: "To replace a file means that its existing contents will be lost. " +
- "The file that you are copying now will be copied over it instead."
- standardButtons: StandardButton.Yes | StandardButton.YesToAll |
- StandardButton.No | StandardButton.NoToAll | StandardButton.Abort
- Component.onCompleted: visible = true
- onYes: console.log("copied")
- onNo: console.log("didn't copy")
- onRejected: console.log("aborted")
- }
- \endqml
-
- \image replacefile.png
-
- The default is \c StandardButton.Ok.
-
- The enum values are the same as in \l QMessageBox::StandardButtons.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/dialogs/qquickplatformmessagedialog_p.h b/src/imports/dialogs/qquickplatformmessagedialog_p.h
deleted file mode 100644
index 61f055bb38..0000000000
--- a/src/imports/dialogs/qquickplatformmessagedialog_p.h
+++ /dev/null
@@ -1,78 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPLATFORMMESSAGEDIALOG_P_H
-#define QQUICKPLATFORMMESSAGEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickabstractmessagedialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPlatformMessageDialog : public QQuickAbstractMessageDialog
-{
- Q_OBJECT
-
-public:
- QQuickPlatformMessageDialog(QObject *parent = 0);
- virtual ~QQuickPlatformMessageDialog();
-
-protected:
- QPlatformMessageDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickPlatformMessageDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPlatformMessageDialog *)
-
-#endif // QQUICKPLATFORMMESSAGEDIALOG_P_H
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 3f15755211..f1d262a6c3 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -11,11 +11,7 @@ qtHaveModule(quick) {
qtquick2 \
particles \
window \
- dialogs-private \
- dialogs \
testlib
}
qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel
-
-qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += widgets
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 48693dbbf3..7e0de1cd4b 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -281,7 +281,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
ScopedValue values(scope, ctx->callData->args[1]);
if (values->asArrayObject()) {
ScopedArrayObject array(scope, values);
- quint32 size = array->arrayLength();
+ quint32 size = array->getLength();
QV4::ScopedValue v(scope);
for (quint32 ii = 0; ii < size; ++ii)
query.bindValue(ii, engine->toVariant((v = array->getIndexed(ii)), -1));
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index 011a39f20c..128eb9ed38 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -273,6 +273,9 @@ QSettings *QQmlSettingsPrivate::instance() const
void QQmlSettingsPrivate::init()
{
if (!initialized) {
+#ifdef SETTINGS_DEBUG
+ qDebug() << "QQmlSettings: stored at" << instance()->fileName();
+#endif
load();
initialized = true;
}
diff --git a/src/imports/widgets/plugins.qmltypes b/src/imports/widgets/plugins.qmltypes
deleted file mode 100644
index a67443c5b7..0000000000
--- a/src/imports/widgets/plugins.qmltypes
+++ /dev/null
@@ -1,302 +0,0 @@
-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 by:
-// 'qmlplugindump -nonrelocatable QtQuick.PrivateWidgets 1.1'
-
-Module {
- Component {
- name: "QQuickAbstractColorDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "showAlphaChannel"; type: "bool" }
- Property { name: "color"; type: "QColor" }
- Property { name: "currentColor"; type: "QColor" }
- Property { name: "currentHue"; type: "double"; isReadonly: true }
- Property { name: "currentSaturation"; type: "double"; isReadonly: true }
- Property { name: "currentLightness"; type: "double"; isReadonly: true }
- Property { name: "currentAlpha"; type: "double"; isReadonly: true }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setColor"
- Parameter { name: "arg"; type: "QColor" }
- }
- Method {
- name: "setCurrentColor"
- Parameter { name: "currentColor"; type: "QColor" }
- }
- Method {
- name: "setShowAlphaChannel"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAbstractDialog"
- prototype: "QObject"
- 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" }
- Property { name: "height"; type: "int" }
- Signal { name: "visibilityChanged" }
- Signal { name: "geometryChanged" }
- Signal { name: "accepted" }
- Signal { name: "rejected" }
- Method { name: "open" }
- Method { name: "close" }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- }
- Component {
- name: "QQuickAbstractFileDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "selectExisting"; type: "bool" }
- Property { name: "selectMultiple"; type: "bool" }
- Property { name: "selectFolder"; type: "bool" }
- Property { name: "folder"; type: "QUrl" }
- Property { name: "nameFilters"; type: "QStringList" }
- Property { name: "selectedNameFilter"; type: "string" }
- Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
- Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
- Signal { name: "filterSelected" }
- Signal { name: "fileModeChanged" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setSelectExisting"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectMultiple"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setSelectFolder"
- Parameter { name: "s"; type: "bool" }
- }
- Method {
- name: "setFolder"
- Parameter { name: "f"; type: "QUrl" }
- }
- Method {
- name: "setNameFilters"
- Parameter { name: "f"; type: "QStringList" }
- }
- Method {
- name: "selectNameFilter"
- Parameter { name: "f"; type: "string" }
- }
- }
- Component {
- name: "QQuickAbstractFontDialog"
- prototype: "QQuickAbstractDialog"
- Property { name: "scalableFonts"; type: "bool" }
- Property { name: "nonScalableFonts"; type: "bool" }
- Property { name: "monospacedFonts"; type: "bool" }
- Property { name: "proportionalFonts"; type: "bool" }
- Property { name: "font"; type: "QFont" }
- Signal { name: "selectionAccepted" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setModality"
- Parameter { name: "m"; type: "Qt::WindowModality" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "t"; type: "string" }
- }
- Method {
- name: "setFont"
- Parameter { name: "arg"; type: "QFont" }
- }
- Method {
- name: "setScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setNonScalableFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setMonospacedFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- Method {
- name: "setProportionalFonts"
- Parameter { name: "arg"; type: "bool" }
- }
- }
- Component {
- name: "QQuickAbstractMessageDialog"
- prototype: "QQuickAbstractDialog"
- exports: ["QtQuick.PrivateWidgets/QtMessageDialog 1.1"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Icon"
- values: {
- "NoIcon": 0,
- "Information": 1,
- "Warning": 2,
- "Critical": 3,
- "Question": 4
- }
- }
- Enum {
- name: "StandardButton"
- values: {
- "NoButton": 0,
- "Ok": 1024,
- "Save": 2048,
- "SaveAll": 4096,
- "Open": 8192,
- "Yes": 16384,
- "YesToAll": 32768,
- "No": 65536,
- "NoToAll": 131072,
- "Abort": 262144,
- "Retry": 524288,
- "Ignore": 1048576,
- "Close": 2097152,
- "Cancel": 4194304,
- "Discard": 8388608,
- "Help": 16777216,
- "Apply": 33554432,
- "Reset": 67108864,
- "RestoreDefaults": 134217728
- }
- }
- Enum {
- name: "StandardButtons"
- values: {
- "NoButton": 0,
- "Ok": 1024,
- "Save": 2048,
- "SaveAll": 4096,
- "Open": 8192,
- "Yes": 16384,
- "YesToAll": 32768,
- "No": 65536,
- "NoToAll": 131072,
- "Abort": 262144,
- "Retry": 524288,
- "Ignore": 1048576,
- "Close": 2097152,
- "Cancel": 4194304,
- "Discard": 8388608,
- "Help": 16777216,
- "Apply": 33554432,
- "Reset": 67108864,
- "RestoreDefaults": 134217728
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "informativeText"; type: "string" }
- Property { name: "detailedText"; type: "string" }
- Property { name: "icon"; type: "Icon" }
- Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
- Property { name: "standardButtons"; type: "StandardButtons" }
- Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
- Signal { name: "buttonClicked" }
- Signal { name: "discard" }
- Signal { name: "help" }
- Signal { name: "yes" }
- Signal { name: "no" }
- Signal { name: "apply" }
- Signal { name: "reset" }
- Method {
- name: "setVisible"
- Parameter { name: "v"; type: "bool" }
- }
- Method {
- name: "setTitle"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setInformativeText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setDetailedText"
- Parameter { name: "arg"; type: "string" }
- }
- Method {
- name: "setIcon"
- Parameter { name: "icon"; type: "Icon" }
- }
- Method {
- name: "setStandardButtons"
- Parameter { name: "buttons"; type: "StandardButtons" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
- Parameter { type: "QMessageDialogOptions::ButtonRole" }
- }
- Method {
- name: "click"
- Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
- }
- }
- Component {
- name: "QQuickQColorDialog"
- prototype: "QQuickAbstractColorDialog"
- exports: ["QtQuick.PrivateWidgets/QtColorDialog 1.0"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickQFileDialog"
- prototype: "QQuickAbstractFileDialog"
- exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"]
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QQuickQFontDialog"
- prototype: "QQuickAbstractFontDialog"
- exports: ["QtQuick.PrivateWidgets/QtFontDialog 1.1"]
- exportMetaObjectRevisions: [0]
- }
-}
diff --git a/src/imports/widgets/qmessageboxhelper_p.h b/src/imports/widgets/qmessageboxhelper_p.h
deleted file mode 100644
index 4f1070f97d..0000000000
--- a/src/imports/widgets/qmessageboxhelper_p.h
+++ /dev/null
@@ -1,107 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMESSAGEBOXHELPER_P_H
-#define QMESSAGEBOXHELPER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QMessageBox>
-#include "../dialogs/qquickabstractmessagedialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QMessageBoxHelper : public QPlatformMessageDialogHelper
-{
- Q_OBJECT
-public:
- QMessageBoxHelper() {
- connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
- connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
- connect(&m_dialog, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
- }
-
- virtual void exec() { m_dialog.exec(); }
-
- virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
- m_dialog.winId();
- QWindow *window = m_dialog.windowHandle();
- Q_ASSERT(window);
- window->setTransientParent(parent);
- window->setFlags(f);
- m_dialog.setWindowModality(m);
- m_dialog.setWindowTitle(QPlatformMessageDialogHelper::options()->windowTitle());
- m_dialog.setIcon(static_cast<QMessageBox::Icon>(QPlatformMessageDialogHelper::options()->icon()));
- if (!QPlatformMessageDialogHelper::options()->text().isNull())
- m_dialog.setText(QPlatformMessageDialogHelper::options()->text());
- if (!QPlatformMessageDialogHelper::options()->informativeText().isNull())
- m_dialog.setInformativeText(QPlatformMessageDialogHelper::options()->informativeText());
- if (!QPlatformMessageDialogHelper::options()->detailedText().isNull())
- m_dialog.setDetailedText(QPlatformMessageDialogHelper::options()->detailedText());
- m_dialog.setStandardButtons(static_cast<QMessageBox::StandardButtons>(static_cast<int>(
- QPlatformMessageDialogHelper::options()->standardButtons())));
- m_dialog.show();
- return m_dialog.isVisible();
- }
-
- virtual void hide() { m_dialog.hide(); }
-
- QMessageBox m_dialog;
-
-public Q_SLOTS:
- void buttonClicked(QAbstractButton* button) {
- emit clicked(static_cast<QMessageDialogOptions::StandardButton>(m_dialog.standardButton(button)),
- static_cast<QMessageDialogOptions::ButtonRole>(m_dialog.buttonRole(button)));
- }
-};
-
-QT_END_NAMESPACE
-
-#endif // QMESSAGEBOXHELPER_P_H
diff --git a/src/imports/widgets/qmldir b/src/imports/widgets/qmldir
deleted file mode 100644
index da63c98e61..0000000000
--- a/src/imports/widgets/qmldir
+++ /dev/null
@@ -1,4 +0,0 @@
-module QtQuick.PrivateWidgets
-plugin widgetsplugin
-classname QtQuick2PrivateWidgetsPlugin
-typeinfo plugins.qmltypes
diff --git a/src/imports/widgets/qquickqcolordialog.cpp b/src/imports/widgets/qquickqcolordialog.cpp
deleted file mode 100644
index ee27d147e7..0000000000
--- a/src/imports/widgets/qquickqcolordialog.cpp
+++ /dev/null
@@ -1,175 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickqcolordialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <private/qqmlcontext_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-#include <QColorDialog>
-
-QT_BEGIN_NAMESPACE
-
-class QColorDialogHelper : public QPlatformColorDialogHelper
-{
-public:
- QColorDialogHelper() :
- QPlatformColorDialogHelper()
- {
- connect(&m_dialog, SIGNAL(currentColorChanged(const QColor&)), this, SIGNAL(currentColorChanged(const QColor&)));
- connect(&m_dialog, SIGNAL(colorSelected(const QColor&)), this, SIGNAL(colorSelected(const QColor&)));
- connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
- connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
- }
-
- virtual void setCurrentColor(const QColor &c) { m_dialog.setCurrentColor(c); }
- virtual QColor currentColor() const { return m_dialog.currentColor(); }
-
- virtual void exec() { m_dialog.exec(); }
-
- virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
- 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())));
- m_dialog.show();
- return m_dialog.isVisible();
- }
-
- virtual void hide() { m_dialog.hide(); }
-
-private:
- QColorDialog m_dialog;
-};
-
-/*!
- \qmltype QtColorDialog
- \instantiates QQuickQColorDialog
- \inqmlmodule QtQuick.PrivateWidgets 1
- \ingroup qtquick-visual
- \brief Dialog component for choosing a color.
- \since 5.1
- \internal
-
- QtColorDialog provides a means to instantiate and manage a QColorDialog.
- It is not recommended to be used directly; it is an implementation
- detail of \l ColorDialog in the \l QtQuick.Dialogs module.
-
- To use this type, you will need to import the module with the following line:
- \code
- import QtQuick.PrivateWidgets 1.0
- \endcode
-*/
-
-/*!
- \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.
-
- Example:
-
- \qml
- ColorDialog {
- onAccepted: { console.log("Selected color: " + color) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::ColorDialog::rejected
-
- The \a rejected signal is emitted when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickQColorDialog
- \inmodule QtQuick.PrivateWidgets
- \internal
-
- \brief The QQuickQColorDialog class is a wrapper for a QColorDialog.
-
- \since 5.1
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickQColorDialog::QQuickQColorDialog(QObject *parent)
- : QQuickAbstractColorDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickQColorDialog::~QQuickQColorDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformColorDialogHelper *QQuickQColorDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if (!m_dlgHelper) {
- m_dlgHelper = new QColorDialogHelper();
- connect(m_dlgHelper, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(setCurrentColor(QColor)));
- connect(m_dlgHelper, SIGNAL(colorSelected(const QColor&)), this, SLOT(setColor(QColor)));
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- }
-
- return m_dlgHelper;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/widgets/qquickqcolordialog_p.h b/src/imports/widgets/qquickqcolordialog_p.h
deleted file mode 100644
index 3fb0476299..0000000000
--- a/src/imports/widgets/qquickqcolordialog_p.h
+++ /dev/null
@@ -1,78 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKQCOLORDIALOG_P_H
-#define QQUICKQCOLORDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "../dialogs/qquickabstractcolordialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickQColorDialog : public QQuickAbstractColorDialog
-{
- Q_OBJECT
-
-public:
- QQuickQColorDialog(QObject *parent = 0);
- virtual ~QQuickQColorDialog();
-
-protected:
- QPlatformColorDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickQColorDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickQColorDialog *)
-
-#endif // QQUICKQCOLORDIALOG_P_H
diff --git a/src/imports/widgets/qquickqfiledialog.cpp b/src/imports/widgets/qquickqfiledialog.cpp
deleted file mode 100644
index c3991b4f3c..0000000000
--- a/src/imports/widgets/qquickqfiledialog.cpp
+++ /dev/null
@@ -1,211 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickqfiledialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <private/qqmlcontext_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-#include <QFileDialog>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype QtFileDialog
- \instantiates QQuickQFileDialog
- \inqmlmodule QtQuick.PrivateWidgets 1
- \ingroup qtquick-visual
- \brief Dialog component for choosing files from a local filesystem.
- \since 5.1
- \internal
-
- QtFileDialog provides a means to instantiate and manage a QFileDialog.
- It is not recommended to be used directly; it is an implementation
- detail of \l FileDialog in the \l QtQuick.Dialogs module.
-
- To use this type, you will need to import the module with the following line:
- \code
- import QtQuick.PrivateWidgets 1.0
- \endcode
-*/
-
-/*!
- \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 fileUrl or \a fileUrls properties to
- get the selection.
-
- Example:
-
- \qml
- FileDialog {
- onAccepted: { console.log("Selected file: " + fileUrl) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FileDialog::rejected
-
- The \a rejected signal is emitted when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickQFileDialog
- \inmodule QtQuick.PrivateWidgets
- \internal
-
- \brief The QQuickQFileDialog class is a wrapper for a QFileDialog.
-
- \since 5.1
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickQFileDialog::QQuickQFileDialog(QObject *parent)
- : QQuickAbstractFileDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickQFileDialog::~QQuickQFileDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformFileDialogHelper *QQuickQFileDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if (!m_dlgHelper) {
- m_dlgHelper = new QFileDialogHelper();
- connect(m_dlgHelper, SIGNAL(directoryEntered(const QUrl &)), this, SIGNAL(folderChanged()));
- connect(m_dlgHelper, SIGNAL(filterSelected(const QString &)), this, SIGNAL(filterSelected()));
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- }
-
- return m_dlgHelper;
-}
-
-QFileDialogHelper::QFileDialogHelper() :
- QPlatformFileDialogHelper()
-{
- connect(&m_dialog, SIGNAL(currentChanged(const QString&)), this, SLOT(currentChanged(const QString&)));
- connect(&m_dialog, SIGNAL(directoryEntered(const QString&)), this, SLOT(directoryEntered(const QString&)));
- connect(&m_dialog, SIGNAL(fileSelected(const QString&)), this, SLOT(fileSelected(const QString&)));
- connect(&m_dialog, SIGNAL(filesSelected(const QStringList&)), this, SLOT(filesSelected(const QStringList&)));
- connect(&m_dialog, SIGNAL(filterSelected(const QString&)), this, SIGNAL(filterSelected(const QString&)));
- connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
- connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
-}
-
-QList<QUrl> QFileDialogHelper::selectedFiles() const
-{
- return m_dialog.selectedUrls();
-}
-
-void QFileDialogHelper::setFilter() {
- m_dialog.setWindowTitle(QPlatformFileDialogHelper::options()->windowTitle());
- if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::LookIn))
- m_dialog.setLabelText(m_dialog.LookIn, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::LookIn));
- if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::FileName))
- m_dialog.setLabelText(m_dialog.FileName, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::FileName));
- if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::FileType))
- m_dialog.setLabelText(m_dialog.FileType, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::FileType));
- if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::Accept))
- m_dialog.setLabelText(m_dialog.Accept, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::Accept));
- if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::Reject))
- m_dialog.setLabelText(m_dialog.Reject, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::Reject));
- m_dialog.setFilter(QPlatformFileDialogHelper::options()->filter());
- m_dialog.setNameFilters(QPlatformFileDialogHelper::options()->nameFilters());
- m_dialog.selectNameFilter(QPlatformFileDialogHelper::options()->initiallySelectedNameFilter());
- m_dialog.setFileMode(QFileDialog::FileMode(QPlatformFileDialogHelper::options()->fileMode()));
- m_dialog.setOptions((QFileDialog::Options)((int)(QPlatformFileDialogHelper::options()->options())));
- m_dialog.setAcceptMode(QFileDialog::AcceptMode(QPlatformFileDialogHelper::options()->acceptMode()));
-}
-
-bool QFileDialogHelper::show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
- m_dialog.winId();
- 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();
-}
-
-void QFileDialogHelper::currentChanged(const QString& path)
-{
- emit QPlatformFileDialogHelper::currentChanged(QUrl::fromLocalFile(path));
-}
-
-void QFileDialogHelper::directoryEntered(const QString& path)
-{
- emit QPlatformFileDialogHelper::directoryEntered(QUrl::fromLocalFile(path));
-}
-
-void QFileDialogHelper::fileSelected(const QString& path)
-{
- emit QPlatformFileDialogHelper::fileSelected(QUrl::fromLocalFile(path));
-}
-
-void QFileDialogHelper::filesSelected(const QStringList& paths)
-{
- QList<QUrl> pathUrls;
- foreach (const QString &path, paths)
- pathUrls << QUrl::fromLocalFile(path);
- emit QPlatformFileDialogHelper::filesSelected(pathUrls);
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/widgets/qquickqfiledialog_p.h b/src/imports/widgets/qquickqfiledialog_p.h
deleted file mode 100644
index 2bd364eba0..0000000000
--- a/src/imports/widgets/qquickqfiledialog_p.h
+++ /dev/null
@@ -1,107 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKQFILEDIALOG_P_H
-#define QQUICKQFILEDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QFileDialog>
-#include "../dialogs/qquickabstractfiledialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickQFileDialog : public QQuickAbstractFileDialog
-{
- Q_OBJECT
-
-public:
- QQuickQFileDialog(QObject *parent = 0);
- virtual ~QQuickQFileDialog();
-
-protected:
- QPlatformFileDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickQFileDialog)
-};
-
-class QFileDialogHelper : public QPlatformFileDialogHelper
-{
- Q_OBJECT
-public:
- QFileDialogHelper();
-
- bool defaultNameFilterDisables() const Q_DECL_OVERRIDE { return true; }
- void setDirectory(const QUrl &dir) Q_DECL_OVERRIDE { m_dialog.setDirectoryUrl(dir); }
- QUrl directory() const Q_DECL_OVERRIDE { return m_dialog.directoryUrl(); }
- void selectFile(const QUrl &f) Q_DECL_OVERRIDE { m_dialog.selectUrl(f); }
- QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
- void setFilter() Q_DECL_OVERRIDE;
- void selectNameFilter(const QString &f) Q_DECL_OVERRIDE { m_dialog.selectNameFilter(f); }
- QString selectedNameFilter() const Q_DECL_OVERRIDE { return m_dialog.selectedNameFilter(); }
- void exec() Q_DECL_OVERRIDE { m_dialog.exec(); }
- bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE { m_dialog.hide(); }
-
-private Q_SLOTS:
- void currentChanged(const QString& path);
- void directoryEntered(const QString& path);
- void fileSelected(const QString& path);
- void filesSelected(const QStringList& paths);
-
-private:
- QFileDialog m_dialog;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickQFileDialog *)
-
-#endif // QQUICKQFILEDIALOG_P_H
diff --git a/src/imports/widgets/qquickqfontdialog.cpp b/src/imports/widgets/qquickqfontdialog.cpp
deleted file mode 100644
index 6d637e1ddb..0000000000
--- a/src/imports/widgets/qquickqfontdialog.cpp
+++ /dev/null
@@ -1,178 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickqfontdialog_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <private/qqmlcontext_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-#include <QFontDialog>
-
-QT_BEGIN_NAMESPACE
-
-class QFontDialogHelper : public QPlatformFontDialogHelper
-{
-public:
- QFontDialogHelper() :
- QPlatformFontDialogHelper()
- {
- connect(&m_dialog, SIGNAL(currentFontChanged(const QFont &)), this, SIGNAL(currentFontChanged(const QFont &)));
- connect(&m_dialog, SIGNAL(fontSelected(const QFont &)), this, SIGNAL(fontSelected(const QFont &)));
- connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
- connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
- }
-
- virtual void setCurrentFont(const QFont &font) { m_dialog.setCurrentFont(font); }
- virtual QFont currentFont() const { return m_dialog.currentFont(); }
-
- virtual void exec() { m_dialog.exec(); }
-
- virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
- m_dialog.winId();
- QWindow *window = m_dialog.windowHandle();
- Q_ASSERT(window);
- window->setTransientParent(parent);
- window->setFlags(f);
- m_dialog.windowHandle()->setTransientParent(parent);
- m_dialog.windowHandle()->setFlags(f);
- m_dialog.setWindowModality(m);
- m_dialog.setWindowTitle(QPlatformFontDialogHelper::options()->windowTitle());
- m_dialog.setOptions((QFontDialog::FontDialogOptions)((int)(QPlatformFontDialogHelper::options()->options())));
- m_dialog.show();
- return m_dialog.isVisible();
- }
-
- virtual void hide() { m_dialog.hide(); }
-
-private:
- QFontDialog m_dialog;
-};
-
-/*!
- \qmltype QtFontDialog
- \instantiates QQuickQFontDialog
- \inqmlmodule QtQuick.PrivateWidgets 1
- \ingroup qtquick-visual
- \brief Dialog component for choosing files from a local filesystem.
- \since 5.2
- \internal
-
- QtFontDialog provides a means to instantiate and manage a QFontDialog.
- It is not recommended to be used directly; it is an implementation
- detail of \l FontDialog in the \l QtQuick.Dialogs module.
-
- To use this type, you will need to import the module with the following line:
- \code
- import QtQuick.PrivateWidgets 1.1
- \endcode
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FontDialog::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
- get the selection.
-
- Example:
-
- \qml
- FontDialog {
- onAccepted: { console.log("Selected file: " + filePath) }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::FontDialog::rejected
-
- The \a rejected signal is emitted when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickQFontDialog
- \inmodule QtQuick.PrivateWidgets
- \internal
-
- \brief The QQuickQFontDialog class is a wrapper for a QFontDialog.
-
- \since 5.2
-*/
-
-/*!
- Constructs a file dialog with parent window \a parent.
-*/
-QQuickQFontDialog::QQuickQFontDialog(QObject *parent)
- : QQuickAbstractFontDialog(parent)
-{
-}
-
-/*!
- Destroys the file dialog.
-*/
-QQuickQFontDialog::~QQuickQFontDialog()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformFontDialogHelper *QQuickQFontDialog::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if (!m_dlgHelper) {
- m_dlgHelper = new QFontDialogHelper();
- connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(setFont(const QFont &)));
- connect(m_dlgHelper, SIGNAL(fontSelected(const QFont &)), this, SLOT(setFont(const QFont &)));
- connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
- connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
- }
-
- return m_dlgHelper;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/widgets/qquickqfontdialog_p.h b/src/imports/widgets/qquickqfontdialog_p.h
deleted file mode 100644
index 6efd15995b..0000000000
--- a/src/imports/widgets/qquickqfontdialog_p.h
+++ /dev/null
@@ -1,78 +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 QtQuick.Dialogs module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKQFONTDIALOG_P_H
-#define QQUICKQFONTDIALOG_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "../dialogs/qquickabstractfontdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickQFontDialog : public QQuickAbstractFontDialog
-{
- Q_OBJECT
-
-public:
- QQuickQFontDialog(QObject *parent = 0);
- virtual ~QQuickQFontDialog();
-
-protected:
- QPlatformFontDialogHelper *helper();
-
- Q_DISABLE_COPY(QQuickQFontDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickQFontDialog *)
-
-#endif // QQUICKQFONTDIALOG_P_H
diff --git a/src/imports/widgets/qquickqmessagebox.cpp b/src/imports/widgets/qquickqmessagebox.cpp
deleted file mode 100644
index 1b92efc5ef..0000000000
--- a/src/imports/widgets/qquickqmessagebox.cpp
+++ /dev/null
@@ -1,144 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickqmessagebox_p.h"
-#include "qmessageboxhelper_p.h"
-#include "qquickitem.h"
-
-#include <private/qguiapplication_p.h>
-#include <private/qqmlcontext_p.h>
-#include <QWindow>
-#include <QQuickWindow>
-#include <QMessageBox>
-#include <QAbstractButton>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype QtMessageDialog
- \instantiates QQuickQMessageBox
- \inqmlmodule QtQuick.PrivateWidgets 1
- \ingroup qtquick-visual
- \brief Dialog component for choosing a color.
- \since 5.2
- \internal
-
- QtMessageDialog provides a means to instantiate and manage a QMessageBox.
- It is not recommended to be used directly; it is an implementation
- detail of \l MessageDialog in the \l QtQuick.Dialogs module.
-
- To use this type, you will need to import the module with the following line:
- \code
- import QtQuick.PrivateWidgets 1.1
- \endcode
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::MessageDialog::accepted
-
- The \a accepted signal is emitted when the user has pressed the OK button
- on the dialog.
-
- Example:
-
- \qml
- MessageDialog {
- onAccepted: { console.log("accepted") }
- }
- \endqml
-*/
-
-/*!
- \qmlsignal QtQuick::Dialogs::MessageDialog::rejected
-
- The \a rejected signal is emitted when the user has dismissed the dialog,
- either by closing the dialog window or by pressing the Cancel button.
-*/
-
-/*!
- \class QQuickQMessageBox
- \inmodule QtQuick.PrivateWidgets
- \internal
-
- \brief The QQuickQMessageBox class is a wrapper for a QMessageBox.
-
- \since 5.2
-*/
-
-/*!
- Constructs a message dialog with parent window \a parent.
-*/
-QQuickQMessageBox::QQuickQMessageBox(QObject *parent)
- : QQuickAbstractMessageDialog(parent)
-{
-}
-
-/*!
- Destroys the message dialog.
-*/
-QQuickQMessageBox::~QQuickQMessageBox()
-{
- if (m_dlgHelper)
- m_dlgHelper->hide();
- delete m_dlgHelper;
-}
-
-QPlatformDialogHelper *QQuickQMessageBox::helper()
-{
- QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
- if (parentItem)
- m_parentWindow = parentItem->window();
-
- if (!QQuickAbstractMessageDialog::m_dlgHelper) {
- QMessageBoxHelper* helper = new QMessageBoxHelper();
- QQuickAbstractMessageDialog::m_dlgHelper = helper;
- // accept() shouldn't be emitted. reject() happens only if the dialog is
- // dismissed by closing the window rather than by one of its button widgets.
- connect(helper, SIGNAL(accept()), this, SLOT(accept()));
- connect(helper, SIGNAL(reject()), this, SLOT(reject()));
- connect(helper, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
- this, SLOT(click(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
- }
-
- return QQuickAbstractMessageDialog::m_dlgHelper;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/widgets/qquickqmessagebox_p.h b/src/imports/widgets/qquickqmessagebox_p.h
deleted file mode 100644
index be91f1d02b..0000000000
--- a/src/imports/widgets/qquickqmessagebox_p.h
+++ /dev/null
@@ -1,77 +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 QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKQMESSAGEBOX_P_H
-#define QQUICKQMESSAGEBOX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "../dialogs/qquickabstractmessagedialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickQMessageBox : public QQuickAbstractMessageDialog
-{
-public:
- QQuickQMessageBox(QObject *parent = 0);
- virtual ~QQuickQMessageBox();
-
-protected:
- virtual QPlatformDialogHelper *helper();
-
-protected:
- Q_DISABLE_COPY(QQuickQMessageBox)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickQMessageBox *)
-
-#endif // QQUICKQMESSAGEBOX_P_H
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
deleted file mode 100644
index 5320838082..0000000000
--- a/src/imports/widgets/widgets.pro
+++ /dev/null
@@ -1,32 +0,0 @@
-CXX_MODULE = qml
-TARGET = widgetsplugin
-TARGETPATH = QtQuick/PrivateWidgets
-IMPORT_VERSION = 1.1
-
-SOURCES += \
- qquickqmessagebox.cpp \
- ../dialogs/qquickabstractmessagedialog.cpp \
- qquickqfiledialog.cpp \
- ../dialogs/qquickabstractfiledialog.cpp \
- qquickqcolordialog.cpp \
- ../dialogs/qquickabstractcolordialog.cpp \
- qquickqfontdialog.cpp \
- ../dialogs/qquickabstractfontdialog.cpp \
- ../dialogs/qquickabstractdialog.cpp \
- widgetsplugin.cpp
-
-HEADERS += \
- qquickqmessagebox_p.h \
- qmessageboxhelper_p.h \
- ../dialogs/qquickabstractmessagedialog_p.h \
- qquickqfiledialog_p.h \
- ../dialogs/qquickabstractfiledialog_p.h \
- qquickqcolordialog_p.h \
- ../dialogs/qquickabstractcolordialog_p.h \
- qquickqfontdialog_p.h \
- ../dialogs/qquickabstractfontdialog_p.h \
- ../dialogs/qquickabstractdialog_p.h
-
-QT += quick-private gui-private core-private qml-private widgets
-
-load(qml_plugin)
diff --git a/src/imports/widgets/widgetsplugin.cpp b/src/imports/widgets/widgetsplugin.cpp
deleted file mode 100644
index 05c3a5e86c..0000000000
--- a/src/imports/widgets/widgetsplugin.cpp
+++ /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 plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqmlextensionplugin.h>
-#include <QtQml/qqml.h>
-#include "qquickqmessagebox_p.h"
-#include "qquickqfiledialog_p.h"
-#include "qquickqcolordialog_p.h"
-#include "qquickqfontdialog_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlmodule QtQuick.PrivateWidgets 1
- \title QWidget QML Types
- \ingroup qmlmodules
- \brief Provides QML types for certain QWidgets
- \internal
-
- This QML module contains types which should not be depended upon in Qt Quick
- applications, but are available if the Widgets module is linked. It is
- recommended to load components from this module conditionally, if at all,
- and to provide fallback implementations in case they fail to load.
-
- \code
- import QtQuick.PrivateWidgets 1.1
- \endcode
-
- \since 5.1
-*/
-
-class QtQuick2PrivateWidgetsPlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
-
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.PrivateWidgets"));
-
- qmlRegisterType<QQuickQMessageBox>(uri, 1, 1, "QtMessageDialog");
- qmlRegisterType<QQuickQFileDialog>(uri, 1, 0, "QtFileDialog");
- qmlRegisterType<QQuickQColorDialog>(uri, 1, 0, "QtColorDialog");
- qmlRegisterType<QQuickQFontDialog>(uri, 1, 1, "QtFontDialog");
- }
-};
-
-QT_END_NAMESPACE
-
-#include "widgetsplugin.moc"
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 97dc3aba1f..ebfdad5cbf 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -925,10 +925,12 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
Scope scope(v4engine);
Scoped<Object> o(scope, v4engine->newObject());
+ ScopedString name(scope);
+ ScopedValue value(scope);
for (int ii = 0; ii < d->roleObjects.count(); ++ii) {
- ScopedString name(scope, v4engine->newIdentifier(d->roleObjects[ii]->name()));
- Property *p = o->insertMember(name, PropertyAttributes());
- p->value = v8engine->fromVariant(d->data.value(ii).value(index));
+ name = v4engine->newIdentifier(d->roleObjects[ii]->name());
+ value = v8engine->fromVariant(d->data.value(ii).value(index));
+ o->insertMember(name, value);
}
return QQmlV4Handle(o);
diff --git a/src/plugins/accessible/shared/qqmlaccessible.cpp b/src/plugins/accessible/shared/qqmlaccessible.cpp
index d08f9bdb2c..ecf4e56acf 100644
--- a/src/plugins/accessible/shared/qqmlaccessible.cpp
+++ b/src/plugins/accessible/shared/qqmlaccessible.cpp
@@ -185,7 +185,7 @@ void QQmlAccessible::doAction(const QString &actionName)
// use the "stepSize" property on the item
if (QAccessibleValueInterface *valueIface = valueInterface()) {
QVariant valueV = valueIface->currentValue();
- qreal newValue = valueV.toInt();
+ qreal newValue = valueV.toReal();
QVariant stepSizeV = object()->property("stepSize");
qreal stepSize = stepSizeV.isValid() ? stepSizeV.toReal() : qreal(1.0);
diff --git a/src/qml/compiler/compiler.pri b/src/qml/compiler/compiler.pri
index df4f5e8dc3..b2569f9111 100644
--- a/src/qml/compiler/compiler.pri
+++ b/src/qml/compiler/compiler.pri
@@ -15,7 +15,8 @@ HEADERS += \
$$PWD/qv4ssa_p.h \
$$PWD/qv4regalloc_p.h \
$$PWD/qqmlcodegenerator_p.h \
- $$PWD/qv4isel_masm_p.h
+ $$PWD/qv4isel_masm_p.h \
+ $$PWD/qqmltypecompiler_p.h
SOURCES += \
$$PWD/qv4compileddata.cpp \
@@ -28,6 +29,7 @@ SOURCES += \
$$PWD/qv4ssa.cpp \
$$PWD/qv4regalloc.cpp \
$$PWD/qqmlcodegenerator.cpp \
- $$PWD/qv4isel_masm.cpp
+ $$PWD/qv4isel_masm.cpp \
+ $$PWD/qqmltypecompiler.cpp
include(../../3rdparty/masm/masm.pri)
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 13b23fde68..f0dfc9b7ea 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -64,6 +64,21 @@ using namespace QtQml;
return false; \
}
+void QmlObject::init(MemoryPool *pool, int typeNameIndex, int id, const AST::SourceLocation &loc)
+{
+ inheritedTypeNameIndex = typeNameIndex;
+
+ location.line = loc.startLine;
+ location.column = loc.startColumn;
+
+ idIndex = id;
+ indexOfDefaultProperty = -1;
+ properties = pool->New<PoolList<QmlProperty> >();
+ qmlSignals = pool->New<PoolList<Signal> >();
+ bindings = pool->New<PoolList<Binding> >();
+ functions = pool->New<PoolList<Function> >();
+}
+
void QmlObject::dump(DebugStream &out)
{
out << inheritedTypeNameIndex << " {" << endl;
@@ -82,8 +97,9 @@ QStringList Signal::parameterStringList(const QStringList &stringPool) const
return result;
}
-QQmlCodeGenerator::QQmlCodeGenerator()
- : _object(0)
+QQmlCodeGenerator::QQmlCodeGenerator(const QSet<QString> &illegalNames)
+ : illegalNames(illegalNames)
+ , _object(0)
, jsGenerator(0)
{
}
@@ -292,10 +308,8 @@ bool QQmlCodeGenerator::sanityCheckFunctionNames()
if (name.at(0).isUpper())
COMPILE_EXCEPTION(function->identifierToken, tr("Method names cannot begin with an upper case letter"));
-#if 0 // ###
- if (enginePrivate->v8engine()->illegalNames().contains(currSlot.name.toString()))
- COMPILE_EXCEPTION(&currSlot, tr("Illegal method name"));
-#endif
+ if (illegalNames.contains(name))
+ COMPILE_EXCEPTION(function->identifierToken, tr("Illegal method name"));
}
return true;
}
@@ -307,20 +321,10 @@ int QQmlCodeGenerator::defineQMLObject(AST::UiQualifiedId *qualifiedTypeNameId,
const int objectIndex = _objects.size() - 1;
qSwap(_object, obj);
- _object->inheritedTypeNameIndex = registerString(asString(qualifiedTypeNameId));
-
AST::SourceLocation loc;
if (qualifiedTypeNameId)
loc = qualifiedTypeNameId->firstSourceLocation();
- _object->location.line = loc.startLine;
- _object->location.column = loc.startColumn;
-
- _object->idIndex = emptyStringIndex;
- _object->indexOfDefaultProperty = -1;
- _object->properties = New<PoolList<QmlProperty> >();
- _object->qmlSignals = New<PoolList<Signal> >();
- _object->bindings = New<PoolList<Binding> >();
- _object->functions = New<PoolList<Function> >();
+ _object->init(pool, registerString(asString(qualifiedTypeNameId)), emptyStringIndex, loc);
QSet<QString> propertyNames;
qSwap(_propertyNames, propertyNames);
@@ -589,10 +593,8 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
if (signalName.at(0).isUpper())
COMPILE_EXCEPTION(node->identifierToken, tr("Signal names cannot begin with an upper case letter"));
-#if 0 // ### cannot access identifier table from separate thread
- if (enginePrivate->v8engine()->illegalNames().contains(currSig.name.toString()))
- COMPILE_EXCEPTION(&currSig, tr("Illegal signal name"));
-#endif
+ if (illegalNames.contains(signalName))
+ COMPILE_EXCEPTION(node->identifierToken, tr("Illegal signal name"));
_object->qmlSignals->append(signal);
} else {
@@ -739,6 +741,10 @@ bool QQmlCodeGenerator::visit(AST::UiSourceElement *node)
if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
_functions << funDecl;
Function *f = New<Function>();
+ f->functionDeclaration = funDecl;
+ AST::SourceLocation loc = funDecl->firstSourceLocation();
+ f->location.line = loc.startLine;
+ f->location.column = loc.startColumn;
f->index = _functions.size() - 1;
_object->functions->append(f);
} else {
@@ -926,12 +932,11 @@ bool QQmlCodeGenerator::setId(AST::Statement *value)
COMPILE_EXCEPTION(loc, tr( "IDs must contain only letters, numbers, and underscores"));
}
-#if 0 // ###
- if (enginePrivate->v8engine()->illegalNames().contains(str))
- COMPILE_EXCEPTION(v, tr( "ID illegally masks global JavaScript property"));
-#endif
+ QString idQString(str.toString());
+ if (illegalNames.contains(idQString))
+ COMPILE_EXCEPTION(loc, tr( "ID illegally masks global JavaScript property"));
- _object->idIndex = registerString(str.toString());
+ _object->idIndex = registerString(idQString);
_object->locationOfIdProperty.line = loc.startLine;
_object->locationOfIdProperty.column = loc.startColumn;
@@ -987,13 +992,8 @@ bool QQmlCodeGenerator::sanityCheckPropertyName(const AST::SourceLocation &nameL
if (name.at(0).isUpper())
COMPILE_EXCEPTION(nameLocation, tr("Property names cannot begin with an upper case letter"));
-#if 0 // ### how to check against illegalNames when in separate thread?
- if (enginePrivate->v8engine()->illegalNames().contains(prop.name.toString())) {
- COMPILE_EXCEPTION_LOCATION(prop.nameLocation.line,
- prop.nameLocation.column,
- tr("Illegal property name"));
- }
-#endif
+ if (illegalNames.contains(name))
+ COMPILE_EXCEPTION(nameLocation, tr("Illegal property name"));
return true;
}
@@ -1625,11 +1625,16 @@ SignalHandlerConverter::SignalHandlerConverter(QQmlEnginePrivate *enginePrivate,
bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclarations()
{
- foreach (QmlObject *obj, parsedQML->objects) {
+ for (int objectIndex = 0; objectIndex < parsedQML->objects.count(); ++objectIndex) {
+ QmlObject * const obj = parsedQML->objects.at(objectIndex);
QString elementName = stringAt(obj->inheritedTypeNameIndex);
if (elementName.isEmpty())
continue;
- QQmlPropertyCache *cache = unit->resolvedTypes[obj->inheritedTypeNameIndex].createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
+ QQmlCompiledData::TypeReference &tr = unit->resolvedTypes[obj->inheritedTypeNameIndex];
+ if (tr.type && tr.type->customParser())
+ continue;
+ QQmlPropertyCache *cache = unit->propertyCaches.value(objectIndex);
+ Q_ASSERT(cache);
if (!convertSignalHandlerExpressionsToFunctionDeclarations(obj, elementName, cache))
return false;
}
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index 0a0e4f2d5b..4b126ef5ea 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -135,6 +135,8 @@ struct Binding : public QV4::CompiledData::Binding
struct Function
{
+ AST::FunctionDeclaration *functionDeclaration;
+ QV4::CompiledData::Location location;
int index; // index in parsedQML::functions
Function *next;
};
@@ -153,6 +155,8 @@ struct QmlObject
PoolList<Binding> *bindings;
PoolList<Function> *functions;
+ void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const AST::SourceLocation &location = AST::SourceLocation());
+
void dump(DebugStream &out);
};
@@ -207,7 +211,7 @@ struct Q_QML_EXPORT QQmlCodeGenerator : public AST::Visitor
{
Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
public:
- QQmlCodeGenerator();
+ QQmlCodeGenerator(const QSet<QString> &illegalNames);
bool generateFromQml(const QString &code, const QUrl &url, const QString &urlString, ParsedQML *output);
static bool isSignalPropertyName(const QString &name);
@@ -272,7 +276,7 @@ public:
static QQmlScript::LocationSpan location(AST::SourceLocation start, AST::SourceLocation end);
int registerString(const QString &str) const { return jsGenerator->registerString(str); }
- template <typename _Tp> _Tp *New() { return new (pool->allocate(sizeof(_Tp))) _Tp(); }
+ template <typename _Tp> _Tp *New() { return pool->New<_Tp>(); }
QString stringAt(int index) const { return jsGenerator->strings.at(index); }
@@ -280,6 +284,8 @@ public:
QList<QQmlError> errors;
+ QSet<QString> illegalNames;
+
QList<QV4::CompiledData::Import*> _imports;
QList<Pragma*> _pragmas;
QList<QmlObject*> _objects;
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
new file mode 100644
index 0000000000..50bb5ef5a1
--- /dev/null
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -0,0 +1,1116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmltypecompiler_p.h"
+
+#include <private/qqmlcompiler_p.h>
+#include <private/qqmlobjectcreator_p.h>
+#include <private/qqmlcustomparser_p.h>
+#include <private/qqmlvmemetaobject_p.h>
+#include <private/qqmlcomponent_p.h>
+
+#define COMPILE_EXCEPTION(token, desc) \
+ { \
+ recordError((token)->location, desc); \
+ return false; \
+ }
+
+QT_BEGIN_NAMESPACE
+
+QQmlTypeCompiler::QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QtQml::ParsedQML *parsedQML)
+ : engine(engine)
+ , compiledData(compiledData)
+ , typeData(typeData)
+ , parsedQML(parsedQML)
+{
+}
+
+bool QQmlTypeCompiler::compile()
+{
+ compiledData->importCache = new QQmlTypeNameCache;
+
+ foreach (const QString &ns, typeData->namespaces())
+ compiledData->importCache->add(ns);
+
+ // Add any Composite Singletons that were used to the import cache
+ foreach (const QQmlTypeData::TypeReference &singleton, typeData->compositeSingletons())
+ compiledData->importCache->add(singleton.type->qmlTypeName(), singleton.type->sourceUrl(), singleton.prefix);
+
+ typeData->imports().populateCache(compiledData->importCache);
+ compiledData->importCache->addref();
+
+ const QHash<int, QQmlTypeData::TypeReference> &resolvedTypes = typeData->resolvedTypeRefs();
+ for (QHash<int, QQmlTypeData::TypeReference>::ConstIterator resolvedType = resolvedTypes.constBegin(), end = resolvedTypes.constEnd();
+ resolvedType != end; ++resolvedType) {
+ QQmlCompiledData::TypeReference ref;
+ if (resolvedType->typeData) {
+ ref.component = resolvedType->typeData->compiledData();
+ ref.component->addref();
+ } else {
+ ref.type = resolvedType->type;
+ Q_ASSERT(ref.type);
+ }
+ ref.majorVersion = resolvedType->majorVersion;
+ ref.minorVersion = resolvedType->minorVersion;
+ compiledData->resolvedTypes.insert(resolvedType.key(), ref);
+ }
+
+ // Build property caches and VME meta object data
+
+ const int objectCount = parsedQML->objects.count();
+ compiledData->datas.reserve(objectCount);
+ compiledData->propertyCaches.reserve(objectCount);
+
+ QQmlPropertyCacheCreator propertyCacheBuilder(this);
+
+ for (int i = 0; i < objectCount; ++i) {
+ const QtQml::QmlObject *obj = parsedQML->objects.at(i);
+
+ QByteArray vmeMetaObjectData;
+ QQmlPropertyCache *propertyCache = 0;
+
+ // If the object has no type, then it's probably a nested object definition as part
+ // of a group property.
+ const bool objectHasType = !propertyCacheBuilder.stringAt(obj->inheritedTypeNameIndex).isEmpty();
+ if (objectHasType) {
+ if (!propertyCacheBuilder.create(obj, &propertyCache, &vmeMetaObjectData)) {
+ errors << propertyCacheBuilder.errors;
+ return false;
+ }
+ }
+
+ compiledData->datas << vmeMetaObjectData;
+ if (propertyCache)
+ propertyCache->addref();
+ compiledData->propertyCaches << propertyCache;
+
+ if (i == parsedQML->indexOfRootObject) {
+ Q_ASSERT(propertyCache);
+ compiledData->rootPropertyCache = propertyCache;
+ propertyCache->addref();
+ }
+ }
+
+ {
+ SignalHandlerConverter converter(engine, parsedQML, compiledData);
+ if (!converter.convertSignalHandlerExpressionsToFunctionDeclarations()) {
+ errors << converter.errors;
+ return false;
+ }
+ }
+
+ // Collect imported scripts
+ const QList<QQmlTypeData::ScriptReference> &scripts = typeData->resolvedScripts();
+ compiledData->scripts.reserve(scripts.count());
+ for (int scriptIndex = 0; scriptIndex < scripts.count(); ++scriptIndex) {
+ const QQmlTypeData::ScriptReference &script = scripts.at(scriptIndex);
+
+ QString qualifier = script.qualifier;
+ QString enclosingNamespace;
+
+ const int lastDotIndex = qualifier.lastIndexOf(QLatin1Char('.'));
+ if (lastDotIndex != -1) {
+ enclosingNamespace = qualifier.left(lastDotIndex);
+ qualifier = qualifier.mid(lastDotIndex+1);
+ }
+
+ compiledData->importCache->add(qualifier, scriptIndex, enclosingNamespace);
+ QQmlScriptData *scriptData = script.script->scriptData();
+ scriptData->addref();
+ compiledData->scripts << scriptData;
+ }
+
+ // Resolve component boundaries and aliases
+
+ {
+ // Scan for components, determine their scopes and resolve aliases within the scope.
+ QQmlComponentAndAliasResolver resolver(this);
+ if (!resolver.resolve()) {
+ errors << resolver.errors;
+ return false;
+ }
+ }
+
+ // Compile JS binding expressions and signal handlers
+
+ JSCodeGen jsCodeGen(typeData->finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, compiledData->importCache);
+ const QVector<int> runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(parsedQML->functions);
+
+ QV4::ExecutionEngine *v4 = engine->v4engine();
+
+ QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(engine, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
+ isel->setUseFastLookups(false);
+ QV4::CompiledData::CompilationUnit *jsUnit = isel->compile(/*generated unit data*/false);
+
+ // Generate QML compiled type data structures
+
+ QmlUnitGenerator qmlGenerator;
+ QV4::CompiledData::QmlUnit *qmlUnit = qmlGenerator.generate(*parsedQML, runtimeFunctionIndices);
+
+ if (jsUnit) {
+ Q_ASSERT(!jsUnit->data);
+ jsUnit->ownsData = false;
+ jsUnit->data = &qmlUnit->header;
+ }
+
+ compiledData->compilationUnit = jsUnit;
+ if (compiledData->compilationUnit)
+ compiledData->compilationUnit->ref();
+ compiledData->qmlUnit = qmlUnit; // ownership transferred to m_compiledData
+
+ // Add to type registry of composites
+ if (compiledData->isCompositeType())
+ engine->registerInternalCompositeType(compiledData);
+ else {
+ const QV4::CompiledData::Object *obj = qmlUnit->objectAt(qmlUnit->indexOfRootObject);
+ QQmlCompiledData::TypeReference typeRef = compiledData->resolvedTypes.value(obj->inheritedTypeNameIndex);
+ if (typeRef.component) {
+ compiledData->metaTypeId = typeRef.component->metaTypeId;
+ compiledData->listMetaTypeId = typeRef.component->listMetaTypeId;
+ } else {
+ compiledData->metaTypeId = typeRef.type->typeId();
+ compiledData->listMetaTypeId = typeRef.type->qListTypeId();
+ }
+ }
+
+ // Sanity check property bindings
+ QQmlPropertyValidator validator(this);
+ if (!validator.validate()) {
+ errors << validator.errors;
+ return false;
+ }
+
+ return errors.isEmpty();
+}
+
+void QQmlTypeCompiler::recordError(const QQmlError &error)
+{
+ QQmlError e = error;
+ e.setUrl(compiledData->url);
+ errors << e;
+}
+
+QString QQmlTypeCompiler::stringAt(int idx) const
+{
+ return parsedQML->stringAt(idx);
+}
+
+int QQmlTypeCompiler::registerString(const QString &str)
+{
+ return parsedQML->jsGenerator.registerString(str);
+}
+
+const QV4::CompiledData::QmlUnit *QQmlTypeCompiler::qmlUnit() const
+{
+ return compiledData->qmlUnit;
+}
+
+const QQmlImports *QQmlTypeCompiler::imports() const
+{
+ return &typeData->imports();
+}
+
+QHash<int, QQmlCompiledData::TypeReference> *QQmlTypeCompiler::resolvedTypes()
+{
+ return &compiledData->resolvedTypes;
+}
+
+QList<QmlObject *> *QQmlTypeCompiler::qmlObjects()
+{
+ return &parsedQML->objects;
+}
+
+int QQmlTypeCompiler::rootObjectIndex() const
+{
+ return parsedQML->indexOfRootObject;
+}
+
+const QList<QQmlPropertyCache *> &QQmlTypeCompiler::propertyCaches() const
+{
+ return compiledData->propertyCaches;
+}
+
+QList<QByteArray> *QQmlTypeCompiler::vmeMetaObjects() const
+{
+ return &compiledData->datas;
+}
+
+QHash<int, int> *QQmlTypeCompiler::objectIndexToIdForRoot()
+{
+ return &compiledData->objectIndexToIdForRoot;
+}
+
+QHash<int, QHash<int, int> > *QQmlTypeCompiler::objectIndexToIdPerComponent()
+{
+ return &compiledData->objectIndexToIdPerComponent;
+}
+
+QHash<int, QByteArray> *QQmlTypeCompiler::customParserData()
+{
+ return &compiledData->customParserData;
+}
+
+MemoryPool *QQmlTypeCompiler::memoryPool()
+{
+ return parsedQML->jsParserEngine.pool();
+}
+
+QQmlCompilePass::QQmlCompilePass(QQmlTypeCompiler *typeCompiler)
+ : compiler(typeCompiler)
+{
+}
+
+void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description)
+{
+ QQmlError error;
+ error.setLine(location.line);
+ error.setColumn(location.column);
+ error.setDescription(description);
+ compiler->recordError(error);
+}
+
+static QAtomicInt classIndexCounter(0);
+
+QQmlPropertyCacheCreator::QQmlPropertyCacheCreator(QQmlTypeCompiler *typeCompiler)
+ : QQmlCompilePass(typeCompiler)
+ , enginePrivate(typeCompiler->enginePrivate())
+ , imports(typeCompiler->imports())
+ , resolvedTypes(typeCompiler->resolvedTypes())
+{
+}
+
+bool QQmlPropertyCacheCreator::create(const QtQml::QmlObject *obj, QQmlPropertyCache **resultCache, QByteArray *vmeMetaObjectData)
+{
+ Q_ASSERT(!stringAt(obj->inheritedTypeNameIndex).isEmpty());
+
+ QQmlCompiledData::TypeReference typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex);
+ QQmlPropertyCache *baseTypeCache = typeRef.createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
+ Q_ASSERT(baseTypeCache);
+ if (obj->properties->count == 0 && obj->qmlSignals->count == 0 && obj->functions->count == 0) {
+ *resultCache = baseTypeCache;
+ vmeMetaObjectData->clear();
+ return true;
+ }
+
+ QQmlPropertyCache *cache = baseTypeCache->copyAndReserve(QQmlEnginePrivate::get(enginePrivate),
+ obj->properties->count,
+ obj->functions->count + obj->properties->count + obj->qmlSignals->count,
+ obj->qmlSignals->count + obj->properties->count);
+ *resultCache = cache;
+
+ vmeMetaObjectData->clear();
+
+ struct TypeData {
+ QV4::CompiledData::Property::Type dtype;
+ int metaType;
+ } builtinTypes[] = {
+ { QV4::CompiledData::Property::Var, qMetaTypeId<QJSValue>() },
+ { QV4::CompiledData::Property::Variant, QMetaType::QVariant },
+ { QV4::CompiledData::Property::Int, QMetaType::Int },
+ { QV4::CompiledData::Property::Bool, QMetaType::Bool },
+ { QV4::CompiledData::Property::Real, QMetaType::Double },
+ { QV4::CompiledData::Property::String, QMetaType::QString },
+ { QV4::CompiledData::Property::Url, QMetaType::QUrl },
+ { QV4::CompiledData::Property::Color, QMetaType::QColor },
+ { QV4::CompiledData::Property::Font, QMetaType::QFont },
+ { QV4::CompiledData::Property::Time, QMetaType::QTime },
+ { QV4::CompiledData::Property::Date, QMetaType::QDate },
+ { QV4::CompiledData::Property::DateTime, QMetaType::QDateTime },
+ { QV4::CompiledData::Property::Rect, QMetaType::QRectF },
+ { QV4::CompiledData::Property::Point, QMetaType::QPointF },
+ { QV4::CompiledData::Property::Size, QMetaType::QSizeF },
+ { QV4::CompiledData::Property::Vector2D, QMetaType::QVector2D },
+ { QV4::CompiledData::Property::Vector3D, QMetaType::QVector3D },
+ { QV4::CompiledData::Property::Vector4D, QMetaType::QVector4D },
+ { QV4::CompiledData::Property::Matrix4x4, QMetaType::QMatrix4x4 },
+ { QV4::CompiledData::Property::Quaternion, QMetaType::QQuaternion }
+ };
+ static const uint builtinTypeCount = sizeof(builtinTypes) / sizeof(TypeData);
+
+ QByteArray newClassName;
+
+ if (false /* ### compileState->root == obj && !compileState->nested*/) {
+#if 0 // ###
+ QString path = output->url.path();
+ int lastSlash = path.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash > -1) {
+ QString nameBase = path.mid(lastSlash + 1, path.length()-lastSlash-5);
+ if (!nameBase.isEmpty() && nameBase.at(0).isUpper())
+ newClassName = nameBase.toUtf8() + "_QMLTYPE_" +
+ QByteArray::number(classIndexCounter.fetchAndAddRelaxed(1));
+ }
+#endif
+ }
+ if (newClassName.isEmpty()) {
+ newClassName = QQmlMetaObject(baseTypeCache).className();
+ newClassName.append("_QML_");
+ newClassName.append(QByteArray::number(classIndexCounter.fetchAndAddRelaxed(1)));
+ }
+
+ cache->_dynamicClassName = newClassName;
+
+ int aliasCount = 0;
+ int varPropCount = 0;
+
+ for (QtQml::QmlProperty *p = obj->properties->first; p; p = p->next) {
+ if (p->type == QV4::CompiledData::Property::Alias)
+ aliasCount++;
+ else if (p->type == QV4::CompiledData::Property::Var)
+ varPropCount++;
+
+#if 0 // ### Do this elsewhere
+ // No point doing this for both the alias and non alias cases
+ QQmlPropertyData *d = property(obj, p->name);
+ if (d && d->isFinal())
+ COMPILE_EXCEPTION(p, tr("Cannot override FINAL property"));
+#endif
+ }
+
+ typedef QQmlVMEMetaData VMD;
+
+ QByteArray &dynamicData = *vmeMetaObjectData = QByteArray(sizeof(QQmlVMEMetaData)
+ + obj->properties->count * sizeof(VMD::PropertyData)
+ + obj->functions->count * sizeof(VMD::MethodData)
+ + aliasCount * sizeof(VMD::AliasData), 0);
+
+ int effectivePropertyIndex = cache->propertyIndexCacheStart;
+ int effectiveMethodIndex = cache->methodIndexCacheStart;
+
+ // For property change signal override detection.
+ // We prepopulate a set of signal names which already exist in the object,
+ // and throw an error if there is a signal/method defined as an override.
+ QSet<QString> seenSignals;
+ seenSignals << QStringLiteral("destroyed") << QStringLiteral("parentChanged") << QStringLiteral("objectNameChanged");
+ QQmlPropertyCache *parentCache = cache;
+ while ((parentCache = parentCache->parent())) {
+ if (int pSigCount = parentCache->signalCount()) {
+ int pSigOffset = parentCache->signalOffset();
+ for (int i = pSigOffset; i < pSigCount; ++i) {
+ QQmlPropertyData *currPSig = parentCache->signal(i);
+ // XXX TODO: find a better way to get signal name from the property data :-/
+ for (QQmlPropertyCache::StringCache::ConstIterator iter = parentCache->stringCache.begin();
+ iter != parentCache->stringCache.end(); ++iter) {
+ if (currPSig == (*iter).second) {
+ seenSignals.insert(iter.key());
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // First set up notify signals for properties - first normal, then var, then alias
+ enum { NSS_Normal = 0, NSS_Var = 1, NSS_Alias = 2 };
+ for (int ii = NSS_Normal; ii <= NSS_Alias; ++ii) { // 0 == normal, 1 == var, 2 == alias
+
+ if (ii == NSS_Var && varPropCount == 0) continue;
+ else if (ii == NSS_Alias && aliasCount == 0) continue;
+
+ for (QtQml::QmlProperty *p = obj->properties->first; p; p = p->next) {
+ if ((ii == NSS_Normal && (p->type == QV4::CompiledData::Property::Alias ||
+ p->type == QV4::CompiledData::Property::Var)) ||
+ ((ii == NSS_Var) && (p->type != QV4::CompiledData::Property::Var)) ||
+ ((ii == NSS_Alias) && (p->type != QV4::CompiledData::Property::Alias)))
+ continue;
+
+ quint32 flags = QQmlPropertyData::IsSignal | QQmlPropertyData::IsFunction |
+ QQmlPropertyData::IsVMESignal;
+
+ QString changedSigName = stringAt(p->nameIndex) + QLatin1String("Changed");
+ seenSignals.insert(changedSigName);
+
+ cache->appendSignal(changedSigName, flags, effectiveMethodIndex++);
+ }
+ }
+
+ // Dynamic signals
+ for (QtQml::Signal *s = obj->qmlSignals->first; s; s = s->next) {
+ const int paramCount = s->parameters->count;
+
+ QList<QByteArray> names;
+ QVarLengthArray<int, 10> paramTypes(paramCount?(paramCount + 1):0);
+
+ if (paramCount) {
+ paramTypes[0] = paramCount;
+
+ QtQml::SignalParameter *param = s->parameters->first;
+ for (int i = 0; i < paramCount; ++i, param = param->next) {
+ names.append(stringAt(param->nameIndex).toUtf8());
+ if (param->type < builtinTypeCount) {
+ // built-in type
+ paramTypes[i + 1] = builtinTypes[param->type].metaType;
+ } else {
+ // lazily resolved type
+ Q_ASSERT(param->type == QV4::CompiledData::Property::Custom);
+ const QString customTypeName = stringAt(param->customTypeNameIndex);
+ QQmlType *qmltype = 0;
+ if (!imports->resolveType(customTypeName, &qmltype, 0, 0, 0))
+ COMPILE_EXCEPTION(s, tr("Invalid signal parameter type: %1").arg(customTypeName));
+
+ if (qmltype->isComposite()) {
+ QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
+ Q_ASSERT(tdata);
+ Q_ASSERT(tdata->isComplete());
+
+ QQmlCompiledData *data = tdata->compiledData();
+
+ paramTypes[i + 1] = data->metaTypeId;
+
+ tdata->release();
+ } else {
+ paramTypes[i + 1] = qmltype->typeId();
+ }
+ }
+ }
+ }
+
+ ((QQmlVMEMetaData *)dynamicData.data())->signalCount++;
+
+ quint32 flags = QQmlPropertyData::IsSignal | QQmlPropertyData::IsFunction |
+ QQmlPropertyData::IsVMESignal;
+ if (paramCount)
+ flags |= QQmlPropertyData::HasArguments;
+
+ QString signalName = stringAt(s->nameIndex);
+ if (seenSignals.contains(signalName))
+ COMPILE_EXCEPTION(s, tr("Duplicate signal name: invalid override of property change signal or superclass signal"));
+ seenSignals.insert(signalName);
+
+ cache->appendSignal(signalName, flags, effectiveMethodIndex++,
+ paramCount?paramTypes.constData():0, names);
+ }
+
+
+ // Dynamic slots
+ for (QtQml::Function *s = obj->functions->first; s; s = s->next) {
+ AST::FunctionDeclaration *astFunction = s->functionDeclaration;
+
+ quint32 flags = QQmlPropertyData::IsFunction | QQmlPropertyData::IsVMEFunction;
+
+ if (astFunction->formals)
+ flags |= QQmlPropertyData::HasArguments;
+
+ QString slotName = astFunction->name.toString();
+ if (seenSignals.contains(slotName))
+ COMPILE_EXCEPTION(s, tr("Duplicate method name: invalid override of property change signal or superclass signal"));
+ // Note: we don't append slotName to the seenSignals list, since we don't
+ // protect against overriding change signals or methods with properties.
+
+ QList<QByteArray> parameterNames;
+ AST::FormalParameterList *param = astFunction->formals;
+ while (param) {
+ parameterNames << param->name.toUtf8();
+ param = param->next;
+ }
+
+ cache->appendMethod(slotName, flags, effectiveMethodIndex++, parameterNames);
+ }
+
+
+ // Dynamic properties (except var and aliases)
+ int effectiveSignalIndex = cache->signalHandlerIndexCacheStart;
+ int propertyIdx = 0;
+ for (QtQml::QmlProperty *p = obj->properties->first; p; p = p->next, ++propertyIdx) {
+
+ if (p->type == QV4::CompiledData::Property::Alias ||
+ p->type == QV4::CompiledData::Property::Var)
+ continue;
+
+ int propertyType = 0;
+ int vmePropertyType = 0;
+ quint32 propertyFlags = 0;
+
+ if (p->type < builtinTypeCount) {
+ propertyType = builtinTypes[p->type].metaType;
+ vmePropertyType = propertyType;
+
+ if (p->type == QV4::CompiledData::Property::Variant)
+ propertyFlags |= QQmlPropertyData::IsQVariant;
+ } else {
+ Q_ASSERT(p->type == QV4::CompiledData::Property::CustomList ||
+ p->type == QV4::CompiledData::Property::Custom);
+
+ QQmlType *qmltype = 0;
+ if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, 0, 0, 0)) {
+ COMPILE_EXCEPTION(p, tr("Invalid property type"));
+ }
+
+ Q_ASSERT(qmltype);
+ if (qmltype->isComposite()) {
+ QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
+ Q_ASSERT(tdata);
+ Q_ASSERT(tdata->isComplete());
+
+ QQmlCompiledData *data = tdata->compiledData();
+
+ if (p->type == QV4::CompiledData::Property::Custom) {
+ propertyType = data->metaTypeId;
+ vmePropertyType = QMetaType::QObjectStar;
+ } else {
+ propertyType = data->listMetaTypeId;
+ vmePropertyType = qMetaTypeId<QQmlListProperty<QObject> >();
+ }
+
+ tdata->release();
+ } else {
+ if (p->type == QV4::CompiledData::Property::Custom) {
+ propertyType = qmltype->typeId();
+ vmePropertyType = QMetaType::QObjectStar;
+ } else {
+ propertyType = qmltype->qListTypeId();
+ vmePropertyType = qMetaTypeId<QQmlListProperty<QObject> >();
+ }
+ }
+
+ if (p->type == QV4::CompiledData::Property::Custom)
+ propertyFlags |= QQmlPropertyData::IsQObjectDerived;
+ else
+ propertyFlags |= QQmlPropertyData::IsQList;
+ }
+
+ if ((!p->flags & QV4::CompiledData::Property::IsReadOnly) && p->type != QV4::CompiledData::Property::CustomList)
+ propertyFlags |= QQmlPropertyData::IsWritable;
+
+
+ QString propertyName = stringAt(p->nameIndex);
+ if (propertyIdx == obj->indexOfDefaultProperty) cache->_defaultPropertyName = propertyName;
+ cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
+ propertyType, effectiveSignalIndex);
+
+ effectiveSignalIndex++;
+
+ VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
+ (vmd->propertyData() + vmd->propertyCount)->propertyType = vmePropertyType;
+ vmd->propertyCount++;
+ }
+
+ // Now do var properties
+ propertyIdx = 0;
+ for (QtQml::QmlProperty *p = obj->properties->first; p; p = p->next, ++propertyIdx) {
+
+ if (p->type != QV4::CompiledData::Property::Var)
+ continue;
+
+ quint32 propertyFlags = QQmlPropertyData::IsVarProperty;
+ if (!p->flags & QV4::CompiledData::Property::IsReadOnly)
+ propertyFlags |= QQmlPropertyData::IsWritable;
+
+ VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
+ (vmd->propertyData() + vmd->propertyCount)->propertyType = QMetaType::QVariant;
+ vmd->propertyCount++;
+ ((QQmlVMEMetaData *)dynamicData.data())->varPropertyCount++;
+
+ QString propertyName = stringAt(p->nameIndex);
+ if (propertyIdx == obj->indexOfDefaultProperty) cache->_defaultPropertyName = propertyName;
+ cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
+ QMetaType::QVariant, effectiveSignalIndex);
+
+ effectiveSignalIndex++;
+ }
+
+ // Alias property count. Actual data is setup in buildDynamicMetaAliases
+ ((QQmlVMEMetaData *)dynamicData.data())->aliasCount = aliasCount;
+
+ // Dynamic slot data - comes after the property data
+ for (QtQml::Function *s = obj->functions->first; s; s = s->next) {
+ AST::FunctionDeclaration *astFunction = s->functionDeclaration;
+ int formalsCount = 0;
+ AST::FormalParameterList *param = astFunction->formals;
+ while (param) {
+ formalsCount++;
+ param = param->next;
+ }
+
+ VMD::MethodData methodData = { /* runtimeFunctionIndex*/ 0, // ###
+ formalsCount,
+ /* s->location.start.line */0 }; // ###
+
+ VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
+ VMD::MethodData &md = *(vmd->methodData() + vmd->methodCount);
+ vmd->methodCount++;
+ md = methodData;
+ }
+
+ return true;
+}
+
+QQmlComponentAndAliasResolver::QQmlComponentAndAliasResolver(QQmlTypeCompiler *typeCompiler)
+ : QQmlCompilePass(typeCompiler)
+ , enginePrivate(typeCompiler->enginePrivate())
+ , pool(typeCompiler->memoryPool())
+ , qmlObjects(typeCompiler->qmlObjects())
+ , indexOfRootObject(typeCompiler->rootObjectIndex())
+ , _componentIndex(-1)
+ , _objectIndexToIdInScope(0)
+ , resolvedTypes(typeCompiler->resolvedTypes())
+ , propertyCaches(typeCompiler->propertyCaches())
+ , vmeMetaObjectData(typeCompiler->vmeMetaObjects())
+ , objectIndexToIdForRoot(typeCompiler->objectIndexToIdForRoot())
+ , objectIndexToIdPerComponent(typeCompiler->objectIndexToIdPerComponent())
+{
+}
+
+void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, int objectIndex)
+{
+ QQmlPropertyCache *propertyCache = propertyCaches.value(objectIndex);
+ Q_ASSERT(propertyCache);
+
+ PropertyResolver propertyResolver(propertyCache);
+
+ for (QtQml::Binding *binding = obj->bindings->first; binding; binding = binding->next) {
+ if (binding->type != QV4::CompiledData::Binding::Type_Object)
+ continue;
+ if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression)
+ continue;
+
+ const QtQml::QmlObject *targetObject = qmlObjects->at(binding->value.objectIndex);
+ QQmlType *targetType = resolvedTypes->value(targetObject->inheritedTypeNameIndex).type;
+ if (targetType && targetType->metaObject() == &QQmlComponent::staticMetaObject)
+ continue;
+
+ QString propertyName = stringAt(binding->propertyNameIndex);
+ bool notInRevision = false;
+ QQmlPropertyData *pd = propertyResolver.property(propertyName, &notInRevision);
+ if (!pd || !pd->isQObject())
+ continue;
+
+ QQmlPropertyCache *pc = enginePrivate->rawPropertyCacheForType(pd->propType);
+ const QMetaObject *mo = pc->firstCppMetaObject();
+ while (mo) {
+ if (mo == &QQmlComponent::staticMetaObject)
+ break;
+ mo = mo->superClass();
+ }
+
+ if (!mo)
+ continue;
+
+ static QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
+ Q_ASSERT(componentType);
+
+ QtQml::QmlObject *syntheticComponent = pool->New<QtQml::QmlObject>();
+ syntheticComponent->init(pool, compiler->registerString(QString::fromUtf8(componentType->typeName())), compiler->registerString(QString()));
+
+ if (!resolvedTypes->contains(syntheticComponent->inheritedTypeNameIndex)) {
+ QQmlCompiledData::TypeReference typeRef;
+ typeRef.type = componentType;
+ typeRef.majorVersion = componentType->majorVersion();
+ typeRef.minorVersion = componentType->minorVersion();
+ resolvedTypes->insert(syntheticComponent->inheritedTypeNameIndex, typeRef);
+ }
+
+ qmlObjects->append(syntheticComponent);
+ const int componentIndex = qmlObjects->count() - 1;
+
+ QtQml::Binding *syntheticBinding = pool->New<QtQml::Binding>();
+ *syntheticBinding = *binding;
+ syntheticBinding->type = QV4::CompiledData::Binding::Type_Object;
+ syntheticComponent->bindings->append(syntheticBinding);
+
+ binding->value.objectIndex = componentIndex;
+
+ componentRoots.append(componentIndex);
+ componentBoundaries.append(syntheticBinding->value.objectIndex);
+ }
+}
+
+bool QQmlComponentAndAliasResolver::resolve()
+{
+ // Detect real Component {} objects as well as implicitly defined components, such as
+ // someItemDelegate: Item {}
+ // In the implicit case Item is surrounded by a synthetic Component {} because the property
+ // on the left hand side is of QQmlComponent type.
+ for (int i = 0; i < qmlObjects->count(); ++i) {
+ const QtQml::QmlObject *obj = qmlObjects->at(i);
+ if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
+ continue;
+
+ QQmlCompiledData::TypeReference tref = resolvedTypes->value(obj->inheritedTypeNameIndex);
+ if (!tref.type)
+ continue;
+ if (tref.type->metaObject() != &QQmlComponent::staticMetaObject) {
+ findAndRegisterImplicitComponents(obj, i);
+ continue;
+ }
+
+ componentRoots.append(i);
+
+ if (obj->functions->count > 0)
+ COMPILE_EXCEPTION(obj, tr("Component objects cannot declare new functions."));
+ if (obj->properties->count > 0)
+ COMPILE_EXCEPTION(obj, tr("Component objects cannot declare new properties."));
+ if (obj->qmlSignals->count > 0)
+ COMPILE_EXCEPTION(obj, tr("Component objects cannot declare new signals."));
+
+ if (obj->bindings->count == 0)
+ COMPILE_EXCEPTION(obj, tr("Cannot create empty component specification"));
+
+ const QtQml::Binding *rootBinding = obj->bindings->first;
+ if (rootBinding->next || rootBinding->type != QV4::CompiledData::Binding::Type_Object)
+ COMPILE_EXCEPTION(rootBinding, tr("Component elements may not contain properties other than id"));
+
+ componentBoundaries.append(rootBinding->value.objectIndex);
+ }
+
+ std::sort(componentBoundaries.begin(), componentBoundaries.end());
+
+ for (int i = 0; i < componentRoots.count(); ++i) {
+ const QtQml::QmlObject *component = qmlObjects->at(componentRoots.at(i));
+ const QtQml::Binding *rootBinding = component->bindings->first;
+
+ _componentIndex = i;
+ _idToObjectIndex.clear();
+
+ _objectIndexToIdInScope = &(*objectIndexToIdPerComponent)[componentRoots.at(i)];
+
+ _objectsWithAliases.clear();
+
+ if (!collectIdsAndAliases(rootBinding->value.objectIndex))
+ return false;
+
+ if (!resolveAliases())
+ return false;
+ }
+
+ // Collect ids and aliases for root
+ _componentIndex = -1;
+ _idToObjectIndex.clear();
+ _objectIndexToIdInScope = objectIndexToIdForRoot;
+ _objectsWithAliases.clear();
+
+ collectIdsAndAliases(indexOfRootObject);
+
+ resolveAliases();
+
+ return errors.isEmpty();
+}
+
+bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
+{
+ const QtQml::QmlObject *obj = qmlObjects->at(objectIndex);
+
+ QString id = stringAt(obj->idIndex);
+ if (!id.isEmpty()) {
+ if (_idToObjectIndex.contains(obj->idIndex)) {
+ recordError(obj->locationOfIdProperty, tr("id is not unique"));
+ return false;
+ }
+ _idToObjectIndex.insert(obj->idIndex, objectIndex);
+ _objectIndexToIdInScope->insert(objectIndex, _objectIndexToIdInScope->count());
+ }
+
+ for (QtQml::QmlProperty *property = obj->properties->first; property; property = property->next) {
+ if (property->type == QV4::CompiledData::Property::Alias) {
+ _objectsWithAliases.append(objectIndex);
+ break;
+ }
+ }
+
+ for (QtQml::Binding *binding = obj->bindings->first; binding; binding = binding->next) {
+ if (binding->type != QV4::CompiledData::Binding::Type_Object
+ && binding->type != QV4::CompiledData::Binding::Type_AttachedProperty
+ && binding->type != QV4::CompiledData::Binding::Type_GroupProperty)
+ continue;
+
+ // Stop at Component boundary
+ if (std::binary_search(componentBoundaries.constBegin(), componentBoundaries.constEnd(), binding->value.objectIndex))
+ continue;
+
+ if (!collectIdsAndAliases(binding->value.objectIndex))
+ return false;
+ }
+
+ return true;
+}
+
+bool QQmlComponentAndAliasResolver::resolveAliases()
+{
+ foreach (int objectIndex, _objectsWithAliases) {
+ const QtQml::QmlObject *obj = qmlObjects->at(objectIndex);
+
+ QQmlPropertyCache *propertyCache = propertyCaches.value(objectIndex);
+ Q_ASSERT(propertyCache);
+
+ int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.count();
+ int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count();
+ int effectiveAliasIndex = 0;
+
+ const QtQml::QmlProperty *p = obj->properties->first;
+ for (int propertyIndex = 0; propertyIndex < obj->properties->count; ++propertyIndex, p = p->next) {
+ if (p->type != QV4::CompiledData::Property::Alias)
+ continue;
+
+ const int idIndex = p->aliasIdValueIndex;
+ const int targetObjectIndex = _idToObjectIndex.value(idIndex, -1);
+ if (targetObjectIndex == -1) {
+ recordError(p->aliasLocation, tr("Invalid alias reference. Unable to find id \"%1\"").arg(stringAt(idIndex)));
+ return false;
+ }
+ const int targetId = _objectIndexToIdInScope->value(targetObjectIndex, -1);
+ Q_ASSERT(targetId != -1);
+
+ const QString aliasPropertyValue = stringAt(p->aliasPropertyValueIndex);
+
+ QStringRef property;
+ QStringRef subProperty;
+
+ const int propertySeparator = aliasPropertyValue.indexOf(QLatin1Char('.'));
+ if (propertySeparator != -1) {
+ property = aliasPropertyValue.leftRef(propertySeparator);
+ subProperty = aliasPropertyValue.midRef(propertySeparator + 1);
+ } else
+ property = QStringRef(&aliasPropertyValue, 0, aliasPropertyValue.length());
+
+ int propIdx = -1;
+ int propType = 0;
+ int notifySignal = -1;
+ int flags = 0;
+ int type = 0;
+ bool writable = false;
+ bool resettable = false;
+
+ quint32 propertyFlags = QQmlPropertyData::IsAlias;
+
+ if (property.isEmpty()) {
+ const QtQml::QmlObject *targetObject = qmlObjects->at(targetObjectIndex);
+ QQmlCompiledData::TypeReference typeRef = resolvedTypes->value(targetObject->inheritedTypeNameIndex);
+
+ if (typeRef.type)
+ type = typeRef.type->typeId();
+ else
+ type = typeRef.component->metaTypeId;
+
+ flags |= QML_ALIAS_FLAG_PTR;
+ propertyFlags |= QQmlPropertyData::IsQObjectDerived;
+ } else {
+ QQmlPropertyCache *targetCache = propertyCaches.value(targetObjectIndex);
+ Q_ASSERT(targetCache);
+ QtQml::PropertyResolver resolver(targetCache);
+
+ QQmlPropertyData *targetProperty = resolver.property(property.toString());
+ if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
+ recordError(p->aliasLocation, tr("Invalid alias location"));
+ return false;
+ }
+
+ propIdx = targetProperty->coreIndex;
+ type = targetProperty->propType;
+
+ writable = targetProperty->isWritable();
+ resettable = targetProperty->isResettable();
+ notifySignal = targetProperty->notifyIndex;
+
+ if (!subProperty.isEmpty()) {
+ QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type);
+ if (!valueType) {
+ recordError(p->aliasLocation, tr("Invalid alias location"));
+ return false;
+ }
+
+ propType = type;
+
+ int valueTypeIndex =
+ valueType->metaObject()->indexOfProperty(subProperty.toString().toUtf8().constData());
+ if (valueTypeIndex == -1) {
+ recordError(p->aliasLocation, tr("Invalid alias location"));
+ return false;
+ }
+ Q_ASSERT(valueTypeIndex <= 0x0000FFFF);
+
+ propIdx |= (valueTypeIndex << 16);
+ if (valueType->metaObject()->property(valueTypeIndex).isEnumType())
+ type = QVariant::Int;
+ else
+ type = valueType->metaObject()->property(valueTypeIndex).userType();
+
+ } else {
+ if (targetProperty->isEnum()) {
+ type = QVariant::Int;
+ } else {
+ // Copy type flags
+ propertyFlags |= targetProperty->getFlags() & QQmlPropertyData::PropTypeFlagMask;
+
+ if (targetProperty->isVarProperty())
+ propertyFlags |= QQmlPropertyData::IsQVariant;
+
+ if (targetProperty->isQObject())
+ flags |= QML_ALIAS_FLAG_PTR;
+ }
+ }
+ }
+
+ QQmlVMEMetaData::AliasData aliasData = { targetId, propIdx, propType, flags, notifySignal };
+
+ typedef QQmlVMEMetaData VMD;
+ QByteArray &dynamicData = (*vmeMetaObjectData)[objectIndex];
+ Q_ASSERT(!dynamicData.isEmpty());
+ VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
+ *(vmd->aliasData() + effectiveAliasIndex++) = aliasData;
+
+ Q_ASSERT(dynamicData.isDetached());
+
+ if (!(p->flags & QV4::CompiledData::Property::IsReadOnly) && writable)
+ propertyFlags |= QQmlPropertyData::IsWritable;
+ else
+ propertyFlags &= ~QQmlPropertyData::IsWritable;
+
+ if (resettable)
+ propertyFlags |= QQmlPropertyData::IsResettable;
+ else
+ propertyFlags &= ~QQmlPropertyData::IsResettable;
+
+ QString propertyName = stringAt(p->nameIndex);
+ if (propertyIndex == obj->indexOfDefaultProperty) propertyCache->_defaultPropertyName = propertyName;
+ propertyCache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
+ type, effectiveSignalIndex++);
+
+ }
+ }
+ return true;
+}
+
+
+QQmlPropertyValidator::QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler)
+ : QQmlCompilePass(typeCompiler)
+ , qmlUnit(typeCompiler->qmlUnit())
+ , resolvedTypes(*typeCompiler->resolvedTypes())
+ , propertyCaches(typeCompiler->propertyCaches())
+ , objectIndexToIdPerComponent(*typeCompiler->objectIndexToIdPerComponent())
+ , customParserData(typeCompiler->customParserData())
+{
+}
+
+bool QQmlPropertyValidator::validate()
+{
+ for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
+ const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
+ if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
+ continue;
+
+ if (isComponent(i))
+ continue;
+
+ QQmlPropertyCache *propertyCache = propertyCaches.value(i);
+ Q_ASSERT(propertyCache);
+
+ if (!validateObject(obj, i, propertyCache))
+ return false;
+ }
+ return true;
+}
+
+bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache)
+{
+ QQmlCustomParser *customParser = 0;
+ QQmlCompiledData::TypeReference objectType = resolvedTypes.value(obj->inheritedTypeNameIndex);
+ if (objectType.type)
+ customParser = objectType.type->customParser();
+ QList<const QV4::CompiledData::Binding*> customBindings;
+
+ PropertyResolver propertyResolver(propertyCache);
+
+ QQmlPropertyData *defaultProperty = propertyCache->defaultProperty();
+
+ const QV4::CompiledData::Binding *binding = obj->bindingTable();
+ for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
+ if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty
+ || binding->type == QV4::CompiledData::Binding::Type_GroupProperty) {
+ if (customParser)
+ customBindings << binding;
+ continue;
+ }
+
+ const QString name = stringAt(binding->propertyNameIndex);
+
+ bool bindingToDefaultProperty = false;
+
+ bool notInRevision = false;
+ QQmlPropertyData *pd = 0;
+ if (!name.isEmpty()) {
+ if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression)
+ pd = propertyResolver.signal(name, &notInRevision);
+ else
+ pd = propertyResolver.property(name, &notInRevision);
+
+ if (notInRevision) {
+ QString typeName = stringAt(obj->inheritedTypeNameIndex);
+ if (objectType.type) {
+ COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(name).arg(objectType.type->module()).arg(objectType.majorVersion).arg(objectType.minorVersion));
+ } else {
+ COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available due to component versioning.").arg(typeName).arg(name));
+ }
+ }
+ } else {
+ pd = defaultProperty;
+ bindingToDefaultProperty = true;
+ }
+
+ if (!pd) {
+ if (customParser) {
+ customBindings << binding;
+ continue;
+ }
+ if (bindingToDefaultProperty) {
+ COMPILE_EXCEPTION(binding, tr("Cannot assign to non-existent default property"));
+ } else {
+ COMPILE_EXCEPTION(binding, tr("Cannot assign to non-existent property \"%1\"").arg(name));
+ }
+ }
+ }
+
+ if (customParser && !customBindings.isEmpty()) {
+ customParser->clearErrors();
+ QByteArray data = customParser->compile(qmlUnit, customBindings);
+ customParserData->insert(objectIndex, data);
+ const QList<QQmlError> parserErrors = customParser->errors();
+ if (!parserErrors.isEmpty()) {
+ foreach (QQmlError error, parserErrors) {
+ error.setUrl(url);
+ errors << error;
+ }
+ return false;
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
new file mode 100644
index 0000000000..9f055f4376
--- /dev/null
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QQMLTYPECOMPILER_P_H
+#define QQMLTYPECOMPILER_P_H
+
+#include <qglobal.h>
+#include <qqmlerror.h>
+#include <qhash.h>
+#include <private/qqmlcompiler_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEnginePrivate;
+class QQmlCompiledData;
+class QQmlError;
+class QQmlTypeData;
+class QQmlImports;
+
+namespace QtQml {
+struct ParsedQML;
+}
+
+namespace QV4 {
+namespace CompiledData {
+struct QmlUnit;
+struct Location;
+}
+}
+
+struct QQmlTypeCompiler
+{
+ QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QtQml::ParsedQML *parsedQML);
+
+ bool compile();
+
+ QList<QQmlError> compilationErrors() const { return errors; }
+ void recordError(const QQmlError &error);
+
+ QString stringAt(int idx) const;
+ int registerString(const QString &str);
+
+ const QV4::CompiledData::QmlUnit *qmlUnit() const;
+
+ QQmlEnginePrivate *enginePrivate() const { return engine; }
+ const QQmlImports *imports() const;
+ QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes();
+ QList<QtQml::QmlObject*> *qmlObjects();
+ int rootObjectIndex() const;
+ const QList<QQmlPropertyCache *> &propertyCaches() const;
+ QList<QByteArray> *vmeMetaObjects() const;
+ QHash<int, int> *objectIndexToIdForRoot();
+ QHash<int, QHash<int, int> > *objectIndexToIdPerComponent();
+ QHash<int, QByteArray> *customParserData();
+ QQmlJS::MemoryPool *memoryPool();
+
+private:
+ QList<QQmlError> errors;
+ QQmlEnginePrivate *engine;
+ QQmlCompiledData *compiledData;
+ QQmlTypeData *typeData;
+ QtQml::ParsedQML *parsedQML;
+};
+
+struct QQmlCompilePass
+{
+ QQmlCompilePass(QQmlTypeCompiler *typeCompiler);
+ QList<QQmlError> errors;
+
+ QString stringAt(int idx) const { return compiler->stringAt(idx); }
+protected:
+ void recordError(const QV4::CompiledData::Location &location, const QString &description);
+
+ const QUrl url;
+ QQmlTypeCompiler *compiler;
+};
+
+class QQmlPropertyCacheCreator : public QQmlCompilePass
+{
+ Q_DECLARE_TR_FUNCTIONS(QQmlPropertyCacheCreator)
+public:
+ QQmlPropertyCacheCreator(QQmlTypeCompiler *typeCompiler);
+
+ bool create(const QtQml::QmlObject *obj, QQmlPropertyCache **cache, QByteArray *vmeMetaObjectData);
+
+protected:
+ QQmlEnginePrivate *enginePrivate;
+ const QQmlImports *imports;
+ QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes;
+};
+
+class QQmlComponentAndAliasResolver : public QQmlCompilePass
+{
+ Q_DECLARE_TR_FUNCTIONS(QQmlAnonymousComponentResolver)
+public:
+ QQmlComponentAndAliasResolver(QQmlTypeCompiler *typeCompiler);
+
+ bool resolve();
+
+protected:
+ void findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, int objectIndex);
+ bool collectIdsAndAliases(int objectIndex);
+ bool resolveAliases();
+
+ QQmlEnginePrivate *enginePrivate;
+ QQmlJS::MemoryPool *pool;
+
+ QList<QtQml::QmlObject*> *qmlObjects;
+ const int indexOfRootObject;
+
+ // indices of the objects that are actually Component {}
+ QVector<int> componentRoots;
+ // indices of objects that are the beginning of a new component
+ // scope. This is sorted and used for binary search.
+ QVector<int> componentBoundaries;
+
+ int _componentIndex;
+ QHash<int, int> _idToObjectIndex;
+ QHash<int, int> *_objectIndexToIdInScope;
+ QList<int> _objectsWithAliases;
+
+ QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes;
+ const QList<QQmlPropertyCache *> propertyCaches;
+ QList<QByteArray> *vmeMetaObjectData;
+ QHash<int, int> *objectIndexToIdForRoot;
+ QHash<int, QHash<int, int> > *objectIndexToIdPerComponent;
+};
+
+class QQmlPropertyValidator : public QQmlCompilePass
+{
+ Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
+public:
+ QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler);
+
+ bool validate();
+
+private:
+ bool validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache);
+
+ bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
+
+ const QV4::CompiledData::QmlUnit *qmlUnit;
+ const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes;
+ const QList<QQmlPropertyCache *> &propertyCaches;
+ const QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
+ QHash<int, QByteArray> *customParserData;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLTYPECOMPILER_P_H
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 90f27d5f57..91033b02ea 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -516,6 +516,8 @@ protected:
}
+Q_DECLARE_TYPEINFO(QV4::CompiledData::JSClassMember, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 35097bae49..415fdad8e9 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -1015,7 +1015,7 @@ void InstructionSelection::setQObjectProperty(V4IR::Expr *source, V4IR::Expr *ta
void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target)
{
-#if QT_POINTER_SIZE == 8
+#if 0 // QT_POINTER_SIZE == 8
V4IR::Temp *tbase = base->asTemp();
V4IR::Temp *tindex = index->asTemp();
if (tbase && tindex &&
@@ -1026,9 +1026,10 @@ void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR:
_as->urshift64(Assembler::TrustedImm32(QV4::Value::IsManaged_Shift), Assembler::ReturnValueRegister);
Assembler::Jump notManaged = _as->branch64(Assembler::NotEqual, Assembler::ReturnValueRegister, Assembler::TrustedImm64(0));
// check whether we have an object with a simple array
- Assembler::Address managedType(Assembler::ScratchRegister, qOffsetOf(QV4::Managed, flags));
+ // ### need to check we have an object first!
+ Assembler::Address managedType(Assembler::ScratchRegister, qOffsetOf(QV4::Object, arrayData) + qOffsetOf(QV4::ArrayData, flags));
_as->load8(managedType, Assembler::ReturnValueRegister);
- _as->and32(Assembler::TrustedImm32(QV4::Managed::SimpleArray), Assembler::ReturnValueRegister);
+ _as->and32(Assembler::TrustedImm32(QV4::ArrayData::SimpleArray), Assembler::ReturnValueRegister);
Assembler::Jump notSimple = _as->branch32(Assembler::Equal, Assembler::ReturnValueRegister, Assembler::TrustedImm32(0));
bool needNegativeCheck = false;
@@ -1069,12 +1070,12 @@ void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR:
// get data, ScratchRegister holds index
addr = _as->loadTempAddress(Assembler::ReturnValueRegister, tbase);
_as->load64(addr, Assembler::ReturnValueRegister);
- Address arrayDataLen(Assembler::ReturnValueRegister, qOffsetOf(Object, arrayDataLen));
+ Address dataLen(Assembler::ReturnValueRegister, qOffsetOf(Object, arrayData) + qOffsetOf(ArrayData, length));
Assembler::Jump outOfRange;
if (needNegativeCheck)
outOfRange = _as->branch32(Assembler::LessThan, Assembler::ScratchRegister, Assembler::TrustedImm32(0));
- Assembler::Jump outOfRange2 = _as->branch32(Assembler::GreaterThanOrEqual, Assembler::ScratchRegister, arrayDataLen);
- Address arrayData(Assembler::ReturnValueRegister, qOffsetOf(Object, arrayData));
+ Assembler::Jump outOfRange2 = _as->branch32(Assembler::GreaterThanOrEqual, Assembler::ScratchRegister, dataLen);
+ Address arrayData(Assembler::ReturnValueRegister, qOffsetOf(Object, arrayData) + qOffsetOf(ArrayData, data));
_as->load64(arrayData, Assembler::ReturnValueRegister);
Q_ASSERT(sizeof(Property) == (1<<4));
_as->lshift64(Assembler::TrustedImm32(4), Assembler::ScratchRegister);
diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp
index 93ecdb2602..65685f1148 100644
--- a/src/qml/compiler/qv4regalloc.cpp
+++ b/src/qml/compiler/qv4regalloc.cpp
@@ -60,6 +60,9 @@ struct Use {
}
QT_BEGIN_NAMESPACE
+
+Q_DECLARE_TYPEINFO(Use, Q_MOVABLE_TYPE);
+
using namespace QQmlJS::V4IR;
namespace QQmlJS {
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 6a0cf0cf6d..8e1ac38f4f 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -1049,7 +1049,7 @@ bool QJSValue::hasOwnProperty(const QString &name) const
return false;
ScopedString s(scope, engine->newIdentifier(name));
- return o->__getOwnProperty__(s);
+ return o->hasOwnProperty(s);
}
/*!
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index 94983f51e5..a90cea96c2 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -14,6 +14,7 @@ SOURCES += \
$$PWD/qv4managed.cpp \
$$PWD/qv4internalclass.cpp \
$$PWD/qv4sparsearray.cpp \
+ $$PWD/qv4arraydata.cpp \
$$PWD/qv4arrayobject.cpp \
$$PWD/qv4argumentsobject.cpp \
$$PWD/qv4booleanobject.cpp \
@@ -58,6 +59,7 @@ HEADERS += \
$$PWD/qv4managed_p.h \
$$PWD/qv4internalclass_p.h \
$$PWD/qv4sparsearray_p.h \
+ $$PWD/qv4arraydata_p.h \
$$PWD/qv4arrayobject_p.h \
$$PWD/qv4argumentsobject_p.h \
$$PWD/qv4booleanobject_p.h \
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 629c255b48..5094bafa66 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -51,8 +51,7 @@ ArgumentsObject::ArgumentsObject(CallContext *context)
, context(context)
, fullyCreated(false)
{
- type = Type_ArgumentsObject;
- flags &= ~SimpleArray;
+ setArrayType(ArrayData::Complex);
ExecutionEngine *v4 = context->engine;
Scope scope(v4);
@@ -66,14 +65,12 @@ ArgumentsObject::ArgumentsObject(CallContext *context)
memberData[CallerPropertyIndex] = pd;
arrayReserve(context->callData->argc);
- for (int i = 0; i < context->callData->argc; ++i)
- arrayData[i].value = context->callData->args[i];
- arrayDataLen = context->callData->argc;
+ arrayData->put(0, context->callData->args, context->callData->argc);
+ arrayData->setLength(context->callData->argc);
fullyCreated = true;
} else {
Q_ASSERT(CalleePropertyIndex == internalClass->find(context->engine->id_callee));
memberData[CalleePropertyIndex].value = context->function->asReturnedValue();
- isNonStrictArgumentsObject = true;
}
Q_ASSERT(LengthPropertyIndex == internalClass->find(context->engine->id_length));
Property *lp = memberData + ArrayObject::LengthPropertyIndex;
@@ -95,18 +92,18 @@ void ArgumentsObject::fullyCreate()
uint numAccessors = qMin((int)context->function->formalParameterCount, context->realArgumentCount);
uint argCount = qMin(context->realArgumentCount, context->callData->argc);
arrayReserve(argCount);
- ensureArrayAttributes();
+ arrayData->ensureAttributes();
context->engine->requireArgumentsAccessors(numAccessors);
for (uint i = 0; i < (uint)numAccessors; ++i) {
mappedArguments.append(context->callData->args[i]);
- arrayData[i] = context->engine->argumentsAccessors.at(i);
- arrayAttributes[i] = Attr_Accessor;
+ arrayData->data[i] = context->engine->argumentsAccessors.at(i);
+ arrayData->setAttributes(i, Attr_Accessor);
}
- for (uint i = numAccessors; i < argCount; ++i) {
- arrayData[i] = Property::fromValue(context->callData->args[i]);
- arrayAttributes[i] = Attr_Data;
- }
- arrayDataLen = argCount;
+ arrayData->setLength(numAccessors);
+ arrayData->put(numAccessors, context->callData->args + numAccessors, argCount - numAccessors);
+ for (uint i = numAccessors; i < argCount; ++i)
+ arrayData->setAttributes(i, Attr_Data);
+ arrayData->setLength(argCount);
fullyCreated = true;
}
@@ -116,27 +113,24 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
fullyCreate();
Scope scope(ctx);
- uint pidx = propertyIndexFromArrayIndex(index);
- Property *pd = arrayData + pidx;
+ Property *pd = arrayData->getProperty(index);
Property map;
PropertyAttributes mapAttrs;
bool isMapped = false;
if (pd && index < (uint)mappedArguments.size())
- isMapped = arrayAttributes && arrayAttributes[pidx].isAccessor() && pd->getter() == context->engine->argumentsAccessors.at(index).getter();
+ isMapped = arrayData->attributes(index).isAccessor() && pd->getter() == context->engine->argumentsAccessors.at(index).getter();
if (isMapped) {
map = *pd;
- mapAttrs = arrayAttributes[pidx];
- arrayAttributes[pidx] = Attr_Data;
+ mapAttrs = arrayData->attributes(index);
+ arrayData->setAttributes(index, Attr_Data);
pd->value = mappedArguments.at(index);
}
- isNonStrictArgumentsObject = false;
bool strict = ctx->strictMode;
ctx->strictMode = false;
- bool result = Object::__defineOwnProperty__(ctx, index, desc, attrs);
+ bool result = Object::defineOwnProperty2(ctx, index, desc, attrs);
ctx->strictMode = strict;
- isNonStrictArgumentsObject = true;
if (isMapped && attrs.isData()) {
ScopedCallData callData(scope, 1);
@@ -146,7 +140,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
if (attrs.isWritable()) {
*pd = map;
- arrayAttributes[pidx] = mapAttrs;
+ arrayData->setAttributes(index, mapAttrs);
}
}
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index d306fae92b..42b749cbb5 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -77,12 +77,17 @@ struct ArgumentsSetterFunction: FunctionObject
struct ArgumentsObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(ArgumentsObject)
CallContext *context;
bool fullyCreated;
QVector<SafeValue> mappedArguments;
ArgumentsObject(CallContext *context);
~ArgumentsObject() {}
+ static bool isNonStrictArgumentsObject(Managed *m) {
+ return m->internalClass->vtable->type == Type_ArgumentsObject &&
+ !static_cast<ArgumentsObject *>(m)->context->strictMode;
+ }
enum {
LengthPropertyIndex = 0,
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
new file mode 100644
index 0000000000..0ec36bd9db
--- /dev/null
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -0,0 +1,563 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qv4arraydata_p.h"
+#include "qv4object_p.h"
+#include "qv4functionobject_p.h"
+
+using namespace QV4;
+
+const ArrayVTable ArrayData::static_vtbl =
+{
+ ArrayData::Simple,
+ ArrayData::freeData,
+ ArrayData::reserve,
+ ArrayData::get,
+ ArrayData::put,
+ ArrayData::putArray,
+ ArrayData::del,
+ ArrayData::setAttribute,
+ ArrayData::attribute,
+ ArrayData::push_front,
+ ArrayData::pop_front,
+ ArrayData::truncate
+};
+
+const ArrayVTable SparseArrayData::static_vtbl =
+{
+ ArrayData::Sparse,
+ SparseArrayData::freeData,
+ SparseArrayData::reserve,
+ SparseArrayData::get,
+ SparseArrayData::put,
+ SparseArrayData::putArray,
+ SparseArrayData::del,
+ SparseArrayData::setAttribute,
+ SparseArrayData::attribute,
+ SparseArrayData::push_front,
+ SparseArrayData::pop_front,
+ SparseArrayData::truncate
+};
+
+
+void ArrayData::getHeadRoom(ArrayData *d)
+{
+ Q_ASSERT(d);
+ Q_ASSERT(!d->offset);
+ d->offset = qMax(d->len >> 2, (uint)16);
+ Property *newArray = new Property[d->offset + d->alloc];
+ memcpy(newArray + d->offset, d->data, d->len*sizeof(Property));
+ delete [] d->data;
+ d->data = newArray + d->offset;
+ if (d->attrs) {
+ PropertyAttributes *newAttrs = new PropertyAttributes[d->offset + d->alloc];
+ memcpy(newAttrs + d->offset, d->attrs, d->len*sizeof(PropertyAttributes));
+ delete [] d->attrs;
+ d->attrs = newAttrs + d->offset;
+ }
+}
+
+void ArrayData::reserve(ArrayData *d, uint n)
+{
+ if (n < 8)
+ n = 8;
+ if (n <= d->alloc)
+ return;
+
+ d->alloc = qMax(n, 2*d->alloc);
+ Property *newArrayData = new Property[d->alloc + d->offset];
+ if (d->data) {
+ memcpy(newArrayData + d->offset, d->data, sizeof(Property)*d->len);
+ delete [] (d->data - d->offset);
+ }
+ d->data = newArrayData + d->offset;
+
+ if (d->attrs) {
+ PropertyAttributes *newAttrs = new PropertyAttributes[d->alloc];
+ memcpy(newAttrs, d->attrs, sizeof(PropertyAttributes)*d->len);
+ delete [] (d->attrs - d->offset);
+
+ d->attrs = newAttrs;
+ }
+}
+
+void ArrayData::ensureAttributes()
+{
+ if (attrs)
+ return;
+
+ if (type == Simple)
+ type = Complex;
+ attrs = new PropertyAttributes[alloc + offset];
+ attrs += offset;
+ for (uint i = 0; i < len; ++i)
+ attrs[i] = Attr_Data;
+}
+
+
+void ArrayData::freeData(ArrayData *d)
+{
+ delete [] (d->data - d->offset);
+ if (d->attrs)
+ delete [] (d->attrs - d->offset);
+ delete d;
+}
+
+ReturnedValue ArrayData::get(const ArrayData *d, uint index)
+{
+ if (index >= d->len)
+ return Primitive::emptyValue().asReturnedValue();
+ return d->data[index].value.asReturnedValue();
+}
+
+bool ArrayData::put(ArrayData *d, uint index, ValueRef value)
+{
+ Q_ASSERT(!d->attrs || !d->attrs->isAccessor());
+ // ### honour attributes
+ d->data[index].value = value;
+ return true;
+}
+
+bool ArrayData::del(ArrayData *d, uint index)
+{
+ if (index >= d->len)
+ return true;
+
+ if (!d->attrs || d->attrs[index].isConfigurable()) {
+ d->data[index].value = Primitive::emptyValue();
+ if (d->attrs)
+ d->attrs[index] = Attr_Data;
+ return true;
+ }
+ if (d->data[index].value.isEmpty())
+ return true;
+ return false;
+}
+
+void ArrayData::setAttribute(ArrayData *d, uint index, PropertyAttributes attrs)
+{
+ d->attrs[index] = attrs;
+}
+
+PropertyAttributes ArrayData::attribute(const ArrayData *d, uint index)
+{
+ return d->attrs[index];
+}
+
+void ArrayData::push_front(ArrayData *d, SafeValue *values, uint n)
+{
+ Q_ASSERT(!d->attrs);
+ for (int i = n - 1; i >= 0; --i) {
+ if (!d->offset)
+ ArrayData::getHeadRoom(d);
+
+ --d->offset;
+ --d->data;
+ ++d->len;
+ ++d->alloc;
+ d->data->value = values[i].asReturnedValue();
+ }
+
+}
+
+ReturnedValue ArrayData::pop_front(ArrayData *d)
+{
+ Q_ASSERT(!d->attrs);
+ if (!d->len)
+ return Encode::undefined();
+
+ ReturnedValue v = d->data[0].value.isEmpty() ? Encode::undefined() : d->data[0].value.asReturnedValue();
+ ++d->offset;
+ ++d->data;
+ --d->len;
+ --d->alloc;
+ return v;
+}
+
+uint ArrayData::truncate(ArrayData *d, uint newLen)
+{
+ if (d->attrs) {
+ Property *it = d->data + d->len;
+ const Property *begin = d->data + newLen;
+ while (--it >= begin) {
+ if (!it->value.isEmpty() && !d->attrs[it - d->data].isConfigurable()) {
+ newLen = it - d->data + 1;
+ break;
+ }
+ it->value = Primitive::emptyValue();
+ }
+ }
+ d->len = newLen;
+ return newLen;
+}
+
+bool ArrayData::putArray(ArrayData *d, uint index, SafeValue *values, uint n)
+{
+ if (index + n > d->alloc)
+ reserve(d, index + n + 1);
+ for (uint i = d->len; i < index; ++i)
+ d->data[i].value = Primitive::emptyValue();
+ for (uint i = 0; i < n; ++i)
+ d->data[index + i].value = values[i];
+ d->len = qMax(d->len, index + n);
+ return true;
+}
+
+void SparseArrayData::free(ArrayData *d, uint idx)
+{
+ Q_ASSERT(d && d->type == ArrayData::Sparse);
+ SparseArrayData *dd = static_cast<SparseArrayData *>(d);
+ Property &pd = dd->data[idx];
+ pd.value.uint_32 = dd->freeList;
+ dd->freeList = idx;
+ if (dd->attrs)
+ dd->attrs[idx].clear();
+}
+
+
+void SparseArrayData::freeData(ArrayData *d)
+{
+ delete static_cast<SparseArrayData *>(d)->sparse;
+ ArrayData::freeData(d);
+}
+
+void SparseArrayData::reserve(ArrayData *d, uint n)
+{
+ if (n < 8)
+ n = 8;
+ if (n <= d->alloc)
+ return;
+
+ SparseArrayData *dd = static_cast<SparseArrayData *>(d);
+ // ### FIXME
+ dd->len = dd->alloc;
+ dd->alloc = qMax(n, 2*dd->alloc);
+ Property *newArrayData = new Property[dd->alloc];
+ if (dd->data) {
+ memcpy(newArrayData, dd->data, sizeof(Property)*dd->len);
+ delete [] dd->data;
+ }
+ dd->data = newArrayData;
+ if (dd->attrs) {
+ PropertyAttributes *newAttrs = new PropertyAttributes[dd->alloc];
+ memcpy(newAttrs, dd->attrs, sizeof(PropertyAttributes)*dd->len);
+ delete [] dd->attrs;
+ dd->attrs = newAttrs;
+ }
+ for (uint i = dd->freeList; i < dd->alloc; ++i)
+ dd->data[i].value = Primitive::fromInt32(i + 1);
+}
+
+uint SparseArrayData::allocate(ArrayData *d)
+{
+ Q_ASSERT(d->type == ArrayData::Sparse);
+ SparseArrayData *dd = static_cast<SparseArrayData *>(d);
+ uint idx = dd->freeList;
+ if (dd->alloc == dd->freeList)
+ reserve(d, d->alloc + 1);
+ dd->freeList = dd->data[dd->freeList].value.uint_32;
+ if (dd->attrs)
+ dd->attrs[idx].setType(PropertyAttributes::Data);
+ return idx;
+}
+
+ReturnedValue SparseArrayData::get(const ArrayData *d, uint index)
+{
+ SparseArrayNode *n = static_cast<const SparseArrayData *>(d)->sparse->findNode(index);
+ if (!n)
+ return Primitive::emptyValue().asReturnedValue();
+ return d->data[n->value].value.asReturnedValue();
+}
+
+bool SparseArrayData::put(ArrayData *d, uint index, ValueRef value)
+{
+ // ### honour attributes
+ SparseArrayNode *n = static_cast<SparseArrayData *>(d)->sparse->insert(index);
+ if (n->value == UINT_MAX)
+ n->value = allocate(d);
+ d->data[n->value].value = value;
+ return true;
+}
+
+bool SparseArrayData::del(ArrayData *d, uint index)
+{
+ SparseArrayData *dd = static_cast<SparseArrayData *>(d);
+ SparseArrayNode *n = dd->sparse->findNode(index);
+ if (!n)
+ return true;
+
+ uint pidx = n->value;
+ Q_ASSERT(!dd->data[pidx].value.isEmpty());
+
+ if (!dd->attrs || dd->attrs[pidx].isConfigurable()) {
+ d->data[pidx].value.int_32 = static_cast<SparseArrayData *>(d)->freeList;
+ static_cast<SparseArrayData *>(d)->freeList = pidx;
+ static_cast<SparseArrayData *>(d)->sparse->erase(n);
+ return true;
+ }
+ return false;
+}
+
+void SparseArrayData::setAttribute(ArrayData *d, uint index, PropertyAttributes attrs)
+{
+ SparseArrayNode *n = static_cast<SparseArrayData *>(d)->sparse->insert(index);
+ if (n->value == UINT_MAX)
+ n->value = allocate(d);
+ d->attrs[n->value] = attrs;
+}
+
+PropertyAttributes SparseArrayData::attribute(const ArrayData *d, uint index)
+{
+ SparseArrayNode *n = static_cast<const SparseArrayData *>(d)->sparse->insert(index);
+ if (!n)
+ return PropertyAttributes();
+ return d->attrs[n->value];
+}
+
+void SparseArrayData::push_front(ArrayData *d, SafeValue *values, uint n)
+{
+ Q_ASSERT(!d->attrs);
+ for (int i = n - 1; i >= 0; --i) {
+ uint idx = allocate(d);
+ d->data[idx].value = values[i];
+ static_cast<SparseArrayData *>(d)->sparse->push_front(idx);
+ }
+}
+
+ReturnedValue SparseArrayData::pop_front(ArrayData *d)
+{
+ Q_ASSERT(!d->attrs);
+ uint idx = static_cast<SparseArrayData *>(d)->sparse->pop_front();
+ ReturnedValue v;
+ if (idx != UINT_MAX) {
+ v = d->data[idx].value.asReturnedValue();
+ SparseArrayData::free(d, idx);
+ } else {
+ v = Encode::undefined();
+ }
+ return v;
+}
+
+uint SparseArrayData::truncate(ArrayData *d, uint newLen)
+{
+ SparseArrayNode *begin = static_cast<SparseArrayData *>(d)->sparse->lowerBound(newLen);
+ if (begin != static_cast<SparseArrayData *>(d)->sparse->end()) {
+ SparseArrayNode *it = static_cast<SparseArrayData *>(d)->sparse->end()->previousNode();
+ while (1) {
+ Property &pd = d->data[it->value];
+ if (d->attrs) {
+ if (!d->attrs[it->value].isConfigurable()) {
+ newLen = it->key() + 1;
+ break;
+ }
+ }
+ pd.value.tag = Value::Empty_Type;
+ pd.value.int_32 = static_cast<SparseArrayData *>(d)->freeList;
+ static_cast<SparseArrayData *>(d)->freeList = it->value;
+ bool brk = (it == begin);
+ SparseArrayNode *prev = it->previousNode();
+ static_cast<SparseArrayData *>(d)->sparse->erase(it);
+ if (brk)
+ break;
+ it = prev;
+ }
+ }
+ return newLen;
+}
+
+bool SparseArrayData::putArray(ArrayData *d, uint index, SafeValue *values, uint n)
+{
+ for (uint i = 0; i < n; ++i)
+ put(d, index + i, values[i]);
+ d->len = qMax(d->len, index + n);
+ return true;
+}
+
+
+uint ArrayData::append(Object *o, const ArrayObject *otherObj, uint n)
+{
+ ArrayData *d = o->arrayData;
+ if (!n)
+ return d->len;
+
+ const ArrayData *other = otherObj->arrayData;
+
+ if (other->isSparse()) {
+ o->initSparseArray();
+ d = o->arrayData;
+ }
+
+ uint oldSize = d->len;
+
+ // ### copy attributes as well!
+ if (d->type == ArrayData::Sparse) {
+ if (other->isSparse()) {
+ for (const SparseArrayNode *it = static_cast<const SparseArrayData *>(other)->sparse->begin();
+ it != static_cast<const SparseArrayData *>(other)->sparse->end(); it = it->nextNode())
+ // ### accessor properties
+ o->arraySet(d->len + it->key(), other->data[it->value].value);
+ } else {
+ d->vtable->reserve(d, oldSize + n);
+ memcpy(d->data + oldSize, other->data, n*sizeof(Property));
+ if (d->attrs)
+ std::fill(d->attrs + oldSize, d->attrs + oldSize + n, PropertyAttributes(Attr_Data));
+ for (uint i = 0; i < n; ++i) {
+ SparseArrayNode *n = static_cast<SparseArrayData *>(d)->sparse->insert(d->len + i);
+ n->value = oldSize + i;
+ }
+ }
+ } else if (other->length()) {
+ d->vtable->reserve(d, oldSize + other->length());
+ if (oldSize > d->len) {
+ for (uint i = d->len; i < oldSize; ++i)
+ d->data[i].value = Primitive::emptyValue();
+ }
+ if (other->attrs) {
+ for (uint i = 0; i < other->len; ++i) {
+ bool exists;
+ d->data[oldSize + i].value = const_cast<ArrayObject *>(otherObj)->getIndexed(i, &exists);
+ d->len = oldSize + i + 1;
+ o->arrayData->setAttributes(oldSize + i, Attr_Data);
+ if (!exists)
+ d->data[oldSize + i].value = Primitive::emptyValue();
+ }
+ } else {
+ d->len = oldSize + other->len;
+ memcpy(d->data + oldSize, other->data, other->len*sizeof(Property));
+ if (d->attrs)
+ std::fill(d->attrs + oldSize, d->attrs + oldSize + other->len, PropertyAttributes(Attr_Data));
+ }
+ }
+
+ return oldSize + n;
+}
+
+Property *ArrayData::insert(Object *o, uint index)
+{
+ Property *pd;
+ if (o->arrayData->type != ArrayData::Sparse && (index < 0x1000 || index < o->arrayData->len + (o->arrayData->len >> 2))) {
+ if (index >= o->arrayData->alloc)
+ o->arrayReserve(index + 1);
+ if (index >= o->arrayData->len) {
+ // mark possible hole in the array
+ for (uint i = o->arrayData->len; i < index; ++i)
+ o->arrayData->data[i].value = Primitive::emptyValue();
+ o->arrayData->len = index + 1;
+ }
+ pd = o->arrayData->data + index;
+ } else {
+ o->initSparseArray();
+ SparseArrayNode *n = static_cast<SparseArrayData *>(o->arrayData)->sparse->insert(index);
+ if (n->value == UINT_MAX)
+ n->value = SparseArrayData::allocate(o->arrayData);
+ pd = o->arrayData->data + n->value;
+ }
+ return pd;
+}
+
+void ArrayData::markObjects(ExecutionEngine *e)
+{
+ if (type == ArrayData::Simple) {
+ for (uint i = 0; i < len; ++i)
+ data[i].value.mark(e);
+ return;
+ } else {
+ for (uint i = 0; i < len; ++i) {
+ const Property &pd = data[i];
+ if (attrs && attrs[i].isAccessor()) {
+ if (pd.getter())
+ pd.getter()->mark(e);
+ if (pd.setter())
+ pd.setter()->mark(e);
+ } else {
+ pd.value.mark(e);
+ }
+ }
+ }
+
+}
+
+void ArrayData::sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint len)
+{
+ ArrayData *d = thisObject->arrayData;
+ if (!d || !d->len)
+ return;
+
+ if (d->type == ArrayData::Sparse) {
+ context->throwUnimplemented(QStringLiteral("Object::sort unimplemented for sparse arrays"));
+ return;
+ }
+
+ if (len > d->len)
+ len = d->len;
+
+ // The spec says the sorting goes through a series of get,put and delete operations.
+ // this implies that the attributes don't get sorted around.
+ // behavior of accessor properties is implementation defined. We simply turn them all
+ // into data properties and then sort. This is in line with the sentence above.
+ if (d->attrs) {
+ for (uint i = 0; i < len; i++) {
+ if (d->data[i].value.isEmpty()) {
+ while (--len > i)
+ if (!d->data[len].value.isEmpty())
+ break;
+ d->data[i].value = thisObject->getValue(d->data + len, d->attrs ? d->attrs[len] : Attr_Data);
+ if (d->attrs)
+ d->attrs[i] = Attr_Data;
+ d->data[len].value = Primitive::emptyValue();
+ } else if (d->attrs && d->attrs[i].isAccessor()) {
+ d->data[i].value = thisObject->getValue(d->data + i, d->attrs[i]);
+ d->attrs[i] = Attr_Data;
+ }
+ }
+ }
+
+ if (!(comparefn->isUndefined() || comparefn->asObject())) {
+ context->throwTypeError();
+ return;
+ }
+
+ ArrayElementLessThan lessThan(context, thisObject, comparefn);
+
+ if (!len)
+ return;
+ Property *begin = d->data;
+ std::sort(begin, begin + len, lessThan);
+}
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
new file mode 100644
index 0000000000..98968fada2
--- /dev/null
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -0,0 +1,242 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4ARRAYDATA_H
+#define QV4ARRAYDATA_H
+
+#include "qv4global_p.h"
+#include "qv4managed_p.h"
+#include "qv4property_p.h"
+#include "qv4sparsearray_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+
+struct ArrayData;
+
+struct ArrayVTable
+{
+ uint type;
+ void (*freeData)(ArrayData *d);
+ void (*reserve)(ArrayData *d, uint n);
+ ReturnedValue (*get)(const ArrayData *d, uint index);
+ bool (*put)(ArrayData *d, uint index, ValueRef value);
+ bool (*putArray)(ArrayData *d, uint index, SafeValue *values, uint n);
+ bool (*del)(ArrayData *d, uint index);
+ void (*setAttribute)(ArrayData *d, uint index, PropertyAttributes attrs);
+ PropertyAttributes (*attribute)(const ArrayData *d, uint index);
+ void (*push_front)(ArrayData *d, SafeValue *values, uint n);
+ ReturnedValue (*pop_front)(ArrayData *d);
+ uint (*truncate)(ArrayData *d, uint newLen);
+};
+
+
+struct Q_QML_EXPORT ArrayData
+{
+ ArrayData()
+ : vtable(&static_vtbl)
+ , offset(0)
+ , len(0)
+ , alloc(0)
+ , type(0)
+ , attrs(0)
+ , data(0)
+ {
+ }
+
+ enum Type {
+ Simple = 0,
+ Complex = 1,
+ Sparse = 2,
+ Custom = 3
+ };
+
+ const ArrayVTable *vtable;
+ uint offset;
+ uint len;
+ uint alloc;
+ uint type;
+ PropertyAttributes *attrs;
+ Property *data;
+
+ bool isSparse() const { return this && type == Sparse; }
+
+ uint length() const {
+ return this ? len : 0;
+ }
+ void setLength(uint l) {
+ Q_ASSERT(this);
+ len = l;
+ }
+
+ bool hasAttributes() const {
+ return this && attrs;
+ }
+ void ensureAttributes();
+ PropertyAttributes attributes(int i) const {
+ Q_ASSERT(this);
+ return attrs ? vtable->attribute(this, i) : Attr_Data;
+ }
+ void setAttributes(uint i, PropertyAttributes a) {
+ Q_ASSERT(this);
+ if (attrs || a != Attr_Data) {
+ ensureAttributes();
+ a.resolve();
+ vtable->setAttribute(this, i, a);
+ }
+ }
+
+ bool isEmpty(uint i) const {
+ if (!this)
+ return true;
+ return (vtable->get(this, i) == Primitive::emptyValue().asReturnedValue());
+ }
+
+
+ inline void free() {
+ vtable->freeData(this);
+ }
+
+ inline void push_front(SafeValue *values, uint nValues) {
+ vtable->push_front(this, values, nValues);
+ }
+ inline ReturnedValue pop_front() {
+ return vtable->pop_front(this);
+ }
+ inline uint push_back(uint l, uint n, SafeValue *values) {
+ vtable->putArray(this, l, values, n);
+ return len;
+ }
+ inline bool deleteIndex(uint index) {
+ return vtable->del(this, index);
+ }
+ inline uint truncate(uint newLen) {
+ if (!this || len < newLen)
+ return newLen;
+ return vtable->truncate(this, newLen);
+ }
+ bool put(uint index, ValueRef value) {
+ return vtable->put(this, index, value);
+ }
+ bool put(uint index, SafeValue *values, uint n) {
+ return vtable->putArray(this, index, values, n);
+ }
+ ReturnedValue get(uint i) const {
+ if (!this)
+ return Primitive::emptyValue().asReturnedValue();
+ return vtable->get(this, i);
+ }
+ inline Property *getProperty(uint index) const;
+
+
+
+ static void sort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint dataLen);
+ static uint append(Object *o, const ArrayObject *otherObj, uint n);
+ static Property *insert(Object *o, uint index);
+ void markObjects(ExecutionEngine *e);
+
+ static void getHeadRoom(ArrayData *d);
+ static void reserve(ArrayData *d, uint n);
+
+ static void freeData(ArrayData *d);
+ static ReturnedValue get(const ArrayData *d, uint index);
+ static bool put(ArrayData *d, uint index, ValueRef value);
+ static bool putArray(ArrayData *d, uint index, SafeValue *values, uint n);
+ static bool del(ArrayData *d, uint index);
+ static void setAttribute(ArrayData *d, uint index, PropertyAttributes attrs);
+ static PropertyAttributes attribute(const ArrayData *d, uint index);
+ static void push_front(ArrayData *d, SafeValue *values, uint n);
+ static ReturnedValue pop_front(ArrayData *d);
+ static uint truncate(ArrayData *d, uint newLen);
+
+ static const ArrayVTable static_vtbl;
+};
+
+struct Q_QML_EXPORT SparseArrayData : public ArrayData
+{
+ SparseArrayData()
+ : freeList(0)
+ , sparse(0)
+ { vtable = &static_vtbl; }
+
+ uint freeList;
+ SparseArray *sparse;
+
+ static uint allocate(ArrayData *d);
+ static void free(ArrayData *d, uint idx);
+
+ static void freeData(ArrayData *d);
+ static void reserve(ArrayData *d, uint n);
+ static ReturnedValue get(const ArrayData *d, uint index);
+ static bool put(ArrayData *d, uint index, ValueRef value);
+ static bool putArray(ArrayData *d, uint index, SafeValue *values, uint n);
+ static bool del(ArrayData *d, uint index);
+ static void setAttribute(ArrayData *d, uint index, PropertyAttributes attrs);
+ static PropertyAttributes attribute(const ArrayData *d, uint index);
+ static void push_front(ArrayData *d, SafeValue *values, uint n);
+ static ReturnedValue pop_front(ArrayData *d);
+ static uint truncate(ArrayData *d, uint newLen);
+
+ static const ArrayVTable static_vtbl;
+};
+
+
+inline Property *ArrayData::getProperty(uint index) const
+{
+ if (!this)
+ return 0;
+ if (type != Sparse) {
+ if (index >= len || data[index].value.isEmpty())
+ return 0;
+ return data + index;
+ } else {
+ SparseArrayNode *n = static_cast<const SparseArrayData *>(this)->sparse->findNode(index);
+ if (!n)
+ return 0;
+ return data + n->value;
+ }
+}
+
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 296471692c..eb8a5301de 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -72,9 +72,8 @@ ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData)
} else {
len = callData->argc;
a->arrayReserve(len);
- for (unsigned int i = 0; i < len; ++i)
- a->arrayData[i].value = callData->args[i];
- a->arrayDataLen = len;
+ a->arrayData->put(0, callData->args, len);
+ a->arrayData->setLength(len);
}
a->setArrayLengthUnchecked(len);
@@ -122,15 +121,6 @@ void ArrayPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
defineDefaultProperty(QStringLiteral("reduceRight"), method_reduceRight, 1);
}
-uint ArrayPrototype::getLength(ExecutionContext *ctx, ObjectRef o)
-{
- if (o->isArrayObject())
- return o->arrayLength();
- Scope scope(ctx);
- ScopedValue v(scope, o->get(ctx->engine->id_length));
- return v->toUInt32();
-}
-
ReturnedValue ArrayPrototype::method_isArray(CallContext *ctx)
{
bool isArray = ctx->callData->argc && ctx->callData->args[0].asArrayObject();
@@ -180,15 +170,17 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
eltAsObj = ctx->callData->args[i];
elt = ctx->callData->args[i];
if (elt) {
- result->arrayConcat(elt.getPointer());
+ uint n = elt->getLength();
+ uint newLen = ArrayData::append(result.getPointer(), elt.getPointer(), n);
+ result->setArrayLengthUnchecked(newLen);
} else if (eltAsObj && eltAsObj->isListType()) {
- const uint startIndex = getLength(ctx, result);
- for (int i = 0, len = getLength(ctx, eltAsObj); i < len; ++i) {
+ const uint startIndex = result->getLength();
+ for (int i = 0, len = eltAsObj->getLength(); i < len; ++i) {
entry = eltAsObj->getIndexed(i);
result->putIndexed(startIndex + i, entry);
}
} else {
- result->arraySet(getLength(ctx, result), ctx->callData->args[i]);
+ result->arraySet(result->getLength(), ctx->callData->args[i]);
}
}
@@ -218,7 +210,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
// ### FIXME
if (ArrayObject *a = self->asArrayObject()) {
ScopedValue e(scope);
- for (uint i = 0; i < a->arrayLength(); ++i) {
+ for (uint i = 0; i < a->getLength(); ++i) {
if (i)
R += r4;
@@ -260,7 +252,7 @@ ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
if (!len) {
if (!instance->isArrayObject())
@@ -288,7 +280,10 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+
+ instance->arrayCreate();
+
+ uint len = instance->getLength();
if (len + ctx->callData->argc < len) {
// ughh...
@@ -308,21 +303,8 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
return Encode(newLen);
}
- if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
- for (int i = 0; i < ctx->callData->argc; ++i) {
- if (!instance->sparseArray) {
- if (len >= instance->arrayAlloc)
- instance->arrayReserve(len + 1);
- instance->arrayData[len].value = ctx->callData->args[i];
- if (instance->arrayAttributes)
- instance->arrayAttributes[len] = Attr_Data;
- instance->arrayDataLen = len + 1;
- } else {
- uint j = instance->allocArrayValue(ctx->callData->args[i]);
- instance->sparseArray->push_back(j, len);
- }
- ++len;
- }
+ if (!instance->protoHasArray() && instance->arrayData->length() <= len) {
+ len = instance->arrayData->push_back(len, ctx->callData->argc, ctx->callData->args);
} else {
for (int i = 0; i < ctx->callData->argc; ++i)
instance->putIndexed(len + i, ctx->callData->args[i]);
@@ -342,7 +324,7 @@ ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint length = getLength(ctx, instance);
+ uint length = instance->getLength();
int lo = 0, hi = length - 1;
@@ -374,7 +356,10 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+
+ instance->arrayCreate();
+
+ uint len = instance->getLength();
if (!len) {
if (!instance->isArrayObject())
@@ -382,28 +367,14 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
return Encode::undefined();
}
- Property *front = 0;
- uint pidx = instance->propertyIndexFromArrayIndex(0);
- if (pidx < UINT_MAX && !instance->arrayData[pidx].value.isEmpty())
- front = instance->arrayData + pidx;
+ ScopedValue result(scope);
- ScopedValue result(scope, front ? instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data) : Encode::undefined());
-
- if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
- if (!instance->sparseArray) {
- if (instance->arrayDataLen) {
- ++instance->arrayOffset;
- ++instance->arrayData;
- --instance->arrayDataLen;
- --instance->arrayAlloc;
- if (instance->arrayAttributes)
- ++instance->arrayAttributes;
- }
- } else {
- uint idx = instance->sparseArray->pop_front();
- instance->freeArrayValue(idx);
- }
+ if (!instance->protoHasArray() && !instance->arrayData->hasAttributes() && instance->arrayData->length() <= len) {
+ result = instance->arrayData->pop_front();
} else {
+ result = instance->getIndexed(0);
+ if (scope.hasException())
+ return Encode::undefined();
ScopedValue v(scope);
// do it the slow way
for (uint k = 1; k < len; ++k) {
@@ -415,6 +386,8 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
instance->putIndexed(k - 1, v);
else
instance->deleteIndexedProperty(k - 1);
+ if (scope.hasException())
+ return Encode::undefined();
}
instance->deleteIndexedProperty(len - 1);
if (scope.hasException())
@@ -436,7 +409,7 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
return Encode::undefined();
Scoped<ArrayObject> result(scope, ctx->engine->newArrayObject());
- uint len = getLength(ctx, o);
+ uint len = o->getLength();
double s = ScopedValue(scope, ctx->argument(0))->toInteger();
uint start;
if (s < 0)
@@ -477,10 +450,10 @@ ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
ScopedValue comparefn(scope, ctx->argument(0));
- instance->arraySort(ctx, instance, comparefn, len);
+ ArrayData::sort(ctx, instance, comparefn, len);
return ctx->callData->thisObject.asReturnedValue();
}
@@ -490,7 +463,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<ArrayObject> newArray(scope, ctx->engine->newArrayObject());
@@ -504,17 +477,21 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
uint deleteCount = (uint)qMin(qMax(ScopedValue(scope, ctx->argument(1))->toInteger(), 0.), (double)(len - start));
newArray->arrayReserve(deleteCount);
+ ScopedValue v(scope);
for (uint i = 0; i < deleteCount; ++i) {
- newArray->arrayData[i].value = instance->getIndexed(start + i);
+ bool exists;
+ v = instance->getIndexed(start + i, &exists);
if (scope.hasException())
return Encode::undefined();
- newArray->arrayDataLen = i + 1;
+ if (exists) {
+ newArray->arrayData->put(i, v);
+ newArray->arrayData->setLength(i + 1);
+ }
}
newArray->setArrayLengthUnchecked(deleteCount);
uint itemCount = ctx->callData->argc < 2 ? 0 : ctx->callData->argc - 2;
- ScopedValue v(scope);
if (itemCount < deleteCount) {
for (uint k = start; k < len - deleteCount; ++k) {
bool exists;
@@ -568,32 +545,15 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
- ScopedValue v(scope);
- if (!instance->protoHasArray() && instance->arrayDataLen <= len) {
- for (int i = ctx->callData->argc - 1; i >= 0; --i) {
- v = ctx->argument(i);
-
- if (!instance->sparseArray) {
- if (!instance->arrayOffset)
- instance->getArrayHeadRoom();
-
- --instance->arrayOffset;
- --instance->arrayData;
- ++instance->arrayDataLen;
- ++instance->arrayAlloc;
- if (instance->arrayAttributes) {
- --instance->arrayAttributes;
- *instance->arrayAttributes = Attr_Data;
- }
- instance->arrayData->value = v.asReturnedValue();
- } else {
- uint idx = instance->allocArrayValue(v);
- instance->sparseArray->push_front(idx);
- }
- }
+ instance->arrayCreate();
+
+ uint len = instance->getLength();
+
+ if (!instance->protoHasArray() && !instance->arrayData->hasAttributes() && instance->arrayData->length() <= len) {
+ instance->arrayData->push_front(ctx->callData->args, ctx->callData->argc);
} else {
+ ScopedValue v(scope);
for (uint k = len; k > 0; --k) {
bool exists;
v = instance->getIndexed(k - 1, &exists);
@@ -622,7 +582,7 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
if (!len)
return Encode(-1);
@@ -651,7 +611,48 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
return Encode(-1);
}
- return instance->arrayIndexOf(searchValue, fromIndex, len, ctx, instance.getPointer());
+ ScopedValue value(scope);
+
+ if ((instance->arrayData && instance->arrayType() != ArrayData::Simple) || instance->protoHasArray()) {
+ // lets be safe and slow
+ for (uint i = fromIndex; i < len; ++i) {
+ bool exists;
+ value = instance->getIndexed(i, &exists);
+ if (scope.hasException())
+ return Encode::undefined();
+ if (exists && __qmljs_strict_equal(value, searchValue))
+ return Encode(i);
+ }
+ } else if (!instance->arrayData) {
+ return Encode(-1);
+ } else if (instance->arrayType() == ArrayData::Sparse) {
+ for (SparseArrayNode *n = static_cast<SparseArrayData *>(instance->arrayData)->sparse->lowerBound(fromIndex);
+ n != static_cast<SparseArrayData *>(instance->arrayData)->sparse->end() && n->key() < len; n = n->nextNode()) {
+ value = instance->getValue(instance->arrayData->data + n->value,
+ instance->arrayData->attrs ? instance->arrayData->attrs[n->value] : Attr_Data);
+ if (scope.hasException())
+ return Encode::undefined();
+ if (__qmljs_strict_equal(value, searchValue))
+ return Encode(n->key());
+ }
+ } else {
+ if (len > instance->arrayData->length())
+ len = instance->arrayData->length();
+ Property *pd = instance->arrayData->data;
+ Property *end = pd + len;
+ pd += fromIndex;
+ while (pd < end) {
+ if (!pd->value.isEmpty()) {
+ value = instance->getValue(pd, instance->arrayData->attributes(pd - instance->arrayData->data));
+ if (scope.hasException())
+ return Encode::undefined();
+ if (__qmljs_strict_equal(value, searchValue))
+ return Encode((uint)(pd - instance->arrayData->data));
+ }
+ ++pd;
+ }
+ }
+ return Encode(-1);
}
ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
@@ -661,7 +662,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx));
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
if (!len)
return Encode(-1);
@@ -707,7 +708,7 @@ ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -741,7 +742,7 @@ ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -775,7 +776,7 @@ ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -806,7 +807,7 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -843,7 +844,7 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -884,7 +885,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
@@ -934,7 +935,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
if (!instance)
return Encode::undefined();
- uint len = getLength(ctx, instance);
+ uint len = instance->getLength();
Scoped<FunctionObject> callback(scope, ctx->argument(0));
if (!callback)
diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h
index 7e809f9064..641be86e2c 100644
--- a/src/qml/jsruntime/qv4arrayobject_p.h
+++ b/src/qml/jsruntime/qv4arrayobject_p.h
@@ -64,8 +64,6 @@ struct ArrayPrototype: ArrayObject
void init(ExecutionEngine *engine, ObjectRef ctor);
- static uint getLength(ExecutionContext *ctx, ObjectRef o);
-
static ReturnedValue method_isArray(CallContext *ctx);
static ReturnedValue method_toString(CallContext *ctx);
static ReturnedValue method_toLocaleString(CallContext *ctx);
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 05a0e66e09..27c3a31d95 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -53,6 +53,13 @@ using namespace QV4;
const ManagedVTable ExecutionContext::static_vtbl =
{
+ ExecutionContext::IsExecutionContext,
+ ExecutionContext::IsString,
+ ExecutionContext::IsObject,
+ ExecutionContext::IsFunctionObject,
+ ExecutionContext::IsErrorObject,
+ 0,
+ ExecutionContext::MyType,
call,
construct,
markObjects,
@@ -70,6 +77,7 @@ const ManagedVTable ExecutionContext::static_vtbl =
0,
isEqualTo,
0,
+ 0,
"ExecutionContext",
};
@@ -355,16 +363,9 @@ void ExecutionContext::setProperty(const StringRef name, const ValueRef value)
}
if (activation) {
- if (ctx->type == Type_QmlContext) {
+ if (ctx->type == Type_QmlContext || activation->hasOwnProperty(name)) {
activation->put(name, value);
return;
- } else {
- PropertyAttributes attrs;
- Property *p = activation->__getOwnProperty__(name, &attrs);
- if (p) {
- activation->putValue(p, attrs, value);
- return;
- }
}
}
}
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 4eb89ad905..851f024a60 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -70,6 +70,10 @@ struct WithContext;
struct Q_QML_EXPORT ExecutionContext : public Managed
{
Q_MANAGED
+ Q_MANAGED_TYPE(ExecutionContext)
+ enum {
+ IsExecutionContext = true
+ };
enum ContextType {
Type_GlobalContext = 0x1,
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 5d0c8ccf8e..2b6aa21ac2 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -647,7 +647,6 @@ DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
: Object(engine->dateClass)
{
setVTable(&static_vtbl);
- type = Type_DateObject;
value.setDouble(date.isValid() ? date.toMSecsSinceEpoch() : qSNaN());
}
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index 9c451dd251..244553b1d4 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -53,9 +53,9 @@ namespace QV4 {
struct DateObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(DateObject)
SafeValue value;
DateObject(ExecutionEngine *engine, const ValueRef date): Object(engine->dateClass) {
- type = Type_DateObject;
value = date;
}
DateObject(ExecutionEngine *engine, const QDateTime &value);
@@ -64,8 +64,7 @@ struct DateObject: Object {
protected:
DateObject(InternalClass *ic): Object(ic) {
- setVTable(&static_vtbl);
- type = Type_DateObject;
+ Q_ASSERT(internalClass->vtable == &static_vtbl);
value = Primitive::fromDouble(qSNaN());
}
};
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 539bc5ddd6..384254f896 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -195,9 +195,9 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
identifierTable = new IdentifierTable(this);
emptyClass = new (classPool.allocate(sizeof(InternalClass))) InternalClass(this);
- executionContextClass = emptyClass->changeVTable(&ExecutionContext::static_vtbl);
- stringClass = emptyClass->changeVTable(&String::static_vtbl);
- regExpValueClass = emptyClass->changeVTable(&RegExp::static_vtbl);
+ executionContextClass = InternalClass::create(this, &ExecutionContext::static_vtbl, 0);
+ stringClass = InternalClass::create(this, &String::static_vtbl, 0);
+ regExpValueClass = InternalClass::create(this, &RegExp::static_vtbl, 0);
id_undefined = newIdentifier(QStringLiteral("undefined"));
id_null = newIdentifier(QStringLiteral("null"));
@@ -230,7 +230,7 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
id_toString = newIdentifier(QStringLiteral("toString"));
id_valueOf = newIdentifier(QStringLiteral("valueOf"));
- ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(emptyClass->changeVTable(&ObjectPrototype::static_vtbl));
+ ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(InternalClass::create(this, &ObjectPrototype::static_vtbl, 0));
objectClass = InternalClass::create(this, &Object::static_vtbl, objectPrototype);
Q_ASSERT(objectClass->vtable == &Object::static_vtbl);
@@ -249,16 +249,16 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
initRootContext();
- StringPrototype *stringPrototype = new (memoryManager) StringPrototype(objectClass);
+ StringPrototype *stringPrototype = new (memoryManager) StringPrototype(InternalClass::create(this, &StringPrototype::static_vtbl, objectPrototype));
stringObjectClass = InternalClass::create(this, &String::static_vtbl, stringPrototype);
- NumberPrototype *numberPrototype = new (memoryManager) NumberPrototype(objectClass);
+ NumberPrototype *numberPrototype = new (memoryManager) NumberPrototype(InternalClass::create(this, &NumberPrototype::static_vtbl, objectPrototype));
numberClass = InternalClass::create(this, &NumberObject::static_vtbl, numberPrototype);
- BooleanPrototype *booleanPrototype = new (memoryManager) BooleanPrototype(objectClass);
+ BooleanPrototype *booleanPrototype = new (memoryManager) BooleanPrototype(InternalClass::create(this, &BooleanPrototype::static_vtbl, objectPrototype));
booleanClass = InternalClass::create(this, &BooleanObject::static_vtbl, booleanPrototype);
- DatePrototype *datePrototype = new (memoryManager) DatePrototype(objectClass);
+ DatePrototype *datePrototype = new (memoryManager) DatePrototype(InternalClass::create(this, &DatePrototype::static_vtbl, objectPrototype));
dateClass = InternalClass::create(this, &DateObject::static_vtbl, datePrototype);
FunctionPrototype *functionPrototype = new (memoryManager) FunctionPrototype(InternalClass::create(this, &FunctionPrototype::static_vtbl, objectPrototype));
@@ -269,14 +269,14 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
protoClass = objectClass->addMember(id_constructor, Attr_NotEnumerable, &index);
Q_ASSERT(index == FunctionObject::Index_ProtoConstructor);
- RegExpPrototype *regExpPrototype = new (memoryManager) RegExpPrototype(objectClass);
+ RegExpPrototype *regExpPrototype = new (memoryManager) RegExpPrototype(InternalClass::create(this, &RegExpPrototype::static_vtbl, objectPrototype));
regExpClass = InternalClass::create(this, &RegExpObject::static_vtbl, regExpPrototype);
regExpExecArrayClass = arrayClass->addMember(id_index, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayIndex);
regExpExecArrayClass = regExpExecArrayClass->addMember(id_input, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayInput);
- ErrorPrototype *errorPrototype = new (memoryManager) ErrorPrototype(objectClass);
+ ErrorPrototype *errorPrototype = new (memoryManager) ErrorPrototype(InternalClass::create(this, &ErrorObject::static_vtbl, objectPrototype));
errorClass = InternalClass::create(this, &ErrorObject::static_vtbl, errorPrototype);
EvalErrorPrototype *evalErrorPrototype = new (memoryManager) EvalErrorPrototype(errorClass);
evalErrorClass = InternalClass::create(this, &EvalErrorObject::static_vtbl, evalErrorPrototype);
@@ -357,8 +357,8 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
globalObject->defineDefaultProperty(QStringLiteral("TypeError"), typeErrorCtor);
globalObject->defineDefaultProperty(QStringLiteral("URIError"), uRIErrorCtor);
ScopedObject o(scope);
- globalObject->defineDefaultProperty(QStringLiteral("Math"), (o = new (memoryManager) MathObject(this)));
- globalObject->defineDefaultProperty(QStringLiteral("JSON"), (o = new (memoryManager) JsonObject(this)));
+ globalObject->defineDefaultProperty(QStringLiteral("Math"), (o = new (memoryManager) MathObject(QV4::InternalClass::create(this, &MathObject::static_vtbl, objectPrototype))));
+ globalObject->defineDefaultProperty(QStringLiteral("JSON"), (o = new (memoryManager) JsonObject(QV4::InternalClass::create(this, &JsonObject::static_vtbl, objectPrototype))));
globalObject->defineReadonlyProperty(QStringLiteral("undefined"), Primitive::undefinedValue());
globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits<double>::quiet_NaN()));
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index cf5c06dd41..f5d21b2f30 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -76,8 +76,6 @@ ErrorObject::ErrorObject(InternalClass *ic)
: Object(ic)
, stack(0)
{
- type = Type_ErrorObject;
-
Scope scope(engine());
ScopedValue protectThis(scope, this);
@@ -89,7 +87,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const ValueRef message, ErrorType t)
: Object(ic)
, stack(0)
{
- type = Type_ErrorObject;
subtype = t;
Scope scope(engine());
@@ -113,7 +110,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, ErrorObject:
: Object(ic)
, stack(0)
{
- type = Type_ErrorObject;
subtype = t;
Scope scope(engine());
@@ -137,7 +133,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, const QStrin
: Object(ic)
, stack(0)
{
- type = Type_ErrorObject;
subtype = t;
Scope scope(engine());
diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h
index def776d3b6..560b003062 100644
--- a/src/qml/jsruntime/qv4errorobject_p.h
+++ b/src/qml/jsruntime/qv4errorobject_p.h
@@ -52,6 +52,10 @@ struct SyntaxErrorObject;
struct ErrorObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(ErrorObject)
+ enum {
+ IsErrorObject = true
+ };
enum ErrorType {
Error,
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 6e5c137e0b..a1673dfc2a 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -112,7 +112,6 @@ FunctionObject::FunctionObject(InternalClass *ic)
{
name = ic->engine->id_undefined;
- type = Type_FunctionObject;
needsActivation = false;
strictMode = false;
}
@@ -130,7 +129,6 @@ void FunctionObject::init(const StringRef n, bool createProto)
Scope s(internalClass->engine);
ScopedValue protectThis(s, this);
- type = Type_FunctionObject;
needsActivation = true;
strictMode = false;
#ifndef QT_NO_DEBUG
@@ -345,19 +343,19 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
if (!arg->isNullOrUndefined())
return ctx->throwTypeError();
} else {
- len = ArrayPrototype::getLength(ctx, arr);
+ len = arr->getLength();
}
ScopedCallData callData(scope, len);
if (len) {
- if (!(arr->flags & SimpleArray) || arr->protoHasArray() || arr->hasAccessorProperty) {
+ if (arr->arrayType() != ArrayData::Simple || arr->protoHasArray() || arr->hasAccessorProperty) {
for (quint32 i = 0; i < len; ++i)
callData->args[i] = arr->getIndexed(i);
} else {
- int alen = qMin(len, arr->arrayDataLen);
+ int alen = qMin(len, arr->arrayData->length());
for (int i = 0; i < alen; ++i)
- callData->args[i] = arr->arrayData[i].value;
+ callData->args[i] = arr->arrayData->data[i].value;
for (quint32 i = alen; i < len; ++i)
callData->args[i] = Primitive::undefinedValue();
}
@@ -429,8 +427,8 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
if (scope->strictMode) {
Property pd = Property::fromAccessor(v4->thrower, v4->thrower);
- *insertMember(scope->engine->id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
- *insertMember(scope->engine->id_arguments, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
+ insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
}
@@ -511,8 +509,8 @@ SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *fu
if (scope->strictMode) {
Property pd = Property::fromAccessor(v4->thrower, v4->thrower);
- *insertMember(scope->engine->id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
- *insertMember(scope->engine->id_arguments, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
+ insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
}
@@ -670,8 +668,8 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObjectRef target,
ExecutionEngine *v4 = scope->engine;
Property pd = Property::fromAccessor(v4->thrower, v4->thrower);
- *insertMember(scope->engine->id_arguments, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
- *insertMember(scope->engine->id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable) = pd;
+ insertMember(scope->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
+ insertMember(scope->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
void BoundFunction::destroy(Managed *that)
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 96534cb68c..0168e13a6f 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -94,6 +94,10 @@ struct Lookup;
struct Q_QML_EXPORT FunctionObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(FunctionObject)
+ enum {
+ IsFunctionObject = true
+ };
// Used with Managed::subType
enum FunctionType {
RegularFunction = 0,
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 29ede3d104..761a180722 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -183,6 +183,8 @@ InternalClass *InternalClass::changeMember(String *string, PropertyAttributes da
InternalClass *InternalClass::create(ExecutionEngine *engine, const ManagedVTable *vtable, Object *proto)
{
InternalClass *c = engine->emptyClass->changeVTable(vtable);
+ if (!proto)
+ return c;
return c->changePrototype(proto);
}
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 6633435668..f40c765327 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -66,6 +66,8 @@ static int indent = 0;
#endif
+DEFINE_MANAGED_VTABLE(JsonObject);
+
class JsonParser
{
public:
@@ -288,8 +290,7 @@ bool JsonParser::parseMember(ObjectRef o)
if (idx < UINT_MAX) {
o->putIndexed(idx, val);
} else {
- Property *p = o->insertMember(s, Attr_Data);
- p->value = val.asReturnedValue();
+ o->insertMember(s, val);
}
END;
@@ -337,7 +338,7 @@ ReturnedValue JsonParser::parseArray()
}
}
- DEBUG << "size =" << array->arrayLength();
+ DEBUG << "size =" << array->getLength();
END;
--nestingLevel;
@@ -853,7 +854,7 @@ QString Stringify::JA(ArrayObjectRef a)
indent += gap;
QStringList partial;
- uint len = a->arrayLength();
+ uint len = a->getLength();
ScopedValue v(scope);
for (uint i = 0; i < len; ++i) {
bool exists;
@@ -884,12 +885,10 @@ QString Stringify::JA(ArrayObjectRef a)
}
-JsonObject::JsonObject(ExecutionEngine *engine)
- : Object(engine)
+JsonObject::JsonObject(InternalClass *ic)
+ : Object(ic)
{
- type = Type_JSONObject;
-
- Scope scope(engine);
+ Scope scope(ic->engine);
ScopedObject protectThis(scope, this);
defineDefaultProperty(QStringLiteral("parse"), method_parse, 2);
@@ -925,7 +924,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
if (o) {
stringify.replacerFunction = o->asFunctionObject();
if (o->isArrayObject()) {
- uint arrayLen = o->arrayLength();
+ uint arrayLen = o->getLength();
ScopedValue v(scope);
for (uint i = 0; i < arrayLen; ++i) {
v = o->getIndexed(i);
@@ -1057,9 +1056,10 @@ QV4::ReturnedValue JsonObject::fromJsonArray(ExecutionEngine *engine, const QJso
int size = array.size();
Scoped<ArrayObject> a(scope, engine->newArrayObject());
a->arrayReserve(size);
+ ScopedValue v(scope);
for (int i = 0; i < size; i++) {
- a->arrayData[i].value = fromJsonValue(engine, array.at(i));
- a->arrayDataLen = i + 1;
+ a->arrayData->put(i, (v = fromJsonValue(engine, array.at(i))));
+ a->arrayData->setLength(i + 1);
}
a->setArrayLengthUnchecked(size);
return a.asReturnedValue();
@@ -1083,7 +1083,7 @@ QJsonArray JsonObject::toJsonArray(ArrayObjectRef a, V4ObjectSet &visitedObjects
visitedObjects.insert(a);
ScopedValue v(scope);
- quint32 length = a->arrayLength();
+ quint32 length = a->getLength();
for (quint32 i = 0; i < length; ++i) {
v = a->getIndexed(i);
if (v->asFunctionObject())
diff --git a/src/qml/jsruntime/qv4jsonobject_p.h b/src/qml/jsruntime/qv4jsonobject_p.h
index 3bcbdeadbf..b37b28b078 100644
--- a/src/qml/jsruntime/qv4jsonobject_p.h
+++ b/src/qml/jsruntime/qv4jsonobject_p.h
@@ -51,10 +51,12 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
struct JsonObject : Object {
+ Q_MANAGED_TYPE(JsonObject)
+ Q_MANAGED
private:
typedef QSet<QV4::Object *> V4ObjectSet;
public:
- JsonObject(ExecutionEngine *engine);
+ JsonObject(InternalClass *ic);
static ReturnedValue method_parse(CallContext *ctx);
static ReturnedValue method_stringify(CallContext *ctx);
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index a870cdac61..66dc7b7e4a 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -316,6 +316,15 @@ ReturnedValue Lookup::stringLengthGetter(Lookup *l, const ValueRef object)
return getterGeneric(l, object);
}
+ReturnedValue Lookup::arrayLengthGetter(Lookup *l, const ValueRef object)
+{
+ if (ArrayObject *a = object->asArrayObject())
+ return a->memberData[ArrayObject::LengthPropertyIndex].value.asReturnedValue();
+
+ l->getter = getterGeneric;
+ return getterGeneric(l, object);
+}
+
ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
{
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
index 9966d36604..93c2e2156e 100644
--- a/src/qml/jsruntime/qv4lookup_p.h
+++ b/src/qml/jsruntime/qv4lookup_p.h
@@ -85,6 +85,7 @@ struct Lookup {
static ReturnedValue primitiveGetterAccessor0(Lookup *l, const ValueRef object);
static ReturnedValue primitiveGetterAccessor1(Lookup *l, const ValueRef object);
static ReturnedValue stringLengthGetter(Lookup *l, const ValueRef object);
+ static ReturnedValue arrayLengthGetter(Lookup *l, const ValueRef object);
static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionContext *ctx);
static ReturnedValue globalGetter0(Lookup *l, ExecutionContext *ctx);
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index fef7489110..c3dec2535b 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -47,6 +47,13 @@ using namespace QV4;
const ManagedVTable Managed::static_vtbl =
{
+ Managed::IsExecutionContext,
+ Managed::IsString,
+ Managed::IsObject,
+ Managed::IsFunctionObject,
+ Managed::IsErrorObject,
+ 0,
+ Managed::MyType,
call,
construct,
0 /*markObjects*/,
@@ -64,6 +71,7 @@ const ManagedVTable Managed::static_vtbl =
0,
isEqualTo,
0,
+ 0,
"Managed",
};
@@ -101,7 +109,7 @@ ExecutionEngine *Managed::engine() const
QString Managed::className() const
{
const char *s = 0;
- switch (Type(type)) {
+ switch (Type(internalClass->vtable->type)) {
case Type_Invalid:
case Type_String:
return QString();
@@ -157,18 +165,23 @@ QString Managed::className() const
case Type_ArgumentsObject:
s = "Arguments";
break;
- case Type_JSONObject:
+ case Type_JsonObject:
s = "JSON";
break;
case Type_MathObject:
s = "Math";
break;
+
+ case Type_ExecutionContext:
+ s = "__ExecutionContext";
+ break;
case Type_ForeachIteratorObject:
s = "__ForeachIterator";
break;
case Type_RegExp:
- s = "RegExp";
+ s = "__RegExp";
break;
+
case Type_QmlSequence:
s = "QmlSequence";
break;
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index e10409f397..932dbe818c 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -53,8 +53,8 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
#define Q_MANAGED_CHECK \
- template <typename T> inline void qt_check_for_QMANAGED_macro(const T &_q_argument) const \
- { int i = qYouForgotTheQ_MANAGED_Macro(this, &_q_argument); i = i + 1; }
+ template <typename T> inline void qt_check_for_QMANAGED_macro(const T *_q_argument) const \
+ { int i = qYouForgotTheQ_MANAGED_Macro(this, _q_argument); i = i + 1; }
template <typename T>
inline int qYouForgotTheQ_MANAGED_Macro(T, T) { return 0; }
@@ -69,6 +69,9 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
template <typename T> \
QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
+#define Q_MANAGED_TYPE(type) \
+ public: \
+ enum { MyType = Type_##type };
struct GCDeletable
{
@@ -80,6 +83,13 @@ struct GCDeletable
struct ManagedVTable
{
+ uint isExecutionContext : 1;
+ uint isString : 1;
+ uint isObject : 1;
+ uint isFunctionObject : 1;
+ uint isErrorObject : 1;
+ uint unused : 19;
+ uint type : 8;
ReturnedValue (*call)(Managed *, CallData *data);
ReturnedValue (*construct)(Managed *, CallData *data);
void (*markObjects)(Managed *, ExecutionEngine *e);
@@ -96,6 +106,7 @@ struct ManagedVTable
ReturnedValue (*getLookup)(Managed *m, Lookup *l);
void (*setLookup)(Managed *m, Lookup *l, const ValueRef v);
bool (*isEqualTo)(Managed *m, Managed *other);
+ uint (*getLength)(const Managed *m);
Property *(*advanceIterator)(Managed *m, ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes);
const char *className;
};
@@ -103,6 +114,13 @@ struct ManagedVTable
#define DEFINE_MANAGED_VTABLE(classname) \
const QV4::ManagedVTable classname::static_vtbl = \
{ \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
call, \
construct, \
markObjects, \
@@ -119,13 +137,52 @@ const QV4::ManagedVTable classname::static_vtbl = \
getLookup, \
setLookup, \
isEqualTo, \
+ getLength, \
advanceIterator, \
#classname \
}
+#define DEFINE_MANAGED_VTABLE_WITH_NAME(classname, name) \
+const QV4::ManagedVTable classname::static_vtbl = \
+{ \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
+ call, \
+ construct, \
+ markObjects, \
+ destroy, \
+ 0, \
+ get, \
+ getIndexed, \
+ put, \
+ putIndexed, \
+ query, \
+ queryIndexed, \
+ deleteProperty, \
+ deleteIndexedProperty, \
+ getLookup, \
+ setLookup, \
+ isEqualTo, \
+ getLength, \
+ advanceIterator, \
+ #name \
+}
+
#define DEFINE_MANAGED_VTABLE_WITH_DELETABLES(classname) \
const QV4::ManagedVTable classname::static_vtbl = \
{ \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ 0, \
+ classname::MyType, \
call, \
construct, \
markObjects, \
@@ -142,6 +199,7 @@ const QV4::ManagedVTable classname::static_vtbl = \
getLookup, \
setLookup, \
isEqualTo, \
+ getLength, \
advanceIterator, \
#classname \
}
@@ -149,6 +207,13 @@ const QV4::ManagedVTable classname::static_vtbl = \
struct Q_QML_EXPORT Managed
{
Q_MANAGED
+ enum {
+ IsExecutionContext = false,
+ IsString = false,
+ IsObject = false,
+ IsFunctionObject = false,
+ IsErrorObject = false
+ };
private:
void *operator new(size_t);
Managed(const Managed &other);
@@ -183,13 +248,16 @@ public:
Type_RegExpObject,
Type_ErrorObject,
Type_ArgumentsObject,
- Type_JSONObject,
+ Type_JsonObject,
Type_MathObject,
+
+ Type_ExecutionContext,
Type_ForeachIteratorObject,
Type_RegExp,
Type_QmlSequence
};
+ Q_MANAGED_TYPE(Invalid)
ExecutionEngine *engine() const;
@@ -199,7 +267,7 @@ public:
if (!this || !internalClass)
return 0;
#if !defined(QT_NO_QOBJECT_CHECK)
- static_cast<T *>(this)->qt_check_for_QMANAGED_macro(*static_cast<T *>(this));
+ static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(this));
#endif
return internalClass->vtable == &T::static_vtbl ? static_cast<T *>(this) : 0;
}
@@ -209,26 +277,26 @@ public:
if (!this)
return 0;
#if !defined(QT_NO_QOBJECT_CHECK)
- reinterpret_cast<T *>(this)->qt_check_for_QMANAGED_macro(*reinterpret_cast<T *>(const_cast<Managed *>(this)));
+ static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(const_cast<Managed *>(this)));
#endif
return internalClass->vtable == &T::static_vtbl ? static_cast<const T *>(this) : 0;
}
- String *asString() { return type == Type_String ? reinterpret_cast<String *>(this) : 0; }
- Object *asObject() { return type != Type_String ? reinterpret_cast<Object *>(this) : 0; }
- ArrayObject *asArrayObject() { return type == Type_ArrayObject ? reinterpret_cast<ArrayObject *>(this) : 0; }
- FunctionObject *asFunctionObject() { return type == Type_FunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; }
- BooleanObject *asBooleanObject() { return type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; }
- NumberObject *asNumberObject() { return type == Type_NumberObject ? reinterpret_cast<NumberObject *>(this) : 0; }
- StringObject *asStringObject() { return type == Type_StringObject ? reinterpret_cast<StringObject *>(this) : 0; }
- DateObject *asDateObject() { return type == Type_DateObject ? reinterpret_cast<DateObject *>(this) : 0; }
- ErrorObject *asErrorObject() { return type == Type_ErrorObject ? reinterpret_cast<ErrorObject *>(this) : 0; }
- ArgumentsObject *asArgumentsObject() { return type == Type_ArgumentsObject ? reinterpret_cast<ArgumentsObject *>(this) : 0; }
+ String *asString() { return internalClass->vtable->isString ? reinterpret_cast<String *>(this) : 0; }
+ Object *asObject() { return internalClass->vtable->isObject ? reinterpret_cast<Object *>(this) : 0; }
+ ArrayObject *asArrayObject() { return internalClass->vtable->type == Type_ArrayObject ? reinterpret_cast<ArrayObject *>(this) : 0; }
+ FunctionObject *asFunctionObject() { return internalClass->vtable->isFunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; }
+ BooleanObject *asBooleanObject() { return internalClass->vtable->type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; }
+ NumberObject *asNumberObject() { return internalClass->vtable->type == Type_NumberObject ? reinterpret_cast<NumberObject *>(this) : 0; }
+ StringObject *asStringObject() { return internalClass->vtable->type == Type_StringObject ? reinterpret_cast<StringObject *>(this) : 0; }
+ DateObject *asDateObject() { return internalClass->vtable->type == Type_DateObject ? reinterpret_cast<DateObject *>(this) : 0; }
+ ErrorObject *asErrorObject() { return internalClass->vtable->isErrorObject ? reinterpret_cast<ErrorObject *>(this) : 0; }
+ ArgumentsObject *asArgumentsObject() { return internalClass->vtable->type == Type_ArgumentsObject ? reinterpret_cast<ArgumentsObject *>(this) : 0; }
- bool isListType() const { return type == Type_QmlSequence; }
+ bool isListType() const { return internalClass->vtable->type == Type_QmlSequence; }
- bool isArrayObject() const { return type == Type_ArrayObject; }
- bool isStringObject() const { return type == Type_StringObject; }
+ bool isArrayObject() const { return internalClass->vtable->type == Type_ArrayObject; }
+ bool isStringObject() const { return internalClass->vtable->type == Type_StringObject; }
QString className() const;
@@ -263,6 +331,7 @@ public:
bool isEqualTo(Managed *other)
{ return internalClass->vtable->isEqualTo(this, other); }
+ uint getLength() const { return internalClass->vtable->getLength(this); }
Property *advanceIterator(ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes);
static void destroy(Managed *that) { that->_data = 0; }
@@ -271,34 +340,27 @@ public:
static ReturnedValue getLookup(Managed *m, Lookup *);
static void setLookup(Managed *m, Lookup *l, const ValueRef v);
static bool isEqualTo(Managed *m, Managed *other);
-
- uint internalType() const {
- return type;
- }
+ static uint getLength(const Managed *) { return 0; }
ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); }
InternalClass *internalClass;
- enum {
- SimpleArray = 1
- };
-
union {
uint _data;
struct {
uchar markBit : 1;
uchar inUse : 1;
uchar extensible : 1; // used by Object
- uchar isNonStrictArgumentsObject : 1;
+ uchar _unused : 1;
uchar needsActivation : 1; // used by FunctionObject
uchar strictMode : 1; // used by FunctionObject
uchar bindingKeyFlag : 1;
uchar hasAccessorProperty : 1;
- uchar type;
+ uchar _type;
mutable uchar subtype;
- uchar flags;
+ uchar _flags;
};
};
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 5a7af1f041..6225d6b4ae 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -51,14 +51,14 @@
using namespace QV4;
+DEFINE_MANAGED_VTABLE(MathObject);
+
static const double qt_PI = 2.0 * ::asin(1.0);
-MathObject::MathObject(ExecutionEngine *engine)
- : Object(engine)
+MathObject::MathObject(InternalClass *ic)
+ : Object(ic)
{
- type = Type_MathObject;
-
- Scope scope(engine);
+ Scope scope(ic->engine);
ScopedObject protectThis(scope, this);
defineReadonlyProperty(QStringLiteral("E"), Primitive::fromDouble(::exp(1.0)));
diff --git a/src/qml/jsruntime/qv4mathobject_p.h b/src/qml/jsruntime/qv4mathobject_p.h
index 6fe3db3950..45f8e7cd2e 100644
--- a/src/qml/jsruntime/qv4mathobject_p.h
+++ b/src/qml/jsruntime/qv4mathobject_p.h
@@ -49,7 +49,9 @@ namespace QV4 {
struct MathObject: Object
{
- MathObject(ExecutionEngine *engine);
+ Q_MANAGED
+ Q_MANAGED_TYPE(MathObject)
+ MathObject(InternalClass *ic);
static ReturnedValue method_abs(CallContext *context);
static ReturnedValue method_acos(CallContext *context);
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index f67efaffb9..625e34de07 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -275,6 +275,7 @@ Managed *MemoryManager::alloc(std::size_t size)
if (size >= MemoryManager::Data::MaxItemSize) {
// we use malloc for this
MemoryManager::Data::LargeItem *item = static_cast<MemoryManager::Data::LargeItem *>(malloc(size + sizeof(MemoryManager::Data::LargeItem)));
+ memset(item, 0, size + sizeof(MemoryManager::Data::LargeItem));
item->next = m_d->largeItems;
m_d->largeItems = item;
return item->managed();
@@ -520,6 +521,7 @@ void MemoryManager::sweep(char *chunkStart, std::size_t chunkSize, size_t size,
m->internalClass->vtable->collectDeletables(m, deletable);
m->internalClass->vtable->destroy(m);
+ memset(m, 0, size);
m->setNextFree(*f);
#ifdef V4_USE_VALGRIND
VALGRIND_DISABLE_ERROR_REPORTING;
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 106525d412..00d11b4cd6 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -72,37 +72,27 @@ DEFINE_MANAGED_VTABLE(Object);
Object::Object(ExecutionEngine *engine)
: Managed(engine->objectClass)
, memberDataAlloc(InlinePropertySize), memberData(inlineProperties)
- , arrayOffset(0), arrayDataLen(0), arrayAlloc(0), arrayAttributes(0), arrayData(0), sparseArray(0)
{
- type = Type_Object;
- flags = SimpleArray;
- memset(memberData, 0, sizeof(Property)*memberDataAlloc);
}
Object::Object(InternalClass *ic)
: Managed(ic)
, memberDataAlloc(InlinePropertySize), memberData(inlineProperties)
- , arrayOffset(0), arrayDataLen(0), arrayAlloc(0), arrayAttributes(0), arrayData(0), sparseArray(0)
{
Q_ASSERT(internalClass->vtable && internalClass->vtable != &Managed::static_vtbl);
- type = Type_Object;
- flags = SimpleArray;
if (internalClass->size >= memberDataAlloc) {
memberDataAlloc = internalClass->size;
memberData = new Property[memberDataAlloc];
}
- memset(memberData, 0, sizeof(Property)*memberDataAlloc);
}
Object::~Object()
{
if (memberData != inlineProperties)
delete [] memberData;
- delete [] (arrayData - (sparseArray ? 0 : arrayOffset));
- if (arrayAttributes)
- delete [] (arrayAttributes - (sparseArray ? 0 : arrayOffset));
- delete sparseArray;
+ if (arrayData)
+ arrayData->free();
_data = 0;
}
@@ -172,12 +162,6 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef val
engine()->currentContext()->throwTypeError();
}
-void Object::defineDefaultProperty(const StringRef name, ValueRef value)
-{
- Property *pd = insertMember(name, Attr_Data|Attr_NotEnumerable);
- pd->value = *value;
-}
-
void Object::defineDefaultProperty(const QString &name, ValueRef value)
{
ExecutionEngine *e = engine();
@@ -216,12 +200,10 @@ void Object::defineAccessorProperty(const QString &name, ReturnedValue (*getter)
void Object::defineAccessorProperty(const StringRef name, ReturnedValue (*getter)(CallContext *), ReturnedValue (*setter)(CallContext *))
{
ExecutionEngine *v4 = engine();
- Property *p = insertMember(name, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
-
- if (getter)
- p->setGetter(v4->newBuiltinFunction(v4->rootContext, name, getter)->getPointer());
- if (setter)
- p->setSetter(v4->newBuiltinFunction(v4->rootContext, name, setter)->getPointer());
+ Property p;
+ p.setGetter(getter ? v4->newBuiltinFunction(v4->rootContext, name, getter)->getPointer() : 0);
+ p.setSetter(setter ? v4->newBuiltinFunction(v4->rootContext, name, setter)->getPointer() : 0);
+ insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
void Object::defineReadonlyProperty(const QString &name, ValueRef value)
@@ -234,8 +216,7 @@ void Object::defineReadonlyProperty(const QString &name, ValueRef value)
void Object::defineReadonlyProperty(const StringRef name, ValueRef value)
{
- Property *pd = insertMember(name, Attr_ReadOnly);
- pd->value = *value;
+ insertMember(name, value, Attr_ReadOnly);
}
void Object::markObjects(Managed *that, ExecutionEngine *e)
@@ -258,23 +239,8 @@ void Object::markObjects(Managed *that, ExecutionEngine *e)
}
}
}
- if (o->flags & SimpleArray) {
- for (uint i = 0; i < o->arrayDataLen; ++i)
- o->arrayData[i].value.mark(e);
- return;
- } else {
- for (uint i = 0; i < o->arrayDataLen; ++i) {
- const Property &pd = o->arrayData[i];
- if (o->arrayAttributes && o->arrayAttributes[i].isAccessor()) {
- if (pd.getter())
- pd.getter()->mark(e);
- if (pd.setter())
- pd.setter()->mark(e);
- } else {
- pd.value.mark(e);
- }
- }
- }
+ if (o->arrayData)
+ o->arrayData->markObjects(e);
}
void Object::ensureMemberIndex(uint idx)
@@ -290,7 +256,7 @@ void Object::ensureMemberIndex(uint idx)
}
}
-Property *Object::insertMember(const StringRef s, PropertyAttributes attributes)
+void Object::insertMember(const StringRef s, const Property &p, PropertyAttributes attributes)
{
uint idx;
internalClass = internalClass->addMember(s.getPointer(), attributes, &idx);
@@ -300,7 +266,7 @@ Property *Object::insertMember(const StringRef s, PropertyAttributes attributes)
ensureMemberIndex(idx);
- return memberData + idx;
+ memberData[idx] = p;
}
// Section 8.12.1
@@ -324,14 +290,11 @@ Property *Object::__getOwnProperty__(const StringRef name, PropertyAttributes *a
Property *Object::__getOwnProperty__(uint index, PropertyAttributes *attrs)
{
- uint pidx = propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX) {
- Property *p = arrayData + pidx;
- if (!p->value.isEmpty() && !(arrayAttributes && arrayAttributes[pidx].isGeneric())) {
- if (attrs)
- *attrs = arrayAttributes ? arrayAttributes[pidx] : PropertyAttributes(Attr_Data);
- return p;
- }
+ Property *p = arrayData->getProperty(index);
+ if (p) {
+ if (attrs)
+ *attrs = arrayData->attributes(index);
+ return p;
}
if (isStringObject()) {
if (attrs)
@@ -372,14 +335,11 @@ Property *Object::__getPropertyDescriptor__(uint index, PropertyAttributes *attr
{
const Object *o = this;
while (o) {
- uint pidx = o->propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX) {
- Property *p = o->arrayData + pidx;
- if (!p->value.isEmpty()) {
- if (attrs)
- *attrs = o->arrayAttributes ? o->arrayAttributes[pidx] : PropertyAttributes(Attr_Data);
- return p;
- }
+ Property *p = o->arrayData->getProperty(index);
+ if (p) {
+ if (attrs)
+ *attrs = o->arrayData->attributes(index);
+ return p;
}
if (o->isStringObject()) {
Property *p = static_cast<const StringObject *>(o)->getIndex(index);
@@ -426,6 +386,16 @@ bool Object::__hasProperty__(uint index) const
return false;
}
+bool Object::hasOwnProperty(const StringRef name) const
+{
+ return const_cast<Object *>(this)->__getOwnProperty__(name) != 0;
+}
+
+bool Object::hasOwnProperty(uint index) const
+{
+ return const_cast<Object *>(this)->__getOwnProperty__(index) != 0;
+}
+
ReturnedValue Object::get(Managed *m, const StringRef name, bool *hasProperty)
{
return static_cast<Object *>(m)->internalGet(name, hasProperty);
@@ -463,13 +433,9 @@ PropertyAttributes Object::query(const Managed *m, StringRef name)
PropertyAttributes Object::queryIndexed(const Managed *m, uint index)
{
const Object *o = static_cast<const Object *>(m);
- uint pidx = o->propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX) {
- if (o->arrayAttributes)
- return o->arrayAttributes[pidx];
- if (!o->arrayData[pidx].value.isEmpty())
- return Attr_Data;
- }
+ if (o->arrayData->get(index) != Primitive::emptyValue().asReturnedValue())
+ return o->arrayData->attributes(index);
+
if (o->isStringObject()) {
Property *p = static_cast<const StringObject *>(o)->getIndex(index);
if (p)
@@ -570,41 +536,42 @@ Property *Object::advanceIterator(Managed *m, ObjectIterator *it, StringRef name
name = (String *)0;
*index = UINT_MAX;
- if (!it->arrayIndex)
- it->arrayNode = o->sparseArrayBegin();
-
- // sparse arrays
- if (it->arrayNode) {
- while (it->arrayNode != o->sparseArrayEnd()) {
- int k = it->arrayNode->key();
- uint pidx = it->arrayNode->value;
- Property *p = o->arrayData + pidx;
- it->arrayNode = it->arrayNode->nextNode();
- PropertyAttributes a = o->arrayAttributes ? o->arrayAttributes[pidx] : PropertyAttributes(Attr_Data);
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- it->arrayIndex = k + 1;
- *index = k;
+ if (o->arrayData) {
+ if (!it->arrayIndex)
+ it->arrayNode = o->sparseBegin();
+
+ // sparse arrays
+ if (it->arrayNode) {
+ while (it->arrayNode != o->sparseEnd()) {
+ int k = it->arrayNode->key();
+ uint pidx = it->arrayNode->value;
+ Property *p = o->arrayData->data + pidx;
+ it->arrayNode = it->arrayNode->nextNode();
+ PropertyAttributes a = o->arrayData->attributes(k);
+ if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
+ it->arrayIndex = k + 1;
+ *index = k;
+ if (attrs)
+ *attrs = a;
+ return p;
+ }
+ }
+ it->arrayNode = 0;
+ it->arrayIndex = UINT_MAX;
+ }
+ // dense arrays
+ while (it->arrayIndex < o->arrayData->length()) {
+ Property *p = o->arrayData->data + it->arrayIndex;
+ PropertyAttributes a = o->arrayData->attributes(it->arrayIndex);
+ ++it->arrayIndex;
+ if (!p->value.isEmpty()
+ && (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable())) {
+ *index = it->arrayIndex - 1;
if (attrs)
*attrs = a;
return p;
}
}
- it->arrayNode = 0;
- it->arrayIndex = UINT_MAX;
- }
- // dense arrays
- while (it->arrayIndex < o->arrayDataLen) {
- uint pidx = o->propertyIndexFromArrayIndex(it->arrayIndex);
- Property *p = o->arrayData + pidx;
- PropertyAttributes a = o->arrayAttributes ? o->arrayAttributes[pidx] : PropertyAttributes(Attr_Data);
- ++it->arrayIndex;
- if (!p->value.isEmpty()
- && (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable())) {
- *index = it->arrayIndex - 1;
- if (attrs)
- *attrs = a;
- return p;
- }
}
while (it->memberIndex < o->internalClass->size) {
@@ -654,17 +621,14 @@ ReturnedValue Object::internalGet(const StringRef name, bool *hasProperty)
ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty)
{
Property *pd = 0;
- PropertyAttributes attrs = Attr_Data;
+ PropertyAttributes attrs;
Object *o = this;
while (o) {
- uint pidx = o->propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX) {
- if (!o->arrayData[pidx].value.isEmpty()) {
- pd = o->arrayData + pidx;
- if (o->arrayAttributes)
- attrs = o->arrayAttributes[pidx];
- break;
- }
+ Property *p = o->arrayData->getProperty(index);
+ if (p) {
+ pd = p;
+ attrs = o->arrayData->attributes(index);
+ break;
}
if (o->isStringObject()) {
pd = static_cast<StringObject *>(o)->getIndex(index);
@@ -761,11 +725,8 @@ void Object::internalPut(const StringRef name, const ValueRef value)
return;
}
- {
- Property *p = insertMember(name, Attr_Data);
- p->value = *value;
- return;
- }
+ insertMember(name, value);
+ return;
reject:
if (engine()->currentContext()->strictMode) {
@@ -781,14 +742,11 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
if (internalClass->engine->hasException)
return;
- Property *pd = 0;
PropertyAttributes attrs;
- uint pidx = propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX && !arrayData[pidx].value.isEmpty()) {
- pd = arrayData + pidx;
- attrs = arrayAttributes ? arrayAttributes[pidx] : PropertyAttributes(Attr_Data);
- }
+ Property *pd = arrayData->getProperty(index);
+ if (pd)
+ attrs = arrayData->attributes(index);
if (!pd && isStringObject()) {
pd = static_cast<StringObject *>(this)->getIndex(index);
@@ -879,22 +837,8 @@ bool Object::internalDeleteIndexedProperty(uint index)
if (internalClass->engine->hasException)
return false;
- uint pidx = propertyIndexFromArrayIndex(index);
- if (pidx == UINT_MAX)
- return true;
- if (arrayData[pidx].value.isEmpty())
- return true;
-
- if (!arrayAttributes || arrayAttributes[pidx].isConfigurable()) {
- arrayData[pidx].value = Primitive::emptyValue();
- if (arrayAttributes)
- arrayAttributes[pidx].clear();
- if (sparseArray) {
- arrayData[pidx].value.int_32 = arrayFreeList;
- arrayFreeList = pidx;
- }
+ if (!arrayData || arrayData->deleteIndex(index))
return true;
- }
if (engine()->currentContext()->strictMode)
engine()->currentContext()->throwTypeError();
@@ -954,9 +898,9 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, const StringRef name,
if (!extensible)
goto reject;
// clause 4
- Property *pd = insertMember(name, attrs);
- *pd = p;
- pd->fullyPopulated(&attrs);
+ Property pd = p;
+ pd.fullyPopulated(&attrs);
+ insertMember(name, pd, attrs);
return true;
}
@@ -969,20 +913,27 @@ reject:
bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs)
{
- Property *current = 0;
-
// 15.4.5.1, 4b
- if (isArrayObject() && index >= arrayLength() && !internalClass->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
+ if (isArrayObject() && index >= getLength() && !internalClass->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
goto reject;
- if (isNonStrictArgumentsObject)
+ if (ArgumentsObject::isNonStrictArgumentsObject(this))
return static_cast<ArgumentsObject *>(this)->defineOwnProperty(ctx, index, p, attrs);
+ return defineOwnProperty2(ctx, index, p, attrs);
+reject:
+ if (ctx->strictMode)
+ ctx->throwTypeError();
+ return false;
+}
+
+bool Object::defineOwnProperty2(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs)
+{
+ Property *current = 0;
+
// Clause 1
{
- uint pidx = propertyIndexFromArrayIndex(index);
- if (pidx < UINT_MAX && !arrayData[pidx].value.isEmpty())
- current = arrayData + pidx;
+ current = arrayData->getProperty(index);
if (!current && isStringObject())
current = static_cast<StringObject *>(this)->getIndex(index);
}
@@ -992,9 +943,15 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Prop
if (!extensible)
goto reject;
// clause 4
- Property *pd = arrayInsert(index, attrs);
- *pd = p;
- pd->fullyPopulated(&attrs);
+ Property pp(p);
+ pp.fullyPopulated(&attrs);
+ if (attrs == Attr_Data) {
+ Scope scope(ctx);
+ ScopedValue v(scope, pp.value);
+ arraySet(index, v);
+ } else {
+ arraySet(index, pp, attrs);
+ }
return true;
}
@@ -1011,11 +968,11 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, Property *current, con
if (attrs.isEmpty())
return true;
- PropertyAttributes cattrs = Attr_Data;
+ PropertyAttributes cattrs;
if (!member.isNull())
cattrs = internalClass->propertyData[current - memberData];
- else if (arrayAttributes)
- cattrs = arrayAttributes[current - arrayData];
+ else
+ cattrs = arrayData->attrs ? arrayData->attrs[current - arrayData->data] : Attr_Data;
// clause 6
if (p.isSubset(attrs, *current, cattrs))
@@ -1071,10 +1028,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, Property *current, con
if (!member.isNull()) {
internalClass = internalClass->changeMember(member.getPointer(), cattrs);
} else {
- if (cattrs != Attr_Data)
- ensureArrayAttributes();
- if (arrayAttributes)
- arrayAttributes[current - arrayData] = cattrs;
+ arrayData->setAttributes(current - arrayData->data, cattrs);
}
if (attrs.isAccessor())
hasAccessorProperty = 1;
@@ -1100,7 +1054,7 @@ void Object::copyArrayData(Object *other)
Scope scope(engine());
if (other->protoHasArray() || other->hasAccessorProperty) {
- uint len = other->arrayLength();
+ uint len = other->getLength();
Q_ASSERT(len);
ScopedValue v(scope);
@@ -1108,313 +1062,97 @@ void Object::copyArrayData(Object *other)
arraySet(i, (v = other->getIndexed(i)));
}
} else {
- arrayReserve(other->arrayDataLen);
- arrayDataLen = other->arrayDataLen;
- memcpy(arrayData, other->arrayData, arrayDataLen*sizeof(Property));
- }
-
- arrayOffset = 0;
+ Q_ASSERT(!arrayData && other->arrayData);
+ if (other->arrayType() == ArrayData::Sparse) {
+ SparseArrayData *od = static_cast<SparseArrayData *>(other->arrayData);
+ SparseArrayData *dd = new SparseArrayData;
+ dd->type = ArrayData::Sparse;
+ dd->sparse = new SparseArray(*od->sparse);
+ dd->freeList = od->freeList;
+ arrayData = dd;
+ }
+ arrayReserve(other->arrayData->len);
+ arrayData->len = other->arrayData->len;
+ // ### correctly deal with accessor properties
+ memcpy(arrayData->data, other->arrayData->data, arrayData->len*sizeof(Property));
- if (other->sparseArray) {
- flags &= ~SimpleArray;
- sparseArray = new SparseArray(*other->sparseArray);
- arrayFreeList = other->arrayFreeList;
+ arrayData->offset = 0;
}
-
- setArrayLengthUnchecked(other->arrayLength());
+ setArrayLengthUnchecked(other->getLength());
}
-
-ReturnedValue Object::arrayIndexOf(const ValueRef v, uint fromIndex, uint endIndex, ExecutionContext *ctx, Object *o)
+uint Object::getLength(const Managed *m)
{
- Q_UNUSED(ctx);
-
- Scope scope(engine());
- ScopedValue value(scope);
-
- if (!(o->flags & SimpleArray) || o->protoHasArray()) {
- // lets be safe and slow
- for (uint i = fromIndex; i < endIndex; ++i) {
- bool exists;
- value = o->getIndexed(i, &exists);
- if (scope.hasException())
- return Encode::undefined();
- if (exists && __qmljs_strict_equal(value, v))
- return Encode(i);
- }
- } else if (sparseArray) {
- for (SparseArrayNode *n = sparseArray->lowerBound(fromIndex); n != sparseArray->end() && n->key() < endIndex; n = n->nextNode()) {
- value = o->getValue(arrayData + n->value, arrayAttributes ? arrayAttributes[n->value] : Attr_Data);
- if (scope.hasException())
- return Encode::undefined();
- if (__qmljs_strict_equal(value, v))
- return Encode(n->key());
- }
- } else {
- if (endIndex > arrayDataLen)
- endIndex = arrayDataLen;
- Property *pd = arrayData;
- Property *end = pd + endIndex;
- pd += fromIndex;
- while (pd < end) {
- if (!pd->value.isEmpty()) {
- value = o->getValue(pd, arrayAttributes ? arrayAttributes[pd - arrayData] : Attr_Data);
- if (scope.hasException())
- return Encode::undefined();
- if (__qmljs_strict_equal(value, v))
- return Encode((uint)(pd - arrayData));
- }
- ++pd;
- }
- }
- return Encode(-1);
+ Scope scope(m->engine());
+ ScopedValue v(scope, const_cast<Managed *>(m)->get(scope.engine->id_length));
+ return v->toUInt32();
}
-void Object::arrayConcat(const ArrayObject *other)
+bool Object::setArrayLength(uint newLen)
{
- int newLen = arrayDataLen + other->arrayLength();
- if (other->sparseArray)
- initSparse();
- // ### copy attributes as well!
- if (sparseArray) {
- if (other->sparseArray) {
- for (const SparseArrayNode *it = other->sparseArray->begin(); it != other->sparseArray->end(); it = it->nextNode())
- arraySet(arrayDataLen + it->key(), other->arrayData + it->value);
- } else {
- int oldSize = arrayDataLen;
- arrayReserve(oldSize + other->arrayLength());
- memcpy(arrayData + oldSize, other->arrayData, other->arrayLength()*sizeof(Property));
- if (arrayAttributes)
- std::fill(arrayAttributes + oldSize, arrayAttributes + oldSize + other->arrayLength(), PropertyAttributes(Attr_Data));
- for (uint i = 0; i < other->arrayLength(); ++i) {
- SparseArrayNode *n = sparseArray->insert(arrayDataLen + i);
- n->value = oldSize + i;
- }
- }
+ Q_ASSERT(isArrayObject());
+ const Property *lengthProperty = memberData + ArrayObject::LengthPropertyIndex;
+ if (lengthProperty && !internalClass->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
+ return false;
+ uint oldLen = getLength();
+ bool ok = true;
+ if (newLen < oldLen) {
+ uint l = arrayData->truncate(newLen);
+ if (l != newLen)
+ ok = false;
+ newLen = l;
} else {
- uint oldSize = arrayLength();
- arrayReserve(oldSize + other->arrayDataLen);
- if (oldSize > arrayDataLen) {
- for (uint i = arrayDataLen; i < oldSize; ++i)
- arrayData[i].value = Primitive::emptyValue();
- }
- if (other->arrayAttributes) {
- for (uint i = 0; i < other->arrayDataLen; ++i) {
- bool exists;
- arrayData[oldSize + i].value = const_cast<ArrayObject *>(other)->getIndexed(i, &exists);
- arrayDataLen = oldSize + i + 1;
- if (arrayAttributes)
- arrayAttributes[oldSize + i] = Attr_Data;
- if (!exists)
- arrayData[oldSize + i].value = Primitive::emptyValue();
- }
- } else {
- arrayDataLen = oldSize + other->arrayDataLen;
- memcpy(arrayData + oldSize, other->arrayData, other->arrayDataLen*sizeof(Property));
- if (arrayAttributes)
- std::fill(arrayAttributes + oldSize, arrayAttributes + oldSize + other->arrayDataLen, PropertyAttributes(Attr_Data));
- }
+ if (newLen >= 0x100000)
+ initSparseArray();
}
setArrayLengthUnchecked(newLen);
+ return ok;
}
-void Object::arraySort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint len)
+void Object::initSparseArray()
{
- if (!arrayDataLen)
+ if (arrayType() == ArrayData::Sparse)
return;
- if (sparseArray) {
- context->throwUnimplemented(QStringLiteral("Object::sort unimplemented for sparse arrays"));
+ SparseArrayData *data = new SparseArrayData;
+ data->type = ArrayData::Sparse;
+ data->sparse = new SparseArray;
+ if (!arrayData) {
+ arrayData = data;
return;
}
- if (len > arrayDataLen)
- len = arrayDataLen;
-
- // The spec says the sorting goes through a series of get,put and delete operations.
- // this implies that the attributes don't get sorted around.
- // behavior of accessor properties is implementation defined. We simply turn them all
- // into data properties and then sort. This is in line with the sentence above.
- if (arrayAttributes) {
- for (uint i = 0; i < len; i++) {
- if ((arrayAttributes && arrayAttributes[i].isGeneric()) || arrayData[i].value.isEmpty()) {
- while (--len > i)
- if (!((arrayAttributes && arrayAttributes[len].isGeneric())|| arrayData[len].value.isEmpty()))
- break;
- arrayData[i].value = getValue(arrayData + len, arrayAttributes[len]);
- arrayData[len].value = Primitive::emptyValue();
- if (arrayAttributes) {
- arrayAttributes[i] = Attr_Data;
- arrayAttributes[len].clear();
- }
- } else if (arrayAttributes[i].isAccessor()) {
- arrayData[i].value = getValue(arrayData + i, arrayAttributes[i]);
- arrayAttributes[i] = Attr_Data;
- }
- }
- }
-
- if (!(comparefn->isUndefined() || comparefn->asObject())) {
- context->throwTypeError();
- return;
+ uint oldOffset = arrayData->offset;
+ data->data = arrayData->data - arrayData->offset;
+ data->attrs = arrayData->attrs;
+ data->len = arrayData->len;
+ data->alloc = arrayData->alloc;
+ data->offset = 0;
+ arrayData->data = 0;
+ arrayData->attrs = 0;
+ delete arrayData;
+
+ uint *lastFree = &data->freeList;
+ for (uint i = 0; i < oldOffset; ++i) {
+ *lastFree = i;
+ lastFree = &data->data[i].value.uint_32;
}
-
- ArrayElementLessThan lessThan(context, thisObject, comparefn);
-
- if (!len)
- return;
- Property *begin = arrayData;
- std::sort(begin, begin + len, lessThan);
-}
-
-
-void Object::initSparse()
-{
- if (!sparseArray) {
- flags &= ~SimpleArray;
- sparseArray = new SparseArray;
- for (uint i = 0; i < arrayDataLen; ++i) {
- if (!((arrayAttributes && arrayAttributes[i].isGeneric()) || arrayData[i].value.isEmpty())) {
- SparseArrayNode *n = sparseArray->insert(i);
- n->value = i + arrayOffset;
- }
- }
-
- uint off = arrayOffset;
- if (!arrayOffset) {
- arrayFreeList = arrayDataLen;
+ for (uint i = 0; i < data->len; ++i) {
+ if (!data->data[i + oldOffset].value.isEmpty()) {
+ SparseArrayNode *n = data->sparse->insert(i);
+ n->value = i + oldOffset;
} else {
- arrayFreeList = 0;
- arrayData -= off;
- arrayAlloc += off;
- int o = off;
- for (int i = 0; i < o - 1; ++i) {
- arrayData[i].value = Primitive::fromInt32(i + 1);
- }
- arrayData[o - 1].value = Primitive::fromInt32(arrayDataLen + off);
- }
- for (uint i = arrayDataLen + off; i < arrayAlloc; ++i) {
- arrayData[i].value = Primitive::fromInt32(i + 1);
+ *lastFree = i + oldOffset;
+ lastFree = &data->data[i + oldOffset].value.uint_32;
}
}
-}
-
-void Object::arrayReserve(uint n)
-{
- if (n < 8)
- n = 8;
- if (n >= arrayAlloc) {
- uint off;
- if (sparseArray) {
- assert(arrayFreeList == arrayAlloc);
- // ### FIXME
- arrayDataLen = arrayAlloc;
- off = 0;
- } else {
- off = arrayOffset;
- }
- arrayAlloc = qMax(n, 2*arrayAlloc);
- Property *newArrayData = new Property[arrayAlloc + off];
- if (arrayData) {
- memcpy(newArrayData + off, arrayData, sizeof(Property)*arrayDataLen);
- delete [] (arrayData - off);
- }
- arrayData = newArrayData + off;
- if (sparseArray) {
- for (uint i = arrayFreeList; i < arrayAlloc; ++i) {
- arrayData[i].value = Primitive::emptyValue();
- arrayData[i].value = Primitive::fromInt32(i + 1);
- }
- }
-
- if (arrayAttributes) {
- PropertyAttributes *newAttrs = new PropertyAttributes[arrayAlloc];
- memcpy(newAttrs, arrayAttributes, sizeof(PropertyAttributes)*arrayDataLen);
- delete [] (arrayAttributes - off);
-
- arrayAttributes = newAttrs;
- if (sparseArray) {
- for (uint i = arrayFreeList; i < arrayAlloc; ++i)
- arrayAttributes[i] = Attr_Invalid;
- }
- }
+ for (uint i = data->len + oldOffset; i < data->alloc; ++i) {
+ *lastFree = i;
+ lastFree = &data->data[i].value.uint_32;
}
+ arrayData = data;
}
-void Object::ensureArrayAttributes()
-{
- if (arrayAttributes)
- return;
-
- flags &= ~SimpleArray;
- uint off = sparseArray ? 0 : arrayOffset;
- arrayAttributes = new PropertyAttributes[arrayAlloc + off];
- arrayAttributes += off;
- for (uint i = 0; i < arrayDataLen; ++i)
- arrayAttributes[i] = Attr_Data;
- for (uint i = arrayDataLen; i < arrayAlloc; ++i)
- arrayAttributes[i] = Attr_Invalid;
-}
-
-
-bool Object::setArrayLength(uint newLen) {
- assert(isArrayObject());
- const Property *lengthProperty = memberData + ArrayObject::LengthPropertyIndex;
- if (lengthProperty && !internalClass->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
- return false;
- uint oldLen = arrayLength();
- bool ok = true;
- if (newLen < oldLen) {
- if (sparseArray) {
- SparseArrayNode *begin = sparseArray->lowerBound(newLen);
- if (begin != sparseArray->end()) {
- SparseArrayNode *it = sparseArray->end()->previousNode();
- while (1) {
- Property &pd = arrayData[it->value];
- if (arrayAttributes) {
- if (!arrayAttributes[it->value].isConfigurable()) {
- ok = false;
- newLen = it->key() + 1;
- break;
- } else {
- arrayAttributes[it->value].clear();
- }
- }
- pd.value.tag = Value::Empty_Type;
- pd.value.int_32 = arrayFreeList;
- arrayFreeList = it->value;
- bool brk = (it == begin);
- SparseArrayNode *prev = it->previousNode();
- sparseArray->erase(it);
- if (brk)
- break;
- it = prev;
- }
- }
- } else {
- Property *it = arrayData + arrayDataLen;
- const Property *begin = arrayData + newLen;
- while (--it >= begin) {
- if (arrayAttributes) {
- if (!arrayAttributes[it - arrayData].isEmpty() && !arrayAttributes[it - arrayData].isConfigurable()) {
- ok = false;
- newLen = it - arrayData + 1;
- break;
- } else {
- arrayAttributes[it - arrayData].clear();
- }
- it->value = Primitive::emptyValue();
- }
- }
- arrayDataLen = newLen;
- }
- } else {
- if (newLen >= 0x100000)
- initSparse();
- }
- setArrayLengthUnchecked(newLen);
- return ok;
-}
DEFINE_MANAGED_VTABLE(ArrayObject);
@@ -1431,9 +1169,10 @@ ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
// elements converted to JS Strings.
int len = list.count();
arrayReserve(len);
+ ScopedValue v(scope);
for (int ii = 0; ii < len; ++ii) {
- arrayData[ii].value = Encode(engine->newString(list.at(ii)));
- arrayDataLen = ii + 1;
+ arrayData->put(ii, (v = engine->newString(list.at(ii))));
+ arrayData->setLength(ii + 1);
}
setArrayLengthUnchecked(len);
}
@@ -1442,10 +1181,28 @@ void ArrayObject::init(ExecutionEngine *engine)
{
Q_UNUSED(engine);
- type = Type_ArrayObject;
memberData[LengthPropertyIndex].value = Primitive::fromInt32(0);
}
+ReturnedValue ArrayObject::getLookup(Managed *m, Lookup *l)
+{
+ if (l->name->equals(m->engine()->id_length)) {
+ // special case, as the property is on the object itself
+ l->getter = Lookup::arrayLengthGetter;
+ ArrayObject *a = static_cast<ArrayObject *>(m);
+ return a->memberData[ArrayObject::LengthPropertyIndex].value.asReturnedValue();
+ }
+ return Object::getLookup(m, l);
+}
+
+uint ArrayObject::getLength(const Managed *m)
+{
+ const ArrayObject *a = static_cast<const ArrayObject *>(m);
+ if (a->memberData[ArrayObject::LengthPropertyIndex].value.isInteger())
+ return a->memberData[ArrayObject::LengthPropertyIndex].value.integerValue();
+ return Primitive::toUInt32(a->memberData[ArrayObject::LengthPropertyIndex].value.doubleValue());
+}
+
QStringList ArrayObject::toQStringList() const
{
QStringList result;
@@ -1454,7 +1211,7 @@ QStringList ArrayObject::toQStringList() const
Scope scope(engine);
ScopedValue v(scope);
- uint32_t length = arrayLength();
+ uint32_t length = getLength();
for (uint32_t i = 0; i < length; ++i) {
v = const_cast<ArrayObject *>(this)->getIndexed(i);
result.append(v->toQStringNoThrow());
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 23f2f682fd..9500c2a4d0 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -49,7 +49,7 @@
#include "qv4managed_p.h"
#include "qv4property_p.h"
#include "qv4internalclass_p.h"
-#include "qv4sparsearray_p.h"
+#include "qv4arraydata_p.h"
#include <QtCore/QString>
#include <QtCore/QHash>
@@ -100,20 +100,17 @@ struct SyntaxErrorPrototype;
struct TypeErrorPrototype;
struct URIErrorPrototype;
+
struct Q_QML_EXPORT Object: Managed {
Q_MANAGED
+ Q_MANAGED_TYPE(Object)
+ enum {
+ IsObject = true
+ };
uint memberDataAlloc;
Property *memberData;
- union {
- uint arrayFreeList;
- uint arrayOffset;
- };
- uint arrayDataLen;
- uint arrayAlloc;
- PropertyAttributes *arrayAttributes;
- Property *arrayData;
- SparseArray *sparseArray;
+ ArrayData *arrayData;
enum {
InlinePropertySize = 4
@@ -136,10 +133,14 @@ struct Q_QML_EXPORT Object: Managed {
bool __hasProperty__(const StringRef name) const;
bool __hasProperty__(uint index) const;
+ bool hasOwnProperty(const StringRef name) const;
+ bool hasOwnProperty(uint index) const;
+
bool __defineOwnProperty__(ExecutionContext *ctx, Property *current, const StringRef member, const Property &p, PropertyAttributes attrs);
bool __defineOwnProperty__(ExecutionContext *ctx, const StringRef name, const Property &p, PropertyAttributes attrs);
bool __defineOwnProperty__(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs);
bool __defineOwnProperty__(ExecutionContext *ctx, const QString &name, const Property &p, PropertyAttributes attrs);
+ bool defineOwnProperty2(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs);
//
// helpers
@@ -156,7 +157,9 @@ struct Q_QML_EXPORT Object: Managed {
void putValue(Property *pd, PropertyAttributes attrs, const ValueRef value);
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
- void defineDefaultProperty(const StringRef name, ValueRef value);
+ void defineDefaultProperty(const StringRef name, ValueRef value) {
+ insertMember(name, value, Attr_Data|Attr_NotEnumerable);
+ }
void defineDefaultProperty(const QString &name, ValueRef value);
void defineDefaultProperty(const QString &name, ReturnedValue (*code)(CallContext *), int argumentCount = 0);
void defineDefaultProperty(const StringRef name, ReturnedValue (*code)(CallContext *), int argumentCount = 0);
@@ -166,113 +169,63 @@ struct Q_QML_EXPORT Object: Managed {
void defineReadonlyProperty(const QString &name, ValueRef value);
void defineReadonlyProperty(const StringRef name, ValueRef value);
- Property *insertMember(const StringRef s, PropertyAttributes attributes);
+ void insertMember(const StringRef s, const ValueRef v, PropertyAttributes attributes = Attr_Data) {
+ insertMember(s, Property::fromValue(*v), attributes);
+ }
+ void insertMember(const StringRef s, const Property &p, PropertyAttributes attributes);
inline ExecutionEngine *engine() const { return internalClass->engine; }
// Array handling
- uint allocArrayValue() {
- uint idx = arrayFreeList;
- if (arrayAlloc <= arrayFreeList)
- arrayReserve(arrayAlloc + 1);
- arrayFreeList = arrayData[arrayFreeList].value.uint_32;
- if (arrayAttributes)
- arrayAttributes[idx].setType(PropertyAttributes::Data);
- return idx;
- }
-
- uint allocArrayValue(const ValueRef v) {
- uint idx = allocArrayValue();
- Property *pd = &arrayData[idx];
- pd->value = *v;
- return idx;
- }
- void freeArrayValue(int idx) {
- Property &pd = arrayData[idx];
- pd.value.tag = Value::Empty_Type;
- pd.value.int_32 = arrayFreeList;
- arrayFreeList = idx;
- if (arrayAttributes)
- arrayAttributes[idx].clear();
- }
-
- void getArrayHeadRoom() {
- assert(!sparseArray && !arrayOffset);
- arrayOffset = qMax(arrayDataLen >> 2, (uint)16);
- Property *newArray = new Property[arrayOffset + arrayAlloc];
- memcpy(newArray + arrayOffset, arrayData, arrayDataLen*sizeof(Property));
- delete [] arrayData;
- arrayData = newArray + arrayOffset;
- if (arrayAttributes) {
- PropertyAttributes *newAttrs = new PropertyAttributes[arrayOffset + arrayAlloc];
- memcpy(newAttrs + arrayOffset, arrayAttributes, arrayDataLen*sizeof(PropertyAttributes));
- delete [] arrayAttributes;
- arrayAttributes = newAttrs + arrayOffset;
- }
- }
-
public:
void copyArrayData(Object *other);
- void initSparse();
- uint arrayLength() const;
bool setArrayLength(uint newLen);
void setArrayLengthUnchecked(uint l);
- Property *arrayInsert(uint index, PropertyAttributes attributes = Attr_Data);
+ void arraySet(uint index, const Property &p, PropertyAttributes attributes = Attr_Data);
- void arraySet(uint index, const Property *pd);
void arraySet(uint index, ValueRef value);
- uint propertyIndexFromArrayIndex(uint index) const
- {
- if (!sparseArray) {
- if (index >= arrayDataLen)
- return UINT_MAX;
- return index;
- } else {
- SparseArrayNode *n = sparseArray->findNode(index);
- if (!n)
- return UINT_MAX;
- return n->value;
- }
- }
+ void push_back(const ValueRef v);
- Property *arrayAt(uint index) const {
- uint pidx = propertyIndexFromArrayIndex(index);
- if (pidx == UINT_MAX)
- return 0;
- return arrayData + pidx;
+ ArrayData::Type arrayType() const {
+ return arrayData ? (ArrayData::Type)arrayData->type : ArrayData::Simple;
}
-
- Property *nonSparseArrayAt(uint index) const {
- if (sparseArray)
- return 0;
- if (index >= arrayDataLen)
- return 0;
- return arrayData + index;
+ // ### remove me
+ void setArrayType(ArrayData::Type t) {
+ Q_ASSERT(t != ArrayData::Simple && t != ArrayData::Sparse);
+ arrayCreate();
+ arrayData->type = t;
}
- void push_back(const ValueRef v);
+ inline void arrayReserve(uint n) {
+ arrayCreate();
+ arrayData->vtable->reserve(arrayData, n);
+ }
- SparseArrayNode *sparseArrayBegin() { return sparseArray ? sparseArray->begin() : 0; }
- SparseArrayNode *sparseArrayEnd() { return sparseArray ? sparseArray->end() : 0; }
+ void arrayCreate() {
+ if (!arrayData)
+ arrayData = new ArrayData;
+ }
- void arrayConcat(const ArrayObject *other);
- void arraySort(ExecutionContext *context, ObjectRef thisObject, const ValueRef comparefn, uint arrayDataLen);
- ReturnedValue arrayIndexOf(const ValueRef v, uint fromIndex, uint arrayDataLen, ExecutionContext *ctx, Object *o);
+ void initSparseArray();
+ SparseArrayNode *sparseBegin() { return arrayType() == ArrayData::Sparse ? static_cast<SparseArrayData *>(arrayData)->sparse->begin() : 0; }
+ SparseArrayNode *sparseEnd() { return arrayType() == ArrayData::Sparse ? static_cast<SparseArrayData *>(arrayData)->sparse->end() : 0; }
- void arrayReserve(uint n);
- void ensureArrayAttributes();
+ inline Property *arrayInsert(uint index) {
+ arrayCreate();
+ return ArrayData::insert(this, index);
+ }
inline bool protoHasArray() {
Scope scope(engine());
Scoped<Object> p(scope, this);
while ((p = p->prototype()))
- if (p->arrayDataLen)
+ if (p->arrayData)
return true;
return false;
@@ -298,6 +251,7 @@ public:
using Managed::getLookup;
using Managed::setLookup;
using Managed::advanceIterator;
+ using Managed::getLength;
protected:
static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e);
@@ -312,7 +266,7 @@ protected:
static ReturnedValue getLookup(Managed *m, Lookup *l);
static void setLookup(Managed *m, Lookup *l, const ValueRef v);
static Property *advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes);
-
+ static uint getLength(const Managed *m);
private:
ReturnedValue internalGet(const StringRef name, bool *hasProperty);
@@ -328,40 +282,39 @@ private:
struct BooleanObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(BooleanObject)
SafeValue value;
BooleanObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->booleanClass) {
- type = Type_BooleanObject;
value = val;
}
protected:
BooleanObject(InternalClass *ic)
: Object(ic) {
- setVTable(&static_vtbl);
- type = Type_BooleanObject;
+ Q_ASSERT(internalClass->vtable == &static_vtbl);
value = Encode(false);
}
};
struct NumberObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(NumberObject)
SafeValue value;
NumberObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->numberClass) {
- type = Type_NumberObject;
value = val;
}
protected:
NumberObject(InternalClass *ic)
: Object(ic) {
- setVTable(&static_vtbl);
- type = Type_NumberObject;
+ Q_ASSERT(internalClass->vtable == &static_vtbl);
value = Encode((int)0);
}
};
struct ArrayObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(ArrayObject)
enum {
LengthPropertyIndex = 0
};
@@ -372,19 +325,13 @@ struct ArrayObject: Object {
void init(ExecutionEngine *engine);
+ static ReturnedValue getLookup(Managed *m, Lookup *l);
+ using Managed::getLength;
+ static uint getLength(const Managed *m);
+
QStringList toQStringList() const;
};
-inline uint Object::arrayLength() const
-{
- if (isArrayObject()) {
- if (memberData[ArrayObject::LengthPropertyIndex].value.isInteger())
- return memberData[ArrayObject::LengthPropertyIndex].value.integerValue();
- return Primitive::toUInt32(memberData[ArrayObject::LengthPropertyIndex].value.doubleValue());
- }
- return 0;
-}
-
inline void Object::setArrayLengthUnchecked(uint l)
{
if (isArrayObject()) {
@@ -396,64 +343,35 @@ inline void Object::setArrayLengthUnchecked(uint l)
inline void Object::push_back(const ValueRef v)
{
- uint idx = arrayLength();
- if (!sparseArray) {
- if (idx >= arrayAlloc)
- arrayReserve(idx + 1);
- arrayData[idx].value = *v;
- arrayDataLen = idx + 1;
- } else {
- uint idx = allocArrayValue(v);
- sparseArray->push_back(idx, arrayLength());
- }
+ arrayCreate();
+ Q_ASSERT(!arrayData->isSparse());
+
+ uint idx = getLength();
+ arrayReserve(idx + 1);
+ arrayData->put(idx, v);
+ arrayData->setLength(idx + 1);
setArrayLengthUnchecked(idx + 1);
}
-inline Property *Object::arrayInsert(uint index, PropertyAttributes attributes) {
+inline void Object::arraySet(uint index, const Property &p, PropertyAttributes attributes)
+{
if (attributes.isAccessor())
hasAccessorProperty = 1;
- Property *pd;
- if (!sparseArray && (index < 0x1000 || index < arrayDataLen + (arrayDataLen >> 2))) {
- if (index >= arrayAlloc)
- arrayReserve(index + 1);
- if (index >= arrayDataLen) {
- // mark possible hole in the array
- for (uint i = arrayDataLen; i < index; ++i) {
- arrayData[i].value = Primitive::emptyValue();
- if (arrayAttributes)
- arrayAttributes[i].clear();
- }
- arrayDataLen = index + 1;
- }
- pd = arrayData + index;
- } else {
- initSparse();
- SparseArrayNode *n = sparseArray->insert(index);
- if (n->value == UINT_MAX)
- n->value = allocArrayValue();
- pd = arrayData + n->value;
- }
- if (index >= arrayLength())
+ Property *pd = arrayInsert(index);
+ *pd = p;
+ arrayData->setAttributes(index, attributes);
+ if (isArrayObject() && index >= getLength())
setArrayLengthUnchecked(index + 1);
- if (arrayAttributes || attributes != Attr_Data) {
- if (!arrayAttributes)
- ensureArrayAttributes();
- attributes.resolve();
- arrayAttributes[pd - arrayData] = attributes;
- }
- return pd;
}
+
inline void Object::arraySet(uint index, ValueRef value)
{
Property *pd = arrayInsert(index);
- pd->value = *value;
-}
-
-inline void Object::arraySet(uint index, const Property *pd)
-{
- *arrayInsert(index) = *pd;
+ pd->value = value ? *value : Primitive::undefinedValue();
+ if (isArrayObject() && index >= getLength())
+ setArrayLengthUnchecked(index + 1);
}
template<>
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index 04fa504991..f7a5cd7531 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -58,7 +58,7 @@ ObjectIterator::ObjectIterator(SafeObject *scratch1, SafeObject *scratch2, const
current = o;
tmpDynamicProperty.value = Primitive::undefinedValue();
- if (object && object->isNonStrictArgumentsObject) {
+ if (object && object->asArgumentsObject()) {
Scope scope(object->engine());
Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate();
}
@@ -76,7 +76,7 @@ ObjectIterator::ObjectIterator(Scope &scope, const ObjectRef o, uint flags)
current = o;
tmpDynamicProperty.value = Primitive::undefinedValue();
- if (object && object->isNonStrictArgumentsObject) {
+ if (object && object->asArgumentsObject()) {
Scope scope(object->engine());
Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate();
}
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index 6c333b328c..33228cefaa 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -86,11 +86,11 @@ struct Q_QML_EXPORT ObjectIterator
struct ForEachIteratorObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(ForeachIteratorObject)
ObjectIterator it;
ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o)
: Object(ctx->engine), it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
setVTable(&static_vtbl);
- type = Type_ForeachIteratorObject;
}
ReturnedValue nextPropertyName() { return it.nextPropertyNameAsString(); }
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 7ca790b970..ac19101a29 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -105,9 +105,9 @@ ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
void ObjectPrototype::init(ExecutionEngine *v4, ObjectRef ctor)
{
Scope scope(v4);
- ScopedObject o(scope);
+ ScopedObject o(scope, this);
- ctor->defineReadonlyProperty(v4->id_prototype, (o = this));
+ ctor->defineReadonlyProperty(v4->id_prototype, o);
ctor->defineReadonlyProperty(v4->id_length, Primitive::fromInt32(1));
ctor->defineDefaultProperty(QStringLiteral("getPrototypeOf"), method_getPrototypeOf, 1);
ctor->defineDefaultProperty(QStringLiteral("getOwnPropertyDescriptor"), method_getOwnPropertyDescriptor, 2);
@@ -134,9 +134,9 @@ void ObjectPrototype::init(ExecutionEngine *v4, ObjectRef ctor)
defineDefaultProperty(QStringLiteral("__defineSetter__"), method_defineSetter, 2);
Scoped<String> id_proto(scope, v4->id___proto__);
- Property *p = insertMember(StringRef(v4->id___proto__), Attr_Accessor|Attr_NotEnumerable);
- p->setGetter(v4->newBuiltinFunction(v4->rootContext, id_proto, method_get_proto)->getPointer());
- p->setSetter(v4->newBuiltinFunction(v4->rootContext, id_proto, method_set_proto)->getPointer());
+ Property p = Property::fromAccessor(v4->newBuiltinFunction(v4->rootContext, id_proto, method_get_proto)->getPointer(),
+ v4->newBuiltinFunction(v4->rootContext, id_proto, method_set_proto)->getPointer());
+ insertMember(StringRef(v4->id___proto__), p, Attr_Accessor|Attr_NotEnumerable);
}
ReturnedValue ObjectPrototype::method_getPrototypeOf(CallContext *ctx)
@@ -157,7 +157,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
if (!O)
return ctx->throwTypeError();
- if (O->isNonStrictArgumentsObject)
+ if (ArgumentsObject::isNonStrictArgumentsObject(O.getPointer()))
Scoped<ArgumentsObject>(scope, O)->fullyCreate();
ScopedValue v(scope, ctx->argument(1));
@@ -271,10 +271,12 @@ ReturnedValue ObjectPrototype::method_seal(CallContext *ctx)
o->internalClass = o->internalClass->sealed();
- o->ensureArrayAttributes();
- for (uint i = 0; i < o->arrayDataLen; ++i) {
- if (!(o->arrayAttributes[i].isGeneric() || o->arrayData[i].value.isEmpty()))
- o->arrayAttributes[i].setConfigurable(false);
+ if (o->arrayData) {
+ o->arrayData->ensureAttributes();
+ for (uint i = 0; i < o->arrayData->length(); ++i) {
+ if (!o->arrayData->isEmpty(i))
+ o->arrayData->attrs[i].setConfigurable(false);
+ }
}
return o.asReturnedValue();
@@ -287,19 +289,21 @@ ReturnedValue ObjectPrototype::method_freeze(CallContext *ctx)
if (!o)
return ctx->throwTypeError();
- if (o->isNonStrictArgumentsObject)
+ if (ArgumentsObject::isNonStrictArgumentsObject(o.getPointer()))
Scoped<ArgumentsObject>(scope, o)->fullyCreate();
o->extensible = false;
o->internalClass = o->internalClass->frozen();
- o->ensureArrayAttributes();
- for (uint i = 0; i < o->arrayDataLen; ++i) {
- if (!(o->arrayAttributes[i].isGeneric() || o->arrayData[i].value.isEmpty()))
- o->arrayAttributes[i].setConfigurable(false);
- if (o->arrayAttributes[i].isData())
- o->arrayAttributes[i].setWritable(false);
+ if (o->arrayData) {
+ o->arrayData->ensureAttributes();
+ for (uint i = 0; i < o->arrayData->length(); ++i) {
+ if (!o->arrayData->isEmpty(i))
+ o->arrayData->attrs[i].setConfigurable(false);
+ if (o->arrayData->attrs[i].isData())
+ o->arrayData->attrs[i].setWritable(false);
+ }
}
return o.asReturnedValue();
}
@@ -328,15 +332,16 @@ ReturnedValue ObjectPrototype::method_isSealed(CallContext *ctx)
if (o->internalClass != o->internalClass->sealed())
return Encode(false);
- if (!o->arrayDataLen)
+ if (!o->arrayData || !o->arrayData->length())
return Encode(true);
- if (!o->arrayAttributes)
+ if (o->arrayData->length() && !o->arrayData->attrs)
return Encode(false);
- for (uint i = 0; i < o->arrayDataLen; ++i) {
- if (!(o->arrayAttributes[i].isGeneric() || o->arrayData[i].value.isEmpty()))
- if (o->arrayAttributes[i].isConfigurable())
+ for (uint i = 0; i < o->arrayData->length(); ++i) {
+ // ### Fix for sparse arrays
+ if (!o->arrayData->isEmpty(i))
+ if (o->arrayData->attributes(i).isConfigurable())
return Encode(false);
}
@@ -356,15 +361,16 @@ ReturnedValue ObjectPrototype::method_isFrozen(CallContext *ctx)
if (o->internalClass != o->internalClass->frozen())
return Encode(false);
- if (!o->arrayDataLen)
+ if (!o->arrayData->length())
return Encode(true);
- if (!o->arrayAttributes)
+ if (o->arrayData->length() && !o->arrayData->attrs)
return Encode(false);
- for (uint i = 0; i < o->arrayDataLen; ++i) {
- if (!(o->arrayAttributes[i].isGeneric() || o->arrayData[i].value.isEmpty()))
- if (o->arrayAttributes[i].isConfigurable() || o->arrayAttributes[i].isWritable())
+ for (uint i = 0; i < o->arrayData->length(); ++i) {
+ // ### Fix for sparse arrays
+ if (!o->arrayData->isEmpty(i))
+ if (o->arrayData->attributes(i).isConfigurable() || o->arrayData->attributes(i).isWritable())
return Encode(false);
}
@@ -448,7 +454,7 @@ ReturnedValue ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
Scoped<Object> O(scope, ctx->callData->thisObject, Scoped<Object>::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- bool r = O->__getOwnProperty__(P) != 0;
+ bool r = O->hasOwnProperty(P);
if (!r)
r = !O->query(P).isEmpty();
return Encode(r);
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index 9763de5adf..ff9ea59514 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -53,7 +53,7 @@ struct FunctionObject;
struct Property {
union {
- Value value;
+ SafeValue value;
struct {
FunctionObject *get;
FunctionObject *set;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 61f92a0f5c..bad2cf3cd4 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1592,7 +1592,7 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRe
if (array) {
Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
- uint32_t length = array->arrayLength();
+ uint32_t length = array->getLength();
for (uint32_t ii = 0; ii < length; ++ii) {
QObject *o = 0;
qobjectWrapper = array->getIndexed(ii);
@@ -1689,9 +1689,10 @@ QV4::ReturnedValue CallArgument::toValue(QV8Engine *engine)
QList<QObject *> &list = *qlistPtr;
QV4::Scoped<ArrayObject> array(scope, v4->newArrayObject());
array->arrayReserve(list.count());
+ QV4::ScopedValue v(scope);
for (int ii = 0; ii < list.count(); ++ii) {
- array->arrayData[ii].value = QV4::QObjectWrapper::wrap(v4, list.at(ii));
- array->arrayDataLen = ii + 1;
+ array->arrayData->put(ii, (v = QV4::QObjectWrapper::wrap(v4, list.at(ii))));
+ array->arrayData->setLength(ii + 1);
}
array->setArrayLengthUnchecked(list.count());
return array.asReturnedValue();
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 41ff9f9741..8544970347 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -99,8 +99,6 @@ RegExp::RegExp(ExecutionEngine* engine, const QString &pattern, bool ignoreCase,
, m_ignoreCase(ignoreCase)
, m_multiLine(multiline)
{
- type = Type_RegExpObject;
-
if (!engine)
return;
const char* error = 0;
diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h
index 9041ff2ef4..d8e9930876 100644
--- a/src/qml/jsruntime/qv4regexp_p.h
+++ b/src/qml/jsruntime/qv4regexp_p.h
@@ -94,6 +94,7 @@ public:
class RegExp : public Managed
{
Q_MANAGED
+ Q_MANAGED_TYPE(RegExp)
public:
static RegExp* create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false);
~RegExp();
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 468fb34d76..1b55c5a2f1 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -76,6 +76,7 @@ RegExpObject::RegExpObject(InternalClass *ic)
, value(RegExp::create(ic->engine, QString(), false, false))
, global(false)
{
+ Q_ASSERT(internalClass->vtable == &static_vtbl);
init(ic->engine);
}
@@ -143,14 +144,13 @@ RegExpObject::RegExpObject(ExecutionEngine *engine, const QRegExp &re)
void RegExpObject::init(ExecutionEngine *engine)
{
setVTable(&static_vtbl);
- type = Type_RegExpObject;
Scope scope(engine);
ScopedObject protectThis(scope, this);
ScopedString lastIndex(scope, engine->newIdentifier(QStringLiteral("lastIndex")));
- Property *lastIndexProperty = insertMember(lastIndex, Attr_NotEnumerable|Attr_NotConfigurable);
- lastIndexProperty->value = Primitive::fromInt32(0);
+ ScopedValue v(scope, Primitive::fromInt32(0));
+ insertMember(lastIndex, v, Attr_NotEnumerable|Attr_NotConfigurable);
if (!this->value)
return;
@@ -162,7 +162,6 @@ void RegExpObject::init(ExecutionEngine *engine)
p.replace('/', QLatin1String("\\/"));
}
- ScopedValue v(scope);
defineReadonlyProperty(QStringLiteral("source"), (v = engine->newString(p)));
defineReadonlyProperty(QStringLiteral("global"), Primitive::fromBoolean(global));
defineReadonlyProperty(QStringLiteral("ignoreCase"), Primitive::fromBoolean(this->value->ignoreCase()));
@@ -344,11 +343,13 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
Scoped<ArrayObject> array(scope, ctx->engine->newArrayObject(ctx->engine->regExpExecArrayClass));
int len = r->value->captureCount();
array->arrayReserve(len);
+ ScopedValue v(scope);
for (int i = 0; i < len; ++i) {
int start = matchOffsets[i * 2];
int end = matchOffsets[i * 2 + 1];
- array->arrayData[i].value = (start != -1 && end != -1) ? ctx->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
- array->arrayDataLen = i + 1;
+ v = (start != -1 && end != -1) ? ctx->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
+ array->arrayData->put(i, v);
+ array->arrayData->setLength(i + 1);
}
array->setArrayLengthUnchecked(len);
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 0129f8d396..bd91e8f693 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -67,6 +67,7 @@ class RegExp;
struct RegExpObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(RegExpObject)
// needs to be compatible with the flags in qv4jsir_p.h
enum Flags {
RegExp_Global = 0x01,
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 011607f0ba..9275704984 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -589,12 +589,10 @@ ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object,
}
if (idx < UINT_MAX) {
- uint pidx = o->propertyIndexFromArrayIndex(idx);
- if (pidx < UINT_MAX) {
- if (!o->arrayAttributes || o->arrayAttributes[pidx].isData()) {
- if (!o->arrayData[pidx].value.isEmpty())
- return o->arrayData[pidx].value.asReturnedValue();
- }
+ if (!o->arrayData->hasAttributes()) {
+ ScopedValue v(scope, o->arrayData->get(idx));
+ if (!v->isEmpty())
+ return v->asReturnedValue();
}
return o->getIndexed(idx);
@@ -615,36 +613,10 @@ void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const Val
uint idx = index->asArrayIndex();
if (idx < UINT_MAX) {
- uint pidx = o->propertyIndexFromArrayIndex(idx);
- if (pidx < UINT_MAX) {
- if (o->arrayAttributes && !o->arrayAttributes[pidx].isEmpty() && !o->arrayAttributes[pidx].isWritable()) {
- if (ctx->strictMode)
- ctx->throwTypeError();
- return;
- }
-
- Property *p = o->arrayData + pidx;
- if (!o->arrayAttributes || o->arrayAttributes[pidx].isData()) {
- p->value = *value;
- return;
- }
-
- if (o->arrayAttributes[pidx].isAccessor()) {
- FunctionObject *setter = p->setter();
- if (!setter) {
- if (ctx->strictMode)
- ctx->throwTypeError();
- return;
- }
-
- ScopedCallData callData(scope, 1);
- callData->thisObject = o;
- callData->args[0] = *value;
- setter->call(callData);
- return;
- }
- }
- o->putIndexed(idx, value);
+ if (idx < o->arrayData->length() && o->arrayType() == ArrayData::Simple)
+ o->arrayData->put(idx, value);
+ else
+ o->putIndexed(idx, value);
return;
}
@@ -1118,25 +1090,23 @@ void __qmljs_builtin_define_property(ExecutionContext *ctx, const ValueRef objec
assert(o);
uint idx = name->asArrayIndex();
- Property *pd = (idx != UINT_MAX) ? o->arrayInsert(idx) : o->insertMember(name, Attr_Data);
- pd->value = val ? *val : Primitive::undefinedValue();
+ if (idx != UINT_MAX) {
+ o->arraySet(idx, val);
+ } else {
+ ScopedValue v(scope, val ? *val : Primitive::undefinedValue());
+ o->insertMember(name, v);
+ }
}
-ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values, uint length)
+ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, SafeValue *values, uint length)
{
Scope scope(ctx);
Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
- // ### FIXME: We need to allocate the array data to avoid crashes other places
- // This should rather be done when required
- a->arrayReserve(length);
if (length) {
- a->arrayDataLen = length;
- Property *pd = a->arrayData;
- for (uint i = 0; i < length; ++i) {
- pd->value = values[i];
- ++pd;
- }
+ a->arrayReserve(length);
+ a->arrayData->setLength(length);
+ a->arrayData->put(0, values, length);
a->setArrayLengthUnchecked(length);
}
return a.asReturnedValue();
@@ -1149,9 +1119,14 @@ void __qmljs_builtin_define_getter_setter(ExecutionContext *ctx, const ValueRef
Q_ASSERT(!!o);
uint idx = name->asArrayIndex();
- Property *pd = (idx != UINT_MAX) ? o->arrayInsert(idx, Attr_Accessor) : o->insertMember(name, Attr_Accessor);
- pd->setGetter(getter ? getter->asFunctionObject() : 0);
- pd->setSetter(setter ? setter->asFunctionObject() : 0);
+ Property pd;
+ pd.setGetter(getter ? getter->asFunctionObject() : 0);
+ pd.setSetter(setter ? setter->asFunctionObject() : 0);
+ if (idx != UINT_MAX) {
+ o->arraySet(idx, pd, Attr_Accessor);
+ } else {
+ o->insertMember(name, pd, Attr_Accessor);
+ }
}
ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId)
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index 9524b2459c..2e252b1067 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -141,7 +141,7 @@ QV4::ExecutionContext *__qmljs_builtin_pop_scope(QV4::ExecutionContext *ctx);
ReturnedValue __qmljs_builtin_unwind_exception(ExecutionContext *ctx);
void __qmljs_builtin_declare_var(QV4::ExecutionContext *ctx, bool deletable, const QV4::StringRef name);
void __qmljs_builtin_define_property(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::StringRef name, QV4::ValueRef val);
-QV4::ReturnedValue __qmljs_builtin_define_array(QV4::ExecutionContext *ctx, QV4::Value *values, uint length);
+QV4::ReturnedValue __qmljs_builtin_define_array(QV4::ExecutionContext *ctx, SafeValue *values, uint length);
void __qmljs_builtin_define_getter_setter(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::StringRef name, const QV4::ValueRef getter, const QV4::ValueRef setter);
QV4::ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId);
QV4::ReturnedValue __qmljs_builtin_setup_arguments_object(ExecutionContext *ctx);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 8b0e31cb71..feb3806ba5 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -166,6 +166,7 @@ template <typename Container>
class QQmlSequence : public QV4::Object
{
Q_MANAGED
+ Q_MANAGED_TYPE(QmlSequence)
public:
QQmlSequence(QV4::ExecutionEngine *engine, const Container &container)
: QV4::Object(InternalClass::create(engine, &static_vtbl, engine->sequencePrototype.asObject()))
@@ -174,8 +175,7 @@ public:
, m_propertyIndex(-1)
, m_isReference(false)
{
- type = Type_QmlSequence;
- flags &= ~SimpleArray;
+ setArrayType(ArrayData::Custom);
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
Q_UNUSED(protectThis);
@@ -188,8 +188,7 @@ public:
, m_propertyIndex(propertyIndex)
, m_isReference(true)
{
- type = Type_QmlSequence;
- flags &= ~SimpleArray;
+ setArrayType(ArrayData::Custom);
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
Q_UNUSED(protectThis);
@@ -469,7 +468,7 @@ public:
{
QV4::Scope scope(array->engine());
Container result;
- quint32 length = array->arrayLength();
+ quint32 length = array->getLength();
QV4::ScopedValue v(scope);
for (quint32 i = 0; i < length; ++i)
result << convertValueToElement<typename Container::value_type>((v = array->getIndexed(i)));
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index ee325db4c2..5f9e24d89c 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -183,7 +183,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
push(data, valueheader(WorkerUndefined));
} else if (v->asArrayObject()) {
QV4::ScopedArrayObject array(scope, v);
- uint32_t length = array->arrayLength();
+ uint32_t length = array->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -266,7 +266,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
// regular object
QV4::ScopedValue val(scope, *v);
QV4::ScopedArrayObject properties(scope, QV4::ObjectPrototype::getOwnPropertyNames(v4, val));
- quint32 length = properties->arrayLength();
+ quint32 length = properties->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -390,8 +390,8 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
array->arrayReserve(seqLength);
for (quint32 ii = 0; ii < seqLength; ++ii) {
value = deserialize(data, engine);
- array->arrayData[ii].value = value.asReturnedValue();
- array->arrayDataLen = ii + 1;
+ array->arrayData->put(ii, value);
+ array->arrayData->setLength(ii + 1);
}
array->setArrayLengthUnchecked(seqLength);
QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded);
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index e5633eb06f..df48faf601 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -103,6 +103,13 @@ static uint toArrayIndex(const char *ch, const char *end, bool *ok)
const ManagedVTable String::static_vtbl =
{
+ String::IsExecutionContext,
+ String::IsString,
+ String::IsObject,
+ String::IsFunctionObject,
+ String::IsErrorObject,
+ 0,
+ String::MyType,
call,
construct,
markObjects,
@@ -119,6 +126,7 @@ const ManagedVTable String::static_vtbl =
0 /*getLookup*/,
0 /*setLookup*/,
isEqualTo,
+ 0,
0 /*advanceIterator*/,
"String",
};
@@ -233,10 +241,9 @@ bool String::isEqualTo(Managed *t, Managed *o)
if (t == o)
return true;
- if (o->type != Type_String)
+ if (!o->internalClass->vtable->isString)
return false;
- Q_ASSERT(t->type == Type_String);
String *that = static_cast<String *>(t);
String *other = static_cast<String *>(o);
if (that->hashValue() != other->hashValue())
@@ -257,7 +264,6 @@ String::String(ExecutionEngine *engine, const QString &text)
{
_text->ref.ref();
len = _text->size;
- type = Type_String;
subtype = StringType_Unknown;
}
@@ -267,7 +273,6 @@ String::String(ExecutionEngine *engine, String *l, String *r)
, stringHash(UINT_MAX), largestSubLength(qMax(l->largestSubLength, r->largestSubLength))
, len(l->len + r->len)
{
- type = Type_String;
subtype = StringType_Unknown;
if (!l->largestSubLength && l->len > largestSubLength)
@@ -418,3 +423,8 @@ uint String::toArrayIndex(const QString &str)
bool ok;
return ::toArrayIndex(str.constData(), str.constData() + str.length(), &ok);
}
+
+uint String::getLength(const Managed *m)
+{
+ return static_cast<const String *>(m)->length();
+}
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index 64e15b04c2..bc5b30518e 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -53,6 +53,11 @@ struct Identifier;
struct Q_QML_EXPORT String : public Managed {
Q_MANAGED
+ Q_MANAGED_TYPE(String)
+ enum {
+ IsString = true
+ };
+
enum StringType {
StringType_Unknown,
StringType_Regular,
@@ -63,7 +68,7 @@ struct Q_QML_EXPORT String : public Managed {
String()
: Managed(0), _text(QStringData::sharedNull()), identifier(0)
, stringHash(UINT_MAX), largestSubLength(0), len(0)
- { type = Type_String; subtype = StringType_Unknown; }
+ { subtype = StringType_Unknown; }
String(ExecutionEngine *engine, const QString &text);
String(ExecutionEngine *engine, String *l, String *n);
~String() {
@@ -86,6 +91,7 @@ struct Q_QML_EXPORT String : public Managed {
return toQString() == other->toQString();
}
+
inline bool compare(const String *other) {
return toQString() < other->toQString();
}
@@ -167,6 +173,7 @@ protected:
static bool deleteProperty(Managed *, const StringRef);
static bool deleteIndexedProperty(Managed *m, uint index);
static bool isEqualTo(Managed *that, Managed *o);
+ static uint getLength(const Managed *m);
private:
QChar *recursiveAppend(QChar *ch) const;
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index d468fb6b83..1781ce2581 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -80,8 +80,7 @@ DEFINE_MANAGED_VTABLE(StringObject);
StringObject::StringObject(InternalClass *ic)
: Object(ic)
{
- setVTable(&static_vtbl);
- type = Type_StringObject;
+ Q_ASSERT(internalClass->vtable == &static_vtbl);
Scope scope(engine());
ScopedObject protectThis(scope, this);
@@ -97,7 +96,6 @@ StringObject::StringObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->stringObjectClass)
{
setVTable(&static_vtbl);
- type = Type_StringObject;
Scope scope(engine);
ScopedObject protectThis(scope, this);
@@ -146,14 +144,20 @@ Property *StringObject::advanceIterator(Managed *m, ObjectIterator *it, StringRe
while (it->arrayIndex < slen) {
*index = it->arrayIndex;
++it->arrayIndex;
- if (attrs)
- *attrs = s->arrayAttributes ? s->arrayAttributes[it->arrayIndex] : PropertyAttributes(Attr_NotWritable|Attr_NotConfigurable);
- return s->__getOwnProperty__(*index);
+ PropertyAttributes a;
+ Property *p = s->__getOwnProperty__(*index, &a);
+ if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
+ if (attrs)
+ *attrs = a;
+ return p;
+ }
+ }
+ if (s->arrayData) {
+ it->arrayNode = s->sparseBegin();
+ // iterate until we're past the end of the string
+ while (it->arrayNode && it->arrayNode->key() < slen)
+ it->arrayNode = it->arrayNode->nextNode();
}
- it->arrayNode = s->sparseArrayBegin();
- // iterate until we're past the end of the string
- while (it->arrayNode && it->arrayNode->key() < slen)
- it->arrayNode = it->arrayNode->nextNode();
}
return Object::advanceIterator(m, it, name, index, attrs);
@@ -694,18 +698,18 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
array->push_back((s = ctx->engine->newString(text.mid(offset, matchOffsets[0] - offset))));
offset = qMax(offset + 1, matchOffsets[1]);
- if (array->arrayLength() >= limit)
+ if (array->getLength() >= limit)
break;
for (int i = 1; i < re->value->captureCount(); ++i) {
uint start = matchOffsets[i * 2];
uint end = matchOffsets[i * 2 + 1];
array->push_back((s = ctx->engine->newString(text.mid(start, end - start))));
- if (array->arrayLength() >= limit)
+ if (array->getLength() >= limit)
break;
}
}
- if (array->arrayLength() < limit)
+ if (array->getLength() < limit)
array->push_back((s = ctx->engine->newString(text.mid(offset))));
} else {
QString separator = separatorValue->toString(ctx)->toQString();
@@ -720,10 +724,10 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
while ((end = text.indexOf(separator, start)) != -1) {
array->push_back((s = ctx->engine->newString(text.mid(start, end - start))));
start = end + separator.size();
- if (array->arrayLength() >= limit)
+ if (array->getLength() >= limit)
break;
}
- if (array->arrayLength() < limit && start != -1)
+ if (array->getLength() < limit && start != -1)
array->push_back((s = ctx->engine->newString(text.mid(start))));
}
return array.asReturnedValue();
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index e8e46b85e7..b91cc48e36 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -51,6 +51,7 @@ namespace QV4 {
struct StringObject: Object {
Q_MANAGED
+ Q_MANAGED_TYPE(StringObject)
SafeValue value;
mutable Property tmpProperty;
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 680c7465ca..b93fcbe4bd 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -64,13 +64,13 @@ inline bool Value::isString() const
{
if (!isManaged())
return false;
- return managed() && managed()->type == Managed::Type_String;
+ return managed() && managed()->internalClass->vtable->isString;
}
inline bool Value::isObject() const
{
if (!isManaged())
return false;
- return managed() && managed()->type != Managed::Type_String;
+ return managed() && managed()->internalClass->vtable->isObject;
}
inline bool Value::isPrimitive() const
diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h
index 820ae8ed71..29103930ad 100644
--- a/src/qml/parser/qqmljsmemorypool_p.h
+++ b/src/qml/parser/qqmljsmemorypool_p.h
@@ -108,6 +108,8 @@ public:
_ptr = _end = 0;
}
+ template <typename _Tp> _Tp *New() { return new (this->allocate(sizeof(_Tp))) _Tp(); }
+
private:
void *allocate_helper(size_t size)
{
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 3dd9d6a14d..6717c97d88 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -2882,7 +2882,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
Object::DynamicProperty::Type dtype;
int metaType;
} builtinTypes[] = {
- { Object::DynamicProperty::Var, QMetaType::QVariant },
+ { Object::DynamicProperty::Var, qMetaTypeId<QJSValue>() },
{ Object::DynamicProperty::Variant, QMetaType::QVariant },
{ Object::DynamicProperty::Int, QMetaType::Int },
{ Object::DynamicProperty::Bool, QMetaType::Bool },
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 516f6653ca..d410d396e3 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -157,6 +157,8 @@ public:
// index in first hash is component index, hash inside maps from object index in that scope to integer id
QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
QHash<int, int> objectIndexToIdForRoot;
+ // hash key is object index
+ QHash<int, QByteArray> customParserData;
QVector<int> customParserBindings; // index is binding identifier, value is compiled function index.
bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 21bcd3569c..5813415347 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1056,7 +1056,11 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context,
p->compiledData = d->cc;
p->compiledData->addref();
- p->vme.init(contextData, d->cc, d->start, d->creationContext);
+ if (enginePriv->useNewCompiler) {
+ p->creator.reset(new QmlObjectCreator(contextData, d->cc));
+ p->subComponentToCreate = d->start;
+ } else
+ p->vme.init(contextData, d->cc, d->start, d->creationContext);
enginePriv->incubate(incubator, forContextData);
}
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index 19e49009ce..0cc62fb988 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -230,6 +230,13 @@ void QQmlCustomParser::clearErrors()
exceptions.clear();
}
+QByteArray QQmlCustomParser::compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
+{
+ Q_UNUSED(qmlUnit)
+ Q_UNUSED(bindings)
+ return QByteArray();
+}
+
/*!
Reports an error with the given \a description.
@@ -256,7 +263,6 @@ void QQmlCustomParser::error(const QString& description)
void QQmlCustomParser::error(const QQmlCustomParserProperty& prop, const QString& description)
{
QQmlError error;
- QString exceptionDescription;
error.setLine(prop.location().line);
error.setColumn(prop.location().column);
error.setDescription(description);
@@ -271,7 +277,6 @@ void QQmlCustomParser::error(const QQmlCustomParserProperty& prop, const QString
void QQmlCustomParser::error(const QQmlCustomParserNode& node, const QString& description)
{
QQmlError error;
- QString exceptionDescription;
error.setLine(node.location().line);
error.setColumn(node.location().column);
error.setDescription(description);
@@ -279,6 +284,20 @@ void QQmlCustomParser::error(const QQmlCustomParserNode& node, const QString& de
}
/*!
+ Reports an error in parsing \a binding, with the given \a description.
+
+ An error is generated referring to the position of \a node in the source file.
+*/
+void QQmlCustomParser::error(const QV4::CompiledData::Binding *binding, const QString &description)
+{
+ QQmlError error;
+ error.setLine(binding->location.line);
+ error.setColumn(binding->location.column);
+ error.setDescription(description);
+ exceptions << error;
+}
+
+/*!
If \a script is a simple enumeration expression (eg. Text.AlignLeft),
returns the integer equivalent (eg. 1), and sets \a ok to true.
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 27f7e00b31..3004b0f50c 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -126,6 +126,7 @@ public:
Flags flags() const { return m_flags; }
virtual QByteArray compile(const QList<QQmlCustomParserProperty> &)=0;
+ virtual QByteArray compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings); // ### make pure virtual
virtual void setCustomData(QObject *, const QByteArray &)=0;
QList<QQmlError> errors() const { return exceptions; }
@@ -134,6 +135,7 @@ protected:
void error(const QString& description);
void error(const QQmlCustomParserProperty&, const QString& description);
void error(const QQmlCustomParserNode&, const QString& description);
+ void error(const QV4::CompiledData::Binding *binding, const QString& description);
int evaluateEnum(const QByteArray&, bool *ok) const;
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index ade4634c2d..52bf1d8b3e 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -46,6 +46,7 @@
#include "qqmlcompiler_p.h"
#include "qqmlexpression_p.h"
#include "qqmlmemoryprofiler_p.h"
+#include "qqmlobjectcreator_p.h"
// XXX TODO
// - check that the Component.onCompleted behavior is the same as 4.8 in the synchronous and
@@ -292,7 +293,14 @@ void QQmlIncubatorPrivate::incubate(QQmlVME::Interrupt &i)
if (progress == QQmlIncubatorPrivate::Execute) {
enginePriv->referenceScarceResources();
- QObject *tresult = vme.execute(&errors, i);
+ QObject *tresult = 0;
+ if (enginePriv->useNewCompiler) {
+ tresult = creator->create(subComponentToCreate);
+ if (!tresult)
+ errors = creator->errors;
+ } else {
+ tresult = vme.execute(&errors, i);
+ }
enginePriv->dereferenceScarceResources();
if (watcher.hasRecursed())
@@ -335,7 +343,11 @@ void QQmlIncubatorPrivate::incubate(QQmlVME::Interrupt &i)
if (watcher.hasRecursed())
return;
- QQmlContextData *ctxt = vme.complete(i);
+ QQmlContextData *ctxt = 0;
+ if (enginePriv->useNewCompiler)
+ ctxt = creator->finalize();
+ else
+ ctxt = vme.complete(i);
if (ctxt) {
rootContext = ctxt;
progress = QQmlIncubatorPrivate::Completed;
@@ -566,6 +578,7 @@ void QQmlIncubator::clear()
d->vme.reset();
d->vmeGuard.clear();
+ d->creator.reset(0);
Q_ASSERT(d->compiledData == 0);
Q_ASSERT(d->waitingOnMe.data() == 0);
diff --git a/src/qml/qml/qqmlincubator_p.h b/src/qml/qml/qqmlincubator_p.h
index e7246ce3b2..a8b549bd28 100644
--- a/src/qml/qml/qqmlincubator_p.h
+++ b/src/qml/qml/qqmlincubator_p.h
@@ -88,7 +88,12 @@ public:
QPointer<QObject> result;
QQmlGuardedContextData rootContext;
QQmlCompiledData *compiledData;
+ // --- old compiler
QQmlVME vme;
+ // --- new compiler
+ QScopedPointer<QmlObjectCreator> creator;
+ int subComponentToCreate;
+ // ---
QQmlVMEGuard vmeGuard;
QExplicitlySharedDataPointer<QQmlIncubatorPrivate> waitingOnMe;
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 7b975c2cc8..76c11cb748 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -57,7 +57,7 @@ QmlListWrapper::QmlListWrapper(QV8Engine *engine)
v8(engine)
{
setVTable(&static_vtbl);
- flags &= ~SimpleArray;
+ setArrayType(ArrayData::Custom);
}
QmlListWrapper::~QmlListWrapper()
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 36e0da5b60..75a366a7af 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -62,7 +62,6 @@ public:
: QV4::Object(engine)
{
setVTable(&static_vtbl);
- type = Type_Object;
}
QLocale locale;
@@ -555,12 +554,12 @@ QV4::ReturnedValue QQmlLocaleData::method_get_weekDays(QV4::CallContext *ctx)
QV4::Scoped<QV4::ArrayObject> result(scope, ctx->engine->newArrayObject());
result->arrayReserve(days.size());
- result->arrayDataLen = days.size();
+ result->arrayData->setLength(days.size());
for (int i = 0; i < days.size(); ++i) {
int day = days.at(i);
if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday)
day = 0;
- result->arrayData[i].value = QV4::Primitive::fromInt32(day);
+ result->arrayData->put(i, QV4::Primitive::fromInt32(day));
}
result->setArrayLengthUnchecked(days.size());
@@ -577,9 +576,10 @@ QV4::ReturnedValue QQmlLocaleData::method_get_uiLanguages(QV4::CallContext *ctx)
QStringList langs = locale->uiLanguages();
QV4::Scoped<QV4::ArrayObject> result(scope, ctx->engine->newArrayObject());
result->arrayReserve(langs.size());
+ QV4::ScopedValue v(scope);
for (int i = 0; i < langs.size(); ++i) {
- result->arrayData[i].value = ctx->engine->newString(langs.at(i));
- result->arrayDataLen = i + 1;
+ result->arrayData->put(i, (v = ctx->engine->newString(langs.at(i))));
+ result->arrayData->setLength(i + 1);
}
result->setArrayLengthUnchecked(langs.size());
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index ed0c0afd6f..437e920d1a 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -664,7 +664,7 @@ void QQmlTypePrivate::insertEnums(const QMetaObject *metaObject) const
{
// Add any enum values defined by 'related' classes
if (metaObject->d.relatedMetaObjects) {
- const QMetaObject **related = metaObject->d.relatedMetaObjects;
+ const QMetaObject * const *related = metaObject->d.relatedMetaObjects;
if (related) {
while (*related)
insertEnums(*related++);
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 3798129e8b..5eeee96d14 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -42,7 +42,6 @@
#include "qqmlobjectcreator_p.h"
#include <private/qqmlengine_p.h>
-#include <private/qqmlabstractbinding_p.h>
#include <private/qqmlvmemetaobject_p.h>
#include <private/qv4function_p.h>
#include <private/qv4functionobject_p.h>
@@ -52,9 +51,8 @@
#include <private/qqmlboundsignal_p.h>
#include <private/qqmltrace_p.h>
#include <private/qqmlcomponentattached_p.h>
-#include <QQmlComponent>
#include <private/qqmlcomponent_p.h>
-#include <private/qqmlcodegenerator_p.h>
+#include <private/qqmlcustomparser_p.h>
QT_USE_NAMESPACE
@@ -70,394 +68,6 @@ struct ActiveOCRestorer
};
}
-QQmlCompilePass::QQmlCompilePass(const QUrl &url, const QV4::CompiledData::QmlUnit *unit)
- : url(url)
- , qmlUnit(unit)
-{
-}
-
-void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description)
-{
- QQmlError error;
- error.setUrl(url);
- error.setLine(location.line);
- error.setColumn(location.column);
- error.setDescription(description);
- errors << error;
-}
-
-#define COMPILE_EXCEPTION(token, desc) \
- { \
- recordError((token)->location, desc); \
- return false; \
- }
-
-static QAtomicInt classIndexCounter(0);
-
-QQmlPropertyCacheCreator::QQmlPropertyCacheCreator(QQmlEnginePrivate *enginePrivate, const QV4::CompiledData::QmlUnit *unit, const QUrl &url, const QQmlImports *imports,
- QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes)
- : QQmlCompilePass(url, unit)
- , enginePrivate(enginePrivate)
- , imports(imports)
- , resolvedTypes(resolvedTypes)
-{
-}
-
-bool QQmlPropertyCacheCreator::create(const QV4::CompiledData::Object *obj, QQmlPropertyCache **resultCache, QByteArray *vmeMetaObjectData)
-{
- Q_ASSERT(!stringAt(obj->inheritedTypeNameIndex).isEmpty());
-
- QQmlCompiledData::TypeReference typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex);
- QQmlPropertyCache *baseTypeCache = typeRef.createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
- Q_ASSERT(baseTypeCache);
- if (obj->nProperties == 0 && obj->nSignals == 0 && obj->nFunctions == 0) {
- *resultCache = baseTypeCache;
- vmeMetaObjectData->clear();
- return true;
- }
-
- QQmlPropertyCache *cache = baseTypeCache->copyAndReserve(QQmlEnginePrivate::get(enginePrivate),
- obj->nProperties,
- obj->nFunctions + obj->nProperties + obj->nSignals,
- obj->nSignals + obj->nProperties);
- *resultCache = cache;
-
- vmeMetaObjectData->clear();
-
- struct TypeData {
- QV4::CompiledData::Property::Type dtype;
- int metaType;
- } builtinTypes[] = {
- { QV4::CompiledData::Property::Var, QMetaType::QVariant },
- { QV4::CompiledData::Property::Variant, QMetaType::QVariant },
- { QV4::CompiledData::Property::Int, QMetaType::Int },
- { QV4::CompiledData::Property::Bool, QMetaType::Bool },
- { QV4::CompiledData::Property::Real, QMetaType::Double },
- { QV4::CompiledData::Property::String, QMetaType::QString },
- { QV4::CompiledData::Property::Url, QMetaType::QUrl },
- { QV4::CompiledData::Property::Color, QMetaType::QColor },
- { QV4::CompiledData::Property::Font, QMetaType::QFont },
- { QV4::CompiledData::Property::Time, QMetaType::QTime },
- { QV4::CompiledData::Property::Date, QMetaType::QDate },
- { QV4::CompiledData::Property::DateTime, QMetaType::QDateTime },
- { QV4::CompiledData::Property::Rect, QMetaType::QRectF },
- { QV4::CompiledData::Property::Point, QMetaType::QPointF },
- { QV4::CompiledData::Property::Size, QMetaType::QSizeF },
- { QV4::CompiledData::Property::Vector2D, QMetaType::QVector2D },
- { QV4::CompiledData::Property::Vector3D, QMetaType::QVector3D },
- { QV4::CompiledData::Property::Vector4D, QMetaType::QVector4D },
- { QV4::CompiledData::Property::Matrix4x4, QMetaType::QMatrix4x4 },
- { QV4::CompiledData::Property::Quaternion, QMetaType::QQuaternion }
- };
- static const uint builtinTypeCount = sizeof(builtinTypes) / sizeof(TypeData);
-
- QByteArray newClassName;
-
- if (false /* ### compileState->root == obj && !compileState->nested*/) {
-#if 0 // ###
- QString path = output->url.path();
- int lastSlash = path.lastIndexOf(QLatin1Char('/'));
- if (lastSlash > -1) {
- QString nameBase = path.mid(lastSlash + 1, path.length()-lastSlash-5);
- if (!nameBase.isEmpty() && nameBase.at(0).isUpper())
- newClassName = nameBase.toUtf8() + "_QMLTYPE_" +
- QByteArray::number(classIndexCounter.fetchAndAddRelaxed(1));
- }
-#endif
- }
- if (newClassName.isEmpty()) {
- newClassName = QQmlMetaObject(baseTypeCache).className();
- newClassName.append("_QML_");
- newClassName.append(QByteArray::number(classIndexCounter.fetchAndAddRelaxed(1)));
- }
-
- cache->_dynamicClassName = newClassName;
-
- int aliasCount = 0;
- int varPropCount = 0;
-
- const QV4::CompiledData::Property *p = obj->propertyTable();
- for (quint32 i = 0; i < obj->nProperties; ++i, ++p) {
-
- if (p->type == QV4::CompiledData::Property::Alias)
- aliasCount++;
- else if (p->type == QV4::CompiledData::Property::Var)
- varPropCount++;
-
-#if 0 // ### Do this elsewhere
- // No point doing this for both the alias and non alias cases
- QQmlPropertyData *d = property(obj, p->name);
- if (d && d->isFinal())
- COMPILE_EXCEPTION(p, tr("Cannot override FINAL property"));
-#endif
- }
-
- typedef QQmlVMEMetaData VMD;
-
- QByteArray &dynamicData = *vmeMetaObjectData = QByteArray(sizeof(QQmlVMEMetaData)
- + obj->nProperties * sizeof(VMD::PropertyData)
- + obj->nFunctions * sizeof(VMD::MethodData)
- + aliasCount * sizeof(VMD::AliasData), 0);
-
- int effectivePropertyIndex = cache->propertyIndexCacheStart;
- int effectiveMethodIndex = cache->methodIndexCacheStart;
-
- // For property change signal override detection.
- // We prepopulate a set of signal names which already exist in the object,
- // and throw an error if there is a signal/method defined as an override.
- QSet<QString> seenSignals;
- seenSignals << QStringLiteral("destroyed") << QStringLiteral("parentChanged") << QStringLiteral("objectNameChanged");
- QQmlPropertyCache *parentCache = cache;
- while ((parentCache = parentCache->parent())) {
- if (int pSigCount = parentCache->signalCount()) {
- int pSigOffset = parentCache->signalOffset();
- for (int i = pSigOffset; i < pSigCount; ++i) {
- QQmlPropertyData *currPSig = parentCache->signal(i);
- // XXX TODO: find a better way to get signal name from the property data :-/
- for (QQmlPropertyCache::StringCache::ConstIterator iter = parentCache->stringCache.begin();
- iter != parentCache->stringCache.end(); ++iter) {
- if (currPSig == (*iter).second) {
- seenSignals.insert(iter.key());
- break;
- }
- }
- }
- }
- }
-
- // First set up notify signals for properties - first normal, then var, then alias
- enum { NSS_Normal = 0, NSS_Var = 1, NSS_Alias = 2 };
- for (int ii = NSS_Normal; ii <= NSS_Alias; ++ii) { // 0 == normal, 1 == var, 2 == alias
-
- if (ii == NSS_Var && varPropCount == 0) continue;
- else if (ii == NSS_Alias && aliasCount == 0) continue;
-
- const QV4::CompiledData::Property *p = obj->propertyTable();
- for (quint32 i = 0; i < obj->nProperties; ++i, ++p) {
- if ((ii == NSS_Normal && (p->type == QV4::CompiledData::Property::Alias ||
- p->type == QV4::CompiledData::Property::Var)) ||
- ((ii == NSS_Var) && (p->type != QV4::CompiledData::Property::Var)) ||
- ((ii == NSS_Alias) && (p->type != QV4::CompiledData::Property::Alias)))
- continue;
-
- quint32 flags = QQmlPropertyData::IsSignal | QQmlPropertyData::IsFunction |
- QQmlPropertyData::IsVMESignal;
-
- QString changedSigName = stringAt(p->nameIndex) + QLatin1String("Changed");
- seenSignals.insert(changedSigName);
-
- cache->appendSignal(changedSigName, flags, effectiveMethodIndex++);
- }
- }
-
- // Dynamic signals
- for (uint i = 0; i < obj->nSignals; ++i) {
- const QV4::CompiledData::Signal *s = obj->signalAt(i);
- const int paramCount = s->nParameters;
-
- QList<QByteArray> names;
- QVarLengthArray<int, 10> paramTypes(paramCount?(paramCount + 1):0);
-
- if (paramCount) {
- paramTypes[0] = paramCount;
-
- for (int i = 0; i < paramCount; ++i) {
- const QV4::CompiledData::Parameter *param = s->parameterAt(i);
- names.append(stringAt(param->nameIndex).toUtf8());
- if (param->type < builtinTypeCount) {
- // built-in type
- paramTypes[i + 1] = builtinTypes[param->type].metaType;
- } else {
- // lazily resolved type
- Q_ASSERT(param->type == QV4::CompiledData::Property::Custom);
- const QString customTypeName = stringAt(param->customTypeNameIndex);
- QQmlType *qmltype = 0;
- if (!imports->resolveType(customTypeName, &qmltype, 0, 0, 0))
- COMPILE_EXCEPTION(s, tr("Invalid signal parameter type: %1").arg(customTypeName));
-
- if (qmltype->isComposite()) {
- QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
- Q_ASSERT(tdata);
- Q_ASSERT(tdata->isComplete());
-
- QQmlCompiledData *data = tdata->compiledData();
-
- paramTypes[i + 1] = data->metaTypeId;
-
- tdata->release();
- } else {
- paramTypes[i + 1] = qmltype->typeId();
- }
- }
- }
- }
-
- ((QQmlVMEMetaData *)dynamicData.data())->signalCount++;
-
- quint32 flags = QQmlPropertyData::IsSignal | QQmlPropertyData::IsFunction |
- QQmlPropertyData::IsVMESignal;
- if (paramCount)
- flags |= QQmlPropertyData::HasArguments;
-
- QString signalName = stringAt(s->nameIndex);
- if (seenSignals.contains(signalName))
- COMPILE_EXCEPTION(s, tr("Duplicate signal name: invalid override of property change signal or superclass signal"));
- seenSignals.insert(signalName);
-
- cache->appendSignal(signalName, flags, effectiveMethodIndex++,
- paramCount?paramTypes.constData():0, names);
- }
-
-
- // Dynamic slots
- const quint32 *functionIndex = obj->functionOffsetTable();
- for (quint32 i = 0; i < obj->nFunctions; ++i, ++functionIndex) {
- const QV4::CompiledData::Function *s = qmlUnit->header.functionAt(*functionIndex);
- int paramCount = s->nFormals;
-
- quint32 flags = QQmlPropertyData::IsFunction | QQmlPropertyData::IsVMEFunction;
-
- if (paramCount)
- flags |= QQmlPropertyData::HasArguments;
-
- QString slotName = stringAt(s->nameIndex);
- if (seenSignals.contains(slotName))
- COMPILE_EXCEPTION(s, tr("Duplicate method name: invalid override of property change signal or superclass signal"));
- // Note: we don't append slotName to the seenSignals list, since we don't
- // protect against overriding change signals or methods with properties.
-
- const quint32 *formalsIndices = s->formalsTable();
- QList<QByteArray> parameterNames;
- parameterNames.reserve(paramCount);
- for (int i = 0; i < paramCount; ++i)
- parameterNames << stringAt(formalsIndices[i]).toUtf8();
-
- cache->appendMethod(slotName, flags, effectiveMethodIndex++, parameterNames);
- }
-
-
- // Dynamic properties (except var and aliases)
- int effectiveSignalIndex = cache->signalHandlerIndexCacheStart;
- /* const QV4::CompiledData::Property* */ p = obj->propertyTable();
- for (quint32 i = 0; i < obj->nProperties; ++i, ++p) {
-
- if (p->type == QV4::CompiledData::Property::Alias ||
- p->type == QV4::CompiledData::Property::Var)
- continue;
-
- int propertyType = 0;
- int vmePropertyType = 0;
- quint32 propertyFlags = 0;
-
- if (p->type < builtinTypeCount) {
- propertyType = builtinTypes[p->type].metaType;
- vmePropertyType = propertyType;
-
- if (p->type == QV4::CompiledData::Property::Variant)
- propertyFlags |= QQmlPropertyData::IsQVariant;
- } else {
- Q_ASSERT(p->type == QV4::CompiledData::Property::CustomList ||
- p->type == QV4::CompiledData::Property::Custom);
-
- QQmlType *qmltype = 0;
- if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, 0, 0, 0)) {
- COMPILE_EXCEPTION(p, tr("Invalid property type"));
- }
-
- Q_ASSERT(qmltype);
- if (qmltype->isComposite()) {
- QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype->sourceUrl());
- Q_ASSERT(tdata);
- Q_ASSERT(tdata->isComplete());
-
- QQmlCompiledData *data = tdata->compiledData();
-
- if (p->type == QV4::CompiledData::Property::Custom) {
- propertyType = data->metaTypeId;
- vmePropertyType = QMetaType::QObjectStar;
- } else {
- propertyType = data->listMetaTypeId;
- vmePropertyType = qMetaTypeId<QQmlListProperty<QObject> >();
- }
-
- tdata->release();
- } else {
- if (p->type == QV4::CompiledData::Property::Custom) {
- propertyType = qmltype->typeId();
- vmePropertyType = QMetaType::QObjectStar;
- } else {
- propertyType = qmltype->qListTypeId();
- vmePropertyType = qMetaTypeId<QQmlListProperty<QObject> >();
- }
- }
-
- if (p->type == QV4::CompiledData::Property::Custom)
- propertyFlags |= QQmlPropertyData::IsQObjectDerived;
- else
- propertyFlags |= QQmlPropertyData::IsQList;
- }
-
- if ((!p->flags & QV4::CompiledData::Property::IsReadOnly) && p->type != QV4::CompiledData::Property::CustomList)
- propertyFlags |= QQmlPropertyData::IsWritable;
-
-
- QString propertyName = stringAt(p->nameIndex);
- if (i == obj->indexOfDefaultProperty) cache->_defaultPropertyName = propertyName;
- cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- propertyType, effectiveSignalIndex);
-
- effectiveSignalIndex++;
-
- VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
- (vmd->propertyData() + vmd->propertyCount)->propertyType = vmePropertyType;
- vmd->propertyCount++;
- }
-
- // Now do var properties
- /* const QV4::CompiledData::Property* */ p = obj->propertyTable();
- for (quint32 i = 0; i < obj->nProperties; ++i, ++p) {
-
- if (p->type != QV4::CompiledData::Property::Var)
- continue;
-
- quint32 propertyFlags = QQmlPropertyData::IsVarProperty;
- if (!p->flags & QV4::CompiledData::Property::IsReadOnly)
- propertyFlags |= QQmlPropertyData::IsWritable;
-
- VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
- (vmd->propertyData() + vmd->propertyCount)->propertyType = QMetaType::QVariant;
- vmd->propertyCount++;
- ((QQmlVMEMetaData *)dynamicData.data())->varPropertyCount++;
-
- QString propertyName = stringAt(p->nameIndex);
- if (i == obj->indexOfDefaultProperty) cache->_defaultPropertyName = propertyName;
- cache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- QMetaType::QVariant, effectiveSignalIndex);
-
- effectiveSignalIndex++;
- }
-
- // Alias property count. Actual data is setup in buildDynamicMetaAliases
- ((QQmlVMEMetaData *)dynamicData.data())->aliasCount = aliasCount;
-
- // Dynamic slot data - comes after the property data
- /*const quint32* */functionIndex = obj->functionOffsetTable();
- for (quint32 i = 0; i < obj->nFunctions; ++i, ++functionIndex) {
- const QV4::CompiledData::Function *s = qmlUnit->header.functionAt(*functionIndex);
-
- VMD::MethodData methodData = { /* runtimeFunctionIndex*/ 0, // ###
- int(s->nFormals),
- /* s->location.start.line */0 }; // ###
-
- VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
- VMD::MethodData &md = *(vmd->methodData() + vmd->methodCount);
- vmd->methodCount++;
- md = methodData;
- }
-
- return true;
-}
-
static void removeBindingOnProperty(QObject *o, int index)
{
int coreIndex = index & 0x0000FFFF;
@@ -468,9 +78,10 @@ static void removeBindingOnProperty(QObject *o, int index)
}
QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData)
- : QQmlCompilePass(compiledData->url, compiledData->qmlUnit)
- , componentAttached(0)
+ : componentAttached(0)
+ , url(compiledData->url)
, engine(parentContext->engine)
+ , qmlUnit(compiledData->qmlUnit)
, jsUnit(compiledData->compilationUnit)
, parentContext(parentContext)
, context(0)
@@ -478,6 +89,7 @@ QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledD
, propertyCaches(compiledData->propertyCaches)
, vmeMetaObjectData(compiledData->datas)
, compiledData(compiledData)
+ , rootContext(0)
, _qobject(0)
, _qobjectForBindings(0)
, _valueTypeProperty(0)
@@ -512,6 +124,9 @@ QObject *QmlObjectCreator::create(int subComponentIndex, QObject *parent)
context->imports->addref();
context->setParent(parentContext);
+ if (!rootContext)
+ rootContext = context;
+
QVector<QQmlContextData::ObjectIdMapping> mapping(objectIndexToId.count());
for (QHash<int, int>::ConstIterator it = objectIndexToId.constBegin(), end = objectIndexToId.constEnd();
it != end; ++it) {
@@ -537,6 +152,10 @@ QObject *QmlObjectCreator::create(int subComponentIndex, QObject *parent)
context->importedScripts = parentContext->importedScripts;
}
+ QVector<QQmlParserStatus*> parserStatusCallbacks;
+ parserStatusCallbacks.resize(qmlUnit->nObjects);
+ qSwap(_parserStatusCallbacks, parserStatusCallbacks);
+
QObject *instance = createInstance(objectToCreate, parent);
if (instance) {
QQmlData *ddata = QQmlData::get(instance);
@@ -546,6 +165,10 @@ QObject *QmlObjectCreator::create(int subComponentIndex, QObject *parent)
context->contextObject = instance;
}
+
+ qSwap(_parserStatusCallbacks, parserStatusCallbacks);
+ allParserStatusCallbacks.prepend(parserStatusCallbacks);
+
return instance;
}
@@ -1219,12 +842,23 @@ void QmlObjectCreator::setupFunctions()
}
}
+void QmlObjectCreator::recordError(const QV4::CompiledData::Location &location, const QString &description)
+{
+ QQmlError error;
+ error.setUrl(url);
+ error.setLine(location.line);
+ error.setColumn(location.column);
+ error.setDescription(description);
+ errors << error;
+}
+
QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
{
ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine));
bool isComponent = false;
QObject *instance = 0;
+ QQmlCustomParser *customParser = 0;
if (compiledData->isComponent(index)) {
isComponent = true;
@@ -1242,6 +876,16 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
recordError(obj->location, tr("Unable to create object of type %1").arg(stringAt(obj->inheritedTypeNameIndex)));
return 0;
}
+
+ const int parserStatusCast = type->parserStatusCast();
+ if (parserStatusCast != -1) {
+ QQmlParserStatus *parserStatus = reinterpret_cast<QQmlParserStatus*>(reinterpret_cast<char *>(instance) + parserStatusCast);
+ parserStatus->classBegin();
+ _parserStatusCallbacks[index] = parserStatus;
+ parserStatus->d = &_parserStatusCallbacks[index];
+ }
+
+ customParser = type->customParser();
} else {
Q_ASSERT(typeRef.component);
if (typeRef.component->qmlUnit->isSingleton())
@@ -1258,6 +902,7 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
if (subCreator.componentAttached)
subCreator.componentAttached->add(&componentAttached);
allCreatedBindings << subCreator.allCreatedBindings;
+ allParserStatusCallbacks << subCreator.allParserStatusCallbacks;
}
// ### use no-event variant
if (parent)
@@ -1285,6 +930,11 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
if (idEntry != objectIndexToId.constEnd())
context->setIdProperty(idEntry.value(), instance);
+ if (customParser) {
+ QByteArray data = compiledData->customParserData.value(index);
+ customParser->setCustomData(instance, data);
+ }
+
if (!isComponent) {
QQmlRefPointer<QQmlPropertyCache> cache = propertyCaches.value(index);
Q_ASSERT(!cache.isNull());
@@ -1296,7 +946,7 @@ QObject *QmlObjectCreator::createInstance(int index, QObject *parent)
return instance;
}
-void QmlObjectCreator::finalize()
+QQmlContextData *QmlObjectCreator::finalize()
{
{
QQmlTrace trace("VME Binding Enable");
@@ -1321,6 +971,28 @@ void QmlObjectCreator::finalize()
}
}
+ if (true /* ### componentCompleteEnabled()*/) { // the qml designer does the component complete later
+ QQmlTrace trace("VME Component Complete");
+ for (QLinkedList<QVector<QQmlParserStatus*> >::ConstIterator it = allParserStatusCallbacks.constBegin(), end = allParserStatusCallbacks.constEnd();
+ it != end; ++it) {
+ const QVector<QQmlParserStatus *> &parserStatusCallbacks = *it;
+ for (int i = parserStatusCallbacks.count() - 1; i >= 0; --i) {
+ QQmlParserStatus *status = parserStatusCallbacks.at(i);
+
+ if (status && status->d) {
+ status->d = 0;
+ status->componentComplete();
+ }
+
+ #if 0 // ###
+ if (watcher.hasRecursed() || interrupt.shouldInterrupt())
+ return 0;
+ #endif
+ }
+ }
+ allParserStatusCallbacks.clear();
+ }
+
{
QQmlTrace trace("VME Component.onCompleted Callbacks");
while (componentAttached) {
@@ -1339,6 +1011,8 @@ void QmlObjectCreator::finalize()
#endif
}
}
+
+ return rootContext;
}
bool QmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPointer<QQmlPropertyCache> cache,
@@ -1406,359 +1080,3 @@ bool QmlObjectCreator::populateInstance(int index, QObject *instance, QQmlRefPoi
}
-QQmlComponentAndAliasResolver::QQmlComponentAndAliasResolver(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit,
- const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes,
- const QList<QQmlPropertyCache *> &propertyCaches, QList<QByteArray> *vmeMetaObjectData,
- QHash<int, int> *objectIndexToIdForRoot,
- QHash<int, QHash<int, int> > *objectIndexToIdPerComponent)
- : QQmlCompilePass(url, qmlUnit)
- , _componentIndex(-1)
- , _objectIndexToIdInScope(0)
- , resolvedTypes(resolvedTypes)
- , propertyCaches(propertyCaches)
- , vmeMetaObjectData(vmeMetaObjectData)
- , objectIndexToIdForRoot(objectIndexToIdForRoot)
- , objectIndexToIdPerComponent(objectIndexToIdPerComponent)
-{
-}
-
-bool QQmlComponentAndAliasResolver::resolve()
-{
- Q_ASSERT(componentRoots.isEmpty());
-
- // Find objects that are Components. This is missing an extra pass
- // that finds implicitly defined components, i.e.
- // someProperty: Item { ... }
- // when someProperty _is_ a QQmlComponent. In that case the Item {}
- // should be implicitly surrounded by Component {}
-
- for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
- if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
- continue;
-
- QQmlCompiledData::TypeReference tref = resolvedTypes.value(obj->inheritedTypeNameIndex);
- if (!tref.type)
- continue;
- if (tref.type->metaObject() != &QQmlComponent::staticMetaObject)
- continue;
-
- componentRoots.append(i);
- // Sanity checks: There can be only an (optional) id property and
- // a default property, that defines the component tree.
- }
-
- std::sort(componentRoots.begin(), componentRoots.end());
-
- // For each component's tree, remember to which component the children
- // belong to
- for (int i = 0; i < componentRoots.count(); ++i) {
- const QV4::CompiledData::Object *component = qmlUnit->objectAt(componentRoots.at(i));
-
- if (component->nFunctions > 0)
- COMPILE_EXCEPTION(component, tr("Component objects cannot declare new functions."));
- if (component->nProperties > 0)
- COMPILE_EXCEPTION(component, tr("Component objects cannot declare new properties."));
- if (component->nSignals > 0)
- COMPILE_EXCEPTION(component, tr("Component objects cannot declare new signals."));
-
- if (component->nBindings == 0)
- COMPILE_EXCEPTION(component, tr("Cannot create empty component specification"));
-
- const QV4::CompiledData::Binding *rootBinding = component->bindingTable();
- if (component->nBindings > 1 || rootBinding->type != QV4::CompiledData::Binding::Type_Object)
- COMPILE_EXCEPTION(rootBinding, tr("Component elements may not contain properties other than id"));
-
- _componentIndex = i;
- _idToObjectIndex.clear();
-
- _objectIndexToIdInScope = &(*objectIndexToIdPerComponent)[componentRoots.at(i)];
-
- _objectsWithAliases.clear();
-
- if (!collectIdsAndAliases(rootBinding->value.objectIndex))
- return false;
-
- if (!resolveAliases())
- return false;
- }
-
- // Collect ids and aliases for root
- _componentIndex = -1;
- _idToObjectIndex.clear();
- _objectIndexToIdInScope = objectIndexToIdForRoot;
- _objectsWithAliases.clear();
-
- collectIdsAndAliases(qmlUnit->indexOfRootObject);
-
- resolveAliases();
-
- return errors.isEmpty();
-}
-
-bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
-{
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
-
- // Only include creatable types. Everything else is synthetic, such as group property
- // objects.
- if (_componentIndex != -1 && !stringAt(obj->inheritedTypeNameIndex).isEmpty())
- objectIndexToComponentIndex.insert(objectIndex, _componentIndex);
-
- QString id = stringAt(obj->idIndex);
- if (!id.isEmpty()) {
- if (_idToObjectIndex.contains(obj->idIndex)) {
- recordError(obj->locationOfIdProperty, tr("id is not unique"));
- return false;
- }
- _idToObjectIndex.insert(obj->idIndex, objectIndex);
- _objectIndexToIdInScope->insert(objectIndex, _objectIndexToIdInScope->count());
- }
-
- const QV4::CompiledData::Property *property = obj->propertyTable();
- for (quint32 i = 0; i < obj->nProperties; ++i, ++property)
- if (property->type == QV4::CompiledData::Property::Alias) {
- _objectsWithAliases.append(objectIndex);
- break;
- }
-
- const QV4::CompiledData::Binding *binding = obj->bindingTable();
- for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
- if (binding->type != QV4::CompiledData::Binding::Type_Object
- && binding->type != QV4::CompiledData::Binding::Type_AttachedProperty
- && binding->type != QV4::CompiledData::Binding::Type_GroupProperty)
- continue;
-
- // Stop at Component boundary
- if (std::binary_search(componentRoots.constBegin(), componentRoots.constEnd(), binding->value.objectIndex))
- continue;
-
- if (!collectIdsAndAliases(binding->value.objectIndex))
- return false;
- }
-
- return true;
-}
-
-bool QQmlComponentAndAliasResolver::resolveAliases()
-{
- foreach (int objectIndex, _objectsWithAliases) {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
-
- QQmlPropertyCache *propertyCache = propertyCaches.value(objectIndex);
- Q_ASSERT(propertyCache);
-
- int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.count();
- int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count();
- int effectiveAliasIndex = 0;
-
- const QV4::CompiledData::Property *p = obj->propertyTable();
- for (quint32 propertyIndex = 0; propertyIndex < obj->nProperties; ++propertyIndex, ++p) {
- if (p->type != QV4::CompiledData::Property::Alias)
- continue;
-
- const int idIndex = p->aliasIdValueIndex;
- const int targetObjectIndex = _idToObjectIndex.value(idIndex, -1);
- if (targetObjectIndex == -1) {
- recordError(p->aliasLocation, tr("Invalid alias reference. Unable to find id \"%1\"").arg(stringAt(idIndex)));
- return false;
- }
- const int targetId = _objectIndexToIdInScope->value(targetObjectIndex, -1);
- Q_ASSERT(targetId != -1);
-
- const QString aliasPropertyValue = stringAt(p->aliasPropertyValueIndex);
-
- QStringRef property;
- QStringRef subProperty;
-
- const int propertySeparator = aliasPropertyValue.indexOf(QLatin1Char('.'));
- if (propertySeparator != -1) {
- property = aliasPropertyValue.leftRef(propertySeparator);
- subProperty = aliasPropertyValue.midRef(propertySeparator + 1);
- } else
- property = QStringRef(&aliasPropertyValue, 0, aliasPropertyValue.length());
-
- int propIdx = -1;
- int propType = 0;
- int notifySignal = -1;
- int flags = 0;
- int type = 0;
- bool writable = false;
- bool resettable = false;
-
- quint32 propertyFlags = QQmlPropertyData::IsAlias;
-
- if (property.isEmpty()) {
- const QV4::CompiledData::Object *targetObject = qmlUnit->objectAt(targetObjectIndex);
- QQmlCompiledData::TypeReference typeRef = resolvedTypes.value(targetObject->inheritedTypeNameIndex);
-
- if (typeRef.type)
- type = typeRef.type->typeId();
- else
- type = typeRef.component->metaTypeId;
-
- flags |= QML_ALIAS_FLAG_PTR;
- propertyFlags |= QQmlPropertyData::IsQObjectDerived;
- } else {
- QQmlPropertyCache *targetCache = propertyCaches.value(targetObjectIndex);
- Q_ASSERT(targetCache);
- QtQml::PropertyResolver resolver(targetCache);
-
- QQmlPropertyData *targetProperty = resolver.property(property.toString());
- if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
- return false;
- }
-
- propIdx = targetProperty->coreIndex;
- type = targetProperty->propType;
-
- writable = targetProperty->isWritable();
- resettable = targetProperty->isResettable();
- notifySignal = targetProperty->notifyIndex;
-
- if (!subProperty.isEmpty()) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type);
- if (!valueType) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
- return false;
- }
-
- propType = type;
-
- int valueTypeIndex =
- valueType->metaObject()->indexOfProperty(subProperty.toString().toUtf8().constData());
- if (valueTypeIndex == -1) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
- return false;
- }
- Q_ASSERT(valueTypeIndex <= 0x0000FFFF);
-
- propIdx |= (valueTypeIndex << 16);
- if (valueType->metaObject()->property(valueTypeIndex).isEnumType())
- type = QVariant::Int;
- else
- type = valueType->metaObject()->property(valueTypeIndex).userType();
-
- } else {
- if (targetProperty->isEnum()) {
- type = QVariant::Int;
- } else {
- // Copy type flags
- propertyFlags |= targetProperty->getFlags() & QQmlPropertyData::PropTypeFlagMask;
-
- if (targetProperty->isVarProperty())
- propertyFlags |= QQmlPropertyData::IsQVariant;
-
- if (targetProperty->isQObject())
- flags |= QML_ALIAS_FLAG_PTR;
- }
- }
- }
-
- QQmlVMEMetaData::AliasData aliasData = { targetId, propIdx, propType, flags, notifySignal };
-
- typedef QQmlVMEMetaData VMD;
- QByteArray &dynamicData = (*vmeMetaObjectData)[objectIndex];
- Q_ASSERT(!dynamicData.isEmpty());
- VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
- *(vmd->aliasData() + effectiveAliasIndex++) = aliasData;
-
- Q_ASSERT(dynamicData.isDetached());
-
- if (!(p->flags & QV4::CompiledData::Property::IsReadOnly) && writable)
- propertyFlags |= QQmlPropertyData::IsWritable;
- else
- propertyFlags &= ~QQmlPropertyData::IsWritable;
-
- if (resettable)
- propertyFlags |= QQmlPropertyData::IsResettable;
- else
- propertyFlags &= ~QQmlPropertyData::IsResettable;
-
- QString propertyName = stringAt(p->nameIndex);
- if (propertyIndex == obj->indexOfDefaultProperty) propertyCache->_defaultPropertyName = propertyName;
- propertyCache->appendProperty(propertyName, propertyFlags, effectivePropertyIndex++,
- type, effectiveSignalIndex++);
-
- }
- }
- return true;
-}
-
-
-QQmlPropertyValidator::QQmlPropertyValidator(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit,
- const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes,
- const QList<QQmlPropertyCache *> &propertyCaches, const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent)
- : QQmlCompilePass(url, qmlUnit)
- , resolvedTypes(resolvedTypes)
- , propertyCaches(propertyCaches)
- , objectIndexToIdPerComponent(objectIndexToIdPerComponent)
-{
-}
-
-bool QQmlPropertyValidator::validate()
-{
- for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
- if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
- continue;
-
- if (isComponent(i))
- continue;
-
- QQmlPropertyCache *propertyCache = propertyCaches.value(i);
- Q_ASSERT(propertyCache);
-
- if (!validateObject(obj, i, propertyCache))
- return false;
- }
- return true;
-}
-
-bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache)
-{
- PropertyResolver propertyResolver(propertyCache);
-
- QQmlPropertyData *defaultProperty = propertyCache->defaultProperty();
-
- const QV4::CompiledData::Binding *binding = obj->bindingTable();
- for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
- if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty
- || binding->type == QV4::CompiledData::Binding::Type_GroupProperty)
- continue;
-
- const QString name = stringAt(binding->propertyNameIndex);
-
- bool bindingToDefaultProperty = false;
-
- bool notInRevision = false;
- QQmlPropertyData *pd = 0;
- if (!name.isEmpty()) {
- pd = propertyResolver.property(name, &notInRevision);
-
- if (notInRevision) {
- QString typeName = stringAt(obj->inheritedTypeNameIndex);
- QQmlCompiledData::TypeReference type = resolvedTypes.value(objectIndex);
- if (type.type) {
- COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(name).arg(type.type->module()).arg(type.majorVersion).arg(type.minorVersion));
- } else {
- COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available due to component versioning.").arg(typeName).arg(name));
- }
- }
- } else {
- pd = defaultProperty;
- bindingToDefaultProperty = true;
- }
-
- if (!pd) {
- if (bindingToDefaultProperty) {
- COMPILE_EXCEPTION(binding, tr("Cannot assign to non-existent default property"));
- } else {
- COMPILE_EXCEPTION(binding, tr("Cannot assign to non-existent property \"%1\"").arg(name));
- }
- }
- }
-
- return true;
-}
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index ec4b362491..a8907fb762 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -45,109 +45,28 @@
#include <private/qqmltypenamecache_p.h>
#include <private/qv4compileddata_p.h>
#include <private/qqmlcompiler_p.h>
+#include <private/qqmltypecompiler_p.h>
#include <QLinkedList>
QT_BEGIN_NAMESPACE
class QQmlAbstractBinding;
+struct QQmlTypeCompiler;
-struct QQmlCompilePass
-{
- QQmlCompilePass(const QUrl &url, const QV4::CompiledData::QmlUnit *unit);
- QList<QQmlError> errors;
-
-protected:
- QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
- void recordError(const QV4::CompiledData::Location &location, const QString &description);
-
- const QUrl url;
- const QV4::CompiledData::QmlUnit *qmlUnit;
-};
-
-class QQmlPropertyCacheCreator : public QQmlCompilePass
-{
- Q_DECLARE_TR_FUNCTIONS(QQmlPropertyCacheCreator)
-public:
- QQmlPropertyCacheCreator(QQmlEnginePrivate *enginePrivate, const QV4::CompiledData::QmlUnit *qmlUnit,
- const QUrl &url, const QQmlImports *imports,
- QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes);
-
- bool create(const QV4::CompiledData::Object *obj, QQmlPropertyCache **cache, QByteArray *vmeMetaObjectData);
-
-protected:
- QQmlEnginePrivate *enginePrivate;
- const QQmlImports *imports;
- QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes;
-};
-
-class QQmlComponentAndAliasResolver : public QQmlCompilePass
-{
- Q_DECLARE_TR_FUNCTIONS(QQmlAnonymousComponentResolver)
-public:
- QQmlComponentAndAliasResolver(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit,
- const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes,
- const QList<QQmlPropertyCache *> &propertyCaches,
- QList<QByteArray> *vmeMetaObjectData,
- QHash<int, int> *objectIndexToIdForRoot,
- QHash<int, QHash<int, int> > *objectIndexToIdPerComponent);
-
- bool resolve();
-
- QVector<int> componentRoots;
- QHash<int, int> objectIndexToComponentIndex;
-
-protected:
- bool collectIdsAndAliases(int objectIndex);
- bool resolveAliases();
-
- bool isComponentType(int typeNameIndex) const
- { return resolvedTypes.value(typeNameIndex).type == 0; }
-
- int _componentIndex;
- QHash<int, int> _idToObjectIndex;
- QHash<int, int> *_objectIndexToIdInScope;
- QList<int> _objectsWithAliases;
-
- const QHash<int, QQmlCompiledData::TypeReference> resolvedTypes;
- const QList<QQmlPropertyCache *> propertyCaches;
- QList<QByteArray> *vmeMetaObjectData;
- QHash<int, int> *objectIndexToIdForRoot;
- QHash<int, QHash<int, int> > *objectIndexToIdPerComponent;
-};
-
-class QQmlPropertyValidator : public QQmlCompilePass
-{
- Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
-public:
- QQmlPropertyValidator(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit,
- const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes,
- const QList<QQmlPropertyCache *> &propertyCaches,
- const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent);
-
- bool validate();
-
-private:
- bool validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache);
-
- bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
-
- const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes;
- const QList<QQmlPropertyCache *> &propertyCaches;
- const QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
-};
-
-class QmlObjectCreator : public QQmlCompilePass
+class QmlObjectCreator
{
Q_DECLARE_TR_FUNCTIONS(QmlObjectCreator)
public:
QmlObjectCreator(QQmlContextData *contextData, QQmlCompiledData *compiledData);
QObject *create(int subComponentIndex = -1, QObject *parent = 0);
- void finalize();
+ QQmlContextData *finalize();
QQmlComponentAttached *componentAttached;
QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks;
+ QList<QQmlError> errors;
+
private:
QObject *createInstance(int index, QObject *parent = 0);
@@ -159,7 +78,12 @@ private:
void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
void setupFunctions();
+ QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
+ void recordError(const QV4::CompiledData::Location &location, const QString &description);
+
+ QUrl url;
QQmlEngine *engine;
+ const QV4::CompiledData::QmlUnit *qmlUnit;
const QV4::CompiledData::CompilationUnit *jsUnit;
QQmlContextData *parentContext;
QQmlContextData *context;
@@ -168,7 +92,9 @@ private:
const QList<QByteArray> vmeMetaObjectData;
QHash<int, int> objectIndexToId;
QLinkedList<QVector<QQmlAbstractBinding*> > allCreatedBindings;
+ QLinkedList<QVector<QQmlParserStatus*> > allParserStatusCallbacks;
QQmlCompiledData *compiledData;
+ QQmlContextData *rootContext;
QObject *_qobject;
QObject *_qobjectForBindings;
@@ -180,6 +106,7 @@ private:
QVector<QQmlAbstractBinding*> _createdBindings;
QQmlListProperty<void> _currentList;
QV4::ExecutionContext *_qmlContext;
+ QVector<QQmlParserStatus*> _parserStatusCallbacks;
};
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlparserstatus.h b/src/qml/qml/qqmlparserstatus.h
index d3447e7752..1d63afd978 100644
--- a/src/qml/qml/qqmlparserstatus.h
+++ b/src/qml/qml/qqmlparserstatus.h
@@ -62,6 +62,7 @@ private:
friend class QQmlComponent;
friend class QQmlComponentPrivate;
friend class QQmlEnginePrivate;
+ friend class QmlObjectCreator;
QQmlParserStatus **d;
};
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 6c40557886..d026b95201 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1140,7 +1140,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(QQmlEngine *engine, const
{
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
bool unnamedParameter = false;
- const QV4::IdentifierHash<bool> &illegalNames = ep->v8engine()->illegalNames();
+ const QSet<QString> &illegalNames = ep->v8engine()->illegalNames();
QString error;
QString parameters;
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 6eda55e35b..278bb017d0 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -52,6 +52,7 @@
#include <private/qqmlprofilerservice_p.h>
#include <private/qqmlmemoryprofiler_p.h>
#include <private/qqmlcodegenerator_p.h>
+#include <private/qqmltypecompiler_p.h>
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
@@ -2154,8 +2155,9 @@ void QQmlTypeData::dataReceived(const Data &data)
if (data.isFile()) preparseData = data.asFile()->metaData(QLatin1String("qml:preparse"));
if (m_useNewCompiler) {
- parsedQML.reset(new QtQml::ParsedQML(QV8Engine::getV4(typeLoader()->engine())->debugger != 0));
- QQmlCodeGenerator compiler;
+ QQmlEngine *qmlEngine = typeLoader()->engine();
+ parsedQML.reset(new QtQml::ParsedQML(QV8Engine::getV4(qmlEngine)->debugger != 0));
+ QQmlCodeGenerator compiler(QV8Engine::get(qmlEngine)->illegalNames());
if (!compiler.generateFromQml(code, finalUrl(), finalUrlString(), parsedQML.data())) {
setError(compiler.errors);
return;
@@ -2305,173 +2307,9 @@ void QQmlTypeData::compile()
QQmlCompilingProfiler prof(m_compiledData->name);
if (m_useNewCompiler) {
- m_compiledData->importCache = new QQmlTypeNameCache;
-
- foreach (const QString &ns, m_namespaces)
- m_compiledData->importCache->add(ns);
-
- // Add any Composite Singletons that were used to the import cache
- for (int i = 0; i < compositeSingletons().count(); ++i) {
- m_compiledData->importCache->add(compositeSingletons().at(i).type->qmlTypeName(),
- compositeSingletons().at(i).type->sourceUrl(), compositeSingletons().at(i).prefix);
- }
-
- m_imports.populateCache(m_compiledData->importCache);
- m_compiledData->importCache->addref();
-
- QQmlEngine *engine = typeLoader()->engine();
- QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(engine);
-
- for (QHash<int, TypeReference>::ConstIterator resolvedType = m_resolvedTypes.constBegin(), end = m_resolvedTypes.constEnd();
- resolvedType != end; ++resolvedType) {
- QQmlCompiledData::TypeReference ref;
- if (resolvedType->typeData) {
- ref.component = resolvedType->typeData->compiledData();
- ref.component->addref();
- } else {
- ref.type = resolvedType->type;
- Q_ASSERT(ref.type);
- }
- ref.majorVersion = resolvedType->majorVersion;
- ref.minorVersion = resolvedType->minorVersion;
- m_compiledData->resolvedTypes.insert(resolvedType.key(), ref);
- }
-
- {
- SignalHandlerConverter converter(QQmlEnginePrivate::get(engine),
- parsedQML.data(),
- m_compiledData);
- if (!converter.convertSignalHandlerExpressionsToFunctionDeclarations()) {
- setError(converter.errors);
- m_compiledData->release();
- m_compiledData = 0;
- return;
- }
- }
-
- // Collect imported scripts
- m_compiledData->scripts.reserve(m_scripts.count());
- for (int scriptIndex = 0; scriptIndex < m_scripts.count(); ++scriptIndex) {
- const ScriptReference &script = m_scripts.at(scriptIndex);
-
- QString qualifier = script.qualifier;
- QString enclosingNamespace;
-
- const int lastDotIndex = qualifier.lastIndexOf(QLatin1Char('.'));
- if (lastDotIndex != -1) {
- enclosingNamespace = qualifier.left(lastDotIndex);
- qualifier = qualifier.mid(lastDotIndex+1);
- }
-
- m_compiledData->importCache->add(qualifier, scriptIndex, enclosingNamespace);
- QQmlScriptData *scriptData = script.script->scriptData();
- scriptData->addref();
- m_compiledData->scripts << scriptData;
- }
-
- // Compile JS binding expressions and signal handlers
-
- JSCodeGen jsCodeGen(finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, m_compiledData->importCache);
- const QVector<int> runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(parsedQML->functions);
-
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(m_typeLoader->engine());
-
- QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(enginePrivate, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
- isel->setUseFastLookups(false);
- QV4::CompiledData::CompilationUnit *jsUnit = isel->compile(/*generated unit data*/false);
-
- // Generate QML compiled type data structures
-
- QmlUnitGenerator qmlGenerator;
- QV4::CompiledData::QmlUnit *qmlUnit = qmlGenerator.generate(*parsedQML.data(), runtimeFunctionIndices);
-
- if (jsUnit) {
- Q_ASSERT(!jsUnit->data);
- jsUnit->ownsData = false;
- jsUnit->data = &qmlUnit->header;
- }
-
- m_compiledData->compilationUnit = jsUnit;
- if (m_compiledData->compilationUnit)
- m_compiledData->compilationUnit->ref();
- m_compiledData->qmlUnit = qmlUnit; // ownership transferred to m_compiledData
-
- QList<QQmlError> errors;
-
- // Build property caches and VME meta object data
-
- m_compiledData->datas.reserve(qmlUnit->nObjects);
- m_compiledData->propertyCaches.reserve(qmlUnit->nObjects);
-
- QQmlPropertyCacheCreator propertyCacheBuilder(enginePrivate,
- qmlUnit, m_compiledData->url,
- &m_imports, &m_compiledData->resolvedTypes);
-
- for (quint32 i = 0; i < qmlUnit->nObjects; ++i) {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i);
-
- QByteArray vmeMetaObjectData;
- QQmlPropertyCache *propertyCache = 0;
-
- // If the object has no type, then it's probably a nested object definition as part
- // of a group property.
- const bool objectHasType = !parsedQML->jsGenerator.strings.at(obj->inheritedTypeNameIndex).isEmpty();
- if (objectHasType) {
- if (!propertyCacheBuilder.create(obj, &propertyCache, &vmeMetaObjectData)) {
- errors << propertyCacheBuilder.errors;
- break;
- }
- }
-
- m_compiledData->datas << vmeMetaObjectData;
- if (propertyCache)
- propertyCache->addref();
- m_compiledData->propertyCaches << propertyCache;
-
- if (i == qmlUnit->indexOfRootObject) {
- Q_ASSERT(propertyCache);
- m_compiledData->rootPropertyCache = propertyCache;
- propertyCache->addref();
- }
- }
-
- // Resolve component boundaries and aliases
-
- if (errors.isEmpty()) {
- // Scan for components, determine their scopes and resolve aliases within the scope.
- QQmlComponentAndAliasResolver resolver(m_compiledData->url, m_compiledData->qmlUnit, m_compiledData->resolvedTypes, m_compiledData->propertyCaches,
- &m_compiledData->datas, &m_compiledData->objectIndexToIdForRoot, &m_compiledData->objectIndexToIdPerComponent);
- if (!resolver.resolve())
- errors << resolver.errors;
- }
-
- if (errors.isEmpty()) {
- // Add to type registry of composites
- if (m_compiledData->isCompositeType())
- QQmlEnginePrivate::get(engine)->registerInternalCompositeType(m_compiledData);
- else {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(qmlUnit->indexOfRootObject);
- QQmlCompiledData::TypeReference typeRef = m_compiledData->resolvedTypes.value(obj->inheritedTypeNameIndex);
- if (typeRef.component) {
- m_compiledData->metaTypeId = typeRef.component->metaTypeId;
- m_compiledData->listMetaTypeId = typeRef.component->listMetaTypeId;
- } else {
- m_compiledData->metaTypeId = typeRef.type->typeId();
- m_compiledData->listMetaTypeId = typeRef.type->qListTypeId();
- }
- }
- }
-
- // Sanity check property bindings
- if (errors.isEmpty()) {
- QQmlPropertyValidator validator(m_compiledData->url, m_compiledData->qmlUnit, m_compiledData->resolvedTypes,
- m_compiledData->propertyCaches, m_compiledData->objectIndexToIdPerComponent);
- if (!validator.validate())
- errors << validator.errors;
- }
-
- if (!errors.isEmpty()) {
- setError(errors);
+ QQmlTypeCompiler compiler(QQmlEnginePrivate::get(typeLoader()->engine()), m_compiledData, this, parsedQML.data());
+ if (!compiler.compile()) {
+ setError(compiler.compilationErrors());
m_compiledData->release();
m_compiledData = 0;
}
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index b93cf2942d..a022162a7c 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -425,7 +425,12 @@ public:
const QQmlScript::Parser &parser() const;
+ // old compiler:
const QList<TypeReference> &resolvedTypes() const;
+ // new compiler:
+ const QHash<int, TypeReference> &resolvedTypeRefs() const { return m_resolvedTypes; }
+ // ---
+
const QList<ScriptReference> &resolvedScripts() const;
const QSet<QString> &namespaces() const;
const QList<TypeReference> &compositeSingletons() const;
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 33f5a00a6c..e64cc0c83b 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -164,7 +164,7 @@ QVariant QV8Engine::toVariant(const QV4::ValueRef value, int typeHint)
QV4::ScopedArrayObject a(scope, value);
if (typeHint == qMetaTypeId<QList<QObject *> >()) {
QList<QObject *> list;
- uint32_t length = a->arrayLength();
+ uint32_t length = a->getLength();
QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
for (uint32_t ii = 0; ii < length; ++ii) {
qobjectWrapper = a->getIndexed(ii);
@@ -196,9 +196,10 @@ static QV4::ReturnedValue arrayFromStringList(QV8Engine *engine, const QStringLi
QV4::Scoped<QV4::ArrayObject> a(scope, e->newArrayObject());
int len = list.count();
a->arrayReserve(len);
+ QV4::ScopedValue v(scope);
for (int ii = 0; ii < len; ++ii) {
- a->arrayData[ii].value = QV4::Encode(e->newString(list.at(ii)));
- a->arrayDataLen = ii + 1;
+ a->arrayData->put(ii, (v = QV4::Encode(e->newString(list.at(ii)))));
+ a->arrayData->setLength(ii + 1);
}
a->setArrayLengthUnchecked(len);
return a.asReturnedValue();
@@ -211,9 +212,10 @@ static QV4::ReturnedValue arrayFromVariantList(QV8Engine *engine, const QVariant
QV4::Scoped<QV4::ArrayObject> a(scope, e->newArrayObject());
int len = list.count();
a->arrayReserve(len);
+ QV4::ScopedValue v(scope);
for (int ii = 0; ii < len; ++ii) {
- a->arrayData[ii].value = engine->fromVariant(list.at(ii));
- a->arrayDataLen = ii + 1;
+ a->arrayData->put(ii, (v = engine->fromVariant(list.at(ii))));
+ a->arrayData->setLength(ii + 1);
}
a->setArrayLengthUnchecked(len);
return a.asReturnedValue();
@@ -325,9 +327,10 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
const QList<QObject *> &list = *(QList<QObject *>*)ptr;
QV4::Scoped<QV4::ArrayObject> a(scope, m_v4Engine->newArrayObject());
a->arrayReserve(list.count());
+ QV4::ScopedValue v(scope);
for (int ii = 0; ii < list.count(); ++ii) {
- a->arrayData[ii].value = QV4::QObjectWrapper::wrap(m_v4Engine, list.at(ii));
- a->arrayDataLen = ii + 1;
+ a->arrayData->put(ii, (v = QV4::QObjectWrapper::wrap(m_v4Engine, list.at(ii))));
+ a->arrayData->setLength(ii + 1);
}
a->setArrayLengthUnchecked(list.count());
return a.asReturnedValue();
@@ -361,7 +364,7 @@ QNetworkAccessManager *QV8Engine::networkAccessManager()
return QQmlEnginePrivate::get(m_engine)->getNetworkAccessManager();
}
-const QV4::IdentifierHash<bool> &QV8Engine::illegalNames() const
+const QSet<QString> &QV8Engine::illegalNames() const
{
return m_illegalNames;
}
@@ -407,7 +410,7 @@ QVariant QV8Engine::toBasicVariant(const QV4::ValueRef value)
QV4::ScopedValue v(scope);
QVariantList rv;
- int length = a->arrayLength();
+ int length = a->getLength();
for (int ii = 0; ii < length; ++ii) {
v = a->getIndexed(ii);
rv << toVariant(v, -1);
@@ -437,9 +440,8 @@ void QV8Engine::initializeGlobal()
qt_add_sqlexceptions(m_v4Engine);
{
- m_illegalNames = QV4::IdentifierHash<bool>(m_v4Engine);
for (uint i = 0; i < m_v4Engine->globalObject->internalClass->size; ++i)
- m_illegalNames.add(m_v4Engine->globalObject->internalClass->nameMap.at(i)->toQString(), true);
+ m_illegalNames.insert(m_v4Engine->globalObject->internalClass->nameMap.at(i)->toQString());
}
{
@@ -541,9 +543,10 @@ QV4::ReturnedValue QV8Engine::variantListToJS(const QVariantList &lst)
QV4::Scope scope(m_v4Engine);
QV4::Scoped<QV4::ArrayObject> a(scope, m_v4Engine->newArrayObject());
a->arrayReserve(lst.size());
+ QV4::ScopedValue v(scope);
for (int i = 0; i < lst.size(); i++) {
- a->arrayData[i].value = variantToJS(lst.at(i));
- a->arrayDataLen = i + 1;
+ a->arrayData->put(i, (v = variantToJS(lst.at(i))));
+ a->arrayData->setLength(i + 1);
}
a->setArrayLengthUnchecked(lst.size());
return a.asReturnedValue();
@@ -569,7 +572,7 @@ QVariantList QV8Engine::variantListFromJS(QV4::ArrayObjectRef a,
QV4::Scope scope(a->engine());
QV4::ScopedValue v(scope);
- quint32 length = a->arrayLength();
+ quint32 length = a->getLength();
for (quint32 i = 0; i < length; ++i) {
v = a->getIndexed(i);
result.append(variantFromJS(v, visitedObjects));
@@ -590,10 +593,11 @@ QV4::ReturnedValue QV8Engine::variantMapToJS(const QVariantMap &vmap)
QV4::Scoped<QV4::Object> o(scope, m_v4Engine->newObject());
QVariantMap::const_iterator it;
QV4::ScopedString s(scope);
+ QV4::ScopedValue v(scope);
for (it = vmap.constBegin(); it != vmap.constEnd(); ++it) {
s = m_v4Engine->newIdentifier(it.key());
- QV4::Property *p = o->insertMember(s, QV4::Attr_Data);
- p->value = variantToJS(it.value());
+ v = variantToJS(it.value());
+ o->insertMember(s, v);
}
return o.asReturnedValue();
}
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index e37b0d4920..5d1005b479 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -217,7 +217,7 @@ public:
virtual QNetworkAccessManager *networkAccessManager();
// Return the list of illegal id names (the names of the properties on the global object)
- const QV4::IdentifierHash<bool> &illegalNames() const;
+ const QSet<QString> &illegalNames() const;
void gc();
@@ -268,7 +268,7 @@ protected:
QVector<Deletable *> m_extensionData;
Deletable *m_listModelData;
- QV4::IdentifierHash<bool> m_illegalNames;
+ QSet<QString> m_illegalNames;
QElapsedTimer m_time;
QHash<QString, qint64> m_startedTimers;
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 5e6a1a084a..b8920deb21 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -251,6 +251,44 @@ QQmlConnectionsParser::compile(const QList<QQmlCustomParserProperty> &props)
return rv;
}
+QByteArray QQmlConnectionsParser::compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
+{
+ QByteArray rv;
+ QDataStream ds(&rv, QIODevice::WriteOnly);
+
+ for (int ii = 0; ii < props.count(); ++ii) {
+ const QV4::CompiledData::Binding *binding = props.at(ii);
+ QString propName = qmlUnit->header.stringAt(binding->propertyNameIndex);
+ int propLine = binding->location.line;
+ int propColumn = binding->location.column;
+
+ if (!propName.startsWith(QLatin1String("on")) || !propName.at(2).isUpper()) {
+ error(props.at(ii), QQmlConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
+ return QByteArray();
+ }
+
+
+ if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
+ const QV4::CompiledData::Object *target = qmlUnit->objectAt(binding->value.objectIndex);
+ if (!qmlUnit->header.stringAt(target->inheritedTypeNameIndex).isEmpty())
+ error(binding, QQmlConnections::tr("Connections: nested objects not allowed"));
+ else
+ error(binding, QQmlConnections::tr("Connections: syntax error"));
+ return QByteArray();
+ } if (binding->type != QV4::CompiledData::Binding::Type_Script) {
+ error(binding, QQmlConnections::tr("Connections: script expected"));
+ return QByteArray();
+ } else {
+ ds << propName;
+ ds << binding->valueAsString(&qmlUnit->header);
+ ds << propLine;
+ ds << propColumn;
+ }
+ }
+
+ return rv;
+}
+
void QQmlConnectionsParser::setCustomData(QObject *object,
const QByteArray &data)
{
diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h
index 9bc668e5f4..2579e4c239 100644
--- a/src/qml/types/qqmlconnections_p.h
+++ b/src/qml/types/qqmlconnections_p.h
@@ -85,6 +85,7 @@ class QQmlConnectionsParser : public QQmlCustomParser
{
public:
virtual QByteArray compile(const QList<QQmlCustomParserProperty> &);
+ virtual QByteArray compile(const QV4::CompiledData::QmlUnit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props);
virtual void setCustomData(QObject *, const QByteArray &);
};
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 7276c0e5c6..4c8635b29c 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1629,37 +1629,46 @@ void QQmlDelegateModelItemMetaType::initializePrototype()
proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, 0);
proto->defineAccessorProperty(QStringLiteral("groups"), QQmlDelegateModelItem::get_groups, QQmlDelegateModelItem::set_groups);
QV4::ScopedString s(scope);
+ QV4::Property p;
+
s = v4->newString(QStringLiteral("isUnresolved"));
- QV4::Property *p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, 30, QQmlDelegateModelItem::get_member));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, 30, QQmlDelegateModelItem::get_member));
+ p.setSetter(0);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+
s = v4->newString(QStringLiteral("inItems"));
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_member));
- p->setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::set_member));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_member));
+ p.setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::set_member));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+
s = v4->newString(QStringLiteral("inPersistedItems"));
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_member));
- p->setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::set_member));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_member));
+ p.setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::set_member));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+
s = v4->newString(QStringLiteral("itemsIndex"));
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_index));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_index));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+
s = v4->newString(QStringLiteral("persistedItemsIndex"));
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index));
+ p.setSetter(0);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
for (int i = 2; i < groupNames.count(); ++i) {
QString propertyName = QStringLiteral("in") + groupNames.at(i);
propertyName.replace(2, 1, propertyName.at(2).toUpper());
s = v4->newString(propertyName);
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::get_member));
- p->setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::set_member));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::get_member));
+ p.setSetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::set_member));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
for (int i = 2; i < groupNames.count(); ++i) {
const QString propertyName = groupNames.at(i) + QStringLiteral("Index");
s = v4->newString(propertyName);
- p = proto->insertMember(s, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
- p->setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::get_index));
+ p.setGetter(new (v4->memoryManager) DelegateModelGroupFunction(v4->rootContext, i + 1, QQmlDelegateModelItem::get_index));
+ p.setSetter(0);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
modelItemProto = proto;
}
@@ -1692,7 +1701,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QV4::ValueRef groups) const
QV4::ScopedArrayObject array(scope, groups);
if (array) {
QV4::ScopedValue v(scope);
- uint arrayLength = array->arrayLength();
+ uint arrayLength = array->getLength();
for (uint i = 0; i < arrayLength; ++i) {
v = array->getIndexed(i);
const QString groupName = v->toQString();
@@ -1863,11 +1872,16 @@ void QQmlDelegateModelItem::incubateObject(
incubatorPriv->compiledData = componentPriv->cc;
incubatorPriv->compiledData->addref();
- incubatorPriv->vme.init(
- context,
- componentPriv->cc,
- componentPriv->start,
- componentPriv->creationContext);
+ if (enginePriv->useNewCompiler) {
+ incubatorPriv->creator.reset(new QmlObjectCreator(context, componentPriv->cc));
+ incubatorPriv->subComponentToCreate = componentPriv->start;
+ } else {
+ incubatorPriv->vme.init(
+ context,
+ componentPriv->cc,
+ componentPriv->start,
+ componentPriv->creationContext);
+ }
enginePriv->incubate(*incubationTask, forContext);
}
@@ -3184,7 +3198,7 @@ public:
: Object(engine)
{
setVTable(&static_vtbl);
- flags &= ~SimpleArray;
+ setArrayType(QV4::ArrayData::Custom);
}
virtual ~QQmlDelegateModelGroupChangeArray() {}
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 7e441023c9..eeb4aa0861 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -441,7 +441,7 @@ void ListModel::set(int elementIndex, QV4::ObjectRef object, QVector<int> *roles
const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List);
ListModel *subModel = new ListModel(r.subLayout, 0, -1);
- int arrayLength = a->arrayLength();
+ int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
subModel->append(o, eng);
@@ -517,7 +517,7 @@ void ListModel::set(int elementIndex, QV4::ObjectRef object, QV8Engine *eng)
if (r.type == ListLayout::Role::List) {
ListModel *subModel = new ListModel(r.subLayout, 0, -1);
- int arrayLength = a->arrayLength();
+ int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
subModel->append(o, eng);
@@ -1188,7 +1188,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::ValueRef
QV4::Scoped<QV4::Object> o(scope);
ListModel *subModel = new ListModel(role.subLayout, 0, -1);
- int arrayLength = a->arrayLength();
+ int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
subModel->append(o, eng);
@@ -1953,7 +1953,7 @@ void QQmlListModel::insert(QQmlV4Function *args)
if (objectArray) {
QV4::ScopedObject argObject(scope);
- int objectArrayLength = objectArray->arrayLength();
+ int objectArrayLength = objectArray->getLength();
for (int i=0 ; i < objectArrayLength ; ++i) {
argObject = objectArray->getIndexed(i);
@@ -2055,7 +2055,7 @@ void QQmlListModel::append(QQmlV4Function *args)
if (objectArray) {
QV4::Scoped<QV4::Object> argObject(scope);
- int objectArrayLength = objectArray->arrayLength();
+ int objectArrayLength = objectArray->getLength();
int index = count();
for (int i=0 ; i < objectArrayLength ; ++i) {
diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h
index 722cb2b44d..a7487537c5 100644
--- a/src/qml/types/qqmllistmodel_p.h
+++ b/src/qml/types/qqmllistmodel_p.h
@@ -188,8 +188,12 @@ private:
ListModel *model;
int elementIndex;
};
+
+ friend class QTypeInfo<QQmlListModelParser::ListInstruction>;
};
+Q_DECLARE_TYPEINFO(QQmlListModelParser::ListInstruction, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQmlListModel)
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 38fdffdde6..36c3623d8b 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -226,9 +226,10 @@ public:
const QByteArray &propertyName = it.key();
QV4::ScopedString name(scope, v4->newString(QString::fromUtf8(propertyName)));
- QV4::Property *p = proto->insertMember(name, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
- p->setGetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::get_property));
- p->setSetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::set_property));
+ QV4::Property p;
+ p.setGetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::get_property));
+ p.setSetter(new (v4->memoryManager) QV4::IndexedBuiltinFunction(v4->rootContext, propertyId, QQmlDMCachedModelData::set_property));
+ proto->insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
}
prototype = proto;
}
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index b3a2c9f46a..763dd5251b 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -180,7 +180,7 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate()
, renderTarget(QQuickCanvasItem::Image)
, renderStrategy(QQuickCanvasItem::Immediate)
{
- antialiasing = true;
+ implicitAntialiasing = true;
}
QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
@@ -642,7 +642,7 @@ void QQuickCanvasItem::updatePolish()
Q_D(QQuickCanvasItem);
if (d->context && d->renderStrategy != QQuickCanvasItem::Cooperative)
- d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
+ d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, antialiasing());
if (d->animationCallbacks.size() > 0 && isVisible()) {
QMap<int, QV4::PersistentValue> animationCallbacks = d->animationCallbacks;
@@ -705,7 +705,7 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
node->setFiltering(QSGTexture::Nearest);
if (d->renderStrategy == QQuickCanvasItem::Cooperative) {
- d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, d->antialiasing);
+ d->context->prepare(d->canvasSize.toSize(), d->tileSize, d->canvasWindow.toRect(), d->dirtyRect.toRect(), d->smooth, antialiasing());
d->context->flush();
}
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index b6d4f1073c..c8741335dd 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -871,7 +871,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object
: QV4::Object(engine)
{
setVTable(&static_vtbl);
- flags &= ~SimpleArray;
+ setArrayType(QV4::ArrayData::Custom);
}
static void destroy(QV4::Managed *that) {
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 1107425575..8587da5ac3 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -630,8 +630,8 @@ void QQuickGridViewPrivate::updateViewport()
void QQuickGridViewPrivate::layoutVisibleItems(int fromModelIndex)
{
if (visibleItems.count()) {
- const qreal from = isContentFlowReversed() ? -position() - size() : position();
- const qreal to = isContentFlowReversed() ? -position() : position() + size();
+ const qreal from = isContentFlowReversed() ? -position()-displayMarginBeginning-size() : position()-displayMarginBeginning;
+ const qreal to = isContentFlowReversed() ? -position()+displayMarginEnd : position()+size()+displayMarginEnd;
FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.first());
qreal rowPos = firstItem->rowPos();
@@ -1534,7 +1534,35 @@ void QQuickGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
of additional memory usage. It is not a substitute for creating efficient
delegates; the fewer objects and bindings in a delegate, the faster a view may be
scrolled.
+
+ The cacheBuffer operates outside of any display margins specified by
+ displayMarginBeginning or displayMarginEnd.
+*/
+
+/*!
+ \qmlproperty int QtQuick::GridView::displayMarginBeginning
+ \qmlproperty int QtQuick::GridView::displayMarginEnd
+ \since QtQuick 2.3
+
+ This property allows delegates to be displayed outside of the view geometry.
+
+ If this value is non-zero, the view will create extra delegates before the
+ start of the view, or after the end. The view will create as many delegates
+ as it can fit into the pixel size specified.
+
+ For example, if in a vertical view the delegate is 20 pixels high,
+ there are 3 columns, and
+ \c displayMarginBeginning and \c displayMarginEnd are both set to 40,
+ then 6 delegates above and 6 delegates below will be created and shown.
+
+ The default value is 0.
+
+ This property is meant for allowing certain UI configurations,
+ and not as a performance optimization. If you wish to create delegates
+ outside of the view geometry for performance reasons, you probably
+ want to use the cacheBuffer property instead.
*/
+
void QQuickGridView::setHighlightMoveDuration(int duration)
{
Q_D(QQuickGridView);
@@ -2000,8 +2028,8 @@ void QQuickGridView::viewportMoved(Qt::Orientations orient)
d->refillOrLayout();
// Set visibility of items to eliminate cost of items outside the visible area.
- qreal from = d->isContentFlowReversed() ? -d->position()-d->size() : d->position();
- qreal to = d->isContentFlowReversed() ? -d->position() : d->position()+d->size();
+ qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning;
+ qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd;
for (int i = 0; i < d->visibleItems.count(); ++i) {
FxGridItemSG *item = static_cast<FxGridItemSG*>(d->visibleItems.at(i));
QQuickItemPrivate::get(item->item)->setCulled(item->rowPos() + d->rowSize() < from || item->rowPos() > to);
@@ -2350,7 +2378,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Insert &ch
// Insert items before the visible item.
int insertionIdx = index;
int i = count - 1;
- int from = tempPos - buffer;
+ int from = tempPos - buffer - displayMarginBeginning;
while (i >= 0) {
if (rowPos > from && insertionIdx < visibleIndex) {
@@ -2387,7 +2415,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Insert &ch
}
} else {
int i = 0;
- int to = buffer+tempPos+size()-1;
+ int to = buffer+displayMarginEnd+tempPos+size()-1;
while (i < count && rowPos <= to + rowSize()*(columns - colNum)/qreal(columns+1)) {
FxViewItem *item = 0;
if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i))))
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 0708304051..62ac72d244 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -62,6 +62,13 @@ public:
{
}
+ void updateTexture(QSGTexture *texture) {
+ if (m_texture == texture)
+ return;
+ m_texture = texture;
+ emit textureChanged();
+ }
+
QSGTexture *texture() const {
if (m_texture) {
m_texture->setFiltering(m_smooth ? QSGTexture::Linear : QSGTexture::Nearest);
@@ -542,7 +549,7 @@ QSGTextureProvider *QQuickImage::textureProvider() const
QQuickImagePrivate *dd = const_cast<QQuickImagePrivate *>(d);
dd->provider = new QQuickImageTextureProvider;
dd->provider->m_smooth = d->smooth;
- dd->provider->m_texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window());
+ dd->provider->updateTexture(d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window()));
}
return d->provider;
@@ -557,7 +564,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
// Copy over the current texture state into the texture provider...
if (d->provider) {
d->provider->m_smooth = d->smooth;
- d->provider->m_texture = texture;
+ d->provider->updateTexture(texture);
}
if (!texture || width() <= 0 || height() <= 0) {
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index c308a7230a..110a8b7586 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2703,6 +2703,8 @@ QQuickItemPrivate::QQuickItemPrivate()
, culled(false)
, hasCursor(false)
, activeFocusOnTab(false)
+ , implicitAntialiasing(false)
+ , antialiasingValid(false)
, dirtyAttributes(0)
, nextDirtyItem(0)
, prevDirtyItem(0)
@@ -4474,96 +4476,6 @@ void QQuickItemPrivate::deliverInputMethodEvent(QInputMethodEvent *e)
}
#endif // QT_NO_IM
-void QQuickItemPrivate::deliverFocusEvent(QFocusEvent *e)
-{
- Q_Q(QQuickItem);
-
- if (e->type() == QEvent::FocusIn) {
- q->focusInEvent(e);
- } else {
- q->focusOutEvent(e);
- }
-}
-
-void QQuickItemPrivate::deliverMouseEvent(QMouseEvent *e)
-{
- Q_Q(QQuickItem);
-
- Q_ASSERT(e->isAccepted());
-
- switch (e->type()) {
- default:
- Q_ASSERT(!"Unknown event type");
- case QEvent::MouseMove:
- q->mouseMoveEvent(e);
- break;
- case QEvent::MouseButtonPress:
- q->mousePressEvent(e);
- break;
- case QEvent::MouseButtonRelease:
- q->mouseReleaseEvent(e);
- break;
- case QEvent::MouseButtonDblClick:
- q->mouseDoubleClickEvent(e);
- break;
- }
-}
-
-#ifndef QT_NO_WHEELEVENT
-void QQuickItemPrivate::deliverWheelEvent(QWheelEvent *e)
-{
- Q_Q(QQuickItem);
- q->wheelEvent(e);
-}
-#endif
-
-void QQuickItemPrivate::deliverTouchEvent(QTouchEvent *e)
-{
- Q_Q(QQuickItem);
- q->touchEvent(e);
-}
-
-void QQuickItemPrivate::deliverHoverEvent(QHoverEvent *e)
-{
- Q_Q(QQuickItem);
- switch (e->type()) {
- default:
- Q_ASSERT(!"Unknown event type");
- case QEvent::HoverEnter:
- q->hoverEnterEvent(e);
- break;
- case QEvent::HoverLeave:
- q->hoverLeaveEvent(e);
- break;
- case QEvent::HoverMove:
- q->hoverMoveEvent(e);
- break;
- }
-}
-
-#ifndef QT_NO_DRAGANDDROP
-void QQuickItemPrivate::deliverDragEvent(QEvent *e)
-{
- Q_Q(QQuickItem);
- switch (e->type()) {
- default:
- Q_ASSERT(!"Unknown event type");
- case QEvent::DragEnter:
- q->dragEnterEvent(static_cast<QDragEnterEvent *>(e));
- break;
- case QEvent::DragLeave:
- q->dragLeaveEvent(static_cast<QDragLeaveEvent *>(e));
- break;
- case QEvent::DragMove:
- q->dragMoveEvent(static_cast<QDragMoveEvent *>(e));
- break;
- case QEvent::Drop:
- q->dropEvent(static_cast<QDropEvent *>(e));
- break;
- }
-}
-#endif // QT_NO_DRAGANDDROP
-
/*!
Called when \a change occurs for this item.
@@ -5569,6 +5481,9 @@ void QQuickItemPrivate::itemChange(QQuickItem::ItemChange change, const QQuickIt
}
}
break;
+ case QQuickItem::ItemAntialiasingHasChanged:
+ q->itemChange(change, data);
+ break;
}
}
@@ -5662,37 +5577,65 @@ void QQuickItem::setActiveFocusOnTab(bool activeFocusOnTab)
/*!
\qmlproperty bool QtQuick::Item::antialiasing
- Primarily used in Rectangle and image based elements to decide if the item should
- use antialiasing or not. Items with antialiasing enabled require more memory and
- are potentially slower to render.
+ Used by visual elements to decide if the item should use antialiasing or not.
+ In some cases items with antialiasing require more memory and are potentially
+ slower to render (see \l {Antialiasing} for more details).
- The default is false.
+ The default is false, but may be overridden by derived elements.
*/
/*!
\property QQuickItem::antialiasing
\brief Specifies whether the item is antialiased or not
- Primarily used in Rectangle and image based elements to decide if the item should
- use antialiasing or not. Items with antialiasing enabled require more memory and
- are potentially slower to render.
+ Used by visual elements to decide if the item should use antialiasing or not.
+ In some cases items with antialiasing require more memory and are potentially
+ slower to render (see \l {Antialiasing} for more details).
- The default is false.
+ The default is false, but may be overridden by derived elements.
*/
bool QQuickItem::antialiasing() const
{
Q_D(const QQuickItem);
- return d->antialiasing;
+ return d->antialiasingValid ? d->antialiasing : d->implicitAntialiasing;
}
-void QQuickItem::setAntialiasing(bool antialiasing)
+
+void QQuickItem::setAntialiasing(bool aa)
{
Q_D(QQuickItem);
- if (d->antialiasing == antialiasing)
+
+ bool changed = (aa != antialiasing());
+ d->antialiasingValid = true;
+
+ if (!changed)
return;
- d->antialiasing = antialiasing;
+ d->antialiasing = aa;
d->dirty(QQuickItemPrivate::Antialiasing);
- emit antialiasingChanged(antialiasing);
+ d->itemChange(ItemAntialiasingHasChanged, d->antialiasing);
+
+ emit antialiasingChanged(antialiasing());
+}
+
+void QQuickItem::resetAntialiasing()
+{
+ Q_D(QQuickItem);
+ if (!d->antialiasingValid)
+ return;
+
+ d->antialiasingValid = false;
+
+ if (d->implicitAntialiasing != d->antialiasing)
+ emit antialiasingChanged(antialiasing());
+}
+
+void QQuickItemPrivate::setImplicitAntialiasing(bool antialiasing)
+{
+ Q_Q(QQuickItem);
+ bool prev = q->antialiasing();
+ implicitAntialiasing = antialiasing;
+ if (componentComplete && (q->antialiasing() != prev))
+ emit q->antialiasingChanged(q->antialiasing());
}
/*!
@@ -6535,6 +6478,17 @@ void QQuickItemPrivate::incrementCursorCount(int delta)
#endif
}
+void QQuickItemPrivate::markObjects(QV4::ExecutionEngine *e)
+{
+ Q_Q(QQuickItem);
+ QQmlData *ddata = QQmlData::get(q);
+ if (ddata)
+ ddata->jsWrapper.markOnce(e);
+
+ foreach (QQuickItem *child, childItems)
+ QQuickItemPrivate::get(child)->markObjects(e);
+}
+
#ifndef QT_NO_CURSOR
/*!
@@ -6977,18 +6931,17 @@ QRectF QQuickItem::mapRectFromScene(const QRectF &rect) const
*/
bool QQuickItem::event(QEvent *ev)
{
+ Q_D(QQuickItem);
+
+ switch (ev->type()) {
#if 0
- if (ev->type() == QEvent::PolishRequest) {
- Q_D(QQuickItem);
+ case QEvent::PolishRequest:
d->polishScheduled = false;
updatePolish();
- return true;
- } else {
- return QObject::event(ev);
- }
+ break;
#endif
#ifndef QT_NO_IM
- if (ev->type() == QEvent::InputMethodQuery) {
+ case QEvent::InputMethodQuery: {
QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(ev);
Qt::InputMethodQueries queries = query->queries();
for (uint i = 0; i < 32; ++i) {
@@ -6999,20 +6952,79 @@ bool QQuickItem::event(QEvent *ev)
}
}
query->accept();
- return true;
- } else if (ev->type() == QEvent::InputMethod) {
+ break;
+ }
+ case QEvent::InputMethod:
inputMethodEvent(static_cast<QInputMethodEvent *>(ev));
- return true;
- } else
+ break;
#endif // QT_NO_IM
- if (ev->type() == QEvent::StyleAnimationUpdate) {
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ case QEvent::TouchCancel:
+ touchEvent(static_cast<QTouchEvent*>(ev));
+ break;
+ case QEvent::StyleAnimationUpdate:
if (isVisible()) {
ev->accept();
update();
}
- return true;
+ break;
+ case QEvent::HoverEnter:
+ hoverEnterEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::HoverLeave:
+ hoverLeaveEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::HoverMove:
+ hoverMoveEvent(static_cast<QHoverEvent*>(ev));
+ break;
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ d->deliverKeyEvent(static_cast<QKeyEvent*>(ev));
+ break;
+ case QEvent::FocusIn:
+ focusInEvent(static_cast<QFocusEvent*>(ev));
+ break;
+ case QEvent::FocusOut:
+ focusOutEvent(static_cast<QFocusEvent*>(ev));
+ break;
+ case QEvent::MouseMove:
+ mouseMoveEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonPress:
+ mousePressEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonRelease:
+ mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
+ break;
+ case QEvent::MouseButtonDblClick:
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+ break;
+#ifndef QT_NO_WHEELEVENT
+ case QEvent::Wheel:
+ wheelEvent(static_cast<QWheelEvent*>(ev));
+ break;
+#endif
+#ifndef QT_NO_DRAGANDDROP
+ case QEvent::DragEnter:
+ dragEnterEvent(static_cast<QDragEnterEvent*>(ev));
+ break;
+ case QEvent::DragLeave:
+ dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
+ break;
+ case QEvent::DragMove:
+ dragMoveEvent(static_cast<QDragMoveEvent*>(ev));
+ break;
+ case QEvent::Drop:
+ dropEvent(static_cast<QDropEvent*>(ev));
+ break;
+#endif // QT_NO_DRAGANDDROP
+ default:
+ return QObject::event(ev);
}
- return QObject::event(ev);
+
+ return true;
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index 2500a2d33a..c666af2729 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -141,7 +141,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus
Q_PROPERTY(QQmlListProperty<QQuickTransform> transform READ transform DESIGNABLE false FINAL)
Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
- Q_PROPERTY(bool antialiasing READ antialiasing WRITE setAntialiasing NOTIFY antialiasingChanged)
+ Q_PROPERTY(bool antialiasing READ antialiasing WRITE setAntialiasing NOTIFY antialiasingChanged RESET resetAntialiasing)
Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged)
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
@@ -172,7 +172,8 @@ public:
ItemParentHasChanged, // value.item
ItemOpacityHasChanged, // value.realValue
ItemActiveFocusHasChanged, // value.boolValue
- ItemRotationHasChanged // value.realValue
+ ItemRotationHasChanged, // value.realValue
+ ItemAntialiasingHasChanged // value.boolValue
};
union ItemChangeData {
@@ -267,6 +268,7 @@ public:
bool antialiasing() const;
void setAntialiasing(bool);
+ void resetAntialiasing();
Flags flags() const;
void setFlag(Flag flag, bool enabled = true);
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 44eabcf0d5..96cb9e8843 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -422,6 +422,8 @@ public:
bool hasCursor:1;
// Bit 32
bool activeFocusOnTab:1;
+ bool implicitAntialiasing:1;
+ bool antialiasingValid:1;
enum DirtyType {
TransformOrigin = 0x00000001,
@@ -521,6 +523,8 @@ public:
virtual void implicitWidthChanged();
virtual void implicitHeightChanged();
+ void setImplicitAntialiasing(bool antialiasing);
+
void resolveLayoutMirror();
void setImplicitLayoutMirror(bool mirror, bool inherit);
void setLayoutMirror(bool mirror);
@@ -540,16 +544,6 @@ public:
#ifndef QT_NO_IM
void deliverInputMethodEvent(QInputMethodEvent *);
#endif
- void deliverFocusEvent(QFocusEvent *);
- void deliverMouseEvent(QMouseEvent *);
-#ifndef QT_NO_WHEELEVENT
- void deliverWheelEvent(QWheelEvent *);
-#endif
- void deliverTouchEvent(QTouchEvent *);
- void deliverHoverEvent(QHoverEvent *);
-#ifndef QT_NO_DRAGANDDROP
- void deliverDragEvent(QEvent *);
-#endif
bool calcEffectiveVisible() const;
bool setEffectiveVisibleRecur(bool);
@@ -589,6 +583,9 @@ public:
virtual void mirrorChange() {}
void incrementCursorCount(int delta);
+
+ // recursive helper to let a visual parent mark its visual children
+ void markObjects(QV4::ExecutionEngine *e);
};
/*
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index a5b78b28e1..96746223ce 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -184,6 +184,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickTranslate>(uri,major,minor,"Translate");
qmlRegisterType<QQuickRotation>(uri,major,minor,"Rotation");
qmlRegisterType<QQuickScale>(uri,major,minor,"Scale");
+ qmlRegisterType<QQuickMatrix4x4>(uri,2,4,"Matrix4x4");
qmlRegisterType<QQuickText>(uri,major,minor,"Text");
qmlRegisterType<QQuickTextEdit>(uri,major,minor,"TextEdit");
qmlRegisterType<QQuickTextEdit,1>(uri,2,1,"TextEdit");
@@ -261,6 +262,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickItem, 1>(uri, 2, 1,"Item");
qmlRegisterType<QQuickGrid, 1>(uri, 2, 1, "Grid");
qmlRegisterUncreatableType<QQuickItemView, 1>(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
+ qmlRegisterUncreatableType<QQuickItemView, 2>(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class"));
qmlRegisterType<QQuickListView, 1>(uri, 2, 1, "ListView");
qmlRegisterType<QQuickGridView, 1>(uri, 2, 1, "GridView");
qmlRegisterType<QQuickTextEdit, 1>(uri, 2, 1, "TextEdit");
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index d7b984788e..f5c0e3b8d2 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -459,6 +459,41 @@ void QQuickItemView::setCacheBuffer(int b)
}
}
+int QQuickItemView::displayMarginBeginning() const
+{
+ Q_D(const QQuickItemView);
+ return d->displayMarginBeginning;
+}
+
+void QQuickItemView::setDisplayMarginBeginning(int margin)
+{
+ Q_D(QQuickItemView);
+ if (d->displayMarginBeginning != margin) {
+ d->displayMarginBeginning = margin;
+ if (isComponentComplete()) {
+ d->refillOrLayout();
+ }
+ emit displayMarginBeginningChanged();
+ }
+}
+
+int QQuickItemView::displayMarginEnd() const
+{
+ Q_D(const QQuickItemView);
+ return d->displayMarginEnd;
+}
+
+void QQuickItemView::setDisplayMarginEnd(int margin)
+{
+ Q_D(QQuickItemView);
+ if (d->displayMarginEnd != margin) {
+ d->displayMarginEnd = margin;
+ if (isComponentComplete()) {
+ d->refillOrLayout();
+ }
+ emit displayMarginEndChanged();
+ }
+}
Qt::LayoutDirection QQuickItemView::layoutDirection() const
{
@@ -1443,6 +1478,7 @@ void QQuickItemView::componentComplete()
QQuickItemViewPrivate::QQuickItemViewPrivate()
: itemCount(0)
, buffer(QML_VIEW_DEFAULTCACHEBUFFER), bufferMode(BufferBefore | BufferAfter)
+ , displayMarginBeginning(0), displayMarginEnd(0)
, layoutDirection(Qt::LeftToRight), verticalLayoutDirection(QQuickItemView::TopToBottom)
, moveReason(Other)
, visibleIndex(0)
@@ -1682,9 +1718,9 @@ void QQuickItemViewPrivate::refill()
{
qreal s = qMax(size(), qreal(0.));
if (isContentFlowReversed())
- refill(-position()-s, -position());
+ refill(-position()-displayMarginBeginning-s, -position()+displayMarginEnd);
else
- refill(position(), position()+s);
+ refill(position()-displayMarginBeginning, position()+displayMarginEnd+s);
}
void QQuickItemViewPrivate::refill(qreal from, qreal to)
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index 17d150f480..ad026a3152 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -63,6 +63,8 @@ class Q_AUTOTEST_EXPORT QQuickItemView : public QQuickFlickable
Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged)
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
+ Q_PROPERTY(int displayMarginBeginning READ displayMarginBeginning WRITE setDisplayMarginBeginning NOTIFY displayMarginBeginningChanged REVISION 2)
+ Q_PROPERTY(int displayMarginEnd READ displayMarginEnd WRITE setDisplayMarginEnd NOTIFY displayMarginEndChanged REVISION 2)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged)
@@ -133,6 +135,12 @@ public:
int cacheBuffer() const;
void setCacheBuffer(int);
+ int displayMarginBeginning() const;
+ void setDisplayMarginBeginning(int);
+
+ int displayMarginEnd() const;
+ void setDisplayMarginEnd(int);
+
Qt::LayoutDirection layoutDirection() const;
void setLayoutDirection(Qt::LayoutDirection);
Qt::LayoutDirection effectiveLayoutDirection() const;
@@ -218,6 +226,8 @@ Q_SIGNALS:
void keyNavigationWrapsChanged();
void cacheBufferChanged();
+ void displayMarginBeginningChanged();
+ void displayMarginEndChanged();
void layoutDirectionChanged();
void effectiveLayoutDirectionChanged();
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index e0f08fd50f..af7c23c02e 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -257,6 +257,8 @@ public:
int itemCount;
int buffer;
int bufferMode;
+ int displayMarginBeginning;
+ int displayMarginEnd;
Qt::LayoutDirection layoutDirection;
QQuickItemView::VerticalLayoutDirection verticalLayoutDirection;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 9f2f90a2a7..2dd61e386f 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -777,8 +777,8 @@ void QQuickListViewPrivate::visibleItemsChanged()
void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex)
{
if (!visibleItems.isEmpty()) {
- const qreal from = isContentFlowReversed() ? -position() - size() : position();
- const qreal to = isContentFlowReversed() ? -position() : position() + size();
+ const qreal from = isContentFlowReversed() ? -position()-displayMarginBeginning-size() : position()-displayMarginBeginning;
+ const qreal to = isContentFlowReversed() ? -position()+displayMarginEnd : position()+size()+displayMarginEnd;
FxViewItem *firstItem = *visibleItems.constBegin();
bool fixedCurrent = currentItem && firstItem->item == currentItem->item;
@@ -892,12 +892,12 @@ void QQuickListViewPrivate::createHighlight()
highlightWidthAnimator = new QSmoothedAnimation;
highlightWidthAnimator->velocity = highlightResizeVelocity;
highlightWidthAnimator->userDuration = highlightResizeDuration;
- highlightWidthAnimator->target = QQmlProperty(item, "width");
+ highlightWidthAnimator->target = QQmlProperty(item, QStringLiteral("width"));
highlightHeightAnimator = new QSmoothedAnimation;
highlightHeightAnimator->velocity = highlightResizeVelocity;
highlightHeightAnimator->userDuration = highlightResizeDuration;
- highlightHeightAnimator->target = QQmlProperty(item, "height");
+ highlightHeightAnimator->target = QQmlProperty(item, QStringLiteral("height"));
highlight = newHighlight;
changed = true;
@@ -2145,8 +2145,33 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation)
of additional memory usage. It is not a substitute for creating efficient
delegates; the fewer objects and bindings in a delegate, the faster a view can be
scrolled.
+
+ The cacheBuffer operates outside of any display margins specified by
+ displayMarginBeginning or displayMarginEnd.
*/
+/*!
+ \qmlproperty int QtQuick::ListView::displayMarginBeginning
+ \qmlproperty int QtQuick::ListView::displayMarginEnd
+ \since QtQuick 2.3
+
+ This property allows delegates to be displayed outside of the view geometry.
+
+ If this value is non-zero, the view will create extra delegates before the
+ start of the view, or after the end. The view will create as many delegates
+ as it can fit into the pixel size specified.
+
+ For example, if in a vertical view the delegate is 20 pixels high and
+ \c displayMarginBeginning and \c displayMarginEnd are both set to 40,
+ then 2 delegates above and 2 delegates below will be created and shown.
+
+ The default value is 0.
+
+ This property is meant for allowing certain UI configurations,
+ and not as a performance optimization. If you wish to create delegates
+ outside of the view geometry for performance reasons, you probably
+ want to use the cacheBuffer property instead.
+*/
/*!
\qmlpropertygroup QtQuick::ListView::section
@@ -2703,8 +2728,8 @@ void QQuickListView::viewportMoved(Qt::Orientations orient)
d->refillOrLayout();
// Set visibility of items to eliminate cost of items outside the visible area.
- qreal from = d->isContentFlowReversed() ? -d->position()-d->size() : d->position();
- qreal to = d->isContentFlowReversed() ? -d->position() : d->position()+d->size();
+ qreal from = d->isContentFlowReversed() ? -d->position()-d->displayMarginBeginning-d->size() : d->position()-d->displayMarginBeginning;
+ qreal to = d->isContentFlowReversed() ? -d->position()+d->displayMarginEnd : d->position()+d->size()+d->displayMarginEnd;
for (int i = 0; i < d->visibleItems.count(); ++i) {
FxViewItem *item = static_cast<FxListItemSG*>(d->visibleItems.at(i));
QQuickItemPrivate::get(item->item)->setCulled(item->endPosition() < from || item->position() > to);
@@ -2910,7 +2935,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Insert &ch
// there are no visible items except items marked for removal
index = visibleItems.count();
} else if (visibleItems.at(i)->index + 1 == modelIndex
- && visibleItems.at(i)->endPosition() <= buffer+tempPos+size()) {
+ && visibleItems.at(i)->endPosition() <= buffer+displayMarginEnd+tempPos+size()) {
// Special case of appending an item to the model.
index = visibleItems.count();
} else {
@@ -2939,7 +2964,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Insert &ch
// Insert items before the visible item.
int insertionIdx = index;
int i = 0;
- int from = tempPos - buffer;
+ int from = tempPos - displayMarginBeginning - buffer;
for (i = count-1; i >= 0; --i) {
if (pos > from && insertionIdx < visibleIndex) {
@@ -2970,7 +2995,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Insert &ch
}
} else {
int i = 0;
- int to = buffer+tempPos+size();
+ int to = buffer+displayMarginEnd+tempPos+size();
for (i = 0; i < count && pos <= to; ++i) {
FxViewItem *item = 0;
if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i))))
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 7a4b359d91..f07571d3cc 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -49,6 +49,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qevent.h>
+#include <QtGui/qstylehints.h>
#include <float.h>
@@ -56,8 +57,6 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
-static const int PressAndHoldDelay = 800;
-
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
: enabled(true), hovered(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
@@ -627,7 +626,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
#endif
setHovered(true);
d->startScene = event->windowPos();
- d->pressAndHoldTimer.start(PressAndHoldDelay, this);
+ d->pressAndHoldTimer.start(qApp->styleHints()->mousePressAndHoldInterval(), this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(event->button(), true));
}
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 8fe306b006..6b273dcd43 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -43,6 +43,7 @@
#include <QtQuick/qquickwindow.h>
#include <private/qsgadaptationlayer_p.h>
#include <private/qquickitem_p.h>
+#include <private/qguiapplication_p.h>
#include <QEvent>
#include <QMouseEvent>
#include <math.h>
@@ -675,6 +676,10 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event)
QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(),
event->button(), event->buttons(), event->modifiers());
mouseEvent.setAccepted(false);
+ QGuiApplicationPrivate::setMouseEventCapsAndVelocity(&mouseEvent,
+ QGuiApplicationPrivate::mouseEventCaps(event),
+ QGuiApplicationPrivate::mouseEventVelocity(event));
+ QGuiApplicationPrivate::setMouseEventSource(&mouseEvent, Qt::MouseEventSynthesizedByQt);
switch (mouseEvent.type()) {
case QEvent::MouseMove:
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 48f79a2192..ee1b66f2b5 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -321,6 +321,16 @@ void QQuickRectangle::doUpdate()
}
/*!
+ \qmlproperty bool QtQuick::Rectangle::antialiasing
+
+ Used to decide if the Rectangle should use antialiasing or not.
+ \l {Antialiasing} provides information on the performance implications
+ of this property.
+
+ The default is true for Rectangles with a radius, and false otherwise.
+*/
+
+/*!
\qmlpropertygroup QtQuick::Rectangle::border
\qmlproperty int QtQuick::Rectangle::border.width
\qmlproperty color QtQuick::Rectangle::border.color
@@ -409,6 +419,8 @@ void QQuickRectangle::setRadius(qreal radius)
return;
d->radius = radius;
+ d->setImplicitAntialiasing(radius != 0.0);
+
update();
emit radiusChanged();
}
@@ -476,7 +488,7 @@ QSGNode *QQuickRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
}
rectangle->setRadius(d->radius);
- rectangle->setAntialiasing(d->antialiasing || d->radius > 0);
+ rectangle->setAntialiasing(antialiasing());
QGradientStops stops;
if (d->gradient) {
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index ad904a2579..beb2039924 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -88,6 +88,7 @@ QQuickTextPrivate::QQuickTextPrivate()
, truncated(false), hAlignImplicit(true), rightToLeftText(false)
, layoutTextElided(false), textHasChanged(true), needToUpdateLayout(false), formatModifiesFontSize(false)
{
+ implicitAntialiasing = true;
}
QQuickTextPrivate::ExtraData::ExtraData()
@@ -114,6 +115,7 @@ QQuickTextDocumentWithImageResources::QQuickTextDocumentWithImageResources(QQuic
{
setUndoRedoEnabled(false);
documentLayout()->registerHandler(QTextFormat::ImageObject, this);
+ connect(this, SIGNAL(baseUrlChanged(QUrl)), this, SLOT(reset()));
}
QQuickTextDocumentWithImageResources::~QQuickTextDocumentWithImageResources()
@@ -125,14 +127,13 @@ QQuickTextDocumentWithImageResources::~QQuickTextDocumentWithImageResources()
QVariant QQuickTextDocumentWithImageResources::loadResource(int type, const QUrl &name)
{
QQmlContext *context = qmlContext(parent());
- QUrl url = m_baseUrl.resolved(name);
if (type == QTextDocument::ImageResource) {
- QQuickPixmap *p = loadPixmap(context, url);
+ QQuickPixmap *p = loadPixmap(context, name);
return p->image();
}
- return QTextDocument::loadResource(type,url); // The *resolved* URL
+ return QTextDocument::loadResource(type, name);
}
void QQuickTextDocumentWithImageResources::requestFinished()
@@ -144,14 +145,6 @@ void QQuickTextDocumentWithImageResources::requestFinished()
}
}
-void QQuickTextDocumentWithImageResources::clear()
-{
- clearResources();
-
- QTextDocument::clear();
-}
-
-
QSizeF QQuickTextDocumentWithImageResources::intrinsicSize(
QTextDocument *, int, const QTextFormat &format)
{
@@ -166,7 +159,7 @@ QSizeF QQuickTextDocumentWithImageResources::intrinsicSize(
QSizeF size(width, height);
if (!hasWidth || !hasHeight) {
QQmlContext *context = qmlContext(parent());
- QUrl url = m_baseUrl.resolved(QUrl(imageFormat.name()));
+ QUrl url = baseUrl().resolved(QUrl(imageFormat.name()));
QQuickPixmap *p = loadPixmap(context, url);
if (!p->isReady()) {
@@ -204,19 +197,16 @@ void QQuickTextDocumentWithImageResources::drawObject(
QImage QQuickTextDocumentWithImageResources::image(const QTextImageFormat &format)
{
QQmlContext *context = qmlContext(parent());
- QUrl url = m_baseUrl.resolved(QUrl(format.name()));
+ QUrl url = baseUrl().resolved(QUrl(format.name()));
QQuickPixmap *p = loadPixmap(context, url);
return p->image();
}
-void QQuickTextDocumentWithImageResources::setBaseUrl(const QUrl &url, bool clear)
+void QQuickTextDocumentWithImageResources::reset()
{
- m_baseUrl = url;
- if (clear) {
- clearResources();
- markContentsDirty(0, characterCount());
- }
+ clearResources();
+ markContentsDirty(0, characterCount());
}
QQuickPixmap *QQuickTextDocumentWithImageResources::loadPixmap(
@@ -297,6 +287,15 @@ qreal QQuickTextPrivate::getImplicitHeight() const
return implicitHeight;
}
+/*!
+ \qmlproperty bool QtQuick::Text::antialiasing
+
+ Used to decide if the Text should use antialiasing or not. Only Text
+ with renderType of Text.NativeRendering can disable antialiasing.
+
+ The default is true.
+*/
+
void QQuickText::q_imagesLoaded()
{
Q_D(QQuickText);
@@ -620,8 +619,9 @@ void QQuickTextPrivate::setupCustomLineGeometry(QTextLine &line, qreal &height,
textLine->setHeight(0);
textLine->setLineOffset(lineOffset);
- // use the text item's width by default if it has one and wrap is on
- if (q->widthValid() && q->wrapMode() != QQuickText::NoWrap)
+ // use the text item's width by default if it has one and wrap is on or text must be aligned
+ if (q->widthValid() && (q->wrapMode() != QQuickText::NoWrap ||
+ q->effectiveHAlign() != QQuickText::AlignLeft))
textLine->setWidth(q->width());
else
textLine->setWidth(INT_MAX);
@@ -959,7 +959,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// If the horizontal alignment is not left and the width was not valid we need to relayout
// now that we know the maximum line width.
- if (!implicitWidthValid && lineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
+ if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
widthExceeded = false;
heightExceeded = false;
continue;
@@ -1415,6 +1415,9 @@ void QQuickText::setFont(const QFont &font)
QFont oldFont = d->font;
d->font = font;
+ if (!antialiasing())
+ d->font.setStyleStrategy(QFont::NoAntialias);
+
if (d->font.pointSizeF() != -1) {
// 0.5pt resolution
qreal size = qRound(d->font.pointSizeF()*2.0);
@@ -1434,6 +1437,21 @@ void QQuickText::setFont(const QFont &font)
emit fontChanged(d->sourceFont);
}
+void QQuickText::itemChange(ItemChange change, const ItemChangeData &value)
+{
+ Q_D(QQuickText);
+ Q_UNUSED(value);
+ if (change == ItemAntialiasingHasChanged) {
+ if (!antialiasing())
+ d->font.setStyleStrategy(QFont::NoAntialias);
+ else
+ d->font.setStyleStrategy(QFont::PreferAntialias);
+ d->implicitWidthValid = false;
+ d->implicitHeightValid = false;
+ d->updateLayout();
+ }
+}
+
/*!
\qmlproperty string QtQuick::Text::text
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 489ef58344..d55dc7e287 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -241,6 +241,7 @@ Q_SIGNALS:
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
+ virtual void itemChange(ItemChange change, const ItemChangeData &value);
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h
index 1f6cd3eab5..12113f416c 100644
--- a/src/quick/items/qquicktext_p_p.h
+++ b/src/quick/items/qquicktext_p_p.h
@@ -195,16 +195,13 @@ public:
void setText(const QString &);
int resourcesLoading() const { return outstanding; }
- void clearResources();
-
- void clear();
-
QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
QImage image(const QTextImageFormat &format);
- void setBaseUrl(const QUrl &url, bool clear = true);
+public Q_SLOTS:
+ void clearResources();
Q_SIGNALS:
void imagesLoaded();
@@ -215,11 +212,11 @@ protected:
QQuickPixmap *loadPixmap(QQmlContext *context, const QUrl &name);
private Q_SLOTS:
+ void reset();
void requestFinished();
private:
QHash<QUrl, QQuickPixmap *> m_resources;
- QUrl m_baseUrl;
int outstanding;
static QSet<QUrl> errors;
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index ffc732621d..c342c79ce5 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -830,7 +830,7 @@ void QQuickTextEdit::setBaseUrl(const QUrl &url)
if (baseUrl() != url) {
d->baseUrl = url;
- d->document->setBaseUrl(url, d->richText);
+ d->document->setBaseUrl(url);
emit baseUrlChanged();
}
}
@@ -1281,7 +1281,7 @@ void QQuickTextEdit::componentComplete()
Q_D(QQuickTextEdit);
QQuickImplicitSizeItem::componentComplete();
- d->document->setBaseUrl(baseUrl(), d->richText);
+ d->document->setBaseUrl(baseUrl());
#ifndef QT_NO_TEXTHTML_PARSER
if (d->richText)
d->control->setHtml(d->text);
diff --git a/src/quick/items/qquicktranslate.cpp b/src/quick/items/qquicktranslate.cpp
index f1b716cf5b..5c61fb33f8 100644
--- a/src/quick/items/qquicktranslate.cpp
+++ b/src/quick/items/qquicktranslate.cpp
@@ -458,4 +458,79 @@ void QQuickRotation::applyTo(QMatrix4x4 *matrix) const
matrix->translate(-d->origin);
}
+class QQuickMatrix4x4Private : public QQuickTransformPrivate
+{
+public:
+ QQuickMatrix4x4Private()
+ : matrix() {}
+ QMatrix4x4 matrix;
+};
+
+/*!
+ \qmltype Matrix4x4
+ \instantiates QQuickMatrix4x4
+ \inqmlmodule QtQuick
+ \ingroup qtquick-visual-transforms
+ \brief Provides a way to apply a 4x4 tranformation matrix to an \l Item
+
+ The Matrix4x4 type provides a way to apply a transformation to an
+ \l Item through a 4x4 matrix.
+
+ It allows for a combination of rotation, scale, translatation and shearing
+ by using just one tranformation provided in a 4x4-matrix.
+
+ The following example rotates a Rectangle 45 degress (PI/4):
+
+ \qml
+ Rectangle {
+ width: 100
+ height: 100
+ color: "red"
+
+ transform: Matrix4x4 {
+ property real a: Math.PI / 4
+ matrix: Qt.matrix4x4(Math.cos(a), -Math.sin(a), 0, 0,
+ Math.sin(a), Math.cos(a), 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1)
+ }
+ }
+ \endqml
+*/
+QQuickMatrix4x4::QQuickMatrix4x4(QObject *parent)
+ : QQuickTransform(*new QQuickMatrix4x4Private, parent)
+{
+}
+
+QQuickMatrix4x4::~QQuickMatrix4x4()
+{
+}
+
+/*!
+ \qmlproperty QMatrix4x4 QtQuick::Matrix4x4::matrix
+
+ 4x4-matrix which will be used in the tranformation of an \l Item
+*/
+QMatrix4x4 QQuickMatrix4x4::matrix() const
+{
+ Q_D(const QQuickMatrix4x4);
+ return d->matrix;
+}
+
+void QQuickMatrix4x4::setMatrix(const QMatrix4x4 &matrix)
+{
+ Q_D(QQuickMatrix4x4);
+ if (d->matrix == matrix)
+ return;
+ d->matrix = matrix;
+ update();
+ emit matrixChanged();
+}
+
+void QQuickMatrix4x4::applyTo(QMatrix4x4 *matrix) const
+{
+ Q_D(const QQuickMatrix4x4);
+ *matrix *= d->matrix;
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h
index d7843fe103..dd93275a28 100644
--- a/src/quick/items/qquicktranslate_p.h
+++ b/src/quick/items/qquicktranslate_p.h
@@ -148,6 +148,29 @@ private:
Q_DECLARE_PRIVATE(QQuickRotation)
};
+class QQuickMatrix4x4Private;
+class Q_AUTOTEST_EXPORT QQuickMatrix4x4 : public QQuickTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged)
+public:
+ QQuickMatrix4x4(QObject *parent = 0);
+ ~QQuickMatrix4x4();
+
+ QMatrix4x4 matrix() const;
+ void setMatrix(const QMatrix4x4& matrix);
+
+ void applyTo(QMatrix4x4 *matrix) const;
+
+Q_SIGNALS:
+ void matrixChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QQuickMatrix4x4)
+};
+
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickTranslate)
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index d1fe489dcb..61f0f9bec2 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -56,6 +56,26 @@
QT_BEGIN_NAMESPACE
+DEFINE_MANAGED_VTABLE(QQuickRootItemMarker);
+
+QQuickRootItemMarker::QQuickRootItemMarker(QQuickViewPrivate *view)
+ : QV4::Object(QQmlEnginePrivate::getV4Engine(view->engine.data()))
+ , view(view)
+{
+ setVTable(&static_vtbl);
+}
+
+void QQuickRootItemMarker::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e)
+{
+ QQuickItem *root = static_cast<QQuickRootItemMarker*>(that)->view->root;
+ if (root) {
+ QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root);
+ rootPrivate->markObjects(e);
+ }
+
+ QV4::Object::markObjects(that, e);
+}
+
void QQuickViewPrivate::init(QQmlEngine* e)
{
Q_Q(QQuickView);
@@ -68,6 +88,13 @@ void QQuickViewPrivate::init(QQmlEngine* e)
if (!engine.data()->incubationController())
engine.data()->setIncubationController(q->incubationController());
+ {
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine.data());
+ QV4::Scope scope(v4);
+ QV4::Scoped<QQuickRootItemMarker> v(scope, new (v4->memoryManager) QQuickRootItemMarker(this));
+ rootItemMarker = v;
+ }
+
if (QQmlDebugService::isDebuggingEnabled())
QQmlInspectorService::instance()->addView(q);
}
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h
index 170c93a6cf..e18b45dfbe 100644
--- a/src/quick/items/qquickview_p.h
+++ b/src/quick/items/qquickview_p.h
@@ -51,12 +51,17 @@
#include <QtCore/QWeakPointer>
#include <QtQml/qqmlengine.h>
+#include <private/qv4object_p.h>
#include "qquickwindow_p.h"
#include "qquickitemchangelistener_p.h"
QT_BEGIN_NAMESPACE
+namespace QV4 {
+struct ExecutionEngine;
+}
+
class QQmlContext;
class QQmlError;
class QQuickItem;
@@ -94,6 +99,23 @@ public:
QQuickView::ResizeMode resizeMode;
QSize initialSize;
QElapsedTimer frameTimer;
+ QV4::PersistentValue rootItemMarker;
+};
+
+struct QQuickRootItemMarker : public QV4::Object
+{
+ Q_MANAGED
+
+ QQuickRootItemMarker(QQuickViewPrivate *view);
+
+ static void destroy(Managed *that)
+ {
+ static_cast<QQuickRootItemMarker*>(that)->~QQuickRootItemMarker();
+ }
+
+ static void markObjects(Managed *that, QV4::ExecutionEngine *e);
+
+ QQuickViewPrivate *view;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index d286ccff0c..c3f5169804 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -257,8 +257,10 @@ void QQuickWindowPrivate::polishItems()
for (QSet<QQuickItem *>::iterator it = itms.begin(); it != itms.end(); ++it) {
QQuickItem *item = *it;
- QQuickItemPrivate::get(item)->polishScheduled = false;
- item->updatePolish();
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ itemPrivate->polishScheduled = false;
+ if (item->isVisible() || (itemPrivate->extra.isAllocated() && itemPrivate->extra->effectRefCount>0))
+ item->updatePolish();
}
}
@@ -470,6 +472,7 @@ static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::Touc
transformedVelocity = transformMatrix.mapVector(p.velocity()).toVector2D();
}
QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, event->device()->capabilities(), transformedVelocity);
+ QGuiApplicationPrivate::setMouseEventSource(me, Qt::MouseEventSynthesizedByQt);
return me;
}
@@ -523,7 +526,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
item->grabMouse();
item->grabTouchPoints(QVector<int>() << touchMouseId);
- QQuickItemPrivate::get(item)->deliverMouseEvent(mousePress.data());
+ QCoreApplication::sendEvent(item, mousePress.data());
event->setAccepted(mousePress->isAccepted());
if (!mousePress->isAccepted()) {
touchMouseId = -1;
@@ -536,7 +539,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
if (mousePress->isAccepted() && checkIfDoubleClicked(event->timestamp())) {
QScopedPointer<QMouseEvent> mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event, item));
- QQuickItemPrivate::get(item)->deliverMouseEvent(mouseDoubleClick.data());
+ QCoreApplication::sendEvent(item, mouseDoubleClick.data());
event->setAccepted(mouseDoubleClick->isAccepted());
if (mouseDoubleClick->isAccepted()) {
return true;
@@ -557,7 +560,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
if (p.state() & Qt::TouchPointMoved) {
if (mouseGrabberItem) {
QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseMove, p, event, mouseGrabberItem));
- QQuickItemPrivate::get(item)->deliverMouseEvent(me.data());
+ QCoreApplication::sendEvent(item, me.data());
event->setAccepted(me->isAccepted());
if (me->isAccepted()) {
itemForTouchPointId[p.id()] = mouseGrabberItem; // N.B. the mouseGrabberItem may be different after returning from sendEvent()
@@ -587,7 +590,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
touchMouseId = -1;
if (mouseGrabberItem) {
QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem));
- QQuickItemPrivate::get(item)->deliverMouseEvent(me.data());
+ QCoreApplication::sendEvent(item, me.data());
if (mouseGrabberItem) // might have ungrabbed due to event
mouseGrabberItem->ungrabMouse();
return me->isAccepted();
@@ -1325,6 +1328,7 @@ QMouseEvent *QQuickWindowPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *t
event->windowPos(), event->screenPos(),
event->button(), event->buttons(), event->modifiers());
QGuiApplicationPrivate::setMouseEventCapsAndVelocity(me, caps, velocity);
+ QGuiApplicationPrivate::setMouseEventSource(me, QGuiApplicationPrivate::mouseEventSource(event));
me->setTimestamp(event->timestamp());
return me;
}
@@ -1401,6 +1405,12 @@ bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event)
void QQuickWindow::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickWindow);
+
+ if (event->source() == Qt::MouseEventSynthesizedBySystem) {
+ event->accept();
+ return;
+ }
+
#ifdef MOUSE_DEBUG
qWarning() << "QQuickWindow::mousePressEvent()" << event->localPos() << event->button() << event->buttons();
#endif
@@ -1412,6 +1422,12 @@ void QQuickWindow::mousePressEvent(QMouseEvent *event)
void QQuickWindow::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickWindow);
+
+ if (event->source() == Qt::MouseEventSynthesizedBySystem) {
+ event->accept();
+ return;
+ }
+
#ifdef MOUSE_DEBUG
qWarning() << "QQuickWindow::mouseReleaseEvent()" << event->localPos() << event->button() << event->buttons();
#endif
@@ -1430,6 +1446,12 @@ void QQuickWindow::mouseReleaseEvent(QMouseEvent *event)
void QQuickWindow::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_D(QQuickWindow);
+
+ if (event->source() == Qt::MouseEventSynthesizedBySystem) {
+ event->accept();
+ return;
+ }
+
#ifdef MOUSE_DEBUG
qWarning() << "QQuickWindow::mouseDoubleClickEvent()" << event->localPos() << event->button() << event->buttons();
#endif
@@ -1465,6 +1487,12 @@ bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
void QQuickWindow::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickWindow);
+
+ if (event->source() == Qt::MouseEventSynthesizedBySystem) {
+ event->accept();
+ return;
+ }
+
#ifdef MOUSE_DEBUG
qWarning() << "QQuickWindow::mouseMoveEvent()" << event->localPos() << event->button() << event->buttons();
#endif
@@ -1813,11 +1841,11 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
itemForTouchPointId[id] = item;
// Deliver the touch event to the given item
- QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
- itemPrivate->deliverTouchEvent(touchEvent.data());
+ QCoreApplication::sendEvent(item, touchEvent.data());
touchEventAccepted = touchEvent->isAccepted();
// If the touch event wasn't accepted, synthesize a mouse event and see if the item wants it.
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (!touchEventAccepted && (itemPrivate->acceptedMouseButtons() & Qt::LeftButton)) {
// send mouse event
event->setAccepted(translateTouchToMouse(item, event));
@@ -2235,16 +2263,12 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
case QEvent::KeyPress:
case QEvent::KeyRelease:
e->accept();
- QQuickItemPrivate::get(item)->deliverKeyEvent(static_cast<QKeyEvent *>(e));
+ QCoreApplication::sendEvent(item, e);
while (!e->isAccepted() && (item = item->parentItem())) {
e->accept();
- QQuickItemPrivate::get(item)->deliverKeyEvent(static_cast<QKeyEvent *>(e));
+ QCoreApplication::sendEvent(item, e);
}
break;
- case QEvent::FocusIn:
- case QEvent::FocusOut:
- QQuickItemPrivate::get(item)->deliverFocusEvent(static_cast<QFocusEvent *>(e));
- break;
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
@@ -2253,7 +2277,7 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
if (!d->sendFilteredMouseEvent(item->parentItem(), item, e)) {
// accept because qml items by default accept and have to explicitly opt out of accepting
e->accept();
- QQuickItemPrivate::get(item)->deliverMouseEvent(static_cast<QMouseEvent *>(e));
+ QCoreApplication::sendEvent(item, e);
}
break;
case QEvent::UngrabMouse:
@@ -2264,30 +2288,26 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- QQuickItemPrivate::get(item)->deliverWheelEvent(static_cast<QWheelEvent *>(e));
- break;
#endif
+#ifndef QT_NO_DRAGANDDROP
+ case QEvent::DragEnter:
+ case QEvent::DragMove:
+ case QEvent::DragLeave:
+ case QEvent::Drop:
+#endif
+ case QEvent::FocusIn:
+ case QEvent::FocusOut:
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- QQuickItemPrivate::get(item)->deliverHoverEvent(static_cast<QHoverEvent *>(e));
+ case QEvent::TouchCancel:
+ QCoreApplication::sendEvent(item, e);
break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
d->sendFilteredTouchEvent(item->parentItem(), item, static_cast<QTouchEvent *>(e));
break;
- case QEvent::TouchCancel:
- QQuickItemPrivate::get(item)->deliverTouchEvent(static_cast<QTouchEvent *>(e));
- break;
-#ifndef QT_NO_DRAGANDDROP
- case QEvent::DragEnter:
- case QEvent::DragMove:
- case QEvent::DragLeave:
- case QEvent::Drop:
- QQuickItemPrivate::get(item)->deliverDragEvent(e);
- break;
-#endif
default:
break;
}
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index 460e2ca554..407b80915d 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -185,7 +185,8 @@ void QQuickBehavior::write(const QVariant &value)
return;
}
- if (d->animation->isRunning() && value == d->targetValue)
+ bool behaviorActive = d->animation->isRunning();
+ if (behaviorActive && value == d->targetValue)
return;
d->targetValue = value;
@@ -201,6 +202,14 @@ void QQuickBehavior::write(const QVariant &value)
// to the item, so we need to read the value after.
const QVariant &currentValue = d->property.read();
+ // Don't unnecessarily wake up the animation system if no real animation
+ // is needed (value has not changed). If the Behavior was already
+ // running, let it continue as normal to ensure correct behavior and state.
+ if (!behaviorActive && d->targetValue == currentValue) {
+ QQmlPropertyPrivate::write(d->property, value, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
+ return;
+ }
+
QQuickStateOperation::ActionList actions;
QQuickStateAction action;
action.property = d->property;
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index 152d1f34c9..5ae74c2fec 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -398,7 +398,7 @@ public:
if (!array)
return QMatrix4x4();
- if (array->arrayLength() != 16)
+ if (array->getLength() != 16)
return QMatrix4x4();
float matVals[16];
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index bca40e9acd..4a8025c254 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -124,7 +124,7 @@ void tst_QQmlDebugClient::state()
QTRY_COMPARE(client.state(), QQmlDebugClient::Unavailable);
// duplicate plugin name
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugClient: Conflicting plugin name \"tst_QQmlDebugClient::state()\"");
QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn);
QCOMPARE(client2.state(), QQmlDebugClient::NotConnected);
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 1c1d84f37b..c50bb10035 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -164,7 +164,7 @@ void tst_QQmlDebugService::state()
QTRY_COMPARE(service.state(), QQmlDebugService::Unavailable);
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::state()\"");
QQmlDebugTestService duplicate("tst_QQmlDebugService::state()");
QCOMPARE(duplicate.state(), QQmlDebugService::NotConnected);
}
@@ -183,7 +183,7 @@ void tst_QQmlDebugService::sendMessage()
QByteArray resp = client.waitForResponse();
QCOMPARE(resp, msg);
- QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\" ");
+ QTest::ignoreMessage(QtWarningMsg, "QQmlDebugService: Conflicting plugin name \"tst_QQmlDebugService::sendMessage()\"");
QQmlDebugTestService duplicate("tst_QQmlDebugService::sendMessage()");
duplicate.sendMessage("msg");
}
diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
index 7e85312692..cd68fb9b82 100644
--- a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
+++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml
@@ -91,4 +91,15 @@ QtObject {
testObjectWithAliasHandler.count++
return testObjectWithAliasHandler.testSuccess
}
+
+ signal signalWithClosureArgument(var f)
+ onSignalWithClosureArgument: f()
+
+ function testSignalWithClosureArgument() {
+ var testSuccess = false
+ signalWithClosureArgument(function() {
+ testSuccess = true
+ })
+ return testSuccess
+ }
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index c45750caac..b11ad2dd0e 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -3910,7 +3910,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
QV4::Scope scope(v4);
QV4::ScopedArrayObject scripts(scope, ctxt->importedScripts);
QV4::ScopedValue qml(scope);
- for (quint32 i = 0; i < scripts->arrayLength(); ++i) {
+ for (quint32 i = 0; i < scripts->getLength(); ++i) {
QQmlContextData *scriptContext, *newContext;
qml = scripts->getIndexed(i);
@@ -6069,6 +6069,9 @@ void tst_qqmlecmascript::signalHandlers()
QMetaObject::invokeMethod(o, "testAliasSignalHandler", Q_RETURN_ARG(QVariant, result));
QCOMPARE(result.toBool(), true);
+ QMetaObject::invokeMethod(o, "testSignalWithClosureArgument", Q_RETURN_ARG(QVariant, result));
+ QCOMPARE(result.toBool(), true);
+
delete o;
}
diff --git a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
index 44fbb0a982..c3d8a1502c 100644
--- a/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
+++ b/tests/auto/qml/qqmlerror/tst_qqmlerror.cpp
@@ -203,7 +203,7 @@ void tst_qqmlerror::debug()
error.setLine(92);
error.setColumn(13);
- QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error ");
+ QTest::ignoreMessage(QtWarningMsg, "http://www.qt-project.org/main.qml:92:13: An Error");
qWarning() << error;
}
diff --git a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
index 793da64734..2d7e0a8594 100644
--- a/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
+++ b/tests/auto/qml/qqmlglobal/tst_qqmlglobal.cpp
@@ -63,7 +63,7 @@ void tst_qqmlglobal::initTestCase()
void tst_qqmlglobal::colorProviderWarning()
{
- const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set! ");
+ const QLatin1String expected("Warning: QQml_colorProvider: no color provider has been set!");
QTest::ignoreMessage(QtWarningMsg, expected.data());
QQml_colorProvider();
}
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 0cd4360e67..9d62aa2984 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -500,7 +500,7 @@ void tst_qqmlinstruction::dump()
<< "8\t\tSTORE_INTEGER\t\t5\t9"
<< "9\t\tSTORE_BOOL\t\t6\ttrue"
<< "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
- << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\") "
+ << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.qt-project.org\")"
<< "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
<< "13\t\tSTORE_DATE\t\t10\t9"
<< "14\t\tSTORE_TIME\t\t11"
diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
index d5e85f478d..143164841f 100644
--- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
+++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp
@@ -1725,11 +1725,11 @@ void tst_qqmllistcompositor::changeDebug()
void tst_qqmllistcompositor::groupDebug()
{
- QTest::ignoreMessage(QtDebugMsg, "Default ");
+ QTest::ignoreMessage(QtDebugMsg, "Default");
qDebug() << C::Default;
- QTest::ignoreMessage(QtDebugMsg, "Cache ");
+ QTest::ignoreMessage(QtDebugMsg, "Cache");
qDebug() << C::Cache;
- QTest::ignoreMessage(QtDebugMsg, "Group3 ");
+ QTest::ignoreMessage(QtDebugMsg, "Group3");
qDebug() << Selection;
}
diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
index b1f83fcd6c..b0c7c5e81a 100644
--- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
+++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
@@ -329,11 +329,11 @@ void tst_QQmlMetaObject::method_data()
<< (QList<QByteArray>() << "int" << "bool" << "double")
<< (QList<QByteArray>() << "foo" << "bar" << "baz");
QTest::newRow("testSignal(variant foo, var bar)") << "signal.4.qml"
- << "testSignal(QVariant,QVariant)"
+ << "testSignal(QVariant,QJSValue)"
<< QMetaMethod::Signal
<< int(QMetaType::Void) << "void"
- << (QList<int>() << QMetaType::QVariant << QMetaType::QVariant)
- << (QList<QByteArray>() << "QVariant" << "QVariant")
+ << (QList<int>() << QMetaType::QVariant << qMetaTypeId<QJSValue>())
+ << (QList<QByteArray>() << "QVariant" << "QJSValue")
<< (QList<QByteArray>() << "foo" << "bar");
QTest::newRow("testSignal(color foo, date bar, url baz)") << "signal.5.qml"
<< "testSignal(QColor,QDateTime,QUrl)"
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 62b64a3ef1..669ae7d5ea 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -123,21 +123,21 @@ void tst_QQmlPropertyMap::insert()
//inserting property names same with existing method(signal, slot, method) names is not allowed
//QQmlPropertyMap has an invokable keys() method
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("keys"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("keys")));
QVERIFY(map.value(QLatin1String("keys")).isNull());
//QQmlPropertyMap has a deleteLater() slot
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("deleteLater"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("deleteLater")));
QVERIFY(map.value(QLatin1String("deleteLater")).isNull());
//QQmlPropertyMap has an valueChanged() signal
- QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. ");
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols.");
map.insert(QLatin1String("valueChanged"), 1);
QVERIFY(map.keys().count() == 2);
QVERIFY(!map.contains(QLatin1String("valueChanged")));
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index 7c0507dce3..5b8695f8f8 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -804,7 +804,7 @@ void tst_qqmlvaluetypes::font()
// Test pixelSize and pointSize
{
QQmlComponent component(&engine, testFileUrl("font_write.3.qml"));
- QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size.");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -814,7 +814,7 @@ void tst_qqmlvaluetypes::font()
}
{
QQmlComponent component(&engine, testFileUrl("font_write.4.qml"));
- QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
+ QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size.");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
diff --git a/examples/quick/dialogs/systemdialogs/main.cpp b/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml
index f6723bb35b..9cf22dc7a1 100644
--- a/examples/quick/dialogs/systemdialogs/main.cpp
+++ b/tests/auto/quick/qquickbehaviors/data/qtbug21549-2.qml
@@ -3,7 +3,7 @@
** 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.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
@@ -37,5 +37,35 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(dialogs/systemdialogs/systemdialogs)
+
+import QtQuick 2.0
+
+Item {
+ width: 400; height: 400
+
+ property alias animRunning: springAnim.running
+
+ Rectangle {
+ objectName: "myRect"
+ color: "green"
+ width: 20; height: 20
+
+ property bool triggered: false
+
+ onXChanged: {
+ if (!triggered && x > 50 && x < 80) {
+ triggered = true
+ x = x //set same value
+ }
+ }
+
+ Behavior on x {
+ SpringAnimation {
+ id: springAnim
+ spring: 3
+ damping: 0.2
+ mass: .5
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml b/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml
new file mode 100644
index 0000000000..db076bca9a
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/qtbug21549.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Item {
+ width: 200
+ height: 200
+
+ property int behaviorCount: 0
+
+ Rectangle {
+ id: myRect
+ objectName: "myRect"
+ width: 100
+ height: 100
+ Behavior on x {
+ ScriptAction { script: ++behaviorCount }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
index c40abbd55f..5deda2d96b 100644
--- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
+++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
@@ -81,6 +81,7 @@ private slots:
void delayedRegistration();
void startOnCompleted();
void multipleChangesToValueType();
+ void currentValue();
};
void tst_qquickbehaviors::simpleBehavior()
@@ -495,6 +496,59 @@ void tst_qquickbehaviors::multipleChangesToValueType()
QTRY_COMPARE(text->property("font").value<QFont>(), value);
}
+//QTBUG-21549
+void tst_qquickbehaviors::currentValue()
+{
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("qtbug21549.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+
+ QQuickRectangle *target = item->findChild<QQuickRectangle*>("myRect");
+ QVERIFY(target);
+
+ QCOMPARE(target->x(), qreal(0));
+
+ target->setProperty("x", 50);
+ QCOMPARE(item->property("behaviorCount").toInt(), 1);
+ QCOMPARE(target->x(), qreal(50));
+
+ target->setProperty("x", 50);
+ QCOMPARE(item->property("behaviorCount").toInt(), 1);
+ QCOMPARE(target->x(), qreal(50));
+
+ target->setX(100);
+ target->setProperty("x", 100);
+ QCOMPARE(item->property("behaviorCount").toInt(), 1);
+ QCOMPARE(target->x(), qreal(100));
+
+ delete item;
+ }
+
+ {
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("qtbug21549-2.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+
+ QQuickRectangle *target = item->findChild<QQuickRectangle*>("myRect");
+ QVERIFY(target);
+
+ QCOMPARE(target->x(), qreal(0));
+
+ target->setProperty("x", 100);
+
+ // the spring animation should smoothly transition to the new value triggered
+ // in the QML (which should be between 50 and 80);
+ QTRY_COMPARE(item->property("animRunning").toBool(), true);
+ QTRY_COMPARE(item->property("animRunning").toBool(), false);
+ QVERIFY(target->x() > qreal(50) && target->x() < qreal(80));
+
+ delete item;
+ }
+}
+
QTEST_MAIN(tst_qquickbehaviors)
#include "tst_qquickbehaviors.moc"
diff --git a/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
index bc11d349fa..c658f35d1f 100644
--- a/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/CanvasTestCase.qml
@@ -1,5 +1,6 @@
import QtQuick 2.0
import QtTest 1.0
+import QtQuick.Window 2.1
TestCase {
id:testCase
@@ -10,10 +11,16 @@ TestCase {
function cleanupTestCase() {
wait(100) //wait for a short while to make sure no leaked textures
}
+ Window {
+ id: win
+ visible: true
+ }
+
function testData(type) {
if (type === "2d")
return [
{ tag:"image threaded", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}},
+ { tag:"image canvas invisible", properties:{visible: false, width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Threaded}},
// { tag:"image cooperative", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Cooperative}},
{ tag:"image immediate", properties:{width:100, height:100, renderTarget:Canvas.Image, renderStrategy:Canvas.Immediate}},
// { tag:"fbo cooperative", properties:{width:100, height:100, renderTarget:Canvas.FramebufferObject, renderStrategy:Canvas.Cooperative}},
@@ -24,7 +31,7 @@ TestCase {
}
function createCanvasObject(data) {
- return component.createObject(testCase, data.properties);
+ return component.createObject(win, data.properties);
}
function comparePixel(ctx,x,y,r,g,b,a, d)
diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
index f13039ad95..b92f6354a5 100644
--- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
+++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml
@@ -180,11 +180,20 @@ CanvasTestCase {
tryCompare(c, "availableChangedCount", 1);
//scene graph could be available immediately
//in this case, we force waiting a short while until the init paint finished
- tryCompare(c, "paintedCount", 1);
+ if (c.visible) {
+ tryCompare(c, "paintedCount", 1);
+ } else {
+ tryCompare(c, "paintedCount", 0);
+ }
ctx.fillRect(0, 0, c.width, c.height);
c.toDataURL();
- tryCompare(c, "paintedCount", 2);
- tryCompare(c, "paintCount", 1);
+ if (c.visible) {
+ tryCompare(c, "paintCount", 1);
+ tryCompare(c, "paintedCount", 2);
+ } else {
+ tryCompare(c, "paintCount", 0);
+ tryCompare(c, "paintedCount", 1);
+ }
c.destroy();
}
function test_loadImage(row) {
diff --git a/src/imports/dialogs/qquickplatformfiledialog_p.h b/tests/auto/quick/qquickgridview/data/displayMargin.qml
index 5431836271..1086b8defd 100644
--- a/src/imports/dialogs/qquickplatformfiledialog_p.h
+++ b/tests/auto/quick/qquickgridview/data/displayMargin.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Jolla Ltd.
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,40 +39,47 @@
**
****************************************************************************/
-#ifndef QQUICKPLATFORMFILEDIALOG_P_H
-#define QQUICKPLATFORMFILEDIALOG_P_H
+import QtQuick 2.3
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
+Item {
+ width: 400; height: 400
-#include "qquickabstractfiledialog_p.h"
+ GridView {
+ id: view
+ anchors.top: header.bottom
+ anchors.bottom: footer.top
+ width: parent.width
-QT_BEGIN_NAMESPACE
+ cellWidth: 50
+ cellHeight: 25
-class QQuickPlatformFileDialog : public QQuickAbstractFileDialog
-{
- Q_OBJECT
+ cacheBuffer: 0
+ displayMarginBeginning: 60
+ displayMarginEnd: 60
-public:
- QQuickPlatformFileDialog(QObject *parent = 0);
- virtual ~QQuickPlatformFileDialog();
+ model: 200
+ delegate: Rectangle {
+ objectName: "delegate"
+ width: 50
+ height: 25
+ color: index % 2 ? "steelblue" : "lightsteelblue"
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
+ }
-protected:
- QPlatformFileDialogHelper *helper();
+ Rectangle {
+ id: header
+ width: parent.width; height: 60
+ color: "#80FF0000"
+ }
- Q_DISABLE_COPY(QQuickPlatformFileDialog)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPlatformFileDialog *)
-
-#endif // QQUICKPLATFORMFILEDIALOG_P_H
+ Rectangle {
+ id: footer
+ anchors.bottom: parent.bottom
+ width: parent.width; height: 60
+ color: "#80FF0000"
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index f1adb7858f..2ee98c6c61 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -207,6 +207,8 @@ private slots:
void moved_topToBottom_RtL_BtT();
void moved_topToBottom_RtL_BtT_data();
+ void displayMargin();
+
private:
QList<int> toIntList(const QVariantList &list);
void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
@@ -6307,6 +6309,43 @@ void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QLi
}
}
+void tst_QQuickGridView::displayMargin()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("displayMargin.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>();
+ QVERIFY(gridview != 0);
+
+ QQuickItem *content = gridview->contentItem();
+ QVERIFY(content != 0);
+
+ QQuickItem *item0;
+ QQuickItem *item97;
+
+ QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0));
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the 97th item should be within the end margin
+ QVERIFY(item97 = findItem<QQuickItem>(content, "delegate", 96));
+ QCOMPARE(delegateVisible(item97), true);
+
+ // GridView staggers item creation, so the 118th item should be outside the end margin.
+ QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == 0);
+
+ // the first delegate should still be within the begin margin
+ gridview->positionViewAtIndex(20, QQuickGridView::Beginning);
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the first delegate should now be outside the begin margin
+ gridview->positionViewAtIndex(36, QQuickGridView::Beginning);
+ QCOMPARE(delegateVisible(item0), false);
+
+ delete window;
+}
+
QTEST_MAIN(tst_QQuickGridView)
#include "tst_qquickgridview.moc"
diff --git a/tests/auto/quick/qquickitem/data/visualParentOwnership.qml b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml
new file mode 100644
index 0000000000..644d14ba43
--- /dev/null
+++ b/tests/auto/quick/qquickitem/data/visualParentOwnership.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Item {
+ Component {
+ id: factory
+ Item {}
+ }
+
+ property Item keepAliveProperty;
+
+ function createItemWithoutParent() {
+ return factory.createObject(/*parent*/ null);
+ }
+}
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index ad3c4fc208..f4f2374183 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -49,6 +49,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QDebug>
#include <QTimer>
+#include <QQmlEngine>
#include "../../shared/util.h"
class TestItem : public QQuickItem
@@ -167,6 +168,8 @@ private slots:
void acceptedMouseButtons();
+ void visualParentOwnership();
+
private:
enum PaintOrderOp {
@@ -1754,6 +1757,68 @@ void tst_qquickitem::acceptedMouseButtons()
QCOMPARE(item.releaseCount, 3);
}
+static void gc(QQmlEngine &engine)
+{
+ engine.collectGarbage();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+}
+
+void tst_qquickitem::visualParentOwnership()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("visualParentOwnership.qml"));
+
+ QQuickItem *root = qobject_cast<QQuickItem*>(view.rootObject());
+ QVERIFY(root);
+
+ QVariant newObject;
+ {
+ QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QPointer<QQuickItem> newItem = qvariant_cast<QQuickItem*>(newObject);
+ QVERIFY(!newItem.isNull());
+
+ QVERIFY(!newItem->parent());
+ QVERIFY(!newItem->parentItem());
+
+ newItem->setParentItem(root);
+
+ gc(*view.engine());
+
+ QVERIFY(!newItem.isNull());
+ newItem->setParentItem(0);
+
+ gc(*view.engine());
+ QVERIFY(newItem.isNull());
+ }
+ {
+ QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QPointer<QQuickItem> firstItem = qvariant_cast<QQuickItem*>(newObject);
+ QVERIFY(!firstItem.isNull());
+
+ firstItem->setParentItem(root);
+
+ QVERIFY(QMetaObject::invokeMethod(root, "createItemWithoutParent", Q_RETURN_ARG(QVariant, newObject)));
+ QPointer<QQuickItem> secondItem = qvariant_cast<QQuickItem*>(newObject);
+ QVERIFY(!firstItem.isNull());
+
+ secondItem->setParentItem(firstItem);
+
+ gc(*view.engine());
+
+ delete firstItem;
+
+ root->setProperty("keepAliveProperty", newObject);
+
+ gc(*view.engine());
+ QVERIFY(!secondItem.isNull());
+
+ root->setProperty("keepAliveProperty", QVariant());
+
+ gc(*view.engine());
+ QVERIFY(secondItem.isNull());
+ }
+}
QTEST_MAIN(tst_qquickitem)
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index 8a4ed5ae4c..64795f9ebe 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -1972,6 +1972,8 @@ void tst_QQuickItem::transforms_data()
QTest::addColumn<QTransform>("transform");
QTest::newRow("translate") << QByteArray("Translate { x: 10; y: 20 }")
<< QTransform(1,0,0,0,1,0,10,20,1);
+ QTest::newRow("matrix4x4") << QByteArray("Matrix4x4 { matrix: Qt.matrix4x4(1,0,0,10, 0,1,0,15, 0,0,1,0, 0,0,0,1) }")
+ << QTransform(1,0,0,0,1,0,10,15,1);
QTest::newRow("rotation") << QByteArray("Rotation { angle: 90 }")
<< QTransform(0,1,0,-1,0,0,0,0,1);
QTest::newRow("scale") << QByteArray("Scale { xScale: 1.5; yScale: -2 }")
@@ -1985,7 +1987,7 @@ void tst_QQuickItem::transforms()
QFETCH(QByteArray, qml);
QFETCH(QTransform, transform);
QQmlComponent component(&engine);
- component.setData("import QtQuick 2.0\nItem { transform: "+qml+"}", QUrl::fromLocalFile(""));
+ component.setData("import QtQuick 2.4\nItem { transform: "+qml+"}", QUrl::fromLocalFile(""));
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
QCOMPARE(item->itemTransform(0,0), transform);
diff --git a/src/imports/dialogs-private/dialogsprivateplugin.cpp b/tests/auto/quick/qquicklistview/data/displayMargin.qml
index f920df30f3..fde48bc5b9 100644
--- a/src/imports/dialogs-private/dialogsprivateplugin.cpp
+++ b/tests/auto/quick/qquicklistview/data/displayMargin.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Jolla Ltd.
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the plugins of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,28 +39,44 @@
**
****************************************************************************/
-#include <QtQml/qqmlextensionplugin.h>
-#include <QtQml/qqml.h>
-#include "qquickwritingsystemlistmodel_p.h"
-#include "qquickfontlistmodel_p.h"
+import QtQuick 2.3
-QT_BEGIN_NAMESPACE
+Item {
+ width: 400; height: 400
-class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+ ListView {
+ id: view
+ anchors.top: header.bottom
+ anchors.bottom: footer.top
+ width: parent.width
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs.Private"));
+ cacheBuffer: 0
+ displayMarginBeginning: 60
+ displayMarginEnd: 60
- qmlRegisterType<QQuickWritingSystemListModel>(uri, 1, 1, "WritingSystemListModel");
- qmlRegisterType<QQuickFontListModel>(uri, 1, 1, "FontListModel");
+ model: 100
+ delegate: Rectangle {
+ objectName: "delegate"
+ width: parent.width
+ height: 25
+ color: index % 2 ? "steelblue" : "lightsteelblue"
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
}
-};
-QT_END_NAMESPACE
+ Rectangle {
+ id: header
+ width: parent.width; height: 60
+ color: "#80FF0000"
+ }
-#include "dialogsprivateplugin.moc"
+ Rectangle {
+ id: footer
+ anchors.bottom: parent.bottom
+ width: parent.width; height: 60
+ color: "#80FF0000"
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index a0045a244f..f741fec159 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -215,6 +215,7 @@ private slots:
void testProxyModelChangedAfterMove();
void typedModel();
+ void displayMargin();
void highlightItemGeometryChanges();
@@ -7039,6 +7040,43 @@ void tst_QQuickListView::typedModel()
QCOMPARE(listview->count(), 0);
}
+void tst_QQuickListView::displayMargin()
+{
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("displayMargin.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
+ QVERIFY(listview != 0);
+
+ QQuickItem *content = listview->contentItem();
+ QVERIFY(content != 0);
+
+ QQuickItem *item0;
+ QQuickItem *item14;
+
+ QVERIFY(item0 = findItem<QQuickItem>(content, "delegate", 0));
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the 14th item should be within the end margin
+ QVERIFY(item14 = findItem<QQuickItem>(content, "delegate", 13));
+ QCOMPARE(delegateVisible(item14), true);
+
+ // the 15th item should be outside the end margin
+ QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == 0);
+
+ // the first delegate should still be within the begin margin
+ listview->positionViewAtIndex(3, QQuickListView::Beginning);
+ QCOMPARE(delegateVisible(item0), true);
+
+ // the first delegate should now be outside the begin margin
+ listview->positionViewAtIndex(4, QQuickListView::Beginning);
+ QCOMPARE(delegateVisible(item0), false);
+
+ delete window;
+}
+
void tst_QQuickListView::highlightItemGeometryChanges()
{
QQmlEngine engine;
diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
index 204a3ff019..1fed2ecda8 100644
--- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
+++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QtTest/QSignalSpy>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
@@ -54,6 +55,7 @@ public:
private slots:
void gradient();
+ void antialiasing();
private:
QQmlEngine engine;
@@ -87,6 +89,61 @@ void tst_qquickrectangle::gradient()
delete rect;
}
+void tst_qquickrectangle::antialiasing()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Rectangle {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickRectangle *rect = qobject_cast<QQuickRectangle *>(object.data());
+ QVERIFY(rect);
+
+ QSignalSpy spy(rect, SIGNAL(antialiasingChanged(bool)));
+
+ QCOMPARE(rect->antialiasing(), false);
+
+ rect->setAntialiasing(true);
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ rect->setAntialiasing(true);
+ QCOMPARE(spy.count(), 1);
+
+ rect->resetAntialiasing();
+ QCOMPARE(rect->antialiasing(), false);
+ QCOMPARE(spy.count(), 2);
+
+ rect->setRadius(5);
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 3);
+
+ rect->resetAntialiasing();
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 3);
+
+ rect->setRadius(0);
+ QCOMPARE(rect->antialiasing(), false);
+ QCOMPARE(spy.count(), 4);
+
+ rect->resetAntialiasing();
+ QCOMPARE(rect->antialiasing(), false);
+ QCOMPARE(spy.count(), 4);
+
+ rect->setRadius(5);
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ rect->resetAntialiasing();
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 5);
+
+ rect->setAntialiasing(false);
+ QCOMPARE(rect->antialiasing(), false);
+ QCOMPARE(spy.count(), 6);
+
+ rect->resetAntialiasing();
+ QCOMPARE(rect->antialiasing(), true);
+ QCOMPARE(spy.count(), 7);
+}
QTEST_MAIN(tst_qquickrectangle)
diff --git a/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml b/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml
new file mode 100644
index 0000000000..6349f7a644
--- /dev/null
+++ b/tests/auto/quick/qquicktext/data/lineLayoutHAlign.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+
+Item {
+ id: main
+ width: 200; height: 200
+
+ Text {
+ id: myText
+ objectName: "myText"
+ width: parent.width
+ font.family: "__Qt__Box__Engine__"
+ font.pixelSize: 14
+ horizontalAlignment: Text.AlignHCenter
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
+
+ onLineLaidOut: {
+ // do nothing
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index 78e03be9c2..d241ac2d70 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -101,6 +101,7 @@ private slots:
void color();
void smooth();
void renderType();
+ void antialiasing();
// QQuickFontValueType
void weight();
@@ -126,6 +127,7 @@ private slots:
void clipRect();
void lineLaidOut();
void lineLaidOutRelayout();
+ void lineLaidOutHAlign();
void imgTagsBaseUrl_data();
void imgTagsBaseUrl();
@@ -901,6 +903,8 @@ void tst_qquicktext::hAlignImplicitWidth()
{
// HCenter Align
text->setHAlign(QQuickText::AlignHCenter);
+ text->setText("Reset"); // set dummy string to force relayout once original text is set again
+ text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC");
QImage image = view.grabWindow();
const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image);
const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image);
@@ -911,6 +915,8 @@ void tst_qquicktext::hAlignImplicitWidth()
{
// Right Align
text->setHAlign(QQuickText::AlignRight);
+ text->setText("Reset"); // set dummy string to force relayout once original text is set again
+ text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC");
QImage image = view.grabWindow();
const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image);
const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image);
@@ -1306,6 +1312,30 @@ void tst_qquicktext::renderType()
QCOMPARE(spy.count(), 2);
}
+void tst_qquicktext::antialiasing()
+{
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\n Text {}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickText *text = qobject_cast<QQuickText *>(object.data());
+ QVERIFY(text);
+
+ QSignalSpy spy(text, SIGNAL(antialiasingChanged(bool)));
+
+ QCOMPARE(text->antialiasing(), true);
+
+ text->setAntialiasing(false);
+ QCOMPARE(text->antialiasing(), false);
+ QCOMPARE(spy.count(), 1);
+
+ text->setAntialiasing(false);
+ QCOMPARE(spy.count(), 1);
+
+ text->resetAntialiasing();
+ QCOMPARE(text->antialiasing(), true);
+ QCOMPARE(spy.count(), 2);
+}
+
void tst_qquicktext::weight()
{
{
@@ -2630,6 +2660,23 @@ void tst_qquicktext::lineLaidOutRelayout()
delete window;
}
+void tst_qquicktext::lineLaidOutHAlign()
+{
+ QQuickView *window = createView(testFile("lineLayoutHAlign.qml"));
+
+ QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText");
+ QVERIFY(myText != 0);
+
+ QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText);
+ QVERIFY(textPrivate != 0);
+
+ QCOMPARE(textPrivate->layout.lineCount(), 1);
+
+ QVERIFY(textPrivate->layout.lineAt(0).naturalTextRect().x() < 0.0);
+
+ delete window;
+}
+
void tst_qquicktext::imgTagsBaseUrl_data()
{
QTest::addColumn<QUrl>("src");
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index ff9554718b..8bf9d14a56 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2663,8 +2663,8 @@ void tst_qquicktextedit::delegateLoading_data()
// import installed
QTest::newRow("pass") << "cursorHttpTestPass.qml" << "";
- QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection ";
- QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type ";
+ QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection";
+ QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type";
}
void tst_qquicktextedit::delegateLoading()
diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp
index a4ed1267ac..77aeba9028 100644
--- a/tests/auto/quick/qquickview/tst_qquickview.cpp
+++ b/tests/auto/quick/qquickview/tst_qquickview.cpp
@@ -229,7 +229,7 @@ void tst_QQuickView::engine()
QCOMPARE(view3->engine(), view4->engine());
delete view3;
QVERIFY(!view4->engine());
- QTest::ignoreMessage(QtWarningMsg, "QQuickView: invalid qml engine. ");
+ QTest::ignoreMessage(QtWarningMsg, "QQuickView: invalid qml engine.");
view4->setSource(QUrl());
QCOMPARE(view4->status(), QQuickView::Error);
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 107d1d71f7..bdd70f6a6e 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -250,6 +250,18 @@ int TestTouchItem::mousePressNum = 0;
int TestTouchItem::mouseMoveNum = 0;
int TestTouchItem::mouseReleaseNum = 0;
+class EventFilter : public QObject
+{
+public:
+ bool eventFilter(QObject *watched, QEvent *event) {
+ Q_UNUSED(watched);
+ events.append(event->type());
+ return false;
+ }
+
+ QList<int> events;
+};
+
class ConstantUpdateItem : public QQuickItem
{
Q_OBJECT
@@ -331,6 +343,10 @@ private slots:
void crashWhenHoverItemDeleted();
+ void qobjectEventFilter_touch();
+ void qobjectEventFilter_key();
+ void qobjectEventFilter_mouse();
+
#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -923,6 +939,9 @@ void tst_qquickwindow::mouseFiltering()
QTRY_COMPARE(middleItem->mousePressId, 1);
QTRY_COMPARE(bottomItem->mousePressId, 2);
QTRY_COMPARE(topItem->mousePressId, 3);
+
+ // clean up mouse press state for the next tests
+ QTest::mouseRelease(window, Qt::LeftButton, 0, pos);
}
void tst_qquickwindow::qmlCreation()
@@ -1560,6 +1579,84 @@ void tst_qquickwindow::crashWhenHoverItemDeleted()
}
}
+// QTBUG-32004
+void tst_qquickwindow::qobjectEventFilter_touch()
+{
+ QQuickWindow window;
+
+ window.resize(250, 250);
+ window.setPosition(100, 100);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ TestTouchItem *item = new TestTouchItem(window.contentItem());
+ item->setSize(QSizeF(150, 150));
+
+ EventFilter eventFilter;
+ item->installEventFilter(&eventFilter);
+
+ QPointF pos(10, 10);
+
+ // press single point
+ QTest::touchEvent(&window, touchDevice).press(0, item->mapToScene(pos).toPoint(), &window);
+
+ QCOMPARE(eventFilter.events.count(), 1);
+ QCOMPARE(eventFilter.events.first(), (int)QEvent::TouchBegin);
+}
+
+// QTBUG-32004
+void tst_qquickwindow::qobjectEventFilter_key()
+{
+ QQuickWindow window;
+
+ window.resize(250, 250);
+ window.setPosition(100, 100);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ TestTouchItem *item = new TestTouchItem(window.contentItem());
+ item->setSize(QSizeF(150, 150));
+ item->setFocus(true);
+
+ EventFilter eventFilter;
+ item->installEventFilter(&eventFilter);
+
+ QTest::keyPress(&window, Qt::Key_A);
+
+ // NB: It may also receive some QKeyEvent(ShortcutOverride) which we're not interested in
+ QVERIFY(eventFilter.events.contains((int)QEvent::KeyPress));
+ eventFilter.events.clear();
+
+ QTest::keyRelease(&window, Qt::Key_A);
+
+ QVERIFY(eventFilter.events.contains((int)QEvent::KeyRelease));
+}
+
+// QTBUG-32004
+void tst_qquickwindow::qobjectEventFilter_mouse()
+{
+ QQuickWindow window;
+
+ window.resize(250, 250);
+ window.setPosition(100, 100);
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ TestTouchItem *item = new TestTouchItem(window.contentItem());
+ item->setSize(QSizeF(150, 150));
+
+ EventFilter eventFilter;
+ item->installEventFilter(&eventFilter);
+
+ QPoint point = item->mapToScene(QPointF(10, 10)).toPoint();
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point);
+
+ QVERIFY(eventFilter.events.contains((int)QEvent::MouseButtonPress));
+
+ // clean up mouse press state for the next tests
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"