aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-01-30 20:57:40 +0100
committerJari-Pekka Nurmi <jpnurmi@theqtcompany.com>2015-02-05 14:50:29 +0200
commit8b2a1ec43134e191a5f9bb08a73f1a694d52927d (patch)
treee3e7e8a14316fa488c3a2dab95fbfd3e592ece2b
parentb46d1280b8d43f80d0ed7c38e11008b9d00a8e1d (diff)
Import the Qt Quick Controls 2 prototype
Change-Id: Ib8c0c4160958e5cfea29a6e9df1b3f1fb19715fc Reviewed-by: Jari-Pekka Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--.gitattributes4
-rw-r--r--.gitignore76
-rw-r--r--.qmake.conf4
-rw-r--r--.tag1
-rw-r--r--LICENSE.LGPLv3172
-rw-r--r--README.md2
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/quick/calendar/calendar.pro12
-rw-r--r--examples/quick/calendar/calendar.qrc5
-rw-r--r--examples/quick/calendar/main.cpp149
-rw-r--r--examples/quick/calendar/main.qml237
-rw-r--r--examples/quick/controls/controls.pro6
-rw-r--r--examples/quick/controls/drawer/drawer.pro12
-rw-r--r--examples/quick/controls/drawer/drawer.qrc7
-rw-r--r--examples/quick/controls/drawer/images/arrow.pngbin0 -> 2446 bytes
-rw-r--r--examples/quick/controls/drawer/images/qt-logo.pngbin0 -> 21710 bytes
-rw-r--r--examples/quick/controls/drawer/main.cpp46
-rw-r--r--examples/quick/controls/drawer/main.qml154
-rw-r--r--examples/quick/controls/mirroring/main.cpp46
-rw-r--r--examples/quick/controls/mirroring/main.qml233
-rw-r--r--examples/quick/controls/mirroring/mirroring.pro12
-rw-r--r--examples/quick/controls/mirroring/mirroring.qrc5
-rw-r--r--examples/quick/controls/styles/main.cpp46
-rw-r--r--examples/quick/controls/styles/main.qml191
-rw-r--r--examples/quick/controls/styles/styles.pro12
-rw-r--r--examples/quick/controls/styles/styles.qrc5
-rw-r--r--examples/quick/controls/tabs/images/qt-logo.pngbin0 -> 21710 bytes
-rw-r--r--examples/quick/controls/tabs/main.cpp46
-rw-r--r--examples/quick/controls/tabs/main.qml272
-rw-r--r--examples/quick/controls/tabs/tabs.pro12
-rw-r--r--examples/quick/controls/tabs/tabs.qrc6
-rw-r--r--examples/quick/quick.pro4
-rw-r--r--qtquickcontrols2.pro2
-rw-r--r--src/calendar/calendar.pri19
-rw-r--r--src/calendar/calendar.pro14
-rw-r--r--src/calendar/qquickabstractcalendarview.cpp255
-rw-r--r--src/calendar/qquickabstractcalendarview_p.h101
-rw-r--r--src/calendar/qquickabstractdayofweekrow.cpp87
-rw-r--r--src/calendar/qquickabstractdayofweekrow_p.h73
-rw-r--r--src/calendar/qquickabstractweeknumbercolumn.cpp113
-rw-r--r--src/calendar/qquickabstractweeknumbercolumn_p.h83
-rw-r--r--src/calendar/qquickcalendarmodel.cpp195
-rw-r--r--src/calendar/qquickcalendarmodel_p.h96
-rw-r--r--src/calendar/qquickdayofweekmodel.cpp123
-rw-r--r--src/calendar/qquickdayofweekmodel_p.h83
-rw-r--r--src/calendar/qquickmonthmodel.cpp224
-rw-r--r--src/calendar/qquickmonthmodel_p.h102
-rw-r--r--src/calendar/qquickweeknumbermodel.cpp182
-rw-r--r--src/calendar/qquickweeknumbermodel_p.h91
-rw-r--r--src/calendar/qtquickcalendarglobal_p.h56
-rw-r--r--src/controls/controls.pri64
-rw-r--r--src/controls/controls.pro22
-rw-r--r--src/controls/controls.qrc5
-rw-r--r--src/controls/doc/qtquickcontrols2.qdocconf42
-rw-r--r--src/controls/doc/src/qtquickcontrols2-index.qdoc48
-rw-r--r--src/controls/doc/src/qtquickcontrols2-overview.qdoc58
-rw-r--r--src/controls/doc/src/qtquickcontrols2.qdoc44
-rw-r--r--src/controls/qquickabstractapplicationwindow.cpp256
-rw-r--r--src/controls/qquickabstractapplicationwindow_p.h94
-rw-r--r--src/controls/qquickabstractbusyindicator.cpp110
-rw-r--r--src/controls/qquickabstractbusyindicator_p.h72
-rw-r--r--src/controls/qquickabstractbutton.cpp189
-rw-r--r--src/controls/qquickabstractbutton_p.h89
-rw-r--r--src/controls/qquickabstractbutton_p_p.h58
-rw-r--r--src/controls/qquickabstractcheckable.cpp190
-rw-r--r--src/controls/qquickabstractcheckable_p.h94
-rw-r--r--src/controls/qquickabstractcheckable_p_p.h57
-rw-r--r--src/controls/qquickabstractcheckbox.cpp57
-rw-r--r--src/controls/qquickabstractcheckbox_p.h54
-rw-r--r--src/controls/qquickabstractcontainer.cpp131
-rw-r--r--src/controls/qquickabstractcontainer_p.h80
-rw-r--r--src/controls/qquickabstractcontainer_p_p.h56
-rw-r--r--src/controls/qquickabstractframe.cpp57
-rw-r--r--src/controls/qquickabstractframe_p.h54
-rw-r--r--src/controls/qquickabstractgroupbox.cpp134
-rw-r--r--src/controls/qquickabstractgroupbox_p.h77
-rw-r--r--src/controls/qquickabstractpageindicator.cpp107
-rw-r--r--src/controls/qquickabstractpageindicator_p.h72
-rw-r--r--src/controls/qquickabstractprogressbar.cpp188
-rw-r--r--src/controls/qquickabstractprogressbar_p.h92
-rw-r--r--src/controls/qquickabstractradiobutton.cpp60
-rw-r--r--src/controls/qquickabstractradiobutton_p.h54
-rw-r--r--src/controls/qquickabstractscrollbar.cpp428
-rw-r--r--src/controls/qquickabstractscrollbar_p.h132
-rw-r--r--src/controls/qquickabstractscrollindicator.cpp319
-rw-r--r--src/controls/qquickabstractscrollindicator_p.h120
-rw-r--r--src/controls/qquickabstractslider.cpp454
-rw-r--r--src/controls/qquickabstractslider_p.h133
-rw-r--r--src/controls/qquickabstractspinbox.cpp300
-rw-r--r--src/controls/qquickabstractspinbox_p.h119
-rw-r--r--src/controls/qquickabstractstackview.cpp352
-rw-r--r--src/controls/qquickabstractstackview_p.h131
-rw-r--r--src/controls/qquickabstractswitch.cpp199
-rw-r--r--src/controls/qquickabstractswitch_p.h82
-rw-r--r--src/controls/qquickabstracttabbar.cpp88
-rw-r--r--src/controls/qquickabstracttabbar_p.h70
-rw-r--r--src/controls/qquickabstracttabbutton.cpp58
-rw-r--r--src/controls/qquickabstracttabbutton_p.h54
-rw-r--r--src/controls/qquickabstracttabview.cpp231
-rw-r--r--src/controls/qquickabstracttabview_p.h118
-rw-r--r--src/controls/qquickabstracttextarea.cpp129
-rw-r--r--src/controls/qquickabstracttextarea_p.h79
-rw-r--r--src/controls/qquickabstracttextfield.cpp130
-rw-r--r--src/controls/qquickabstracttextfield_p.h79
-rw-r--r--src/controls/qquickabstracttogglebutton.cpp57
-rw-r--r--src/controls/qquickabstracttogglebutton_p.h54
-rw-r--r--src/controls/qquickabstracttoolbar.cpp57
-rw-r--r--src/controls/qquickabstracttoolbar_p.h54
-rw-r--r--src/controls/qquickcontrol.cpp232
-rw-r--r--src/controls/qquickcontrol_p.h97
-rw-r--r--src/controls/qquickcontrol_p_p.h65
-rw-r--r--src/controls/qquickexclusivegroup.cpp178
-rw-r--r--src/controls/qquickexclusivegroup_p.h97
-rw-r--r--src/controls/qquickpadding_p.h73
-rw-r--r--src/controls/qquickstyle.cpp168
-rw-r--r--src/controls/qquickstyle_p.h111
-rw-r--r--src/controls/qtquickcontrolsglobal_p.h56
-rw-r--r--src/controls/style.json16
-rw-r--r--src/extras/extras.pri9
-rw-r--r--src/extras/extras.pro14
-rw-r--r--src/extras/qquickabstractdrawer.cpp388
-rw-r--r--src/extras/qquickabstractdrawer_p.h102
-rw-r--r--src/extras/qquickabstractsplitview.cpp97
-rw-r--r--src/extras/qquickabstractsplitview_p.h79
-rw-r--r--src/extras/qtquickextrasglobal_p.h56
-rw-r--r--src/imports/calendar/CalendarDelegate.qml60
-rw-r--r--src/imports/calendar/CalendarView.qml78
-rw-r--r--src/imports/calendar/DayOfWeekRow.qml75
-rw-r--r--src/imports/calendar/WeekNumberColumn.qml75
-rw-r--r--src/imports/calendar/calendar.pro21
-rw-r--r--src/imports/calendar/qmldir7
-rw-r--r--src/imports/calendar/qtquickcalendar2plugin.cpp71
-rw-r--r--src/imports/controls/ApplicationWindow.qml55
-rw-r--r--src/imports/controls/BusyIndicator.qml80
-rw-r--r--src/imports/controls/Button.qml78
-rw-r--r--src/imports/controls/CheckBox.qml101
-rw-r--r--src/imports/controls/Frame.qml68
-rw-r--r--src/imports/controls/GroupBox.qml89
-rw-r--r--src/imports/controls/Label.qml47
-rw-r--r--src/imports/controls/PageIndicator.qml81
-rw-r--r--src/imports/controls/ProgressBar.qml101
-rw-r--r--src/imports/controls/RadioButton.qml102
-rw-r--r--src/imports/controls/ScrollBar.qml84
-rw-r--r--src/imports/controls/ScrollIndicator.qml84
-rw-r--r--src/imports/controls/Slider.qml104
-rw-r--r--src/imports/controls/SpinBox.qml132
-rw-r--r--src/imports/controls/StackView.js63
-rw-r--r--src/imports/controls/StackView.qml954
-rw-r--r--src/imports/controls/StackViewDelegate.qml142
-rw-r--r--src/imports/controls/StackViewTransition.qml56
-rw-r--r--src/imports/controls/Switch.qml111
-rw-r--r--src/imports/controls/TabBar.qml120
-rw-r--r--src/imports/controls/TabButton.qml75
-rw-r--r--src/imports/controls/TabView.qml96
-rw-r--r--src/imports/controls/TextArea.qml78
-rw-r--r--src/imports/controls/TextField.qml90
-rw-r--r--src/imports/controls/ToggleButton.qml110
-rw-r--r--src/imports/controls/ToolBar.qml67
-rw-r--r--src/imports/controls/ToolButton.qml76
-rw-r--r--src/imports/controls/controls.pro47
-rw-r--r--src/imports/controls/images/spinner_large.pngbin0 -> 15085 bytes
-rw-r--r--src/imports/controls/images/spinner_medium.pngbin0 -> 5934 bytes
-rw-r--r--src/imports/controls/images/spinner_small.pngbin0 -> 4582 bytes
-rw-r--r--src/imports/controls/qmldir29
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp128
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.qrc7
-rw-r--r--src/imports/extras/Drawer.qml56
-rw-r--r--src/imports/extras/SplitView.qml556
-rw-r--r--src/imports/extras/extras.pro19
-rw-r--r--src/imports/extras/qmldir5
-rw-r--r--src/imports/extras/qtquickextras2plugin.cpp61
-rw-r--r--src/imports/imports.pro5
-rw-r--r--src/src.pro10
-rw-r--r--sync.profile19
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/cmake/CMakeLists.txt12
-rw-r--r--tests/auto/cmake/cmake.pro7
-rw-r--r--tests/auto/controls/controls.pro12
-rw-r--r--tests/auto/controls/data/tst_busyindicator.qml61
-rw-r--r--tests/auto/controls/data/tst_button.qml172
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml274
-rw-r--r--tests/auto/controls/data/tst_exclusivegroup.qml224
-rw-r--r--tests/auto/controls/data/tst_frame.qml103
-rw-r--r--tests/auto/controls/data/tst_groupbox.qml104
-rw-r--r--tests/auto/controls/data/tst_progressbar.qml121
-rw-r--r--tests/auto/controls/data/tst_radiobutton.qml274
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml192
-rw-r--r--tests/auto/controls/data/tst_scrollindicator.qml121
-rw-r--r--tests/auto/controls/data/tst_slider.qml283
-rw-r--r--tests/auto/controls/data/tst_stackview.qml284
-rw-r--r--tests/auto/controls/data/tst_switch.qml287
-rw-r--r--tests/auto/controls/data/tst_togglebutton.qml287
-rw-r--r--tests/auto/controls/data/tst_toolbar.qml103
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml172
-rw-r--r--tests/auto/controls/tst_controls.cpp38
-rw-r--r--tests/auto/extras/data/tst_splitview.qml328
-rw-r--r--tests/auto/extras/extras.pro9
-rw-r--r--tests/auto/extras/tst_extras.cpp38
-rw-r--r--tests/benchmark/benchmark.pro3
-rw-r--r--tests/benchmark/creation/creation.pro9
-rw-r--r--tests/benchmark/creation/tst_creation.cpp159
-rw-r--r--tests/tests.pro4
202 files changed, 20567 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..1a045fa1
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+.tag export-subst
+.gitignore export-ignore
+.gitattributes export-ignore
+.commit-template export-ignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..5529ed3d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,76 @@
+# This file is used to ignore files which are generated in the Qt build system
+# ----------------------------------------------------------------------------
+
+/examples/quick/calendar/calendar
+/examples/quick/controls/drawer/drawer
+/examples/quick/controls/mirroring/mirroring
+/examples/quick/controls/styles/styles
+/examples/quick/controls/tabs/tabs
+
+/tests/auto/controls/tst_controls
+/tests/auto/extras/tst_extras
+/tests/benchmark/creation/tst_creation
+
+/src/controls/doc/qtquickcontrols2.tags
+
+*.so
+*.so.*
+*.app
+*.exe
+*.dll
+*.dylib
+*.a
+*.la
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.swp
+*.rej
+*.so
+*.pbxuser
+*.mode1
+*.mode1v3
+*_pch.h.cpp
+*_resource.rc
+*~
+.#*
+*.*#
+.qmake.stash
+.qmake.cache
+.qmake.vars
+*.prl
+tags
+.DS_Store
+*.debug
+Makefile*
+*.Debug
+*.Release
+*.prl
+*.pro.user
+*.qmlproject.user*
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+callgrind.out.*
+pcviewer.cfg
+*.flc
+.*.swp
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+.pch
+.rcc
+.project
+.cproject
+.make.cache
+android-build
+app_process
+qtc-debugging-helper
diff --git a/.qmake.conf b/.qmake.conf
new file mode 100644
index 00000000..3748d167
--- /dev/null
+++ b/.qmake.conf
@@ -0,0 +1,4 @@
+load(qt_build_config)
+CONFIG += warning_clean
+
+MODULE_VERSION = 5.6.0
diff --git a/.tag b/.tag
new file mode 100644
index 00000000..6828f88d
--- /dev/null
+++ b/.tag
@@ -0,0 +1 @@
+$Format:%H$
diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3
new file mode 100644
index 00000000..fa5e3579
--- /dev/null
+++ b/LICENSE.LGPLv3
@@ -0,0 +1,172 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
+ Contact: http://www.qt.io/licensing/
+
+ You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ GNU Lesser General Public License version 3, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+Everyone is permitted to copy and distribute verbatim copies of this
+licensedocument, but changing it is not allowed.
+
+This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+0. Additional Definitions.
+
+ As used herein, “this License” refers to version 3 of the GNU Lesser
+General Public License, and the “GNU GPL” refers to version 3 of the
+GNU General Public License.
+
+ “The Library” refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An “Application” is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A “Combined Work” is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the “Linked
+Version”.
+
+ The “Minimal Corresponding Source” for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The “Corresponding Application Code” for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort
+ to ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this
+ license document.
+
+4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that, taken
+together, effectively do not restrict modification of the portions of
+the Library contained in the Combined Work and reverse engineering for
+debugging such modifications, if you also do each of the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this
+ license document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of
+ this License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with
+ the Library. A suitable mechanism is one that (a) uses at run
+ time a copy of the Library already present on the user's
+ computer system, and (b) will operate properly with a modified
+ version of the Library that is interface-compatible with the
+ Linked Version.
+
+ e) Provide Installation Information, but only if you would
+ otherwise be required to provide such information under section 6
+ of the GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the Application
+ with a modified version of the Linked Version. (If you use option
+ 4d0, the Installation Information must accompany the Minimal
+ Corresponding Source and Corresponding Application Code. If you
+ use option 4d1, you must provide the Installation Information in
+ the manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.)
+
+5. Combined Libraries.
+
+ You may place library facilities that are a work based on the Library
+side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities, conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of
+ it is a work based on the Library, and explaining where to find
+ the accompanying uncombined form of the same work.
+
+6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+as you received it specifies that a certain numbered version of the
+GNU Lesser General Public License “or any later version” applies to
+it, you have the option of following the terms and conditions either
+of that published version or of any later version published by the
+Free Software Foundation. If the Library as you received it does not
+specify a version number of the GNU Lesser General Public License,
+you may choose any version of the GNU Lesser General Public License
+ever published by the Free Software Foundation.
+
+If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the Library.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..681f0028
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+qtquickcontrols2
+================
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 00000000..9d95812f
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ quick
diff --git a/examples/quick/calendar/calendar.pro b/examples/quick/calendar/calendar.pro
new file mode 100644
index 00000000..d08794e6
--- /dev/null
+++ b/examples/quick/calendar/calendar.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = calendar
+QT += quick sql
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ calendar.qrc
diff --git a/examples/quick/calendar/calendar.qrc b/examples/quick/calendar/calendar.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/calendar/calendar.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/calendar/main.cpp b/examples/quick/calendar/main.cpp
new file mode 100644
index 00000000..d8fe5921
--- /dev/null
+++ b/examples/quick/calendar/main.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtQml>
+#include <QtSql>
+
+class Event : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name MEMBER name NOTIFY nameChanged)
+ Q_PROPERTY(QDateTime start MEMBER start NOTIFY startChanged)
+ Q_PROPERTY(QDateTime end MEMBER end NOTIFY endChanged)
+
+public:
+ explicit Event(const QString &name, QObject *parent = 0) : QObject(parent), name(name) { }
+
+ QString name;
+ QDateTime start;
+ QDateTime end;
+
+signals:
+ void nameChanged();
+ void startChanged();
+ void endChanged();
+};
+
+class SqlEventModel : public QSqlQueryModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QDate min READ min CONSTANT)
+ Q_PROPERTY(QDate max READ max CONSTANT)
+
+public:
+ SqlEventModel(QObject *parent = 0) : QSqlQueryModel(parent) { }
+
+ QDate min() const
+ {
+ QSqlQuery query(QStringLiteral("SELECT MIN(start) FROM Event"));
+ if (query.next())
+ return QDateTime::fromMSecsSinceEpoch(query.value(0).toLongLong()).date();
+ return QDate();
+ }
+
+ QDate max() const
+ {
+ QSqlQuery query(QStringLiteral("SELECT MAX(end) FROM Event"));
+ if (query.next())
+ return QDateTime::fromMSecsSinceEpoch(query.value(0).toLongLong()).date();
+ return QDate();
+ }
+
+ Q_INVOKABLE QList<QObject*> eventsForDate(const QDate &date)
+ {
+ qint64 from = QDateTime(date, QTime(0, 0)).toMSecsSinceEpoch();
+ qint64 to = QDateTime(date, QTime(23, 59)).toMSecsSinceEpoch();
+
+ QSqlQuery query;
+ if (!query.exec(QStringLiteral("SELECT * FROM Event WHERE start <= %1 AND end >= %2").arg(to).arg(from)))
+ qFatal("Query failed");
+
+ QList<QObject*> events;
+ while (query.next()) {
+ Event *event = new Event(query.value("name").toString(), this);
+ event->start = QDateTime::fromMSecsSinceEpoch(query.value("start").toLongLong());
+ event->end = QDateTime::fromMSecsSinceEpoch(query.value("end").toLongLong());
+ events.append(event);
+ }
+ return events;
+ }
+};
+
+// create an in-memory SQLITE database
+static bool addEvent(QSqlQuery* query, const QString &name, const QDateTime &start, qint64 duration = 0)
+{
+ QDateTime end = start.addSecs(duration);
+ return query->exec(QStringLiteral("insert into Event values('%1', %2, %3)").arg(name)
+ .arg(start.toMSecsSinceEpoch())
+ .arg(end.toMSecsSinceEpoch()));
+}
+
+static void createDatabase()
+{
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
+ db.setDatabaseName(":memory:");
+ if (!db.open()) {
+ qFatal("Cannot open database");
+ return;
+ }
+
+ QSqlQuery query;
+ query.exec("create table if not exists Event (name TEXT, start BIGINT, end BIGINT)");
+
+ const QDate current = QDate::currentDate();
+ addEvent(&query, "Job interview", QDateTime(current.addDays(-19), QTime(12, 0)));
+ addEvent(&query, "Grocery shopping", QDateTime(current.addDays(-14), QTime(18, 0)));
+ addEvent(&query, "Ice skating", QDateTime(current.addDays(-14), QTime(20, 0)), 5400);
+ addEvent(&query, "Dentist's appointment", QDateTime(current.addDays(-8), QTime(14, 0)), 1800);
+ addEvent(&query, "Cross-country skiing", QDateTime(current.addDays(1), QTime(19, 30)), 3600);
+ addEvent(&query, "Conference", QDateTime(current.addDays(10), QTime(9, 0)), 432000);
+ addEvent(&query, "Hairdresser", QDateTime(current.addDays(19), QTime(13, 0)));
+ addEvent(&query, "Doctor's appointment", QDateTime(current.addDays(21), QTime(16, 0)));
+ addEvent(&query, "Vacation", QDateTime(current.addDays(35), QTime(0, 0)), 604800);
+}
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ createDatabase();
+ qmlRegisterType<SqlEventModel>("io.qt.examples.calendar", 1, 0, "SqlEventModel");
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/quick/calendar/main.qml b/examples/quick/calendar/main.qml
new file mode 100644
index 00000000..7fabf979
--- /dev/null
+++ b/examples/quick/calendar/main.qml
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+import io.qt.examples.calendar 1.0
+
+ApplicationWindow {
+ id: window
+ width: 640
+ height: 400
+ minimumWidth: 400
+ minimumHeight: 300
+ color: "#f4f4f4"
+ visible: true
+ title: "Qt Quick Controls - Calendar Example"
+
+ SqlEventModel {
+ id: eventModel
+ }
+
+ Flow {
+ id: row
+ anchors.fill: parent
+ anchors.margins: 20
+ spacing: 10
+ layoutDirection: Qt.RightToLeft
+
+ ListView {
+ id: calendar
+ property date selectedDate: new Date()
+
+ clip: true
+ width: (parent.width > parent.height ? (parent.width - parent.spacing) * 0.6 : parent.width)
+ height: (parent.height > parent.width ? (parent.height - parent.spacing) * 0.6 : parent.height)
+
+ model: CalendarModel {
+ id: model
+ from: eventModel.min
+ to: eventModel.max
+ }
+
+ focus: true
+ currentIndex: -1
+ snapMode: ListView.SnapOneItem
+ highlightMoveDuration: 250
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ orientation: parent.width > parent.height ? ListView.Vertical : ListView.Horizontal
+
+ delegate: CalendarView {
+ id: delegate
+
+ width: calendar.width
+ height: calendar.height
+
+ month: model.month
+ year: model.year
+
+ padding.top: title.height
+ Column {
+ id: title
+ x: delegate.contentItem.x
+ width: delegate.contentItem.width
+ spacing: window.style.spacing
+ Text {
+ width: parent.width
+ height: implicitHeight * 2
+ text: delegate.title
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pointSize: 18
+ }
+ DayOfWeekRow {
+ width: parent.width
+ }
+ }
+
+ padding.left: weekNumbers.width
+ WeekNumberColumn {
+ id: weekNumbers
+ month: model.month
+ year: model.year
+ y: delegate.contentItem.y
+ height: delegate.contentItem.height
+ }
+
+ onClicked: calendar.selectedDate = date
+
+ delegate: CalendarDelegate {
+ text: model.day
+ width: delegate.contentItem.width / 7
+ height: delegate.contentItem.height / 6
+ opacity: model.month === delegate.month ? 1 : 0
+ color: model.today ? window.style.accentColor : window.style.textColor
+ Rectangle {
+ z: -1
+ anchors.centerIn: parent
+ width: Math.min(parent.width * 0.6, parent.width * 0.6)
+ height: width
+ radius: width / 2
+ opacity: 0.5
+ color: pressed ? window.style.pressColor : "transparent"
+ border.color: eventModel.eventsForDate(model.date).length > 0 ? window.style.accentColor : "transparent"
+ }
+ }
+ }
+ Rectangle {
+ z: -1
+ parent: calendar
+ anchors.fill: parent
+ border.color: window.style.frameColor
+ }
+ }
+
+ Component {
+ id: eventListHeader
+
+ Row {
+ id: eventDateRow
+ width: parent.width
+ height: eventDayLabel.height
+ spacing: 10
+
+ Label {
+ id: eventDayLabel
+ text: calendar.selectedDate.getDate()
+ font.pointSize: 35
+ }
+
+ Column {
+ height: eventDayLabel.height
+
+ Label {
+ readonly property var options: { weekday: "long" }
+ text: Qt.locale().standaloneDayName(calendar.selectedDate.getDay(), Locale.LongFormat)
+ font.pointSize: 18
+ }
+ Label {
+ text: Qt.locale().standaloneMonthName(calendar.selectedDate.getMonth())
+ + calendar.selectedDate.toLocaleDateString(Qt.locale(), " yyyy")
+ font.pointSize: 12
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ width: (parent.width > parent.height ? (parent.width - parent.spacing) * 0.4 : parent.width)
+ height: (parent.height > parent.width ? (parent.height - parent.spacing) * 0.4 : parent.height)
+ border.color: window.style.frameColor
+
+ ListView {
+ id: eventsListView
+ spacing: 4
+ clip: true
+ header: eventListHeader
+ anchors.fill: parent
+ anchors.margins: 10
+ model: eventModel.eventsForDate(calendar.selectedDate)
+
+ delegate: Rectangle {
+ width: eventsListView.width
+ height: eventItemColumn.height
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: "#eee"
+ }
+
+ Column {
+ id: eventItemColumn
+ x: 4
+ y: 4
+ width: parent.width - 8
+ height: timeRow.height + nameLabel.height + 8
+
+ Label {
+ id: nameLabel
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: modelData.name
+ }
+ Row {
+ id: timeRow
+ width: parent.width
+ Label {
+ text: modelData.start.toLocaleTimeString(calendar.locale, Locale.ShortFormat)
+ color: "#aaa"
+ }
+ Label {
+ text: "-" + new Date(modelData.end).toLocaleTimeString(calendar.locale, Locale.ShortFormat)
+ visible: modelData.start.getTime() !== modelData.end.getTime() && modelData.start.getDate() === modelData.end.getDate()
+ color: "#aaa"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/controls.pro b/examples/quick/controls/controls.pro
new file mode 100644
index 00000000..b39b9aea
--- /dev/null
+++ b/examples/quick/controls/controls.pro
@@ -0,0 +1,6 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ drawer \
+ mirroring \
+ styles \
+ tabs
diff --git a/examples/quick/controls/drawer/drawer.pro b/examples/quick/controls/drawer/drawer.pro
new file mode 100644
index 00000000..ed788c7e
--- /dev/null
+++ b/examples/quick/controls/drawer/drawer.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = drawer
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ drawer.qrc
diff --git a/examples/quick/controls/drawer/drawer.qrc b/examples/quick/controls/drawer/drawer.qrc
new file mode 100644
index 00000000..25cc5cbe
--- /dev/null
+++ b/examples/quick/controls/drawer/drawer.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/arrow.png</file>
+ <file>images/qt-logo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/drawer/images/arrow.png b/examples/quick/controls/drawer/images/arrow.png
new file mode 100644
index 00000000..4981e0de
--- /dev/null
+++ b/examples/quick/controls/drawer/images/arrow.png
Binary files differ
diff --git a/examples/quick/controls/drawer/images/qt-logo.png b/examples/quick/controls/drawer/images/qt-logo.png
new file mode 100644
index 00000000..cf350dad
--- /dev/null
+++ b/examples/quick/controls/drawer/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/controls/drawer/main.cpp b/examples/quick/controls/drawer/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/drawer/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/drawer/main.qml b/examples/quick/controls/drawer/main.qml
new file mode 100644
index 00000000..e60f6067
--- /dev/null
+++ b/examples/quick/controls/drawer/main.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+import QtQuick.Extras 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Drawer Example"
+
+ Rectangle {
+ id: content
+ anchors.fill: parent
+ anchors.margins: -1
+ border.color: window.style.frameColor
+
+ Image {
+ width: window.width / 2
+ height: window.height / 2
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: window.width > window.height ? width / 2 : 0
+ anchors.verticalCenterOffset: window.width < window.height ? -height / 4 : 0
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/qt-logo.png"
+ }
+
+ Image {
+ width: window.width / 2
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: height / 2
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/arrow.png"
+ }
+
+ transform: Translate {
+ x: effect.current === uncover ? drawer.position * listview.width :
+ effect.current === push ? drawer.position * listview.width * 0.5 : 0
+ }
+
+ z: effect.current === uncover ? 2 : 0
+ }
+
+ Drawer {
+ id: drawer
+ anchors.fill: parent
+
+ ListView {
+ id: listview
+
+ width: window.width / 3 * 2
+ height: window.height
+
+ ExclusiveGroup {
+ id: effect
+ }
+
+ model: VisualItemModel {
+ Label {
+ text: "Settings"
+ x: window.style.padding
+ width: parent.width - window.style.padding * 2
+ lineHeight: 2.0
+ color: window.style.accentColor
+ verticalAlignment: Text.AlignVCenter
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ Switch {
+ id: dim
+ text: "Dim"
+ checked: true
+ width: parent.width
+ layoutDirection: Qt.RightToLeft
+ enabled: effect.current != uncover
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ RadioButton {
+ id: overlay
+ text: "Overlay"
+ checked: true
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ RadioButton {
+ id: push
+ text: "Push"
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ RadioButton {
+ id: uncover
+ text: "Uncover"
+ width: parent.width
+ Exclusive.group: effect
+ layoutDirection: Qt.RightToLeft
+ }
+ Rectangle { width: parent.width; height: 1; color: window.style.frameColor }
+ }
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ anchors.topMargin: -1
+ anchors.bottomMargin: -1
+ border.color: window.style.frameColor
+ }
+
+ transform: Translate {
+ x: effect.current === uncover ? (1.0 - drawer.position) * listview.width : 0
+ }
+ }
+
+ background.visible: dim.checked
+
+ onClicked: close()
+ }
+}
diff --git a/examples/quick/controls/mirroring/main.cpp b/examples/quick/controls/mirroring/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/mirroring/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/mirroring/main.qml b/examples/quick/controls/mirroring/main.qml
new file mode 100644
index 00000000..535b9227
--- /dev/null
+++ b/examples/quick/controls/mirroring/main.qml
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Mirroring Example"
+
+ ListView {
+ id: listview
+ anchors.fill: parent
+
+ LayoutMirroring.enabled: headerItem.mirror
+ LayoutMirroring.childrenInherit: true
+
+ headerPositioning: ListView.PullBackHeader
+ header: Rectangle {
+ property alias mirror: mirrorToggle.checked
+
+ z: 2
+ width: parent.width
+ height: label.implicitHeight + 96
+
+ Label {
+ id: label
+ text: "Beyond the essentials."
+ color: window.style.accentColor
+ anchors.fill: parent
+ anchors.margins: 48
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+
+ ToggleButton {
+ id: mirrorToggle
+ text: "Mirror"
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ layoutDirection: Qt.RightToLeft
+ LayoutMirroring.enabled: false
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ anchors.bottom: parent.bottom
+ color: window.style.frameColor
+ }
+ }
+
+ model: VisualItemModel {
+
+ Item { width: 1; height: 24 }
+
+ Flow {
+ id: flow
+ spacing: 12
+ width: Math.min(window.width, window.height) - 24
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ GroupBox {
+ title: "CheckBox"
+ readonly property real preferredWidth: (flow.width - 12) / 2
+ width: window.width > window.height || implicitWidth > preferredWidth ? flow.width : preferredWidth
+ ColumnLayout {
+ width: parent.width
+ CheckBox {
+ width: parent.width
+ text: "E-mail"
+ checked: true
+ }
+ CheckBox {
+ width: parent.width
+ text: "Calendar"
+ checked: true
+ }
+ CheckBox {
+ width: parent.width
+ text: "Contacts"
+ }
+ }
+ }
+
+ GroupBox {
+ title: "RadioButton"
+ readonly property real preferredWidth: (flow.width - 12) / 2
+ width: window.width > window.height || implicitWidth > preferredWidth ? flow.width : preferredWidth
+ ColumnLayout {
+ width: parent.width
+ ExclusiveGroup { id: eg }
+ RadioButton {
+ width: parent.width
+ text: "Portrait"
+ Exclusive.group: eg
+ }
+ RadioButton {
+ width: parent.width
+ text: "Landscape"
+ Exclusive.group: eg
+ }
+ RadioButton {
+ width: parent.width
+ text: "Automatic"
+ checked: true
+ Exclusive.group: eg
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Button"
+ width: flow.width
+ Row {
+ width: parent.width
+ spacing: window.style.spacing
+ readonly property real availableWidth: (flow.width - 12) / 2
+ readonly property real contentWidth: okButton.implicitWidth + cancelButton.implicitWidth + 12
+ readonly property real buttonWidth: contentWidth > availableWidth ? (width / 2 - spacing) : (width / 2 - 2 * spacing) / 2
+ Button {
+ id: okButton
+ text: "Ok"
+ width: parent.buttonWidth
+ }
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ width: parent.buttonWidth
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Switch"
+ width: flow.width
+ Column {
+ width: parent.width
+ Switch {
+ width: parent.width
+ text: "Wifi"
+ checked: true
+ }
+ Switch {
+ width: parent.width
+ text: "Bluetooth"
+ }
+ }
+ }
+
+ GroupBox {
+ title: "ProgressBar"
+ width: flow.width
+ Column {
+ width: parent.width
+ spacing: window.style.spacing
+ ProgressBar {
+ width: parent.width
+ indeterminate: true
+ }
+ ProgressBar {
+ width: parent.width
+ value: slider.position
+ }
+ }
+ }
+
+ GroupBox {
+ title: "Slider"
+ width: flow.width
+ Column {
+ width: parent.width
+ spacing: window.style.spacing
+ Slider {
+ id: slider
+ value: 0.4
+ width: parent.width
+ }
+ Slider {
+ width: parent.width
+ snapMode: AbstractSlider.SnapAlways
+ stepSize: 0.2
+ value: 0.8
+ }
+ }
+ }
+ }
+
+ Item { width: 1; height: 12 }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { anchors.right: parent.right }
+ }
+}
diff --git a/examples/quick/controls/mirroring/mirroring.pro b/examples/quick/controls/mirroring/mirroring.pro
new file mode 100644
index 00000000..3630b04b
--- /dev/null
+++ b/examples/quick/controls/mirroring/mirroring.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = mirroring
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ mirroring.qrc
diff --git a/examples/quick/controls/mirroring/mirroring.qrc b/examples/quick/controls/mirroring/mirroring.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/controls/mirroring/mirroring.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/styles/main.cpp b/examples/quick/controls/styles/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/styles/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/styles/main.qml b/examples/quick/controls/styles/main.qml
new file mode 100644
index 00000000..e0f66b17
--- /dev/null
+++ b/examples/quick/controls/styles/main.qml
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Styles Example"
+
+ header: ToolBar {
+ ToolButton {
+ label: Text {
+ text: "\u25C0"
+ color: enabled ? window.style.accentColor : window.style.frameColor
+ anchors.centerIn: parent
+ }
+ enabled: stackview.depth > 1
+ onClicked: stackview.pop()
+ }
+ }
+
+ StackView {
+ id: stackview
+ anchors.fill: parent
+ initialItem: pageComponent
+ }
+
+ Component {
+ id: pageComponent
+ Control {
+ id: page
+ style: Style {
+ padding: 6
+ roundness: roundedToggle.checked ? 3 : 0
+ accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0)
+ backgroundColor: darkButton.checked ? "#444" : "#fff"
+ frameColor: darkButton.checked ? "#666" : "#ccc"
+ textColor: darkButton.checked ? "#eee" : "#111"
+ pressColor: darkButton.checked ? "#33ffffff" : "#33333333"
+ baseColor: darkButton.checked ? "#444" : "#eee"
+ }
+ background: Rectangle {
+ color: style.backgroundColor
+ }
+ Flickable {
+ anchors.fill: parent
+ contentHeight: column.height + 48
+
+ Column {
+ id: column
+
+ x: (window.width - width) / 2
+ y: 24
+ width: window.width / 2
+ spacing: 12
+
+ Label {
+ text: "Code less. Create more."
+ color: page.style.accentColor
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+
+ Item { width: 1; height: 48 }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ Column {
+ spacing: 6
+ width: parent.width
+ Label {
+ text: "Accent color"
+ color: page.style.textColor
+ }
+ Slider {
+ id: colorSlider
+ width: parent.width
+ value: 0.275
+ //background: Rectangle { border.color: "red" }
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ ExclusiveGroup {
+ id: styleGroup
+ }
+
+ Column {
+ width: parent.width
+ spacing: 6
+ RadioButton {
+ id: lightButton
+ text: "Light"
+ width: parent.width
+ checked: true
+ layoutDirection: Qt.RightToLeft
+ Exclusive.group: styleGroup
+ //background: Rectangle { border.color: "red" }
+ }
+ RadioButton {
+ id: darkButton
+ text: "Dark"
+ width: parent.width
+ layoutDirection: Qt.RightToLeft
+ Exclusive.group: styleGroup
+ //background: Rectangle { border.color: "red" }
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ ToggleButton {
+ id: roundedToggle
+ width: parent.width
+ text: "Rounded corners"
+ layoutDirection: Qt.RightToLeft
+ checked: true
+ //background: Rectangle { border.color: "red" }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: page.style.frameColor
+ }
+
+ Button {
+ text: "Push"
+ anchors.right: parent.right
+ onClicked: stackview.push(pageComponent)
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+ }
+ }
+}
diff --git a/examples/quick/controls/styles/styles.pro b/examples/quick/controls/styles/styles.pro
new file mode 100644
index 00000000..f8fdec46
--- /dev/null
+++ b/examples/quick/controls/styles/styles.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = styles
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ styles.qrc
diff --git a/examples/quick/controls/styles/styles.qrc b/examples/quick/controls/styles/styles.qrc
new file mode 100644
index 00000000..5f6483ac
--- /dev/null
+++ b/examples/quick/controls/styles/styles.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/controls/tabs/images/qt-logo.png b/examples/quick/controls/tabs/images/qt-logo.png
new file mode 100644
index 00000000..cf350dad
--- /dev/null
+++ b/examples/quick/controls/tabs/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/controls/tabs/main.cpp b/examples/quick/controls/tabs/main.cpp
new file mode 100644
index 00000000..f6f79ce1
--- /dev/null
+++ b/examples/quick/controls/tabs/main.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+ return app.exec();
+}
diff --git a/examples/quick/controls/tabs/main.qml b/examples/quick/controls/tabs/main.qml
new file mode 100644
index 00000000..96c7a6da
--- /dev/null
+++ b/examples/quick/controls/tabs/main.qml
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.XmlListModel 2.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Quick Controls - Tabs Example"
+
+ TabView {
+ id: tabView
+
+ spacing: 1
+ anchors.fill: parent
+ background: Rectangle { color: style.frameColor }
+
+ Rectangle {
+ Tab.title: "Home"
+ anchors.fill: parent
+
+ Image {
+ id: logo
+ width: window.width / 2
+ height: window.height / 2
+ anchors.centerIn: parent
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/qt-logo.png"
+ }
+
+ Label {
+ text: "Things just got better"
+ color: window.style.accentColor
+ anchors.margins: 40
+ anchors.top: logo.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ wrapMode: Text.WordWrap
+ font.pointSize: 26
+ }
+ }
+
+ Rectangle {
+ Tab.title: "Discover"
+ anchors.fill: parent
+
+ ListView {
+ anchors.fill: parent
+ anchors.topMargin: -1
+ model: XmlListModel {
+ id: feedModel
+ query: "/rss/channel/item"
+ source: "http://blog.qt.io/feed/"
+ namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/';"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "pubDate"; query: "pubDate/string()" }
+ XmlRole { name: "creator"; query: "dc:creator/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ delegate: Item {
+ width: parent.width
+ height: feedItem.height
+ Column {
+ id: feedItem
+ width: parent.width
+ spacing: window.style.spacing
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ visible: index == 0
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.title
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ elide: Text.ElideRight
+ color: window.style.accentColor
+ font.pointSize: 20
+ lineHeight: 0.75
+ }
+ Label {
+ text: model.description
+ textFormat: Qt.RichText
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ wrapMode: Text.WordWrap
+ }
+ RowLayout {
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ spacing: window.style.spacing
+ Label {
+ text: model.creator
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ color: window.style.focusColor
+ font.pointSize: 8
+ }
+ Label {
+ text: model.pubDate
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ opacity: window.style.disabledOpacity
+ font.pointSize: 8
+ }
+ Item { Layout.fillWidth: true }
+ Button {
+ text: "Read more..."
+ onClicked: Qt.openUrlExternally(model.link)
+ }
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ }
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ running: feedModel.status === XmlListModel.Loading
+ }
+ }
+
+ Rectangle {
+ Tab.title: "Activity"
+ anchors.fill: parent
+
+ ListView {
+ anchors.fill: parent
+ anchors.topMargin: -1
+ model: XmlListModel {
+ id: commentModel
+ query: "/rss/channel/item"
+ source: "http://blog.qt.io/comments/feed/"
+ namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/';"
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "pubDate"; query: "pubDate/string()" }
+ XmlRole { name: "creator"; query: "dc:creator/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ delegate: Rectangle {
+ width: parent.width
+ height: commentItem.height
+ Column {
+ id: commentItem
+ width: parent.width
+ spacing: window.style.spacing
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ visible: index == 0
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.title
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ elide: Text.ElideRight
+ color: window.style.accentColor
+ font.pointSize: 14
+ lineHeight: 0.75
+ }
+ Item { width: 1; height: window.style.spacing }
+ Label {
+ text: model.description
+ textFormat: Qt.RichText
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ wrapMode: Text.WordWrap
+ }
+ RowLayout {
+ x: window.style.padding
+ width: parent.width - 2 * window.style.padding
+ spacing: window.style.spacing
+ Label {
+ text: model.creator
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ color: window.style.focusColor
+ font.pointSize: 8
+ }
+ Label {
+ text: model.pubDate
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ opacity: window.style.disabledOpacity
+ font.pointSize: 8
+ }
+ Item { Layout.fillWidth: true }
+ Button {
+ text: "Read more..."
+ onClicked: Qt.openUrlExternally(model.link)
+ }
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: window.style.frameColor
+ }
+ }
+ }
+
+ AbstractScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ running: feedModel.status === XmlListModel.Loading
+ }
+ }
+ }
+
+ PageIndicator {
+ count: tabView.count
+ currentIndex: tabView.currentIndex
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quick/controls/tabs/tabs.pro b/examples/quick/controls/tabs/tabs.pro
new file mode 100644
index 00000000..2d9c3e0e
--- /dev/null
+++ b/examples/quick/controls/tabs/tabs.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = tabs
+QT += quick
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ tabs.qrc
diff --git a/examples/quick/controls/tabs/tabs.qrc b/examples/quick/controls/tabs/tabs.qrc
new file mode 100644
index 00000000..b48259b1
--- /dev/null
+++ b/examples/quick/controls/tabs/tabs.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>images/qt-logo.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro
new file mode 100644
index 00000000..80f94e86
--- /dev/null
+++ b/examples/quick/quick.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ calendar \
+ controls
diff --git a/qtquickcontrols2.pro b/qtquickcontrols2.pro
new file mode 100644
index 00000000..ce6617ea
--- /dev/null
+++ b/qtquickcontrols2.pro
@@ -0,0 +1,2 @@
+requires(qtHaveModule(quick))
+load(qt_parts)
diff --git a/src/calendar/calendar.pri b/src/calendar/calendar.pri
new file mode 100644
index 00000000..67267388
--- /dev/null
+++ b/src/calendar/calendar.pri
@@ -0,0 +1,19 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qquickabstractcalendarview_p.h \
+ $$PWD/qquickabstractdayofweekrow_p.h \
+ $$PWD/qquickabstractweeknumbercolumn_p.h \
+ $$PWD/qquickcalendarmodel_p.h \
+ $$PWD/qquickdayofweekmodel_p.h \
+ $$PWD/qquickmonthmodel_p.h \
+ $$PWD/qquickweeknumbermodel_p.h
+
+SOURCES += \
+ $$PWD/qquickabstractcalendarview.cpp \
+ $$PWD/qquickabstractdayofweekrow.cpp \
+ $$PWD/qquickabstractweeknumbercolumn.cpp \
+ $$PWD/qquickcalendarmodel.cpp \
+ $$PWD/qquickdayofweekmodel.cpp \
+ $$PWD/qquickmonthmodel.cpp \
+ $$PWD/qquickweeknumbermodel.cpp
diff --git a/src/calendar/calendar.pro b/src/calendar/calendar.pro
new file mode 100644
index 00000000..e1f3af78
--- /dev/null
+++ b/src/calendar/calendar.pro
@@ -0,0 +1,14 @@
+TARGET = QtQuickCalendar
+MODULE = quickcalendar
+CONFIG += internal_module
+
+QT += quick
+QT += core-private gui-private qml-private quick-private quickcontrols-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ $$PWD/qtquickcalendarglobal_p.h
+
+include(calendar.pri)
+load(qt_module)
diff --git a/src/calendar/qquickabstractcalendarview.cpp b/src/calendar/qquickabstractcalendarview.cpp
new file mode 100644
index 00000000..c076cc0c
--- /dev/null
+++ b/src/calendar/qquickabstractcalendarview.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcalendarview_p.h"
+#include "qquickmonthmodel_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCalendarViewPrivate : public QQuickAbstractContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractCalendarView)
+
+public:
+ QQuickAbstractCalendarViewPrivate() : pressTimer(0), pressedItem(Q_NULLPTR), model(Q_NULLPTR) { }
+
+ QQuickItem *cellAt(const QPoint &pos) const;
+ QDate dateOf(QQuickItem *cell) const;
+
+ void updatePress(const QPoint &pos);
+ void clearPress(bool clicked);
+
+ static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
+
+ QString title;
+ QVariant source;
+ QDate pressedDate;
+ int pressTimer;
+ QQuickItem *pressedItem;
+ QQuickMonthModel *model;
+};
+
+QQuickItem *QQuickAbstractCalendarViewPrivate::cellAt(const QPoint &pos) const
+{
+ Q_Q(const QQuickAbstractCalendarView);
+ if (contentItem) {
+ QPointF mapped = q->mapToItem(contentItem, pos);
+ return contentItem->childAt(mapped.x(), mapped.y());
+ }
+ return Q_NULLPTR;
+}
+
+QDate QQuickAbstractCalendarViewPrivate::dateOf(QQuickItem *cell) const
+{
+ if (contentItem)
+ return model->dateAt(contentItem->childItems().indexOf(cell));
+ return QDate();
+}
+
+void QQuickAbstractCalendarViewPrivate::updatePress(const QPoint &pos)
+{
+ Q_Q(QQuickAbstractCalendarView);
+ clearPress(false);
+ pressedItem = cellAt(pos);
+ setContextProperty(pressedItem, QStringLiteral("pressed"), true);
+ pressedDate = dateOf(pressedItem);
+ if (pressedDate.isValid())
+ emit q->pressed(pressedDate);
+}
+
+void QQuickAbstractCalendarViewPrivate::clearPress(bool clicked)
+{
+ Q_Q(QQuickAbstractCalendarView);
+ setContextProperty(pressedItem, QStringLiteral("pressed"), false);
+ if (pressedDate.isValid()) {
+ emit q->released(pressedDate);
+ if (clicked)
+ emit q->clicked(pressedDate);
+ }
+ pressedDate = QDate();
+ pressedItem = Q_NULLPTR;
+}
+
+void QQuickAbstractCalendarViewPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
+{
+ QQmlContext *context = qmlContext(item);
+ if (context && context->isValid()) {
+ context = context->parentContext();
+ if (context && context->isValid())
+ context->setContextProperty(name, value);
+ }
+}
+
+QQuickAbstractCalendarView::QQuickAbstractCalendarView(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractCalendarViewPrivate), parent)
+{
+ Q_D(QQuickAbstractCalendarView);
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+
+ d->model = new QQuickMonthModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickMonthModel::monthChanged, this, &QQuickAbstractCalendarView::monthChanged);
+ connect(d->model, &QQuickMonthModel::yearChanged, this, &QQuickAbstractCalendarView::yearChanged);
+ connect(d->model, &QQuickMonthModel::localeChanged, this, &QQuickAbstractCalendarView::localeChanged);
+ connect(d->model, &QQuickMonthModel::titleChanged, this, &QQuickAbstractCalendarView::titleChanged);
+}
+
+int QQuickAbstractCalendarView::month() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->month();
+}
+
+void QQuickAbstractCalendarView::setMonth(int month)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setMonth(month);
+}
+
+int QQuickAbstractCalendarView::year() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->year();
+}
+
+void QQuickAbstractCalendarView::setYear(int year)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setYear(year);
+}
+
+QLocale QQuickAbstractCalendarView::locale() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->locale();
+}
+
+void QQuickAbstractCalendarView::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractCalendarView::source() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->source;
+}
+
+void QQuickAbstractCalendarView::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QString QQuickAbstractCalendarView::title() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ if (d->title.isNull())
+ return d->model->title();
+ return d->title;
+}
+
+void QQuickAbstractCalendarView::setTitle(const QString &title)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (d->title != title) {
+ d->title = title;
+ emit titleChanged();
+ }
+}
+
+void QQuickAbstractCalendarView::componentComplete()
+{
+ Q_D(QQuickAbstractCalendarView);
+ QQuickAbstractContainer::componentComplete();
+ if (d->contentItem) {
+ foreach (QQuickItem *child, d->contentItem->childItems()) {
+ if (!child->inherits("QQuickRepeater"))
+ d->setContextProperty(child, QStringLiteral("pressed"), false);
+ }
+ }
+}
+
+void QQuickAbstractCalendarView::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->updatePress(event->pos());
+ if (d->pressedDate.isValid())
+ d->pressTimer = startTimer(qGuiApp->styleHints()->mousePressAndHoldInterval());
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->updatePress(event->pos());
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->clearPress(true);
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->clearPress(false);
+}
+
+void QQuickAbstractCalendarView::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (event->timerId() == d->pressTimer) {
+ if (d->pressedDate.isValid())
+ emit pressAndHold(d->pressedDate);
+ killTimer(d->pressTimer);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractcalendarview_p.h b/src/calendar/qquickabstractcalendarview_p.h
new file mode 100644
index 00000000..ac55b234
--- /dev/null
+++ b/src/calendar/qquickabstractcalendarview_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCALENDARVIEW_P_H
+#define QQUICKABSTRACTCALENDARVIEW_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCalendarViewPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractCalendarView : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+
+public:
+ explicit QQuickAbstractCalendarView(QQuickItem *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void sourceChanged();
+ void titleChanged();
+
+ void pressed(const QDate &date);
+ void released(const QDate &date);
+ void clicked(const QDate &date);
+ void pressAndHold(const QDate &date);
+
+protected:
+ void componentComplete() Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractCalendarView)
+ Q_DECLARE_PRIVATE(QQuickAbstractCalendarView)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCALENDARVIEW_P_H
diff --git a/src/calendar/qquickabstractdayofweekrow.cpp b/src/calendar/qquickabstractdayofweekrow.cpp
new file mode 100644
index 00000000..0d2830de
--- /dev/null
+++ b/src/calendar/qquickabstractdayofweekrow.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractdayofweekrow_p.h"
+#include "qquickdayofweekmodel_p.h"
+
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDayOfWeekRowPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QVariant source;
+ QQuickDayOfWeekModel *model;
+};
+
+QQuickAbstractDayOfWeekRow::QQuickAbstractDayOfWeekRow(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractDayOfWeekRowPrivate), parent)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ d->model = new QQuickDayOfWeekModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickDayOfWeekModel::localeChanged, this, &QQuickAbstractDayOfWeekRow::localeChanged);
+}
+
+QLocale QQuickAbstractDayOfWeekRow::locale() const
+{
+ Q_D(const QQuickAbstractDayOfWeekRow);
+ return d->model->locale();
+}
+
+void QQuickAbstractDayOfWeekRow::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractDayOfWeekRow::source() const
+{
+ Q_D(const QQuickAbstractDayOfWeekRow);
+ return d->source;
+}
+
+void QQuickAbstractDayOfWeekRow::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractdayofweekrow_p.h b/src/calendar/qquickabstractdayofweekrow_p.h
new file mode 100644
index 00000000..68dbe6fa
--- /dev/null
+++ b/src/calendar/qquickabstractdayofweekrow_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTDAYOFWEEKROW_P_H
+#define QQUICKABSTRACTDAYOFWEEKROW_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDayOfWeekRowPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractDayOfWeekRow : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+
+public:
+ explicit QQuickAbstractDayOfWeekRow(QQuickItem *parent = Q_NULLPTR);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+Q_SIGNALS:
+ void localeChanged();
+ void sourceChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractDayOfWeekRow)
+ Q_DECLARE_PRIVATE(QQuickAbstractDayOfWeekRow)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTDAYOFWEEKROW_P_H
diff --git a/src/calendar/qquickabstractweeknumbercolumn.cpp b/src/calendar/qquickabstractweeknumbercolumn.cpp
new file mode 100644
index 00000000..9357c0cf
--- /dev/null
+++ b/src/calendar/qquickabstractweeknumbercolumn.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractweeknumbercolumn_p.h"
+#include "qquickweeknumbermodel_p.h"
+
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractWeekNumberColumnPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QVariant source;
+ QQuickWeekNumberModel *model;
+};
+
+QQuickAbstractWeekNumberColumn::QQuickAbstractWeekNumberColumn(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractWeekNumberColumnPrivate), parent)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model = new QQuickWeekNumberModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickWeekNumberModel::monthChanged, this, &QQuickAbstractWeekNumberColumn::monthChanged);
+ connect(d->model, &QQuickWeekNumberModel::yearChanged, this, &QQuickAbstractWeekNumberColumn::yearChanged);
+ connect(d->model, &QQuickWeekNumberModel::localeChanged, this, &QQuickAbstractWeekNumberColumn::localeChanged);
+}
+
+int QQuickAbstractWeekNumberColumn::month() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->month();
+}
+
+void QQuickAbstractWeekNumberColumn::setMonth(int month)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setMonth(month);
+}
+
+int QQuickAbstractWeekNumberColumn::year() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->year();
+}
+
+void QQuickAbstractWeekNumberColumn::setYear(int year)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setYear(year);
+}
+
+QLocale QQuickAbstractWeekNumberColumn::locale() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->locale();
+}
+
+void QQuickAbstractWeekNumberColumn::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractWeekNumberColumn::source() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->source;
+}
+
+void QQuickAbstractWeekNumberColumn::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractweeknumbercolumn_p.h b/src/calendar/qquickabstractweeknumbercolumn_p.h
new file mode 100644
index 00000000..ab5ec096
--- /dev/null
+++ b/src/calendar/qquickabstractweeknumbercolumn_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
+#define QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractWeekNumberColumnPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractWeekNumberColumn : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+
+public:
+ explicit QQuickAbstractWeekNumberColumn(QQuickItem *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void sourceChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractWeekNumberColumn)
+ Q_DECLARE_PRIVATE(QQuickAbstractWeekNumberColumn)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
diff --git a/src/calendar/qquickcalendarmodel.cpp b/src/calendar/qquickcalendarmodel.cpp
new file mode 100644
index 00000000..c1386ed0
--- /dev/null
+++ b/src/calendar/qquickcalendarmodel.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcalendarmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCalendarModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickCalendarModel)
+
+public:
+ QQuickCalendarModelPrivate() : complete(false),
+ from(1,1,1), to(275759, 9, 25), count(0)
+ {
+ }
+
+ static int getCount(const QDate& from, const QDate &to);
+
+ void populate(const QDate &from, const QDate &to, bool force = false);
+
+ bool complete;
+ QDate from;
+ QDate to;
+ int count;
+};
+
+int QQuickCalendarModelPrivate::getCount(const QDate& from, const QDate &to)
+{
+ QDate f(from.year(), from.month(), 1);
+ QDate t(to.year(), to.month(), to.daysInMonth());
+ QDate r = QDate(1, 1, 1).addDays(f.daysTo(t));
+ int years = r.year() - 1;
+ int months = r.month() - 1;
+ return 12 * years + months + (r.day() / t.day());
+}
+
+void QQuickCalendarModelPrivate::populate(const QDate &f, const QDate &t, bool force)
+{
+ Q_Q(QQuickCalendarModel);
+ if (!force && f == from && t == to)
+ return;
+
+ int c = getCount(from, to);
+ if (c != count) {
+ q->beginResetModel();
+ count = c;
+ q->endResetModel();
+ emit q->countChanged();
+ } else {
+ emit q->dataChanged(q->index(0, 0), q->index(c - 1, 0));
+ }
+}
+
+QQuickCalendarModel::QQuickCalendarModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickCalendarModelPrivate), parent)
+{
+}
+
+QDate QQuickCalendarModel::from() const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from;
+}
+
+void QQuickCalendarModel::setFrom(const QDate &from)
+{
+ Q_D(QQuickCalendarModel);
+ if (d->from != from) {
+ if (d->complete)
+ d->populate(from, d->to);
+ d->from = from;
+ emit fromChanged();
+ }
+}
+
+QDate QQuickCalendarModel::to() const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->to;
+}
+
+void QQuickCalendarModel::setTo(const QDate &to)
+{
+ Q_D(QQuickCalendarModel);
+ if (d->to != to) {
+ if (d->complete)
+ d->populate(d->from, to);
+ d->to = to;
+ emit fromChanged();
+ }
+}
+
+int QQuickCalendarModel::monthAt(int index) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from.addMonths(index).month();
+}
+
+int QQuickCalendarModel::yearAt(int index) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from.addMonths(index).year();
+}
+
+int QQuickCalendarModel::indexOf(const QDate &date) const
+{
+ return indexOf(date.year(), date.month());
+}
+
+int QQuickCalendarModel::indexOf(int year, int month) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->getCount(d->from, QDate(year, month, 1)) - 1;
+}
+
+QVariant QQuickCalendarModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickCalendarModel);
+ if (index.isValid() && index.row() < d->count) {
+ switch (role) {
+ case MonthRole:
+ return monthAt(index.row());
+ case YearRole:
+ return yearAt(index.row());
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickCalendarModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickCalendarModel);
+ if (!parent.isValid())
+ return d->count;
+ return 0;
+}
+
+QHash<int, QByteArray> QQuickCalendarModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[MonthRole] = QByteArrayLiteral("month");
+ roles[YearRole] = QByteArrayLiteral("year");
+ return roles;
+}
+
+void QQuickCalendarModel::classBegin()
+{
+}
+
+void QQuickCalendarModel::componentComplete()
+{
+ Q_D(QQuickCalendarModel);
+ d->complete = true;
+ d->populate(d->from, d->to, true);
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickcalendarmodel_p.h b/src/calendar/qquickcalendarmodel_p.h
new file mode 100644
index 00000000..e5a650f8
--- /dev/null
+++ b/src/calendar/qquickcalendarmodel_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCALENDARMODEL_P_H
+#define QQUICKCALENDARMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qdatetime.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCalendarModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickCalendarModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QDate from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(QDate to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
+
+public:
+ explicit QQuickCalendarModel(QObject *parent = Q_NULLPTR);
+
+ QDate from() const;
+ void setFrom(const QDate &from);
+
+ QDate to() const;
+ void setTo(const QDate &to);
+
+ Q_INVOKABLE int monthAt(int index) const;
+ Q_INVOKABLE int yearAt(int index) const;
+ Q_INVOKABLE int indexOf(const QDate &date) const;
+ Q_INVOKABLE int indexOf(int year, int month) const;
+
+ enum {
+ MonthRole,
+ YearRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void countChanged();
+
+protected:
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickCalendarModel)
+ Q_DECLARE_PRIVATE(QQuickCalendarModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCALENDARMODEL_P_H
diff --git a/src/calendar/qquickdayofweekmodel.cpp b/src/calendar/qquickdayofweekmodel.cpp
new file mode 100644
index 00000000..7f75f784
--- /dev/null
+++ b/src/calendar/qquickdayofweekmodel.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickdayofweekmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDayOfWeekModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDayOfWeekModel)
+
+public:
+ QLocale locale;
+};
+
+QQuickDayOfWeekModel::QQuickDayOfWeekModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickDayOfWeekModelPrivate), parent)
+{
+}
+
+QLocale QQuickDayOfWeekModel::locale() const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ return d->locale;
+}
+
+void QQuickDayOfWeekModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickDayOfWeekModel);
+ if (d->locale != locale) {
+ bool changed = d->locale.firstDayOfWeek() != locale.firstDayOfWeek();
+ d->locale = locale;
+ emit localeChanged();
+ if (changed)
+ emit dataChanged(index(0, 0), index(6, 0));
+ }
+}
+
+int QQuickDayOfWeekModel::dayAt(int index) const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ int day = d->locale.firstDayOfWeek() + index;
+ if (day > 7)
+ day -= 7;
+ if (day == 7)
+ day = 0; // Qt::Sunday = 7, but Sunday is 0 in JS Date
+ return day;
+}
+
+QVariant QQuickDayOfWeekModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ if (index.isValid() && index.row() < 7) {
+ int day = dayAt(index.row());
+ switch (role) {
+ case DayRole:
+ return day;
+ case LongNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::LongFormat);
+ case ShortNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::ShortFormat);
+ case NarrowNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::NarrowFormat);
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickDayOfWeekModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return 7;
+}
+
+QHash<int, QByteArray> QQuickDayOfWeekModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[DayRole] = QByteArrayLiteral("day");
+ roles[LongNameRole] = QByteArrayLiteral("longName");
+ roles[ShortNameRole] = QByteArrayLiteral("shortName");
+ roles[NarrowNameRole] = QByteArrayLiteral("narrowName");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickdayofweekmodel_p.h b/src/calendar/qquickdayofweekmodel_p.h
new file mode 100644
index 00000000..776444a3
--- /dev/null
+++ b/src/calendar/qquickdayofweekmodel_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDAYOFWEEKMODEL_P_H
+#define QQUICKDAYOFWEEKMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDayOfWeekModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickDayOfWeekModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickDayOfWeekModel(QObject *parent = Q_NULLPTR);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ Q_INVOKABLE int dayAt(int index) const;
+
+ enum {
+ DayRole = Qt::UserRole + 1,
+ LongNameRole,
+ ShortNameRole,
+ NarrowNameRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void localeChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickDayOfWeekModel)
+ Q_DECLARE_PRIVATE(QQuickDayOfWeekModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDAYOFWEEKMODEL_P_H
diff --git a/src/calendar/qquickmonthmodel.cpp b/src/calendar/qquickmonthmodel.cpp
new file mode 100644
index 00000000..61185d57
--- /dev/null
+++ b/src/calendar/qquickmonthmodel.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmonthmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+namespace {
+ static const int daysInAWeek = 7;
+ static const int weeksOnACalendarMonth = 6;
+ static const int daysOnACalendarMonth = daysInAWeek * weeksOnACalendarMonth;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMonthModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickMonthModel)
+
+public:
+ QQuickMonthModelPrivate() : dates(daysOnACalendarMonth)
+ {
+ QDate date = QDate::currentDate();
+ month = date.month();
+ year = date.year();
+ }
+
+ bool populate(int month, int year, const QLocale &locale, bool force = false);
+
+ int month;
+ int year;
+ QString title;
+ QLocale locale;
+ QVector<QDate> dates;
+};
+
+bool QQuickMonthModelPrivate::populate(int m, int y, const QLocale &l, bool force)
+{
+ Q_Q(QQuickMonthModel);
+ if (!force && m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek())
+ return false;
+
+ // The actual first (1st) day of the month.
+ QDate firstDayOfMonthDate(y, m, 1);
+ int difference = ((firstDayOfMonthDate.dayOfWeek() - l.firstDayOfWeek()) + 7) % 7;
+ // The first day to display should never be the 1st of the month, as we want some days from
+ // the previous month to be visible.
+ if (difference == 0)
+ difference += 7;
+ QDate firstDateToDisplay = firstDayOfMonthDate.addDays(-difference);
+
+ for (int i = 0; i < daysOnACalendarMonth; ++i)
+ dates[i] = firstDateToDisplay.addDays(i);
+
+ q->setTitle(l.standaloneMonthName(m) + QStringLiteral(" ") + QString::number(y));
+
+ return true;
+}
+
+QQuickMonthModel::QQuickMonthModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickMonthModelPrivate), parent)
+{
+ Q_D(QQuickMonthModel);
+ d->populate(d->month, d->year, d->locale, true);
+}
+
+int QQuickMonthModel::month() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->month;
+}
+
+void QQuickMonthModel::setMonth(int month)
+{
+ Q_D(QQuickMonthModel);
+ if (d->month != month) {
+ if (d->populate(month, d->year, d->locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->month = month;
+ emit monthChanged();
+ }
+}
+
+int QQuickMonthModel::year() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->year;
+}
+
+void QQuickMonthModel::setYear(int year)
+{
+ Q_D(QQuickMonthModel);
+ if (d->year != year) {
+ if (d->populate(d->month, year, d->locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->year = year;
+ emit yearChanged();
+ }
+}
+
+QLocale QQuickMonthModel::locale() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->locale;
+}
+
+void QQuickMonthModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickMonthModel);
+ if (d->locale != locale) {
+ if (d->populate(d->month, d->year, locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->locale = locale;
+ emit localeChanged();
+ }
+}
+
+QString QQuickMonthModel::title() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->title;
+}
+
+void QQuickMonthModel::setTitle(const QString &title)
+{
+ Q_D(QQuickMonthModel);
+ if (d->title != title) {
+ d->title = title;
+ emit titleChanged();
+ }
+}
+
+QDate QQuickMonthModel::dateAt(int index) const
+{
+ Q_D(const QQuickMonthModel);
+ return d->dates.value(index);
+}
+
+int QQuickMonthModel::indexOf(const QDate &date) const
+{
+ Q_D(const QQuickMonthModel);
+ if (date < d->dates.first() || date > d->dates.last())
+ return -1;
+ return qMax(qint64(0), d->dates.first().daysTo(date));
+}
+
+QVariant QQuickMonthModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickMonthModel);
+ if (index.isValid() && index.row() < daysOnACalendarMonth) {
+ const QDate date = d->dates.at(index.row());
+ switch (role) {
+ case DateRole:
+ return date;
+ case DayRole:
+ return date.day();
+ case TodayRole:
+ return date == QDate::currentDate();
+ case WeekNumberRole:
+ return date.weekNumber();
+ case MonthRole:
+ return date.month();
+ case YearRole:
+ return date.year();
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickMonthModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return daysOnACalendarMonth;
+}
+
+QHash<int, QByteArray> QQuickMonthModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[DateRole] = QByteArrayLiteral("date");
+ roles[DayRole] = QByteArrayLiteral("day");
+ roles[TodayRole] = QByteArrayLiteral("today");
+ roles[WeekNumberRole] = QByteArrayLiteral("weekNumber");
+ roles[MonthRole] = QByteArrayLiteral("month");
+ roles[YearRole] = QByteArrayLiteral("year");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickmonthmodel_p.h b/src/calendar/qquickmonthmodel_p.h
new file mode 100644
index 00000000..22720cc8
--- /dev/null
+++ b/src/calendar/qquickmonthmodel_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMONTHMODEL_P_H
+#define QQUICKMONTHMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMonthModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickMonthModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickMonthModel(QObject *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ Q_INVOKABLE QDate dateAt(int index) const;
+ Q_INVOKABLE int indexOf(const QDate &date) const;
+
+ enum {
+ DateRole = Qt::UserRole + 1,
+ DayRole,
+ TodayRole,
+ WeekNumberRole,
+ MonthRole,
+ YearRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void titleChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickMonthModel)
+ Q_DECLARE_PRIVATE(QQuickMonthModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKMONTHMODEL_P_H
diff --git a/src/calendar/qquickweeknumbermodel.cpp b/src/calendar/qquickweeknumbermodel.cpp
new file mode 100644
index 00000000..34d66202
--- /dev/null
+++ b/src/calendar/qquickweeknumbermodel.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickweeknumbermodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+#include <QtCore/qdatetime.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickWeekNumberModel)
+
+public:
+ QQuickWeekNumberModelPrivate()
+ {
+ QDate date = QDate::currentDate();
+ month = date.month();
+ year = date.year();
+ first = calculateFirst(month, year, locale);
+ }
+
+ void init(int month, int year, const QLocale &locale = QLocale());
+ static int calculateFirst(int month, int year, const QLocale &locale);
+
+ int month;
+ int year;
+ int first;
+ QLocale locale;
+};
+
+void QQuickWeekNumberModelPrivate::init(int m, int y, const QLocale &l)
+{
+ Q_Q(QQuickWeekNumberModel);
+ if (m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek())
+ return;
+
+ first = calculateFirst(m, y, l);
+
+ emit q->dataChanged(q->index(0, 0), q->index(5, 0));
+}
+
+int QQuickWeekNumberModelPrivate::calculateFirst(int month, int year, const QLocale &locale)
+{
+ // The actual first (1st) day of the month.
+ QDate firstDayOfMonthDate(year, month, 1);
+ int difference = ((firstDayOfMonthDate.dayOfWeek() - locale.firstDayOfWeek()) + 7) % 7;
+ // The first day to display should never be the 1st of the month, as we want some days from
+ // the previous month to be visible.
+ if (difference == 0)
+ difference += 7;
+ return firstDayOfMonthDate.addDays(-difference).weekNumber();
+}
+
+QQuickWeekNumberModel::QQuickWeekNumberModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickWeekNumberModelPrivate), parent)
+{
+}
+
+int QQuickWeekNumberModel::month() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->month;
+}
+
+void QQuickWeekNumberModel::setMonth(int month)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->month != month) {
+ d->init(month, d->year, d->locale);
+ d->month = month;
+ emit monthChanged();
+ }
+}
+
+int QQuickWeekNumberModel::year() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->year;
+}
+
+void QQuickWeekNumberModel::setYear(int year)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->year != year) {
+ d->init(d->month, year, d->locale);
+ d->year = year;
+ emit yearChanged();
+ }
+}
+
+QLocale QQuickWeekNumberModel::locale() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->locale;
+}
+
+void QQuickWeekNumberModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->locale != locale) {
+ d->init(d->month, d->year, locale);
+ d->locale = locale;
+ emit localeChanged();
+ }
+}
+
+int QQuickWeekNumberModel::weekNumberAt(int index) const
+{
+ Q_D(const QQuickWeekNumberModel);
+ if (index < 0 || index > 5)
+ return -1;
+ return d->first + index;
+}
+
+int QQuickWeekNumberModel::indexOf(int weekNumber) const
+{
+ Q_D(const QQuickWeekNumberModel);
+ if (weekNumber < d->first || weekNumber > d->first + 6)
+ return -1;
+ return weekNumber - d->first;
+}
+
+QVariant QQuickWeekNumberModel::data(const QModelIndex &index, int role) const
+{
+ if (role == WeekNumberRole) {
+ int weekNumber = weekNumberAt(index.row());
+ if (weekNumber != -1)
+ return weekNumber;
+ }
+ return QVariant();
+}
+
+int QQuickWeekNumberModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return 6;
+}
+
+QHash<int, QByteArray> QQuickWeekNumberModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[WeekNumberRole] = QByteArrayLiteral("weekNumber");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickweeknumbermodel_p.h b/src/calendar/qquickweeknumbermodel_p.h
new file mode 100644
index 00000000..d64da352
--- /dev/null
+++ b/src/calendar/qquickweeknumbermodel_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEEKNUMBERMODEL_P_H
+#define QQUICKWEEKNUMBERMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWeekNumberModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickWeekNumberModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickWeekNumberModel(QObject *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ Q_INVOKABLE int weekNumberAt(int index) const;
+ Q_INVOKABLE int indexOf(int weekNumber) const;
+
+ enum {
+ WeekNumberRole = Qt::UserRole + 1
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickWeekNumberModel)
+ Q_DECLARE_PRIVATE(QQuickWeekNumberModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEEKNUMBERMODEL_P_H
diff --git a/src/calendar/qtquickcalendarglobal_p.h b/src/calendar/qtquickcalendarglobal_p.h
new file mode 100644
index 00000000..8f04361e
--- /dev/null
+++ b/src/calendar/qtquickcalendarglobal_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCALENDARGLOBAL_P_H
+#define QTQUICKCALENDARGLOBAL_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKCALENDAR_LIB)
+# define Q_QUICKCALENDAR_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKCALENDAR_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKCALENDAR_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCALENDARGLOBAL_P_H
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
new file mode 100644
index 00000000..af2b7b8c
--- /dev/null
+++ b/src/controls/controls.pri
@@ -0,0 +1,64 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qquickabstractapplicationwindow_p.h \
+ $$PWD/qquickabstractbusyindicator_p.h \
+ $$PWD/qquickabstractbutton_p.h \
+ $$PWD/qquickabstractbutton_p_p.h \
+ $$PWD/qquickabstractcheckable_p.h \
+ $$PWD/qquickabstractcheckable_p_p.h \
+ $$PWD/qquickabstractcheckbox_p.h \
+ $$PWD/qquickabstractcontainer_p.h \
+ $$PWD/qquickabstractcontainer_p_p.h \
+ $$PWD/qquickabstractframe_p.h \
+ $$PWD/qquickabstractgroupbox_p.h \
+ $$PWD/qquickabstractpageindicator_p.h \
+ $$PWD/qquickabstractprogressbar_p.h \
+ $$PWD/qquickabstractradiobutton_p.h \
+ $$PWD/qquickabstractscrollbar_p.h \
+ $$PWD/qquickabstractscrollindicator_p.h \
+ $$PWD/qquickabstractslider_p.h \
+ $$PWD/qquickabstractspinbox_p.h \
+ $$PWD/qquickabstractstackview_p.h \
+ $$PWD/qquickabstractswitch_p.h \
+ $$PWD/qquickabstracttabbar_p.h \
+ $$PWD/qquickabstracttabbutton_p.h \
+ $$PWD/qquickabstracttabview_p.h \
+ $$PWD/qquickabstracttextarea_p.h \
+ $$PWD/qquickabstracttextfield_p.h \
+ $$PWD/qquickabstracttogglebutton_p.h \
+ $$PWD/qquickabstracttoolbar_p.h \
+ $$PWD/qquickcontrol_p.h \
+ $$PWD/qquickcontrol_p_p.h \
+ $$PWD/qquickexclusivegroup_p.h \
+ $$PWD/qquickpadding_p.h \
+ $$PWD/qquickstyle_p.h
+
+SOURCES += \
+ $$PWD/qquickabstractapplicationwindow.cpp \
+ $$PWD/qquickabstractbusyindicator.cpp \
+ $$PWD/qquickabstractbutton.cpp \
+ $$PWD/qquickabstractcheckable.cpp \
+ $$PWD/qquickabstractcheckbox.cpp \
+ $$PWD/qquickabstractcontainer.cpp \
+ $$PWD/qquickabstractframe.cpp \
+ $$PWD/qquickabstractgroupbox.cpp \
+ $$PWD/qquickabstractpageindicator.cpp \
+ $$PWD/qquickabstractprogressbar.cpp \
+ $$PWD/qquickabstractradiobutton.cpp \
+ $$PWD/qquickabstractscrollbar.cpp \
+ $$PWD/qquickabstractscrollindicator.cpp \
+ $$PWD/qquickabstractslider.cpp \
+ $$PWD/qquickabstractspinbox.cpp \
+ $$PWD/qquickabstractstackview.cpp \
+ $$PWD/qquickabstractswitch.cpp \
+ $$PWD/qquickabstracttabbar.cpp \
+ $$PWD/qquickabstracttabbutton.cpp \
+ $$PWD/qquickabstracttabview.cpp \
+ $$PWD/qquickabstracttextarea.cpp \
+ $$PWD/qquickabstracttextfield.cpp \
+ $$PWD/qquickabstracttogglebutton.cpp \
+ $$PWD/qquickabstracttoolbar.cpp \
+ $$PWD/qquickcontrol.cpp \
+ $$PWD/qquickexclusivegroup.cpp \
+ $$PWD/qquickstyle.cpp
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
new file mode 100644
index 00000000..c4a1ff87
--- /dev/null
+++ b/src/controls/controls.pro
@@ -0,0 +1,22 @@
+TARGET = QtQuickControls
+MODULE = quickcontrols
+CONFIG += internal_module
+
+QT += quick
+QT += core-private gui-private qml-private quick-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+QMAKE_DOCS = $$PWD/doc/qtquickcontrols2.qdocconf
+
+HEADERS += \
+ $$PWD/qtquickcontrolsglobal_p.h
+
+OTHER_FILES += \
+ $$PWD/style.json
+
+RESOURCES += \
+ $$PWD/controls.qrc
+
+include(controls.pri)
+load(qt_module)
diff --git a/src/controls/controls.qrc b/src/controls/controls.qrc
new file mode 100644
index 00000000..c1dded8a
--- /dev/null
+++ b/src/controls/controls.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/qtquickcontrols">
+ <file>style.json</file>
+</qresource>
+</RCC>
diff --git a/src/controls/doc/qtquickcontrols2.qdocconf b/src/controls/doc/qtquickcontrols2.qdocconf
new file mode 100644
index 00000000..993493d5
--- /dev/null
+++ b/src/controls/doc/qtquickcontrols2.qdocconf
@@ -0,0 +1,42 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtQuickControls2
+description = Qt Quick Controls 2 Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtQuickControls2
+
+qhp.QtQuickControls2.file = qtquickcontrols2.qhp
+qhp.QtQuickControls2.namespace = org.qt-project.qtquickcontrols2.$QT_VERSION_TAG
+qhp.QtQuickControls2.virtualFolder = qtquickcontrols2
+qhp.QtQuickControls2.indexTitle = Qt Quick Controls 2
+qhp.QtQuickControls2.indexRoot =
+
+qhp.QtQuickControls2.filterAttributes = qtquickcontrols2 $QT_VERSION qtrefdoc
+qhp.QtQuickControls2.customFilters.Qt.name = QtQuickControls2 $QT_VERSION
+qhp.QtQuickControls2.customFilters.Qt.filterAttributes = qtquickcontrols2 $QT_VERSION
+
+qhp.QtQuickControls2.subprojects = qtquickcontrols2qmltypes
+
+qhp.QtQuickControls2.subprojects.qtquickcontrols2qmltypes.title = Controls 2 QML Types
+qhp.QtQuickControls2.subprojects.qtquickcontrols2qmltypes.indexTitle = Qt Quick Controls 2 QML Types
+qhp.QtQuickControls2.subprojects.qtquickcontrols2qmltypes.selectors = qmlclass # cannot choose qmltypes from a specific group QTBUG-32985
+qhp.QtQuickControls2.subprojects.qtquickcontrols2qmltypes.sortPages = true
+
+depends = qtcore qtgui qtdoc qtqml qtquick qtquicklayouts qtquickdialogs
+
+# Specify the install path under QT_INSTALL_EXAMPLES
+# Examples will be installed under quick/controls - 'controls' subdirectory
+# is given as part of \example commands
+exampledirs += ../../../examples/quick/controls
+examplesinstallpath = quick/controls
+
+headerdirs += ../
+sourcedirs += ../
+
+imagedirs += images
+
+navigation.landingpage = "Qt Quick Controls 2"
+navigation.qmltypespage = "Qt Quick Controls 2 QML Types"
+
+tagfile = qtquickcontrols2.tags
diff --git a/src/controls/doc/src/qtquickcontrols2-index.qdoc b/src/controls/doc/src/qtquickcontrols2-index.qdoc
new file mode 100644
index 00000000..028e4bd4
--- /dev/null
+++ b/src/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-index.html
+ \title Qt Quick Controls 2
+
+ \brief The Qt Quick Controls 2 module provides a set of UI controls for Qt Quick.
+
+ The Qt Quick Controls 2 module provides a set of controls that can be used to
+ build complete interfaces in Qt Quick.
+
+ The module is new in Qt 5.6.
+
+ Visit the \l{Qt Quick Controls 2 Overview} page to get started.
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls 2 Overview}
+ \li \l{Qt Quick Controls 2 QML Types}{Qt Quick Controls 2 QML Types}
+ \endlist
+*/
diff --git a/src/controls/doc/src/qtquickcontrols2-overview.qdoc b/src/controls/doc/src/qtquickcontrols2-overview.qdoc
new file mode 100644
index 00000000..2140aa55
--- /dev/null
+++ b/src/controls/doc/src/qtquickcontrols2-overview.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-overview.html
+ \title Qt Quick Controls 2 Overview
+ \brief A set of UI controls to create user interfaces in Qt Quick
+
+ The Qt Quick Controls 2 provide a set of UI controls to create user interfaces
+ in Qt Quick.
+
+ \section1 Getting Started
+
+ TODO
+
+ \section1 Setting Up Controls from C++
+
+ TODO
+
+ \section2 Using C++ Data From QML
+
+ TODO
+
+ \section2 Deploying Qt Quick Controls 2
+
+ TODO
+
+ \section1 Related information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/controls/doc/src/qtquickcontrols2.qdoc b/src/controls/doc/src/qtquickcontrols2.qdoc
new file mode 100644
index 00000000..bb188eac
--- /dev/null
+++ b/src/controls/doc/src/qtquickcontrols2.qdoc
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Controls 2.0
+ \title Qt Quick Controls 2 QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for user interfaces.
+
+ The \l{Qt Quick Controls 2} module provides QML types for creating user
+ interfaces. These QML types work in conjunction with \l{Qt Quick} and
+ \l{Qt Quick Layouts}.
+
+ The QML types can be imported into your application using the
+ following import statement in your .qml file.
+
+ \code
+ import QtQuick.Controls 2.0
+ \endcode
+*/
diff --git a/src/controls/qquickabstractapplicationwindow.cpp b/src/controls/qquickabstractapplicationwindow.cpp
new file mode 100644
index 00000000..f6ad3084
--- /dev/null
+++ b/src/controls/qquickabstractapplicationwindow.cpp
@@ -0,0 +1,256 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractapplicationwindow_p.h"
+#include "qquickstyle_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ApplicationWindow
+ \inherits Window
+ \instantiates QQuickAbstractApplicationWindow
+ \inqmlmodule QtQuick.Controls
+ \ingroup application
+ \brief An application window.
+
+ TODO
+*/
+
+class QQuickAbstractApplicationWindowPrivate : public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractApplicationWindow)
+
+public:
+ QQuickAbstractApplicationWindowPrivate() : contentWidth(0), contentHeight(0),
+ header(Q_NULLPTR), footer(Q_NULLPTR), style(Q_NULLPTR) { }
+
+ void relayout();
+
+ void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+
+ qreal contentWidth;
+ qreal contentHeight;
+ QQuickItem *header;
+ QQuickItem *footer;
+ mutable QQuickStyle *style;
+ QQuickAbstractApplicationWindow *q_ptr;
+};
+
+void QQuickAbstractApplicationWindowPrivate::relayout()
+{
+ Q_Q(QQuickAbstractApplicationWindow);
+ QQuickItem *content = q->contentItem();
+ qreal hh = header ? header->height() : 0;
+ qreal fh = footer ? footer->height() : 0;
+
+ content->setY(hh);
+ content->setHeight(q->height() - hh - fh);
+
+ if (header)
+ header->setY(-hh);
+ if (footer)
+ footer->setY(content->height());
+}
+
+void QQuickAbstractApplicationWindowPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickAbstractApplicationWindowPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+QQuickAbstractApplicationWindow::QQuickAbstractApplicationWindow(QWindow *parent) :
+ QQuickWindowQmlImpl(parent), d_ptr(new QQuickAbstractApplicationWindowPrivate)
+{
+ d_ptr->q_ptr = this;
+}
+
+QQuickAbstractApplicationWindow::~QQuickAbstractApplicationWindow()
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->header)
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (d->footer)
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::ApplicationWindow::header
+
+ TODO
+*/
+QQuickItem *QQuickAbstractApplicationWindow::header() const
+{
+ Q_D(const QQuickAbstractApplicationWindow);
+ return d->header;
+}
+
+void QQuickAbstractApplicationWindow::setHeader(QQuickItem *header)
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->header != header) {
+ delete d->header;
+ d->header = header;
+ if (header) {
+ header->setParentItem(contentItem());
+ QQuickItemPrivate *p = QQuickItemPrivate::get(header);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(header->z()))
+ header->setZ(1);
+ }
+ emit headerChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::ApplicationWindow::footer
+
+ TODO
+*/
+QQuickItem *QQuickAbstractApplicationWindow::footer() const
+{
+ Q_D(const QQuickAbstractApplicationWindow);
+ return d->footer;
+}
+
+void QQuickAbstractApplicationWindow::setFooter(QQuickItem *footer)
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->footer != footer) {
+ delete d->footer;
+ d->footer = footer;
+ if (footer) {
+ footer->setParentItem(contentItem());
+ QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(footer->z()))
+ footer->setZ(1);
+ }
+ emit footerChanged();
+ }
+}
+
+/*!
+ \qmlproperty Style QtQuickControls2::ApplicationWindow::style
+
+ TODO
+*/
+QQuickStyle *QQuickAbstractApplicationWindow::style() const
+{
+ Q_D(const QQuickAbstractApplicationWindow);
+ if (!d->style)
+ d->style = QQuickStyle::instance(qmlEngine(this));
+ return d->style;
+}
+
+void QQuickAbstractApplicationWindow::setStyle(QQuickStyle *style)
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->style != style) {
+ d->style = style;
+ emit styleChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ApplicationWindow::contentWidth
+
+ TODO
+*/
+qreal QQuickAbstractApplicationWindow::contentWidth() const
+{
+ Q_D(const QQuickAbstractApplicationWindow);
+ return d->contentWidth;
+}
+
+void QQuickAbstractApplicationWindow::setContentWidth(qreal width)
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->contentWidth != width) {
+ d->contentWidth = width;
+ emit contentWidthChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ApplicationWindow::contentHeight
+
+ TODO
+*/
+qreal QQuickAbstractApplicationWindow::contentHeight() const
+{
+ Q_D(const QQuickAbstractApplicationWindow);
+ return d->contentHeight;
+}
+
+void QQuickAbstractApplicationWindow::setContentHeight(qreal height)
+{
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->contentHeight != height) {
+ d->contentHeight = height;
+ emit contentHeightChanged();
+ }
+}
+
+void QQuickAbstractApplicationWindow::resizeEvent(QResizeEvent *event)
+{
+ QQuickWindowQmlImpl::resizeEvent(event);
+
+ Q_D(QQuickAbstractApplicationWindow);
+ if (d->header) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->header);
+ if (!p->widthValid || qFuzzyCompare(d->header->width(), event->oldSize().width()))
+ d->header->setWidth(width());
+ }
+ if (d->footer) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->footer);
+ if (!p->widthValid || qFuzzyCompare(d->footer->width(), event->oldSize().width()))
+ d->footer->setWidth(width());
+ }
+ d->relayout();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractapplicationwindow_p.h b/src/controls/qquickabstractapplicationwindow_p.h
new file mode 100644
index 00000000..f8f2033a
--- /dev/null
+++ b/src/controls/qquickabstractapplicationwindow_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTAPPLICATIONWINDOW_P_H
+#define QQUICKABSTRACTAPPLICATIONWINDOW_P_H
+
+#include <QtQuick/private/qquickwindowmodule_p.h>
+#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickStyle;
+class QQuickAbstractApplicationWindowPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractApplicationWindow : public QQuickWindowQmlImpl
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
+ Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
+ Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle NOTIFY styleChanged FINAL)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
+
+public:
+ explicit QQuickAbstractApplicationWindow(QWindow *parent = Q_NULLPTR);
+ ~QQuickAbstractApplicationWindow();
+
+ QQuickItem *header() const;
+ void setHeader(QQuickItem *header);
+
+ QQuickItem *footer() const;
+ void setFooter(QQuickItem *footer);
+
+ QQuickStyle *style() const;
+ void setStyle(QQuickStyle *style);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+Q_SIGNALS:
+ void headerChanged();
+ void footerChanged();
+ void styleChanged();
+ void contentWidthChanged();
+ void contentHeightChanged();
+
+protected:
+ void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractApplicationWindow)
+ Q_DECLARE_PRIVATE(QQuickAbstractApplicationWindow)
+ QScopedPointer<QQuickAbstractApplicationWindowPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTAPPLICATIONWINDOW_P_H
diff --git a/src/controls/qquickabstractbusyindicator.cpp b/src/controls/qquickabstractbusyindicator.cpp
new file mode 100644
index 00000000..4370668a
--- /dev/null
+++ b/src/controls/qquickabstractbusyindicator.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractbusyindicator_p.h"
+#include "qquickcontrol_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype BusyIndicator
+ \inherits Control
+ \instantiates QQuickAbstractBusyIndicator
+ \inqmlmodule QtQuick.Controls
+ \ingroup indicators
+ \brief A busy indicator.
+
+ TODO
+*/
+
+class QQuickAbstractBusyIndicatorPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickAbstractBusyIndicatorPrivate() : running(false), indicator(Q_NULLPTR) { }
+
+ bool running;
+ QQuickItem *indicator;
+};
+
+QQuickAbstractBusyIndicator::QQuickAbstractBusyIndicator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractBusyIndicatorPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::BusyIndicator::running
+
+ TODO
+*/
+bool QQuickAbstractBusyIndicator::isRunning() const
+{
+ Q_D(const QQuickAbstractBusyIndicator);
+ return d->running;
+}
+
+void QQuickAbstractBusyIndicator::setRunning(bool running)
+{
+ Q_D(QQuickAbstractBusyIndicator);
+ if (d->running != running) {
+ d->running = running;
+ emit runningChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::BusyIndicator::indicator
+
+ TODO
+*/
+QQuickItem *QQuickAbstractBusyIndicator::indicator() const
+{
+ Q_D(const QQuickAbstractBusyIndicator);
+ return d->indicator;
+}
+
+void QQuickAbstractBusyIndicator::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractBusyIndicator);
+ if (d->indicator != indicator) {
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator && !indicator->parentItem())
+ indicator->setParentItem(this);
+ emit indicatorChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractbusyindicator_p.h b/src/controls/qquickabstractbusyindicator_p.h
new file mode 100644
index 00000000..a99da139
--- /dev/null
+++ b/src/controls/qquickabstractbusyindicator_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTBUSYINDICATOR_P_H
+#define QQUICKABSTRACTBUSYINDICATOR_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractBusyIndicatorPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractBusyIndicator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+
+public:
+ explicit QQuickAbstractBusyIndicator(QQuickItem *parent = Q_NULLPTR);
+
+ bool isRunning() const;
+ void setRunning(bool running);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+Q_SIGNALS:
+ void runningChanged();
+ void indicatorChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractBusyIndicator)
+ Q_DECLARE_PRIVATE(QQuickAbstractBusyIndicator)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTBUSYINDICATOR_P_H
diff --git a/src/controls/qquickabstractbutton.cpp b/src/controls/qquickabstractbutton.cpp
new file mode 100644
index 00000000..5b207520
--- /dev/null
+++ b/src/controls/qquickabstractbutton.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractbutton_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Button
+ \inherits Control
+ \instantiates QQuickAbstractButton
+ \inqmlmodule QtQuick.Controls
+ \ingroup buttons
+ \brief A button control.
+
+ TODO
+*/
+
+QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() :
+ pressed(false), label(Q_NULLPTR)
+{
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractButtonPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty string QtQuickControls2::Button::text
+
+ TODO
+*/
+QString QQuickAbstractButton::text() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->text;
+}
+
+void QQuickAbstractButton::setText(const QString &text)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->text != text) {
+ d->text = text;
+ emit textChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::Button::pressed
+
+ TODO
+*/
+bool QQuickAbstractButton::isPressed() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->pressed;
+}
+
+void QQuickAbstractButton::setPressed(bool pressed)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->pressed != pressed) {
+ d->pressed = pressed;
+ emit pressedChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Button::label
+
+ TODO
+*/
+QQuickItem *QQuickAbstractButton::label() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->label;
+}
+
+void QQuickAbstractButton::setLabel(QQuickItem *label)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->label != label) {
+ delete d->label;
+ d->label = label;
+ if (label && !label->parentItem())
+ label->setParentItem(this);
+ emit labelChanged();
+ }
+}
+
+void QQuickAbstractButton::focusOutEvent(QFocusEvent *event)
+{
+ QQuickControl::focusOutEvent(event);
+ setPressed(false);
+}
+
+void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
+{
+ QQuickControl::keyPressEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ setPressed(true);
+ event->accept();
+ }
+}
+
+void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
+{
+ QQuickControl::keyReleaseEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ emit clicked();
+ setPressed(false);
+ event->accept();
+ }
+}
+
+void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
+{
+ QQuickControl::mousePressEvent(event);
+ setPressed(true);
+ event->accept();
+}
+
+void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
+{
+ QQuickControl::mouseMoveEvent(event);
+ setPressed(contains(event->pos()));
+ event->accept();
+}
+
+void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
+{
+ QQuickControl::mouseReleaseEvent(event);
+ if (contains(event->pos()))
+ emit clicked();
+ setPressed(false);
+ event->accept();
+}
+
+void QQuickAbstractButton::mouseUngrabEvent()
+{
+ QQuickControl::mouseUngrabEvent();
+ setPressed(false);
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractbutton_p.h b/src/controls/qquickabstractbutton_p.h
new file mode 100644
index 00000000..4be68f29
--- /dev/null
+++ b/src/controls/qquickabstractbutton_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTBUTTON_P_H
+#define QQUICKABSTRACTBUTTON_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractButtonPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractButton : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
+
+public:
+ explicit QQuickAbstractButton(QQuickItem *parent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ QQuickItem *label() const;
+ void setLabel(QQuickItem *label);
+
+Q_SIGNALS:
+ void clicked();
+ void textChanged();
+ void pressedChanged();
+ void labelChanged();
+
+protected:
+ QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent);
+
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractButton)
+ Q_DECLARE_PRIVATE(QQuickAbstractButton)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTBUTTON_P_H
diff --git a/src/controls/qquickabstractbutton_p_p.h b/src/controls/qquickabstractbutton_p_p.h
new file mode 100644
index 00000000..fa24543b
--- /dev/null
+++ b/src/controls/qquickabstractbutton_p_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTBUTTON_P_P_H
+#define QQUICKABSTRACTBUTTON_P_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractButtonPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractButton)
+
+public:
+ QQuickAbstractButtonPrivate();
+
+ QString text;
+ bool pressed;
+ QQuickItem *label;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTBUTTON_P_P_H
diff --git a/src/controls/qquickabstractcheckable.cpp b/src/controls/qquickabstractcheckable.cpp
new file mode 100644
index 00000000..3811ada4
--- /dev/null
+++ b/src/controls/qquickabstractcheckable.cpp
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcheckable_p.h"
+#include "qquickabstractcheckable_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Checkable
+ \inherits Button
+ \instantiates QQuickAbstractCheckable
+ \inqmlmodule QtQuick.Controls
+ \qmlabstract
+ \internal
+*/
+
+QQuickAbstractCheckablePrivate::QQuickAbstractCheckablePrivate() :
+ checked(false), exclusive(false), indicator(Q_NULLPTR), layoutDirection(Qt::LeftToRight)
+{
+}
+
+QQuickAbstractCheckable::QQuickAbstractCheckable(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickAbstractCheckablePrivate), parent)
+{
+}
+
+QQuickAbstractCheckable::QQuickAbstractCheckable(QQuickAbstractCheckablePrivate &dd, QQuickItem *parent) :
+ QQuickAbstractButton(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::Checkable::checked
+
+ TODO
+*/
+bool QQuickAbstractCheckable::isChecked() const
+{
+ Q_D(const QQuickAbstractCheckable);
+ return d->checked;
+}
+
+void QQuickAbstractCheckable::setChecked(bool checked)
+{
+ Q_D(QQuickAbstractCheckable);
+ if (d->checked != checked) {
+ d->checked = checked;
+ emit checkedChanged();
+ }
+}
+
+bool QQuickAbstractCheckable::isExclusive() const
+{
+ Q_D(const QQuickAbstractCheckable);
+ return d->exclusive;
+}
+
+void QQuickAbstractCheckable::setExclusive(bool exclusive)
+{
+ Q_D(QQuickAbstractCheckable);
+ d->exclusive = exclusive;
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Checkable::indicator
+
+ TODO
+*/
+QQuickItem *QQuickAbstractCheckable::indicator() const
+{
+ Q_D(const QQuickAbstractCheckable);
+ return d->indicator;
+}
+
+void QQuickAbstractCheckable::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractCheckable);
+ if (d->indicator != indicator) {
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(this);
+ indicator->setAcceptedMouseButtons(Qt::LeftButton);
+ }
+ emit indicatorChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Checkable::layoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractCheckable::layoutDirection() const
+{
+ Q_D(const QQuickAbstractCheckable);
+ return d->layoutDirection;
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Checkable::effectiveLayoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractCheckable::effectiveLayoutDirection() const
+{
+ Q_D(const QQuickAbstractCheckable);
+ if (isMirrored())
+ return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;
+ return d->layoutDirection;
+}
+
+void QQuickAbstractCheckable::setLayoutDirection(Qt::LayoutDirection direction)
+{
+ Q_D(QQuickAbstractCheckable);
+ if (d->layoutDirection != direction) {
+ d->layoutDirection = direction;
+ emit layoutDirectionChanged();
+ emit effectiveLayoutDirectionChanged();
+ }
+}
+
+/*!
+ \qmlmethod void QtQuickControls2::Checkable::toggle()
+
+ TODO
+*/
+void QQuickAbstractCheckable::toggle()
+{
+ Q_D(QQuickAbstractCheckable);
+ setChecked(!d->checked);
+}
+
+void QQuickAbstractCheckable::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickAbstractCheckable);
+ QQuickAbstractButton::keyReleaseEvent(event);
+ if (event->key() == Qt::Key_Space)
+ setChecked(d->exclusive || !d->checked);
+}
+
+void QQuickAbstractCheckable::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCheckable);
+ QQuickAbstractButton::mouseReleaseEvent(event);
+ if (contains(event->pos()))
+ setChecked(d->exclusive || !d->checked);
+}
+
+void QQuickAbstractCheckable::mirrorChange()
+{
+ emit effectiveLayoutDirectionChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractcheckable_p.h b/src/controls/qquickabstractcheckable_p.h
new file mode 100644
index 00000000..d82ea213
--- /dev/null
+++ b/src/controls/qquickabstractcheckable_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCHECKABLE_P_H
+#define QQUICKABSTRACTCHECKABLE_P_H
+
+#include <QtQuickControls/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCheckablePrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractCheckable : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged FINAL)
+
+public:
+ explicit QQuickAbstractCheckable(QQuickItem *parent = Q_NULLPTR);
+
+ bool isChecked() const;
+ void setChecked(bool checked);
+
+ bool isExclusive() const;
+ void setExclusive(bool exclusive);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+ Qt::LayoutDirection layoutDirection() const;
+ Qt::LayoutDirection effectiveLayoutDirection() const;
+ void setLayoutDirection(Qt::LayoutDirection direction);
+
+public Q_SLOTS:
+ void toggle();
+
+Q_SIGNALS:
+ void checkedChanged();
+ void indicatorChanged();
+ void layoutDirectionChanged();
+ void effectiveLayoutDirectionChanged();
+
+protected:
+ QQuickAbstractCheckable(QQuickAbstractCheckablePrivate &dd, QQuickItem *parent);
+
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+
+ void mirrorChange() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractCheckable)
+ Q_DECLARE_PRIVATE(QQuickAbstractCheckable)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCHECKABLE_P_H
diff --git a/src/controls/qquickabstractcheckable_p_p.h b/src/controls/qquickabstractcheckable_p_p.h
new file mode 100644
index 00000000..9788bf05
--- /dev/null
+++ b/src/controls/qquickabstractcheckable_p_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCHECKABLE_P_P_H
+#define QQUICKABSTRACTCHECKABLE_P_P_H
+
+#include <QtQuickControls/private/qquickabstractbutton_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCheckablePrivate : public QQuickAbstractButtonPrivate
+{
+public:
+ QQuickAbstractCheckablePrivate();
+
+ bool checked;
+ bool exclusive;
+ QQuickItem *indicator;
+ Qt::LayoutDirection layoutDirection;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCHECKABLE_P_P_H
diff --git a/src/controls/qquickabstractcheckbox.cpp b/src/controls/qquickabstractcheckbox.cpp
new file mode 100644
index 00000000..67d9efab
--- /dev/null
+++ b/src/controls/qquickabstractcheckbox.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcheckbox_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CheckBox
+ \inherits Checkable
+ \instantiates QQuickAbstractCheckBox
+ \inqmlmodule QtQuick.Controls
+ \ingroup buttons
+ \brief A check box control.
+
+ TODO
+*/
+
+QQuickAbstractCheckBox::QQuickAbstractCheckBox(QQuickItem *parent) :
+ QQuickAbstractCheckable(parent)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractcheckbox_p.h b/src/controls/qquickabstractcheckbox_p.h
new file mode 100644
index 00000000..e97a1031
--- /dev/null
+++ b/src/controls/qquickabstractcheckbox_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCHECKBOX_P_H
+#define QQUICKABSTRACTCHECKBOX_P_H
+
+#include <QtQuickControls/private/qquickabstractcheckable_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractCheckBox : public QQuickAbstractCheckable
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractCheckBox(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCHECKBOX_P_H
diff --git a/src/controls/qquickabstractcontainer.cpp b/src/controls/qquickabstractcontainer.cpp
new file mode 100644
index 00000000..b82f951a
--- /dev/null
+++ b/src/controls/qquickabstractcontainer.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcontainer_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Container
+ \inherits Control
+ \instantiates QQuickAbstractContainer
+ \inqmlmodule QtQuick.Controls
+ \qmlabstract
+ \internal
+*/
+
+QQuickAbstractContainerPrivate::QQuickAbstractContainerPrivate() :
+ contentWidth(0), contentHeight(0), contentItem(Q_NULLPTR)
+{
+}
+
+QQuickAbstractContainer::QQuickAbstractContainer(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractContainerPrivate), parent)
+{
+}
+
+QQuickAbstractContainer::QQuickAbstractContainer(QQuickAbstractContainerPrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Container::contentWidth
+
+ TODO
+*/
+qreal QQuickAbstractContainer::contentWidth() const
+{
+ Q_D(const QQuickAbstractContainer);
+ return d->contentWidth;
+}
+
+void QQuickAbstractContainer::setContentWidth(qreal width)
+{
+ Q_D(QQuickAbstractContainer);
+ if (d->contentWidth != width) {
+ d->contentWidth = width;
+ emit contentWidthChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Container::contentHeight
+
+ TODO
+*/
+qreal QQuickAbstractContainer::contentHeight() const
+{
+ Q_D(const QQuickAbstractContainer);
+ return d->contentHeight;
+}
+
+void QQuickAbstractContainer::setContentHeight(qreal height)
+{
+ Q_D(QQuickAbstractContainer);
+ if (d->contentHeight != height) {
+ d->contentHeight = height;
+ emit contentHeightChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Container::contentItem
+
+ TODO
+*/
+QQuickItem *QQuickAbstractContainer::contentItem() const
+{
+ Q_D(const QQuickAbstractContainer);
+ return d->contentItem;
+}
+
+void QQuickAbstractContainer::setContentItem(QQuickItem *item)
+{
+ Q_D(QQuickAbstractContainer);
+ if (d->contentItem != item) {
+ delete d->contentItem;
+ d->contentItem = item;
+ if (item) {
+ if (!item->parentItem())
+ item->setParentItem(this);
+ }
+ emit contentItemChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractcontainer_p.h b/src/controls/qquickabstractcontainer_p.h
new file mode 100644
index 00000000..c5accc0e
--- /dev/null
+++ b/src/controls/qquickabstractcontainer_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCONTAINER_P_H
+#define QQUICKABSTRACTCONTAINER_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractContainerPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractContainer : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+
+public:
+ explicit QQuickAbstractContainer(QQuickItem *parent = Q_NULLPTR);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+ QQuickItem *contentItem() const;
+ void setContentItem(QQuickItem *item);
+
+Q_SIGNALS:
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void contentItemChanged();
+
+protected:
+ QQuickAbstractContainer(QQuickAbstractContainerPrivate &dd, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractContainer)
+ Q_DECLARE_PRIVATE(QQuickAbstractContainer)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCONTAINER_P_H
diff --git a/src/controls/qquickabstractcontainer_p_p.h b/src/controls/qquickabstractcontainer_p_p.h
new file mode 100644
index 00000000..bf2080af
--- /dev/null
+++ b/src/controls/qquickabstractcontainer_p_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCONTAINER_P_P_H
+#define QQUICKABSTRACTCONTAINER_P_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractContainerPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickAbstractContainerPrivate();
+
+ qreal contentWidth;
+ qreal contentHeight;
+ QQuickItem *contentItem;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCONTAINER_P_P_H
diff --git a/src/controls/qquickabstractframe.cpp b/src/controls/qquickabstractframe.cpp
new file mode 100644
index 00000000..9f8f2aa6
--- /dev/null
+++ b/src/controls/qquickabstractframe.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractframe_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Frame
+ \inherits Container
+ \instantiates QQuickAbstractFrame
+ \inqmlmodule QtQuick.Controls
+ \ingroup containers
+ \brief A frame control.
+
+ TODO
+*/
+
+QQuickAbstractFrame::QQuickAbstractFrame(QQuickItem *parent) :
+ QQuickAbstractContainer(parent)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractframe_p.h b/src/controls/qquickabstractframe_p.h
new file mode 100644
index 00000000..317e2360
--- /dev/null
+++ b/src/controls/qquickabstractframe_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTFRAME_P_H
+#define QQUICKABSTRACTFRAME_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractFrame : public QQuickAbstractContainer
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractFrame(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTFRAME_P_H
diff --git a/src/controls/qquickabstractgroupbox.cpp b/src/controls/qquickabstractgroupbox.cpp
new file mode 100644
index 00000000..8d2f9ec0
--- /dev/null
+++ b/src/controls/qquickabstractgroupbox.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractgroupbox_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype GroupBox
+ \inherits Container
+ \instantiates QQuickAbstractGroupBox
+ \inqmlmodule QtQuick.Controls
+ \ingroup containers
+ \brief A group box control.
+
+ TODO
+*/
+
+class QQuickAbstractGroupBoxPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QQuickAbstractGroupBoxPrivate() : label(Q_NULLPTR), frame(Q_NULLPTR) { }
+
+ QString title;
+ QQuickItem *label;
+ QQuickItem *frame;
+};
+
+QQuickAbstractGroupBox::QQuickAbstractGroupBox(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractGroupBoxPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty string QtQuickControls2::GroupBox::title
+
+ TODO
+*/
+QString QQuickAbstractGroupBox::title() const
+{
+ Q_D(const QQuickAbstractGroupBox);
+ return d->title;
+}
+
+void QQuickAbstractGroupBox::setTitle(const QString &title)
+{
+ Q_D(QQuickAbstractGroupBox);
+ if (d->title != title) {
+ d->title = title;
+ emit titleChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::GroupBox::label
+
+ TODO
+*/
+QQuickItem *QQuickAbstractGroupBox::label() const
+{
+ Q_D(const QQuickAbstractGroupBox);
+ return d->label;
+}
+
+void QQuickAbstractGroupBox::setLabel(QQuickItem *label)
+{
+ Q_D(QQuickAbstractGroupBox);
+ if (d->label != label) {
+ delete d->label;
+ d->label = label;
+ if (label && !label->parentItem())
+ label->setParentItem(this);
+ emit labelChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::GroupBox::frame
+
+ TODO
+*/
+QQuickItem *QQuickAbstractGroupBox::frame() const
+{
+ Q_D(const QQuickAbstractGroupBox);
+ return d->frame;
+}
+
+void QQuickAbstractGroupBox::setFrame(QQuickItem *frame)
+{
+ Q_D(QQuickAbstractGroupBox);
+ if (d->frame != frame) {
+ delete d->frame;
+ d->frame = frame;
+ if (frame && !frame->parentItem())
+ frame->setParentItem(this);
+ emit frameChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractgroupbox_p.h b/src/controls/qquickabstractgroupbox_p.h
new file mode 100644
index 00000000..b1118441
--- /dev/null
+++ b/src/controls/qquickabstractgroupbox_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTGROUPBOX_P_H
+#define QQUICKABSTRACTGROUPBOX_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractGroupBoxPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractGroupBox : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
+ Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged FINAL)
+
+public:
+ explicit QQuickAbstractGroupBox(QQuickItem *parent = Q_NULLPTR);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QQuickItem *label() const;
+ void setLabel(QQuickItem *label);
+
+ QQuickItem *frame() const;
+ void setFrame(QQuickItem *frame);
+
+Q_SIGNALS:
+ void titleChanged();
+ void labelChanged();
+ void frameChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractGroupBox)
+ Q_DECLARE_PRIVATE(QQuickAbstractGroupBox)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTGROUPBOX_P_H
diff --git a/src/controls/qquickabstractpageindicator.cpp b/src/controls/qquickabstractpageindicator.cpp
new file mode 100644
index 00000000..ee3b98bd
--- /dev/null
+++ b/src/controls/qquickabstractpageindicator.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractpageindicator_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype PageIndicator
+ \inherits Control
+ \instantiates QQuickAbstractPageIndicator
+ \inqmlmodule QtQuick.Controls
+ \ingroup indicators
+ \brief A page indicator.
+
+ TODO
+*/
+
+class QQuickAbstractPageIndicatorPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QQuickAbstractPageIndicatorPrivate() : count(0), currentIndex(0) { }
+
+ int count;
+ int currentIndex;
+};
+
+QQuickAbstractPageIndicator::QQuickAbstractPageIndicator(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractPageIndicatorPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty int QtQuickControls2::PageIndicator::count
+
+ TODO
+*/
+int QQuickAbstractPageIndicator::count() const
+{
+ Q_D(const QQuickAbstractPageIndicator);
+ return d->count;
+}
+
+void QQuickAbstractPageIndicator::setCount(int count)
+{
+ Q_D(QQuickAbstractPageIndicator);
+ if (d->count != count) {
+ d->count = count;
+ emit countChanged();
+ }
+}
+
+/*!
+ \qmlproperty int QtQuickControls2::PageIndicator::currentIndex
+
+ TODO
+*/
+int QQuickAbstractPageIndicator::currentIndex() const
+{
+ Q_D(const QQuickAbstractPageIndicator);
+ return d->currentIndex;
+}
+
+void QQuickAbstractPageIndicator::setCurrentIndex(int index)
+{
+ Q_D(QQuickAbstractPageIndicator);
+ if (d->currentIndex != index) {
+ d->currentIndex = index;
+ emit currentIndexChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractpageindicator_p.h b/src/controls/qquickabstractpageindicator_p.h
new file mode 100644
index 00000000..aa6888bb
--- /dev/null
+++ b/src/controls/qquickabstractpageindicator_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTPAGEINDICATOR_P_H
+#define QQUICKABSTRACTPAGEINDICATOR_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractPageIndicatorPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractPageIndicator : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+
+public:
+ explicit QQuickAbstractPageIndicator(QQuickItem *parent = Q_NULLPTR);
+
+ int count() const;
+ void setCount(int count);
+
+ int currentIndex() const;
+ void setCurrentIndex(int index);
+
+Q_SIGNALS:
+ void countChanged();
+ void currentIndexChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractPageIndicator)
+ Q_DECLARE_PRIVATE(QQuickAbstractPageIndicator)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTPAGEINDICATOR_P_H
diff --git a/src/controls/qquickabstractprogressbar.cpp b/src/controls/qquickabstractprogressbar.cpp
new file mode 100644
index 00000000..7e38b167
--- /dev/null
+++ b/src/controls/qquickabstractprogressbar.cpp
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractprogressbar_p.h"
+#include "qquickcontrol_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ProgressBar
+ \inherits Control
+ \instantiates QQuickAbstractProgressBar
+ \inqmlmodule QtQuick.Controls
+ \ingroup indicators
+ \brief A progress bar.
+
+ TODO
+*/
+
+class QQuickAbstractProgressBarPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickAbstractProgressBarPrivate() : value(0), indeterminate(false),
+ layoutDirection(Qt::LeftToRight), indicator(Q_NULLPTR) { }
+
+ qreal value;
+ bool indeterminate;
+ Qt::LayoutDirection layoutDirection;
+ QQuickItem *indicator;
+};
+
+QQuickAbstractProgressBar::QQuickAbstractProgressBar(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractProgressBarPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ProgressBar::value
+
+ TODO
+*/
+qreal QQuickAbstractProgressBar::value() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ return d->value;
+}
+
+void QQuickAbstractProgressBar::setValue(qreal value)
+{
+ Q_D(QQuickAbstractProgressBar);
+ value = qBound(0.0, value, 1.0);
+ if (!qFuzzyCompare(d->value, value)) {
+ d->value = value;
+ emit valueChanged();
+ emit visualPositionChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ProgressBar::visualPosition
+
+ TODO
+*/
+qreal QQuickAbstractProgressBar::visualPosition() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ if (effectiveLayoutDirection() == Qt::RightToLeft)
+ return 1.0 - d->value;
+ return d->value;
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::ProgressBar::indeterminate
+
+ TODO
+*/
+bool QQuickAbstractProgressBar::isIndeterminate() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ return d->indeterminate;
+}
+
+void QQuickAbstractProgressBar::setIndeterminate(bool indeterminate)
+{
+ Q_D(QQuickAbstractProgressBar);
+ if (d->indeterminate != indeterminate) {
+ d->indeterminate = indeterminate;
+ emit indeterminateChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::ProgressBar::layoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractProgressBar::layoutDirection() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ return d->layoutDirection;
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::ProgressBar::effectiveLayoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractProgressBar::effectiveLayoutDirection() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ if (isMirrored())
+ return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;
+ return d->layoutDirection;
+}
+
+void QQuickAbstractProgressBar::setLayoutDirection(Qt::LayoutDirection direction)
+{
+ Q_D(QQuickAbstractProgressBar);
+ if (d->layoutDirection != direction) {
+ d->layoutDirection = direction;
+ emit layoutDirectionChanged();
+ emit effectiveLayoutDirectionChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::ProgressBar::indicator
+
+ TODO
+*/
+QQuickItem *QQuickAbstractProgressBar::indicator() const
+{
+ Q_D(const QQuickAbstractProgressBar);
+ return d->indicator;
+}
+
+void QQuickAbstractProgressBar::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractProgressBar);
+ if (d->indicator != indicator) {
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator && !indicator->parentItem())
+ indicator->setParentItem(this);
+ emit indicatorChanged();
+ }
+}
+
+void QQuickAbstractProgressBar::mirrorChange()
+{
+ emit effectiveLayoutDirectionChanged();
+ emit visualPositionChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractprogressbar_p.h b/src/controls/qquickabstractprogressbar_p.h
new file mode 100644
index 00000000..8215ad31
--- /dev/null
+++ b/src/controls/qquickabstractprogressbar_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTPROGRESSBAR_P_H
+#define QQUICKABSTRACTPROGRESSBAR_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractProgressBarPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractProgressBar : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+ Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate NOTIFY indeterminateChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+
+public:
+ explicit QQuickAbstractProgressBar(QQuickItem *parent = Q_NULLPTR);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal visualPosition() const;
+
+ bool isIndeterminate() const;
+ void setIndeterminate(bool indeterminate);
+
+ Qt::LayoutDirection layoutDirection() const;
+ Qt::LayoutDirection effectiveLayoutDirection() const;
+ void setLayoutDirection(Qt::LayoutDirection direction);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+Q_SIGNALS:
+ void valueChanged();
+ void visualPositionChanged();
+ void indeterminateChanged();
+ void layoutDirectionChanged();
+ void effectiveLayoutDirectionChanged();
+ void indicatorChanged();
+
+protected:
+ void mirrorChange() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractProgressBar)
+ Q_DECLARE_PRIVATE(QQuickAbstractProgressBar)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTPROGRESSBAR_P_H
diff --git a/src/controls/qquickabstractradiobutton.cpp b/src/controls/qquickabstractradiobutton.cpp
new file mode 100644
index 00000000..75f47ac0
--- /dev/null
+++ b/src/controls/qquickabstractradiobutton.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractradiobutton_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype RadioButton
+ \inherits Checkable
+ \instantiates QQuickAbstractRadioButton
+ \inqmlmodule QtQuick.Controls
+ \ingroup buttons
+ \brief A radio button control.
+
+ TODO
+
+ \sa ExclusiveGroup
+*/
+
+QQuickAbstractRadioButton::QQuickAbstractRadioButton(QQuickItem *parent) :
+ QQuickAbstractCheckable(parent)
+{
+ setExclusive(true);
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractradiobutton_p.h b/src/controls/qquickabstractradiobutton_p.h
new file mode 100644
index 00000000..56d67868
--- /dev/null
+++ b/src/controls/qquickabstractradiobutton_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTRADIOBUTTON_P_H
+#define QQUICKABSTRACTRADIOBUTTON_P_H
+
+#include <QtQuickControls/private/qquickabstractcheckable_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractRadioButton : public QQuickAbstractCheckable
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractRadioButton(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTRADIOBUTTON_P_H
diff --git a/src/controls/qquickabstractscrollbar.cpp b/src/controls/qquickabstractscrollbar.cpp
new file mode 100644
index 00000000..09ccace6
--- /dev/null
+++ b/src/controls/qquickabstractscrollbar.cpp
@@ -0,0 +1,428 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractscrollbar_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ScrollBar
+ \inherits Control
+ \instantiates QQuickAbstractScrollBar
+ \inqmlmodule QtQuick.Controls
+ \ingroup indicators
+ \ingroup sliders
+ \brief A scroll bar.
+
+ TODO
+*/
+
+class QQuickAbstractScrollBarPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickAbstractScrollBarPrivate() : size(0), position(0), offset(0),
+ active(false), pressed(false), moving(false),
+ orientation(Qt::Vertical), handle(Q_NULLPTR) { }
+
+ static QQuickAbstractScrollBarPrivate *get(QQuickAbstractScrollBar *bar)
+ {
+ return bar->d_func();
+ }
+
+ qreal size;
+ qreal position;
+ qreal offset;
+ bool active;
+ bool pressed;
+ bool moving;
+ Qt::Orientation orientation;
+ QQuickItem *handle;
+};
+
+QQuickAbstractScrollBar::QQuickAbstractScrollBar(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractScrollBarPrivate), parent)
+{
+ setKeepMouseGrab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickScrollBarAttached *QQuickAbstractScrollBar::qmlAttachedProperties(QObject *object)
+{
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
+ if (flickable)
+ return new QQuickScrollBarAttached(flickable);
+
+ qWarning() << "ScrollBar must be attached to a Flickable" << object;
+ return Q_NULLPTR;
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ScrollBar::size
+
+ TODO
+*/
+qreal QQuickAbstractScrollBar::size() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->size;
+}
+
+void QQuickAbstractScrollBar::setSize(qreal size)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (!qFuzzyCompare(d->size, size)) {
+ d->size = size;
+ emit sizeChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ScrollBar::position
+
+ TODO
+*/
+qreal QQuickAbstractScrollBar::position() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->position;
+}
+
+void QQuickAbstractScrollBar::setPosition(qreal position)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (!qFuzzyCompare(d->position, position)) {
+ d->position = position;
+ emit positionChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::ScrollBar::active
+
+ TODO
+*/
+bool QQuickAbstractScrollBar::isActive() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->active;
+}
+
+void QQuickAbstractScrollBar::setActive(bool active)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (d->active != active) {
+ d->active = active;
+ emit activeChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::ScrollBar::pressed
+
+ TODO
+*/
+bool QQuickAbstractScrollBar::isPressed() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->pressed;
+}
+
+void QQuickAbstractScrollBar::setPressed(bool pressed)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (d->pressed != pressed) {
+ d->pressed = pressed;
+ setActive(d->pressed || d->moving);
+ emit pressedChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::ScrollBar::orientation
+
+ TODO
+*/
+Qt::Orientation QQuickAbstractScrollBar::orientation() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->orientation;
+}
+
+void QQuickAbstractScrollBar::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (d->orientation != orientation) {
+ d->orientation = orientation;
+ emit orientationChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::ScrollBar::handle
+
+ TODO
+*/
+QQuickItem *QQuickAbstractScrollBar::handle() const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ return d->handle;
+}
+
+void QQuickAbstractScrollBar::setHandle(QQuickItem *handle)
+{
+ Q_D(QQuickAbstractScrollBar);
+ if (d->handle != handle) {
+ delete d->handle;
+ d->handle = handle;
+ if (handle && !handle->parentItem())
+ handle->setParentItem(this);
+ emit handleChanged();
+ }
+}
+
+void QQuickAbstractScrollBar::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractScrollBar);
+ QQuickControl::mousePressEvent(event);
+ d->offset = positionAt(event->pos()) - d->position;
+ if (d->offset < 0 || d->offset > d->size)
+ d->offset = d->size / 2;
+ setPressed(true);
+ event->accept();
+}
+
+void QQuickAbstractScrollBar::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractScrollBar);
+ QQuickControl::mouseMoveEvent(event);
+ setPosition(qBound(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
+ event->accept();
+}
+
+void QQuickAbstractScrollBar::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractScrollBar);
+ QQuickControl::mouseReleaseEvent(event);
+ setPosition(qBound(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
+ d->offset = 0.0;
+ setPressed(false);
+ event->accept();
+}
+
+qreal QQuickAbstractScrollBar::positionAt(const QPoint &point) const
+{
+ Q_D(const QQuickAbstractScrollBar);
+ if (d->orientation == Qt::Horizontal)
+ return point.x() / width();
+ else
+ return point.y() / height();
+}
+
+class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+public:
+ QQuickScrollBarAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
+
+ void activateHorizontal();
+ void activateVertical();
+ void scrollHorizontal();
+ void scrollVertical();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+ QQuickFlickable *flickable;
+ QQuickAbstractScrollBar *horizontal;
+ QQuickAbstractScrollBar *vertical;
+};
+
+void QQuickScrollBarAttachedPrivate::activateHorizontal()
+{
+ QQuickAbstractScrollBarPrivate *p = QQuickAbstractScrollBarPrivate::get(horizontal);
+ p->moving = flickable->isMovingHorizontally();
+ horizontal->setActive(p->moving || p->pressed);
+}
+
+void QQuickScrollBarAttachedPrivate::activateVertical()
+{
+ QQuickAbstractScrollBarPrivate *p = QQuickAbstractScrollBarPrivate::get(vertical);
+ p->moving = flickable->isMovingVertically();
+ vertical->setActive(p->moving || p->pressed);
+}
+
+// TODO: QQuickFlickable::maxXYExtent()
+class QQuickFriendlyFlickable : public QQuickFlickable
+{
+ friend class QQuickScrollBarAttachedPrivate;
+};
+
+void QQuickScrollBarAttachedPrivate::scrollHorizontal()
+{
+ QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
+
+ const qreal viewwidth = f->width();
+ const qreal maxxextent = -f->maxXExtent() + f->minXExtent();
+ qreal cx = horizontal->position() * (maxxextent + viewwidth) - f->minXExtent();
+ if (!qIsNaN(cx) && !qFuzzyCompare(cx, flickable->contentX()))
+ flickable->setContentX(cx);
+}
+
+void QQuickScrollBarAttachedPrivate::scrollVertical()
+{
+ QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
+
+ const qreal viewheight = f->height();
+ const qreal maxyextent = -f->maxYExtent() + f->minYExtent();
+ qreal cy = vertical->position() * (maxyextent + viewheight) - f->minYExtent();
+ if (!qIsNaN(cy) && !qFuzzyCompare(cy, flickable->contentY()))
+ flickable->setContentY(cy);
+}
+
+void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_ASSERT(item == flickable);
+ if (horizontal) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(horizontal);
+ if (!p->widthValid || qFuzzyCompare(horizontal->width(), oldGeometry.width()))
+ horizontal->setWidth(newGeometry.width());
+ if (qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height()))
+ horizontal->setY(newGeometry.height() - horizontal->height());
+ }
+ if (vertical) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(vertical);
+ if (!p->heightValid || qFuzzyCompare(vertical->height(), oldGeometry.height()))
+ vertical->setHeight(newGeometry.height());
+ if (!p->isMirrored() && (qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width())))
+ vertical->setX(newGeometry.width() - vertical->width());
+ }
+}
+
+QQuickScrollBarAttached::QQuickScrollBarAttached(QQuickFlickable *flickable) :
+ QObject(*(new QQuickScrollBarAttachedPrivate(flickable)), flickable)
+{
+ Q_D(QQuickScrollBarAttached);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
+ p->addItemChangeListener(d, QQuickItemPrivate::Geometry);
+}
+
+QQuickAbstractScrollBar *QQuickScrollBarAttached::horizontal() const
+{
+ Q_D(const QQuickScrollBarAttached);
+ return d->horizontal;
+}
+
+void QQuickScrollBarAttached::setHorizontal(QQuickAbstractScrollBar *horizontal)
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->horizontal != horizontal) {
+ if (d->horizontal) {
+ QObjectPrivate::disconnect(d->horizontal, &QQuickAbstractScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
+ }
+
+ d->horizontal = horizontal;
+
+ if (horizontal) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QObjectPrivate::connect(horizontal, &QQuickAbstractScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
+
+ horizontal->setSize(area->property("widthRatio").toReal());
+ horizontal->setPosition(area->property("xPosition").toReal());
+ }
+ emit horizontalChanged();
+ }
+}
+
+QQuickAbstractScrollBar *QQuickScrollBarAttached::vertical() const
+{
+ Q_D(const QQuickScrollBarAttached);
+ return d->vertical;
+}
+
+void QQuickScrollBarAttached::setVertical(QQuickAbstractScrollBar *vertical)
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->vertical != vertical) {
+ if (d->vertical) {
+ QObjectPrivate::disconnect(d->vertical, &QQuickAbstractScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
+ }
+
+ d->vertical = vertical;
+
+ if (vertical) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QObjectPrivate::connect(vertical, &QQuickAbstractScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
+
+ vertical->setSize(area->property("heightRatio").toReal());
+ vertical->setPosition(area->property("yPosition").toReal());
+ }
+ emit verticalChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractscrollbar_p.h b/src/controls/qquickabstractscrollbar_p.h
new file mode 100644
index 00000000..ecc0114b
--- /dev/null
+++ b/src/controls/qquickabstractscrollbar_p.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSCROLLBAR_P_H
+#define QQUICKABSTRACTSCROLLBAR_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFlickable;
+class QQuickScrollBarAttached;
+class QQuickAbstractScrollBarPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractScrollBar : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ size NOTIFY sizeChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
+
+public:
+ explicit QQuickAbstractScrollBar(QQuickItem *parent = Q_NULLPTR);
+
+ static QQuickScrollBarAttached *qmlAttachedProperties(QObject *object);
+
+ qreal size() const;
+ qreal position() const;
+
+ bool isActive() const;
+ void setActive(bool active);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ QQuickItem *handle() const;
+ void setHandle(QQuickItem *handle);
+
+public Q_SLOTS:
+ void setSize(qreal size);
+ void setPosition(qreal position);
+
+Q_SIGNALS:
+ void sizeChanged();
+ void positionChanged();
+ void activeChanged();
+ void pressedChanged();
+ void orientationChanged();
+ void handleChanged();
+
+protected:
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+
+ virtual qreal positionAt(const QPoint &point) const;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractScrollBar)
+ Q_DECLARE_PRIVATE(QQuickAbstractScrollBar)
+};
+
+class QQuickScrollBarAttachedPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickScrollBarAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickAbstractScrollBar *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
+ Q_PROPERTY(QQuickAbstractScrollBar *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
+
+public:
+ explicit QQuickScrollBarAttached(QQuickFlickable *flickable);
+
+ QQuickAbstractScrollBar *horizontal() const;
+ void setHorizontal(QQuickAbstractScrollBar *horizontal);
+
+ QQuickAbstractScrollBar *vertical() const;
+ void setVertical(QQuickAbstractScrollBar *vertical);
+
+Q_SIGNALS:
+ void horizontalChanged();
+ void verticalChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickScrollBarAttached)
+ Q_DECLARE_PRIVATE(QQuickScrollBarAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickAbstractScrollBar, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKABSTRACTSCROLLBAR_P_H
diff --git a/src/controls/qquickabstractscrollindicator.cpp b/src/controls/qquickabstractscrollindicator.cpp
new file mode 100644
index 00000000..a68cc6b4
--- /dev/null
+++ b/src/controls/qquickabstractscrollindicator.cpp
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractscrollindicator_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ScrollIndicator
+ \inherits Control
+ \instantiates QQuickAbstractScrollIndicator
+ \inqmlmodule QtQuick.Controls
+ \ingroup indicators
+ \brief A scroll indicator.
+
+ TODO
+*/
+
+class QQuickAbstractScrollIndicatorPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickAbstractScrollIndicatorPrivate() : size(0), position(0),
+ active(false), orientation(Qt::Vertical), indicator(Q_NULLPTR) { }
+
+ qreal size;
+ qreal position;
+ bool active;
+ Qt::Orientation orientation;
+ QQuickItem *indicator;
+};
+
+QQuickAbstractScrollIndicator::QQuickAbstractScrollIndicator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractScrollIndicatorPrivate), parent)
+{
+}
+
+QQuickScrollIndicatorAttached *QQuickAbstractScrollIndicator::qmlAttachedProperties(QObject *object)
+{
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
+ if (flickable)
+ return new QQuickScrollIndicatorAttached(flickable);
+
+ qWarning() << "ScrollIndicator must be attached to a Flickable" << object;
+ return Q_NULLPTR;
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ScrollIndicator::size
+
+ TODO
+*/
+qreal QQuickAbstractScrollIndicator::size() const
+{
+ Q_D(const QQuickAbstractScrollIndicator);
+ return d->size;
+}
+
+void QQuickAbstractScrollIndicator::setSize(qreal size)
+{
+ Q_D(QQuickAbstractScrollIndicator);
+ if (!qFuzzyCompare(d->size, size)) {
+ d->size = size;
+ emit sizeChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::ScrollIndicator::position
+
+ TODO
+*/
+qreal QQuickAbstractScrollIndicator::position() const
+{
+ Q_D(const QQuickAbstractScrollIndicator);
+ return d->position;
+}
+
+void QQuickAbstractScrollIndicator::setPosition(qreal position)
+{
+ Q_D(QQuickAbstractScrollIndicator);
+ if (!qFuzzyCompare(d->position, position)) {
+ d->position = position;
+ emit positionChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::ScrollIndicator::active
+
+ TODO
+*/
+bool QQuickAbstractScrollIndicator::isActive() const
+{
+ Q_D(const QQuickAbstractScrollIndicator);
+ return d->active;
+}
+
+void QQuickAbstractScrollIndicator::setActive(bool active)
+{
+ Q_D(QQuickAbstractScrollIndicator);
+ if (d->active != active) {
+ d->active = active;
+ emit activeChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::ScrollIndicator::orientation
+
+ TODO
+*/
+Qt::Orientation QQuickAbstractScrollIndicator::orientation() const
+{
+ Q_D(const QQuickAbstractScrollIndicator);
+ return d->orientation;
+}
+
+void QQuickAbstractScrollIndicator::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickAbstractScrollIndicator);
+ if (d->orientation != orientation) {
+ d->orientation = orientation;
+ emit orientationChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::ScrollIndicator::indicator
+
+ TODO
+*/
+QQuickItem *QQuickAbstractScrollIndicator::indicator() const
+{
+ Q_D(const QQuickAbstractScrollIndicator);
+ return d->indicator;
+}
+
+void QQuickAbstractScrollIndicator::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractScrollIndicator);
+ if (d->indicator != indicator) {
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator && !indicator->parentItem())
+ indicator->setParentItem(this);
+ emit indicatorChanged();
+ }
+}
+
+class QQuickScrollIndicatorAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+public:
+ QQuickScrollIndicatorAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
+
+ void activateHorizontal();
+ void activateVertical();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+ QQuickFlickable *flickable;
+ QQuickAbstractScrollIndicator *horizontal;
+ QQuickAbstractScrollIndicator *vertical;
+};
+
+void QQuickScrollIndicatorAttachedPrivate::activateHorizontal()
+{
+ horizontal->setActive(flickable->isMovingHorizontally());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::activateVertical()
+{
+ vertical->setActive(flickable->isMovingVertically());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_ASSERT(item == flickable);
+ if (horizontal) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(horizontal);
+ if (!p->widthValid || qFuzzyCompare(horizontal->width(), oldGeometry.width()))
+ horizontal->setWidth(newGeometry.width());
+ if (qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height()))
+ horizontal->setY(newGeometry.height() - horizontal->height());
+ }
+ if (vertical) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(vertical);
+ if (!p->heightValid || qFuzzyCompare(vertical->height(), oldGeometry.height()))
+ vertical->setHeight(newGeometry.height());
+ if (!p->isMirrored() && (qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width())))
+ vertical->setX(newGeometry.width() - vertical->width());
+ }
+}
+
+QQuickScrollIndicatorAttached::QQuickScrollIndicatorAttached(QQuickFlickable *flickable) :
+ QObject(*(new QQuickScrollIndicatorAttachedPrivate(flickable)), flickable)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
+ p->addItemChangeListener(d, QQuickItemPrivate::Geometry);
+}
+
+QQuickAbstractScrollIndicator *QQuickScrollIndicatorAttached::horizontal() const
+{
+ Q_D(const QQuickScrollIndicatorAttached);
+ return d->horizontal;
+}
+
+void QQuickScrollIndicatorAttached::setHorizontal(QQuickAbstractScrollIndicator *horizontal)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->horizontal != horizontal) {
+ if (d->horizontal) {
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
+ }
+
+ d->horizontal = horizontal;
+
+ if (horizontal) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
+
+ horizontal->setSize(area->property("widthRatio").toReal());
+ horizontal->setPosition(area->property("xPosition").toReal());
+ }
+ emit horizontalChanged();
+ }
+}
+
+QQuickAbstractScrollIndicator *QQuickScrollIndicatorAttached::vertical() const
+{
+ Q_D(const QQuickScrollIndicatorAttached);
+ return d->vertical;
+}
+
+void QQuickScrollIndicatorAttached::setVertical(QQuickAbstractScrollIndicator *vertical)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->vertical != vertical) {
+ if (d->vertical) {
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
+ }
+
+ d->vertical = vertical;
+
+ if (vertical) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
+
+ vertical->setSize(area->property("heightRatio").toReal());
+ vertical->setPosition(area->property("yPosition").toReal());
+ }
+ emit verticalChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractscrollindicator_p.h b/src/controls/qquickabstractscrollindicator_p.h
new file mode 100644
index 00000000..a26b650e
--- /dev/null
+++ b/src/controls/qquickabstractscrollindicator_p.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSCROLLINDICATOR_P_H
+#define QQUICKABSTRACTSCROLLINDICATOR_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFlickable;
+class QQuickScrollIndicatorAttached;
+class QQuickAbstractScrollIndicatorPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractScrollIndicator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ size NOTIFY sizeChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+
+public:
+ explicit QQuickAbstractScrollIndicator(QQuickItem *parent = Q_NULLPTR);
+
+ static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
+
+ qreal size() const;
+ qreal position() const;
+
+ bool isActive() const;
+ void setActive(bool active);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+public Q_SLOTS:
+ void setSize(qreal size);
+ void setPosition(qreal position);
+
+Q_SIGNALS:
+ void sizeChanged();
+ void positionChanged();
+ void activeChanged();
+ void orientationChanged();
+ void indicatorChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractScrollIndicator)
+ Q_DECLARE_PRIVATE(QQuickAbstractScrollIndicator)
+};
+
+class QQuickScrollIndicatorAttachedPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickScrollIndicatorAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickAbstractScrollIndicator *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
+ Q_PROPERTY(QQuickAbstractScrollIndicator *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
+
+public:
+ explicit QQuickScrollIndicatorAttached(QQuickFlickable *flickable);
+
+ QQuickAbstractScrollIndicator *horizontal() const;
+ void setHorizontal(QQuickAbstractScrollIndicator *horizontal);
+
+ QQuickAbstractScrollIndicator *vertical() const;
+ void setVertical(QQuickAbstractScrollIndicator *vertical);
+
+Q_SIGNALS:
+ void horizontalChanged();
+ void verticalChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickScrollIndicatorAttached)
+ Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickAbstractScrollIndicator, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKABSTRACTSCROLLINDICATOR_P_H
diff --git a/src/controls/qquickabstractslider.cpp b/src/controls/qquickabstractslider.cpp
new file mode 100644
index 00000000..52fa11af
--- /dev/null
+++ b/src/controls/qquickabstractslider.cpp
@@ -0,0 +1,454 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractslider_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquickwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Slider
+ \inherits Control
+ \instantiates QQuickAbstractSlider
+ \inqmlmodule QtQuick.Controls
+ \ingroup sliders
+ \brief A slider control.
+
+ TODO
+*/
+
+class QQuickAbstractSliderPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractSlider)
+
+public:
+ QQuickAbstractSliderPrivate() : value(0), position(0), stepSize(0),
+ pressed(false), orientation(Qt::Horizontal), layoutDirection(Qt::LeftToRight),
+ snapMode(QQuickAbstractSlider::NoSnap), handle(Q_NULLPTR), track(Q_NULLPTR) { }
+
+ qreal snapPosition(qreal position) const;
+ qreal positionAt(const QPoint &point) const;
+
+ qreal value;
+ qreal position;
+ qreal stepSize;
+ bool pressed;
+ QPoint pressPoint;
+ Qt::Orientation orientation;
+ Qt::LayoutDirection layoutDirection;
+ QQuickAbstractSlider::SnapMode snapMode;
+ QQuickItem *handle;
+ QQuickItem *track;
+};
+
+qreal QQuickAbstractSliderPrivate::snapPosition(qreal position) const
+{
+ if (qFuzzyIsNull(stepSize))
+ return position;
+ return qRound(position / stepSize) * stepSize;
+}
+
+qreal QQuickAbstractSliderPrivate::positionAt(const QPoint &point) const
+{
+ Q_Q(const QQuickAbstractSlider);
+ if (orientation == Qt::Horizontal) {
+ const qreal hw = handle ? handle->width() : 0;
+ const qreal offset = hw / 2;
+ const qreal extent = q->width() - hw;
+ if (!qFuzzyIsNull(extent)) {
+ const qreal pos = (point.x() - offset) / extent;
+ if (q->effectiveLayoutDirection() == Qt::RightToLeft)
+ return 1.0 - pos;
+ return pos;
+ }
+ } else {
+ const qreal hh = handle ? handle->height() : 0;
+ const qreal offset = hh / 2;
+ const qreal extent = q->height() - hh;
+ if (!qFuzzyIsNull(extent))
+ return (point.y() - offset) / extent;
+ }
+ return 0;
+}
+
+QQuickAbstractSlider::QQuickAbstractSlider(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractSliderPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Slider::value
+
+ TODO
+*/
+qreal QQuickAbstractSlider::value() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->value;
+}
+
+void QQuickAbstractSlider::setValue(qreal value)
+{
+ Q_D(QQuickAbstractSlider);
+ value = qBound(0.0, value, 1.0);
+ if (!qFuzzyCompare(d->value, value)) {
+ d->value = value;
+ setPosition(value);
+ emit valueChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Slider::position
+
+ TODO
+*/
+qreal QQuickAbstractSlider::position() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->position;
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Slider::visualPosition
+
+ TODO
+*/
+qreal QQuickAbstractSlider::visualPosition() const
+{
+ Q_D(const QQuickAbstractSlider);
+ if (d->orientation == Qt::Vertical || effectiveLayoutDirection() == Qt::RightToLeft)
+ return 1.0 - d->position;
+ return d->position;
+}
+
+void QQuickAbstractSlider::setPosition(qreal position)
+{
+ Q_D(QQuickAbstractSlider);
+ position = qBound(0.0, position, 1.0);
+ if (!qFuzzyCompare(d->position, position)) {
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Slider::stepSize
+
+ TODO
+*/
+qreal QQuickAbstractSlider::stepSize() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->stepSize;
+}
+
+void QQuickAbstractSlider::setStepSize(qreal step)
+{
+ Q_D(QQuickAbstractSlider);
+ if (!qFuzzyCompare(d->stepSize, step)) {
+ d->stepSize = step;
+ emit stepSizeChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Slider::snapMode
+
+ TODO
+*/
+QQuickAbstractSlider::SnapMode QQuickAbstractSlider::snapMode() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->snapMode;
+}
+
+void QQuickAbstractSlider::setSnapMode(SnapMode mode)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->snapMode != mode) {
+ d->snapMode = mode;
+ emit snapModeChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::Slider::pressed
+
+ TODO
+*/
+bool QQuickAbstractSlider::isPressed() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->pressed;
+}
+
+void QQuickAbstractSlider::setPressed(bool pressed)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->pressed != pressed) {
+ d->pressed = pressed;
+ emit pressedChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Slider::orientation
+
+ TODO
+*/
+Qt::Orientation QQuickAbstractSlider::orientation() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->orientation;
+}
+
+void QQuickAbstractSlider::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->orientation != orientation) {
+ d->orientation = orientation;
+ emit orientationChanged();
+ }
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Slider::layoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractSlider::layoutDirection() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->layoutDirection;
+}
+
+/*!
+ \qmlproperty enumeration QtQuickControls2::Slider::effectiveLayoutDirection
+
+ TODO
+*/
+Qt::LayoutDirection QQuickAbstractSlider::effectiveLayoutDirection() const
+{
+ Q_D(const QQuickAbstractSlider);
+ if (isMirrored())
+ return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;
+ return d->layoutDirection;
+}
+
+void QQuickAbstractSlider::setLayoutDirection(Qt::LayoutDirection direction)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->layoutDirection != direction) {
+ d->layoutDirection = direction;
+ emit layoutDirectionChanged();
+ emit effectiveLayoutDirectionChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Slider::handle
+
+ TODO
+*/
+QQuickItem *QQuickAbstractSlider::handle() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->handle;
+}
+
+void QQuickAbstractSlider::setHandle(QQuickItem *handle)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->handle != handle) {
+ delete d->handle;
+ d->handle = handle;
+ if (handle && !handle->parentItem())
+ handle->setParentItem(this);
+ emit handleChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Slider::track
+
+ TODO
+*/
+QQuickItem *QQuickAbstractSlider::track() const
+{
+ Q_D(const QQuickAbstractSlider);
+ return d->track;
+}
+
+void QQuickAbstractSlider::setTrack(QQuickItem *track)
+{
+ Q_D(QQuickAbstractSlider);
+ if (d->track != track) {
+ delete d->track;
+ d->track = track;
+ if (track && !track->parentItem())
+ track->setParentItem(this);
+ emit trackChanged();
+ }
+}
+
+/*!
+ \qmlmethod void QtQuickControls2::Slider::increase()
+
+ TODO
+*/
+void QQuickAbstractSlider::increase()
+{
+ Q_D(QQuickAbstractSlider);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value + step);
+}
+
+/*!
+ \qmlmethod void QtQuickControls2::Slider::decrease()
+
+ TODO
+*/
+void QQuickAbstractSlider::decrease()
+{
+ Q_D(QQuickAbstractSlider);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value - step);
+}
+
+void QQuickAbstractSlider::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickAbstractSlider);
+ QQuickControl::keyPressEvent(event);
+ if (d->orientation == Qt::Horizontal) {
+ if (event->key() == Qt::Key_Left) {
+ setPressed(true);
+ if (effectiveLayoutDirection() == Qt::RightToLeft)
+ increase();
+ else
+ decrease();
+ event->accept();
+ } else if (event->key() == Qt::Key_Right) {
+ setPressed(true);
+ if (effectiveLayoutDirection() == Qt::RightToLeft)
+ decrease();
+ else
+ increase();
+ event->accept();
+ }
+ } else {
+ if (event->key() == Qt::Key_Up) {
+ setPressed(true);
+ increase();
+ event->accept();
+ } else if (event->key() == Qt::Key_Down) {
+ setPressed(true);
+ decrease();
+ event->accept();
+ }
+ }
+}
+
+void QQuickAbstractSlider::keyReleaseEvent(QKeyEvent *event)
+{
+ QQuickControl::keyReleaseEvent(event);
+ setPressed(false);
+}
+
+void QQuickAbstractSlider::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSlider);
+ QQuickControl::mousePressEvent(event);
+ d->pressPoint = event->pos();
+ setPressed(true);
+ event->accept();
+}
+
+void QQuickAbstractSlider::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSlider);
+ QQuickControl::mouseMoveEvent(event);
+ if (!keepMouseGrab()) {
+ if (d->orientation == Qt::Horizontal)
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
+ else
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event));
+ }
+ if (keepMouseGrab()) {
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode == SnapAlways)
+ pos = d->snapPosition(pos);
+ setPosition(pos);
+ }
+ event->accept();
+}
+
+void QQuickAbstractSlider::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSlider);
+ QQuickControl::mouseReleaseEvent(event);
+ d->pressPoint = QPoint();
+ if (keepMouseGrab()) {
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode != NoSnap)
+ pos = d->snapPosition(pos);
+ setValue(pos);
+ setKeepMouseGrab(false);
+ }
+ setPressed(false);
+ event->accept();
+}
+
+void QQuickAbstractSlider::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractSlider);
+ QQuickControl::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+ setPressed(false);
+}
+
+void QQuickAbstractSlider::mirrorChange()
+{
+ emit effectiveLayoutDirectionChanged();
+ emit visualPositionChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractslider_p.h b/src/controls/qquickabstractslider_p.h
new file mode 100644
index 00000000..6b962aca
--- /dev/null
+++ b/src/controls/qquickabstractslider_p.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSLIDER_P_H
+#define QQUICKABSTRACTSLIDER_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractSliderPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractSlider : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+ Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged FINAL)
+ Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged FINAL)
+ Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
+ Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL)
+ Q_ENUMS(SnapMode)
+
+public:
+ explicit QQuickAbstractSlider(QQuickItem *parent = Q_NULLPTR);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal position() const;
+ qreal visualPosition() const;
+ void setPosition(qreal position);
+
+ qreal stepSize() const;
+ void setStepSize(qreal step);
+
+ enum SnapMode {
+ NoSnap,
+ SnapAlways,
+ SnapOnRelease
+ };
+
+ SnapMode snapMode() const;
+ void setSnapMode(SnapMode mode);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ Qt::LayoutDirection layoutDirection() const;
+ Qt::LayoutDirection effectiveLayoutDirection() const;
+ void setLayoutDirection(Qt::LayoutDirection direction);
+
+ QQuickItem *handle() const;
+ void setHandle(QQuickItem *handle);
+
+ QQuickItem *track() const;
+ void setTrack(QQuickItem *track);
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+
+Q_SIGNALS:
+ void valueChanged();
+ void positionChanged();
+ void visualPositionChanged();
+ void stepSizeChanged();
+ void snapModeChanged();
+ void pressedChanged();
+ void orientationChanged();
+ void layoutDirectionChanged();
+ void effectiveLayoutDirectionChanged();
+ void handleChanged();
+ void trackChanged();
+
+protected:
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void mirrorChange() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractSlider)
+ Q_DECLARE_PRIVATE(QQuickAbstractSlider)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTSLIDER_P_H
diff --git a/src/controls/qquickabstractspinbox.cpp b/src/controls/qquickabstractspinbox.cpp
new file mode 100644
index 00000000..442e479c
--- /dev/null
+++ b/src/controls/qquickabstractspinbox.cpp
@@ -0,0 +1,300 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractspinbox_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquicktextinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractSpinBoxPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractSpinBox)
+
+public:
+ QQuickAbstractSpinBoxPrivate() : value(0), step(1), input(Q_NULLPTR), validator(Q_NULLPTR),
+ upButton(Q_NULLPTR), downButton(Q_NULLPTR), pressed(QQuickAbstractSpinBox::None) { }
+
+ void updateText();
+ void updateValue();
+
+ qreal value;
+ qreal step;
+ QQuickTextInput *input;
+ QValidator *validator;
+ QQuickItem *upButton;
+ QQuickItem *downButton;
+ QQuickAbstractSpinBox::SubControl pressed;
+};
+
+void QQuickAbstractSpinBoxPrivate::updateText()
+{
+ if (input) {
+ QString text = QString::number(value);
+ if (validator) {
+ validator->fixup(text);
+ int cursor = input->cursorPosition();
+ if (validator->validate(text, cursor) == QValidator::Acceptable)
+ input->setCursorPosition(cursor);
+ input->setText(text);
+ }
+ }
+}
+
+void QQuickAbstractSpinBoxPrivate::updateValue()
+{
+ Q_Q(QQuickAbstractSpinBox);
+ if (validator) {
+ QString text = input->text();
+ validator->fixup(text);
+ int cursor = input->cursorPosition();
+ if (validator->validate(text, cursor) == QValidator::Acceptable)
+ q->setValue(text.toDouble());
+ }
+}
+
+QQuickAbstractSpinBox::QQuickAbstractSpinBox(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractSpinBoxPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+qreal QQuickAbstractSpinBox::value() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->value;
+}
+
+void QQuickAbstractSpinBox::setValue(qreal value)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (!qFuzzyCompare(d->value, value)) {
+ d->value = value;
+ d->updateText();
+ emit valueChanged();
+ }
+}
+
+qreal QQuickAbstractSpinBox::step() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->step;
+}
+
+void QQuickAbstractSpinBox::setStep(qreal step)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (!qFuzzyCompare(d->step, step)) {
+ d->step = step;
+ emit stepChanged();
+ }
+}
+
+QQuickTextInput *QQuickAbstractSpinBox::input() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->input;
+}
+
+void QQuickAbstractSpinBox::setInput(QQuickTextInput *input)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (d->input != input) {
+ delete d->input;
+ d->input = input;
+ if (input) {
+ if (!input->parentItem())
+ input->setParentItem(this);
+ input->setValidator(d->validator);
+ input->setFocus(true);
+ QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickAbstractSpinBoxPrivate::updateValue);
+ }
+ emit inputChanged();
+ }
+}
+
+QValidator *QQuickAbstractSpinBox::validator() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->validator;
+}
+
+void QQuickAbstractSpinBox::setValidator(QValidator *validator)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (d->validator != validator) {
+ delete d->validator;
+ d->validator = validator;
+ if (d->input)
+ d->input->setValidator(validator);
+ emit validatorChanged();
+ }
+}
+
+QQuickItem *QQuickAbstractSpinBox::upButton() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->upButton;
+}
+
+void QQuickAbstractSpinBox::setUpButton(QQuickItem *button)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (d->upButton != button) {
+ delete d->upButton;
+ d->upButton = button;
+ if (button && !button->parentItem())
+ button->setParentItem(this);
+ emit upButtonChanged();
+ }
+}
+
+QQuickItem *QQuickAbstractSpinBox::downButton() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->downButton;
+}
+
+void QQuickAbstractSpinBox::setDownButton(QQuickItem *button)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (d->downButton != button) {
+ delete d->downButton;
+ d->downButton = button;
+ if (button && !button->parentItem())
+ button->setParentItem(this);
+ emit downButtonChanged();
+ }
+}
+
+QQuickAbstractSpinBox::SubControl QQuickAbstractSpinBox::pressed() const
+{
+ Q_D(const QQuickAbstractSpinBox);
+ return d->pressed;
+}
+
+void QQuickAbstractSpinBox::setPressed(SubControl control)
+{
+ Q_D(QQuickAbstractSpinBox);
+ if (d->pressed != control) {
+ d->pressed = control;
+ emit pressedChanged();
+ }
+}
+
+void QQuickAbstractSpinBox::increment()
+{
+ Q_D(QQuickAbstractSpinBox);
+ setValue(d->value + d->step);
+}
+
+void QQuickAbstractSpinBox::decrement()
+{
+ Q_D(QQuickAbstractSpinBox);
+ setValue(d->value - d->step);
+}
+
+void QQuickAbstractSpinBox::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Up:
+ increment();
+ event->accept();
+ break;
+ case Qt::Key_Down:
+ decrement();
+ event->accept();
+ break;
+ default:
+ event->ignore();
+ break;
+ }
+}
+
+void QQuickAbstractSpinBox::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSpinBox);
+ QQuickControl::mousePressEvent(event);
+ if (d->upButton && d->upButton->contains(mapToItem(d->upButton, event->pos())))
+ setPressed(UpButton);
+ else if (d->downButton && d->downButton->contains(mapToItem(d->downButton, event->pos())))
+ setPressed(DownButton);
+ else
+ setPressed(None);
+ event->accept();
+}
+
+void QQuickAbstractSpinBox::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSpinBox);
+ QQuickControl::mouseMoveEvent(event);
+ if (d->upButton && d->upButton->contains(mapToItem(d->upButton, event->pos())))
+ setPressed(UpButton);
+ else if (d->downButton && d->downButton->contains(mapToItem(d->downButton, event->pos())))
+ setPressed(DownButton);
+ else
+ setPressed(None);
+ event->accept();
+}
+
+void QQuickAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSpinBox);
+ QQuickControl::mouseReleaseEvent(event);
+ if (d->pressed == UpButton)
+ increment();
+ else if (d->pressed == DownButton)
+ decrement();
+ setPressed(None);
+ event->accept();
+}
+
+void QQuickAbstractSpinBox::mouseUngrabEvent()
+{
+ setPressed(None);
+}
+
+void QQuickAbstractSpinBox::componentComplete()
+{
+ Q_D(QQuickAbstractSpinBox);
+ QQuickControl::componentComplete();
+ d->updateText();
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractspinbox_p.h b/src/controls/qquickabstractspinbox_p.h
new file mode 100644
index 00000000..e4585bcb
--- /dev/null
+++ b/src/controls/qquickabstractspinbox_p.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSPINBOX_P_H
+#define QQUICKABSTRACTSPINBOX_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QValidator;
+class QQuickTextInput;
+class QQuickAbstractSpinBoxPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractSpinBox : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal step READ step WRITE setStep NOTIFY stepChanged FINAL)
+ Q_PROPERTY(QQuickTextInput *input READ input WRITE setInput NOTIFY inputChanged FINAL)
+ Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL)
+ Q_PROPERTY(QQuickItem *upButton READ upButton WRITE setUpButton NOTIFY upButtonChanged FINAL)
+ Q_PROPERTY(QQuickItem *downButton READ downButton WRITE setDownButton NOTIFY downButtonChanged FINAL)
+ Q_PROPERTY(SubControl pressed READ pressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_ENUMS(SubControl)
+
+public:
+ explicit QQuickAbstractSpinBox(QQuickItem *parent = Q_NULLPTR);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal step() const;
+ void setStep(qreal step);
+
+ QQuickTextInput *input() const;
+ void setInput(QQuickTextInput *input);
+
+ QValidator *validator() const;
+ void setValidator(QValidator *validator);
+
+ QQuickItem *upButton() const;
+ void setUpButton(QQuickItem *button);
+
+ QQuickItem *downButton() const;
+ void setDownButton(QQuickItem *button);
+
+ enum SubControl {
+ None,
+ UpButton,
+ DownButton
+ };
+
+ SubControl pressed() const;
+ void setPressed(SubControl control);
+
+public Q_SLOTS:
+ void increment();
+ void decrement();
+
+Q_SIGNALS:
+ void valueChanged();
+ void stepChanged();
+ void inputChanged();
+ void validatorChanged();
+ void upButtonChanged();
+ void downButtonChanged();
+ void pressedChanged();
+
+protected:
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractSpinBox)
+ Q_DECLARE_PRIVATE(QQuickAbstractSpinBox)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTSPINBOX_P_H
diff --git a/src/controls/qquickabstractstackview.cpp b/src/controls/qquickabstractstackview.cpp
new file mode 100644
index 00000000..3775e180
--- /dev/null
+++ b/src/controls/qquickabstractstackview.cpp
@@ -0,0 +1,352 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractstackview_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype StackView
+ \inherits Container
+ \instantiates QQuickAbstractStackView
+ \inqmlmodule QtQuick.Controls
+ \ingroup navigation
+ \brief A stack view control.
+
+ TODO
+*/
+
+class QQuickStackElement
+{
+ QQuickStackElement() : ownItem(false), item(Q_NULLPTR), ownComponent(false), component(Q_NULLPTR) { }
+
+public:
+ static QQuickStackElement *fromString(const QString &str, QQmlEngine *engine, QObject *parent)
+ {
+ QQuickStackElement *element = new QQuickStackElement;
+ element->component = new QQmlComponent(engine, QUrl(str), parent);
+ element->ownComponent = true;
+ return element;
+ }
+
+ static QQuickStackElement *fromObject(QObject *object)
+ {
+ QQuickStackElement *element = new QQuickStackElement;
+ element->component = qobject_cast<QQmlComponent *>(object);
+ element->item = qobject_cast<QQuickItem *>(object);
+ return element;
+ }
+
+ bool ownItem;
+ QQuickItem *item;
+
+ bool ownComponent;
+ QQmlComponent *component;
+};
+
+class QQuickAbstractStackViewPrivate : public QQuickAbstractContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractStackView)
+
+public:
+ QQuickAbstractStackViewPrivate() : busy(false), depth(0), currentItem(Q_NULLPTR) { }
+
+ void setBusy(bool busy);
+ void setDepth(int depth);
+ void setCurrentItem(QQuickItem *item);
+
+ QList<QQuickStackElement *> createElements(const QV4::ScopedValue &value);
+ QQuickItem *pushElements(const QList<QQuickStackElement *> &elements, QQuickAbstractStackView::Operation operation);
+
+ bool busy;
+ int depth;
+ QVariant initialItem;
+ QQuickItem *currentItem;
+ QStack<QQuickStackElement *> elements;
+};
+
+void QQuickAbstractStackViewPrivate::setBusy(bool value)
+{
+ Q_Q(QQuickAbstractStackView);
+ if (busy != value) {
+ busy = value;
+ emit q->busyChanged();
+ }
+}
+
+void QQuickAbstractStackViewPrivate::setDepth(int value)
+{
+ Q_Q(QQuickAbstractStackView);
+ if (depth != value) {
+ depth = value;
+ emit q->depthChanged();
+ }
+}
+
+void QQuickAbstractStackViewPrivate::setCurrentItem(QQuickItem *item)
+{
+ Q_Q(QQuickAbstractStackView);
+ if (currentItem != item) {
+ currentItem = item;
+ emit q->currentItemChanged();
+ }
+}
+
+QList<QQuickStackElement *> QQuickAbstractStackViewPrivate::createElements(const QV4::ScopedValue &value)
+{
+ Q_Q(QQuickAbstractStackView);
+ QList<QQuickStackElement *> elements;
+ if (QV4::String *s = value->asString()) {
+ qDebug() << "### STRING:" << s->toQString();
+ elements += QQuickStackElement::fromString(s->toQString(), qmlEngine(q), q);
+ } else if (QV4::ArrayObject *a = value->asArrayObject()) {
+ int len = a->getLength();
+ qDebug() << "### ARRAY:" << len;
+ for (int i = 0; i < len; ++i) {
+ QV4::Scope scope(a->engine());
+ QV4::ScopedValue v(scope, a->getIndexed(i));
+ elements += createElements(v);
+ }
+ } else if (QV4::QObjectWrapper *o =value->as<QV4::QObjectWrapper>()) {
+ qDebug() << "### QOBJECT:" << o->object();
+ elements += QQuickStackElement::fromObject(o->object());
+ } else {
+ qDebug("### UNKNOWN");
+ }
+ return elements;
+}
+
+QQuickItem *QQuickAbstractStackViewPrivate::pushElements(const QList<QQuickStackElement *> &elems, QQuickAbstractStackView::Operation operation)
+{
+ Q_Q(QQuickAbstractStackView);
+ Q_UNUSED(operation); // TODO
+ if (!elems.isEmpty()) {
+ foreach (QQuickStackElement *elem, elems) {
+ elements.push(elem);
+ }
+ emit q->depthChanged();
+ // TODO: load
+ return elems.last()->item;
+ }
+ return Q_NULLPTR;
+}
+
+QQuickAbstractStackView::QQuickAbstractStackView(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractStackViewPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+}
+
+QQuickAbstractStackView::~QQuickAbstractStackView()
+{
+ Q_D(QQuickAbstractStackView);
+ qDeleteAll(d->elements);
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::StackView::busy
+ \readonly
+ \c true if a transition is running, and \c false otherwise.
+*/
+bool QQuickAbstractStackView::busy() const
+{
+ Q_D(const QQuickAbstractStackView);
+ return d->busy;
+}
+
+// TODO: remove
+void QQuickAbstractStackView::setBusy(bool busy)
+{
+ Q_D(QQuickAbstractStackView);
+ d->setBusy(busy);
+}
+
+/*!
+ \qmlproperty int QtQuickControls2::StackView::depth
+ \readonly
+ The number of items currently pushed onto the stack.
+*/
+int QQuickAbstractStackView::depth() const
+{
+ Q_D(const QQuickAbstractStackView);
+ return d->depth;
+}
+
+// TODO: remove
+void QQuickAbstractStackView::setDepth(int depth)
+{
+ Q_D(QQuickAbstractStackView);
+ d->setDepth(depth);
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::StackView::currentItem
+ \readonly
+ The currently top-most item in the stack.
+*/
+QQuickItem *QQuickAbstractStackView::currentItem() const
+{
+ Q_D(const QQuickAbstractStackView);
+ return d->currentItem;
+}
+
+// TODO: remove
+void QQuickAbstractStackView::setCurrentItem(QQuickItem *item)
+{
+ Q_D(QQuickAbstractStackView);
+ d->setCurrentItem(item);
+}
+
+QQuickItem *QQuickAbstractStackView::qpush(QQmlV4Function *args)
+{
+ Q_D(QQuickAbstractStackView);
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ Operation operation = d->elements.isEmpty() ? Immediate : Transition;
+ QList<QQuickStackElement *> elements;
+ for (int i = 0; i < args->length(); ++i) {
+ QV4::ScopedValue value(scope, (*args)[i]);
+ if (value->isInt32())
+ operation = static_cast<Operation>(value->toInt32());
+ else
+ elements += d->createElements(value);
+ }
+ return d->pushElements(elements, operation);
+}
+
+QQuickItem *QQuickAbstractStackView::qpop(QQmlV4Function *args)
+{
+ Q_UNUSED(args); // TODO
+ return Q_NULLPTR;
+}
+
+void QQuickAbstractStackView::qclear()
+{
+ // TODO
+}
+
+/*!
+ \qmlproperty var QtQuickControls2::StackView::initialItem
+
+ The first \l item that should be shown when the StackView is created.
+ \a initialItem can take same value as the first argument to \l{StackView::push()}
+ {StackView.push()}. Note that this is just a convenience for writing
+ \c{Component.onCompleted: stackView.push(myInitialItem)}
+
+ Examples:
+
+ \list
+ \li initialItem: Qt.resolvedUrl("MyItem.qml")
+ \li initialItem: myItem
+ \li initialItem: {"item" : Qt.resolvedUrl("MyRectangle.qml"), "properties" : {"color" : "red"}}
+ \endlist
+ \sa push
+*/
+QVariant QQuickAbstractStackView::initialItem() const
+{
+ Q_D(const QQuickAbstractStackView);
+ return d->initialItem;
+}
+
+void QQuickAbstractStackView::setInitialItem(const QVariant &item)
+{
+ Q_D(QQuickAbstractStackView);
+ d->initialItem = item;
+}
+
+void QQuickAbstractStackView::componentComplete()
+{
+ QQuickAbstractContainer::componentComplete();
+
+ Q_D(QQuickAbstractStackView);
+ if (QObject *o = d->initialItem.value<QObject *>())
+ d->pushElements(QList<QQuickStackElement *>() << QQuickStackElement::fromObject(o), Immediate);
+ else if (d->initialItem.canConvert<QString>())
+ d->pushElements(QList<QQuickStackElement *>() << QQuickStackElement::fromString(d->initialItem.toString(), qmlEngine(this), this), Immediate);
+}
+
+/*!
+ \qmltype Stack
+ \inherits QtObject
+ \instantiates QQuickStackAttached
+ \inqmlmodule QtQuick.Controls
+ \ingroup navigation
+ \brief TODO
+
+ TODO
+*/
+
+class QQuickStackAttachedPrivate : public QObjectPrivate
+{
+public:
+ QQuickStackAttachedPrivate() : status(QQuickStackAttached::Inactive) { }
+
+ QQuickStackAttached::Status status;
+};
+
+QQuickStackAttached::QQuickStackAttached(QObject *parent) :
+ QObject(*(new QQuickStackAttachedPrivate), parent)
+{
+}
+
+QQuickStackAttached *QQuickStackAttached::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickStackAttached(object);
+}
+
+/*!
+ \qmlattachedproperty enumeration QtQuickControls2::Stack::status
+
+ TODO
+*/
+QQuickStackAttached::Status QQuickStackAttached::status() const
+{
+ Q_D(const QQuickStackAttached);
+ return d->status;
+}
+
+void QQuickStackAttached::setStatus(Status status)
+{
+ Q_D(QQuickStackAttached);
+ if (d->status != status) {
+ d->status = status;
+ emit statusChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractstackview_p.h b/src/controls/qquickabstractstackview_p.h
new file mode 100644
index 00000000..93545cd1
--- /dev/null
+++ b/src/controls/qquickabstractstackview_p.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSTACKVIEW_P_H
+#define QQUICKABSTRACTSTACKVIEW_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlV4Function;
+class QQuickAbstractStackViewPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractStackView : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged FINAL) // TODO: hide setBusy
+ Q_PROPERTY(int depth READ depth WRITE setDepth NOTIFY depthChanged FINAL) // TODO: hide setDepth
+ Q_PROPERTY(QQuickItem *currentItem READ currentItem WRITE setCurrentItem NOTIFY currentItemChanged FINAL) // TODO: hide setCurrentItem
+ Q_PROPERTY(QVariant initialItem READ initialItem WRITE setInitialItem FINAL)
+ Q_ENUMS(Operation)
+
+public:
+ explicit QQuickAbstractStackView(QQuickItem *parent = Q_NULLPTR);
+ ~QQuickAbstractStackView();
+
+ bool busy() const;
+ void setBusy(bool busy); // TODO: hide
+
+ int depth() const;
+ void setDepth(int depth); // TODO: hide
+
+ QQuickItem *currentItem() const;
+ void setCurrentItem(QQuickItem *item); // TODO: hide
+
+ QVariant initialItem() const;
+ void setInitialItem(const QVariant &item);
+
+ enum Operation {
+ Transition,
+ Immediate
+ };
+
+ Q_INVOKABLE QQuickItem *qpush(QQmlV4Function *args);
+ Q_INVOKABLE QQuickItem *qpop(QQmlV4Function *args);
+
+public Q_SLOTS:
+ void qclear();
+
+Q_SIGNALS:
+ void busyChanged();
+ void depthChanged();
+ void currentItemChanged();
+
+protected:
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractStackView)
+ Q_DECLARE_PRIVATE(QQuickAbstractStackView)
+};
+
+class QQuickStackAttachedPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickStackAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged)
+ Q_ENUMS(Status)
+
+public:
+ explicit QQuickStackAttached(QObject *parent = Q_NULLPTR);
+
+ static QQuickStackAttached *qmlAttachedProperties(QObject *object);
+
+ enum Status {
+ Inactive = 0,
+ Deactivating = 1,
+ Activating = 2,
+ Active = 3
+ };
+
+ Status status() const;
+ void setStatus(Status status);
+
+Q_SIGNALS:
+ void statusChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickStackAttached)
+ Q_DECLARE_PRIVATE(QQuickStackAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickStackAttached, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKABSTRACTSTACKVIEW_P_H
diff --git a/src/controls/qquickabstractswitch.cpp b/src/controls/qquickabstractswitch.cpp
new file mode 100644
index 00000000..0251a887
--- /dev/null
+++ b/src/controls/qquickabstractswitch.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractswitch_p.h"
+#include "qquickabstractcheckable_p_p.h"
+
+#include <QtQuick/private/qquickwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Switch
+ \inherits Checkable
+ \instantiates QQuickAbstractSwitch
+ \inqmlmodule QtQuick.Controls
+ \ingroup buttons
+ \brief A switch control.
+
+ TODO
+*/
+
+class QQuickAbstractSwitchPrivate : public QQuickAbstractCheckablePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractSwitch)
+
+public:
+ QQuickAbstractSwitchPrivate() : position(0) { }
+
+ void updatePosition();
+
+ qreal position;
+ QPoint pressPoint;
+};
+
+void QQuickAbstractSwitchPrivate::updatePosition()
+{
+ Q_Q(QQuickAbstractSwitch);
+ q->setPosition(checked ? 1.0 : 0.0);
+}
+
+QQuickAbstractSwitch::QQuickAbstractSwitch(QQuickItem *parent) :
+ QQuickAbstractCheckable(*(new QQuickAbstractSwitchPrivate), parent)
+{
+ setFiltersChildMouseEvents(true);
+ QObjectPrivate::connect(this, &QQuickAbstractCheckable::checkedChanged, d_func(), &QQuickAbstractSwitchPrivate::updatePosition);
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Switch::position
+
+ TODO
+*/
+qreal QQuickAbstractSwitch::position() const
+{
+ Q_D(const QQuickAbstractSwitch);
+ return d->position;
+}
+
+void QQuickAbstractSwitch::setPosition(qreal position)
+{
+ Q_D(QQuickAbstractSwitch);
+ position = qBound(0.0, position, 1.0);
+ if (d->position != position) {
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuickControls2::Switch::visualPosition
+
+ TODO
+*/
+qreal QQuickAbstractSwitch::visualPosition() const
+{
+ Q_D(const QQuickAbstractSwitch);
+ if (isMirrored())
+ return 1.0 - d->position;
+ return d->position;
+}
+
+void QQuickAbstractSwitch::mirrorChange()
+{
+ QQuickAbstractCheckable::mirrorChange();
+ emit visualPositionChanged();
+}
+
+bool QQuickAbstractSwitch::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ if (child == indicator()) {
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ return handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseMove:
+ return handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ return handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::UngrabMouse:
+ return handleMouseUngrabEvent(child);
+ default:
+ return false;
+ }
+ }
+ return false;
+}
+
+bool QQuickAbstractSwitch::handleMousePressEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSwitch);
+ Q_UNUSED(child);
+ d->pressPoint = event->pos();
+ setPressed(true);
+ event->accept();
+ return true;
+}
+
+bool QQuickAbstractSwitch::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSwitch);
+ if (!child->keepMouseGrab())
+ child->setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
+ if (child->keepMouseGrab()) {
+ setPosition(positionAt(event->pos()));
+ event->accept();
+ }
+ return true;
+}
+
+bool QQuickAbstractSwitch::handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_D(QQuickAbstractSwitch);
+ d->pressPoint = QPoint();
+ setPressed(false);
+ if (child->keepMouseGrab()) {
+ setChecked(position() > 0.5);
+ setPosition(isChecked() ? 1.0 : 0.0);
+ child->setKeepMouseGrab(false);
+ } else {
+ emit clicked();
+ toggle();
+ }
+ event->accept();
+ return true;
+}
+
+bool QQuickAbstractSwitch::handleMouseUngrabEvent(QQuickItem *child)
+{
+ Q_D(QQuickAbstractSwitch);
+ Q_UNUSED(child);
+ d->pressPoint = QPoint();
+ setChecked(position() > 0.5);
+ setPosition(isChecked() ? 1.0 : 0.0);
+ setPressed(false);
+ return true;
+}
+
+qreal QQuickAbstractSwitch::positionAt(const QPoint &point) const
+{
+ qreal pos = point.x() / indicator()->width();
+ if (isMirrored())
+ return 1.0 - pos;
+ return pos;
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractswitch_p.h b/src/controls/qquickabstractswitch_p.h
new file mode 100644
index 00000000..7585d80f
--- /dev/null
+++ b/src/controls/qquickabstractswitch_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSWITCH_P_H
+#define QQUICKABSTRACTSWITCH_P_H
+
+#include <QtQuickControls/private/qquickabstractcheckable_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractSwitchPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractSwitch : public QQuickAbstractCheckable
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+
+public:
+ explicit QQuickAbstractSwitch(QQuickItem *parent = Q_NULLPTR);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ qreal visualPosition() const;
+
+Q_SIGNALS:
+ void positionChanged();
+ void visualPositionChanged();
+
+protected:
+ void mirrorChange() Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
+
+ bool handleMousePressEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseUngrabEvent(QQuickItem *child);
+
+ virtual qreal positionAt(const QPoint &point) const;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractSwitch)
+ Q_DECLARE_PRIVATE(QQuickAbstractSwitch)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTSWITCH_P_H
diff --git a/src/controls/qquickabstracttabbar.cpp b/src/controls/qquickabstracttabbar.cpp
new file mode 100644
index 00000000..2917a3b7
--- /dev/null
+++ b/src/controls/qquickabstracttabbar.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttabbar_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TabBar
+ \inherits Container
+ \instantiates QQuickAbstractTabBar
+ \inqmlmodule QtQuick.Controls
+ \ingroup tabs
+ \brief A tab bar control.
+
+ TODO
+*/
+
+class QQuickAbstractTabBarPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QQuickAbstractTabBarPrivate() : currentIndex(0) { }
+
+ int currentIndex;
+};
+
+QQuickAbstractTabBar::QQuickAbstractTabBar(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractTabBarPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+}
+
+/*!
+ \qmlproperty int QtQuickControls2::TabBar::currentIndex
+
+ TODO
+*/
+int QQuickAbstractTabBar::currentIndex() const
+{
+ Q_D(const QQuickAbstractTabBar);
+ return d->currentIndex;
+}
+
+void QQuickAbstractTabBar::setCurrentIndex(int index)
+{
+ Q_D(QQuickAbstractTabBar);
+ if (d->currentIndex != index) {
+ d->currentIndex = index;
+ emit currentIndexChanged(index);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttabbar_p.h b/src/controls/qquickabstracttabbar_p.h
new file mode 100644
index 00000000..30e97959
--- /dev/null
+++ b/src/controls/qquickabstracttabbar_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTABBAR_P_H
+#define QQUICKABSTRACTTABBAR_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractTabBarPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTabBar : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+
+public:
+ explicit QQuickAbstractTabBar(QQuickItem *parent = Q_NULLPTR);
+
+ int currentIndex() const;
+
+public Q_SLOTS:
+ void setCurrentIndex(int index);
+
+Q_SIGNALS:
+ void currentIndexChanged(int index);
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractTabBar)
+ Q_DECLARE_PRIVATE(QQuickAbstractTabBar)
+ friend class QQuickAbstractTabView;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTABBAR_P_H
diff --git a/src/controls/qquickabstracttabbutton.cpp b/src/controls/qquickabstracttabbutton.cpp
new file mode 100644
index 00000000..df2b2c92
--- /dev/null
+++ b/src/controls/qquickabstracttabbutton.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttabbutton_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TabButton
+ \inherits Checkable
+ \instantiates QQuickAbstractTabButton
+ \inqmlmodule QtQuick.Controls
+ \ingroup tabs
+ \brief A tab button control.
+
+ TODO
+*/
+
+QQuickAbstractTabButton::QQuickAbstractTabButton(QQuickItem *parent) :
+ QQuickAbstractCheckable(parent)
+{
+ setExclusive(true);
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttabbutton_p.h b/src/controls/qquickabstracttabbutton_p.h
new file mode 100644
index 00000000..aeabb608
--- /dev/null
+++ b/src/controls/qquickabstracttabbutton_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTABBUTTON_P_H
+#define QQUICKABSTRACTTABBUTTON_P_H
+
+#include <QtQuickControls/private/qquickabstractcheckable_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTabButton : public QQuickAbstractCheckable
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractTabButton(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTABBUTTON_P_H
diff --git a/src/controls/qquickabstracttabview.cpp b/src/controls/qquickabstracttabview.cpp
new file mode 100644
index 00000000..d9ae0090
--- /dev/null
+++ b/src/controls/qquickabstracttabview.cpp
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttabview_p.h"
+#include "qquickabstracttabbar_p.h"
+#include "qquickabstractcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TabView
+ \inherits Container
+ \instantiates QQuickAbstractTabView
+ \inqmlmodule QtQuick.Controls
+ \ingroup tabs
+ \brief A tab view control.
+
+ TODO
+*/
+
+class QQuickAbstractTabViewPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QQuickAbstractTabViewPrivate() : currentIndex(0), bar(Q_NULLPTR) { }
+
+ int currentIndex;
+ QQuickAbstractTabBar *bar;
+};
+
+QQuickAbstractTabView::QQuickAbstractTabView(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractTabViewPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+}
+
+/*!
+ \qmlproperty int QtQuickControls2::TabView::currentIndex
+
+ TODO
+*/
+int QQuickAbstractTabView::currentIndex() const
+{
+ Q_D(const QQuickAbstractTabView);
+ return d->currentIndex;
+}
+
+void QQuickAbstractTabView::setCurrentIndex(int index)
+{
+ Q_D(QQuickAbstractTabView);
+ if (d->currentIndex != index) {
+ d->currentIndex = index;
+ emit currentIndexChanged(index);
+ }
+}
+
+/*!
+ \qmlproperty TabBar QtQuickControls2::TabView::tabBar
+
+ TODO
+*/
+QQuickAbstractTabBar *QQuickAbstractTabView::tabBar() const
+{
+ Q_D(const QQuickAbstractTabView);
+ return d->bar;
+}
+
+void QQuickAbstractTabView::setTabBar(QQuickAbstractTabBar *bar)
+{
+ Q_D(QQuickAbstractTabView);
+ if (d->bar != bar) {
+ if (d->bar) {
+ disconnect(this, &QQuickAbstractTabView::currentIndexChanged, d->bar, &QQuickAbstractTabBar::setCurrentIndex);
+ disconnect(d->bar, &QQuickAbstractTabBar::currentIndexChanged, this, &QQuickAbstractTabView::setCurrentIndex);
+ if (d->bar->parentItem() == this)
+ delete d->bar;
+ }
+ d->bar = bar;
+ if (bar) {
+ connect(this, &QQuickAbstractTabView::currentIndexChanged, d->bar, &QQuickAbstractTabBar::setCurrentIndex);
+ connect(bar, &QQuickAbstractTabBar::currentIndexChanged, this, &QQuickAbstractTabView::setCurrentIndex);
+ if (!bar->parentItem())
+ bar->setParentItem(this);
+
+ int barIndex = bar->currentIndex();
+ if (d->currentIndex != barIndex) {
+ if (d->currentIndex != -1)
+ bar->setCurrentIndex(d->currentIndex);
+ else if (barIndex != -1)
+ setCurrentIndex(barIndex);
+ }
+ }
+ emit tabBarChanged();
+ }
+}
+
+void QQuickAbstractTabView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickAbstractTabView);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ if (d->bar && (!d->bar->widthValid() || qFuzzyCompare(d->bar->width(), oldGeometry.width())))
+ d->bar->setWidth(newGeometry.width());
+}
+
+/*!
+ \qmltype Tab
+ \inherits QtObject
+ \instantiates QQuickTabAttached
+ \inqmlmodule QtQuick.Controls
+ \ingroup tabs
+ \brief TODO
+
+ TODO
+*/
+
+QQuickTabAttached::QQuickTabAttached(QObject *parent) :
+ QObject(parent), m_index(-1), m_visible(true), m_view(Q_NULLPTR)
+{
+}
+
+QQuickTabAttached *QQuickTabAttached::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickTabAttached(object);
+}
+
+/*!
+ \qmlattachedproperty int QtQuickControls2::Tab::index
+
+ TODO
+*/
+int QQuickTabAttached::index() const
+{
+ return m_index;
+}
+
+void QQuickTabAttached::setIndex(int index)
+{
+ if (m_index != index) {
+ m_index = index;
+ emit indexChanged();
+ }
+}
+
+/*!
+ \qmlattachedproperty string QtQuickControls2::Tab::title
+
+ TODO
+*/
+QString QQuickTabAttached::title() const
+{
+ return m_title;
+}
+
+void QQuickTabAttached::setTitle(const QString &title)
+{
+ if (m_title != title) {
+ m_title = title;
+ emit titleChanged();
+ }
+}
+
+/*!
+ \qmlattachedproperty bool QtQuickControls2::Tab::visible
+
+ TODO
+*/
+bool QQuickTabAttached::isVisible() const
+{
+ return m_visible;
+}
+
+void QQuickTabAttached::setVisible(bool visible)
+{
+ if (m_visible != visible) {
+ m_visible = visible;
+ emit visibleChanged();
+ }
+}
+
+/*!
+ \qmlattachedproperty TabView QtQuickControls2::Tab::view
+
+ TODO
+*/
+QQuickAbstractTabView *QQuickTabAttached::view() const
+{
+ return m_view;
+}
+
+void QQuickTabAttached::setView(QQuickAbstractTabView *view)
+{
+ if (m_view != view) {
+ m_view = view;
+ emit viewChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttabview_p.h b/src/controls/qquickabstracttabview_p.h
new file mode 100644
index 00000000..e92ce2e5
--- /dev/null
+++ b/src/controls/qquickabstracttabview_p.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTABVIEW_P_H
+#define QQUICKABSTRACTTABVIEW_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractTabBar;
+class QQuickAbstractTabViewPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTabView : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(QQuickAbstractTabBar *tabBar READ tabBar WRITE setTabBar NOTIFY tabBarChanged FINAL)
+
+public:
+ explicit QQuickAbstractTabView(QQuickItem *parent = Q_NULLPTR);
+
+ int currentIndex() const;
+
+ QQuickAbstractTabBar *tabBar() const;
+ void setTabBar(QQuickAbstractTabBar *bar);
+
+public Q_SLOTS:
+ void setCurrentIndex(int index);
+
+Q_SIGNALS:
+ void currentIndexChanged(int index);
+ void tabBarChanged();
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractTabView)
+ Q_DECLARE_PRIVATE(QQuickAbstractTabView)
+};
+
+class Q_QUICKCONTROLS_EXPORT QQuickTabAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(QQuickAbstractTabView *view READ view WRITE setView NOTIFY viewChanged FINAL)
+
+public:
+ explicit QQuickTabAttached(QObject *parent = Q_NULLPTR);
+
+ static QQuickTabAttached *qmlAttachedProperties(QObject *object);
+
+ int index() const;
+ void setIndex(int index);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ QQuickAbstractTabView *view() const;
+ void setView(QQuickAbstractTabView *view);
+
+Q_SIGNALS:
+ void indexChanged();
+ void titleChanged();
+ void visibleChanged();
+ void viewChanged();
+
+private:
+ int m_index;
+ bool m_visible;
+ QString m_title;
+ QQuickAbstractTabView *m_view;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickTabAttached, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKABSTRACTTABVIEW_P_H
diff --git a/src/controls/qquickabstracttextarea.cpp b/src/controls/qquickabstracttextarea.cpp
new file mode 100644
index 00000000..41e24684
--- /dev/null
+++ b/src/controls/qquickabstracttextarea.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttextarea_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquicktextedit_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractTextAreaPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractTextArea)
+
+public:
+ QQuickAbstractTextAreaPrivate() : edit(Q_NULLPTR), placeholder(Q_NULLPTR) { }
+
+ void updateText();
+
+ QString text;
+ QQuickTextEdit *edit;
+ QQuickText *placeholder;
+};
+
+void QQuickAbstractTextAreaPrivate::updateText()
+{
+ Q_Q(QQuickAbstractTextArea);
+ q->setText(edit->text());
+}
+
+QQuickAbstractTextArea::QQuickAbstractTextArea(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractTextAreaPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+}
+
+QString QQuickAbstractTextArea::text() const
+{
+ Q_D(const QQuickAbstractTextArea);
+ return d->text;
+}
+
+void QQuickAbstractTextArea::setText(const QString &text)
+{
+ Q_D(QQuickAbstractTextArea);
+ if (d->text != text) {
+ d->text = text;
+ if (d->edit)
+ d->edit->setText(text);
+ emit textChanged();
+ }
+}
+
+QQuickTextEdit *QQuickAbstractTextArea::edit() const
+{
+ Q_D(const QQuickAbstractTextArea);
+ return d->edit;
+}
+
+void QQuickAbstractTextArea::setEdit(QQuickTextEdit *edit)
+{
+ Q_D(QQuickAbstractTextArea);
+ if (d->edit != edit) {
+ delete d->edit;
+ d->edit = edit;
+ if (edit) {
+ if (!edit->parentItem())
+ edit->setParentItem(this);
+ edit->setText(d->text);
+ QObjectPrivate::connect(edit, &QQuickTextEdit::textChanged, d, &QQuickAbstractTextAreaPrivate::updateText);
+ }
+ emit editChanged();
+ }
+}
+
+QQuickText *QQuickAbstractTextArea::placeholder() const
+{
+ Q_D(const QQuickAbstractTextArea);
+ return d->placeholder;
+}
+
+void QQuickAbstractTextArea::setPlaceholder(QQuickText *placeholder)
+{
+ Q_D(QQuickAbstractTextArea);
+ if (d->placeholder != placeholder) {
+ delete d->placeholder;
+ d->placeholder = placeholder;
+ if (placeholder && !placeholder->parentItem())
+ placeholder->setParentItem(this);
+ emit placeholderChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttextarea_p.h b/src/controls/qquickabstracttextarea_p.h
new file mode 100644
index 00000000..e5c8d0b7
--- /dev/null
+++ b/src/controls/qquickabstracttextarea_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTEXTAREA_P_H
+#define QQUICKABSTRACTTEXTAREA_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickText;
+class QQuickTextEdit;
+class QQuickAbstractTextAreaPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextArea : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(QQuickTextEdit *edit READ edit WRITE setEdit NOTIFY editChanged FINAL)
+ Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
+
+public:
+ explicit QQuickAbstractTextArea(QQuickItem *parent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ QQuickTextEdit *edit() const;
+ void setEdit(QQuickTextEdit *edit);
+
+ QQuickText *placeholder() const;
+ void setPlaceholder(QQuickText *placeholder);
+
+Q_SIGNALS:
+ void textChanged();
+ void editChanged();
+ void placeholderChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractTextArea)
+ Q_DECLARE_PRIVATE(QQuickAbstractTextArea)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTEXTAREA_P_H
diff --git a/src/controls/qquickabstracttextfield.cpp b/src/controls/qquickabstracttextfield.cpp
new file mode 100644
index 00000000..70e53ab3
--- /dev/null
+++ b/src/controls/qquickabstracttextfield.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttextfield_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquicktextinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractTextFieldPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractTextField)
+
+public:
+ QQuickAbstractTextFieldPrivate() : input(Q_NULLPTR), placeholder(Q_NULLPTR) { }
+
+ void updateText();
+
+ QString text;
+ QQuickTextInput *input;
+ QQuickText *placeholder;
+};
+
+
+void QQuickAbstractTextFieldPrivate::updateText()
+{
+ Q_Q(QQuickAbstractTextField);
+ q->setText(input->text());
+}
+
+QQuickAbstractTextField::QQuickAbstractTextField(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractTextFieldPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+}
+
+QString QQuickAbstractTextField::text() const
+{
+ Q_D(const QQuickAbstractTextField);
+ return d->text;
+}
+
+void QQuickAbstractTextField::setText(const QString &text)
+{
+ Q_D(QQuickAbstractTextField);
+ if (d->text != text) {
+ d->text = text;
+ if (d->input)
+ d->input->setText(text);
+ emit textChanged();
+ }
+}
+
+QQuickTextInput *QQuickAbstractTextField::input() const
+{
+ Q_D(const QQuickAbstractTextField);
+ return d->input;
+}
+
+void QQuickAbstractTextField::setInput(QQuickTextInput *input)
+{
+ Q_D(QQuickAbstractTextField);
+ if (d->input != input) {
+ delete d->input;
+ d->input = input;
+ if (input) {
+ if (!input->parentItem())
+ input->setParentItem(this);
+ input->setText(d->text);
+ QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickAbstractTextFieldPrivate::updateText);
+ }
+ emit inputChanged();
+ }
+}
+
+QQuickText *QQuickAbstractTextField::placeholder() const
+{
+ Q_D(const QQuickAbstractTextField);
+ return d->placeholder;
+}
+
+void QQuickAbstractTextField::setPlaceholder(QQuickText *placeholder)
+{
+ Q_D(QQuickAbstractTextField);
+ if (d->placeholder != placeholder) {
+ delete d->placeholder;
+ d->placeholder = placeholder;
+ if (placeholder && !placeholder->parentItem())
+ placeholder->setParentItem(this);
+ emit placeholderChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttextfield_p.h b/src/controls/qquickabstracttextfield_p.h
new file mode 100644
index 00000000..d274c43c
--- /dev/null
+++ b/src/controls/qquickabstracttextfield_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTEXTFIELD_P_H
+#define QQUICKABSTRACTTEXTFIELD_P_H
+
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickText;
+class QQuickTextInput;
+class QQuickAbstractTextFieldPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractTextField : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(QQuickTextInput *input READ input WRITE setInput NOTIFY inputChanged FINAL)
+ Q_PROPERTY(QQuickText *placeholder READ placeholder WRITE setPlaceholder NOTIFY placeholderChanged FINAL)
+
+public:
+ explicit QQuickAbstractTextField(QQuickItem *parent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ QQuickTextInput *input() const;
+ void setInput(QQuickTextInput *input);
+
+ QQuickText *placeholder() const;
+ void setPlaceholder(QQuickText *placeholder);
+
+Q_SIGNALS:
+ void textChanged();
+ void inputChanged();
+ void placeholderChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractTextField)
+ Q_DECLARE_PRIVATE(QQuickAbstractTextField)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTEXTFIELD_P_H
diff --git a/src/controls/qquickabstracttogglebutton.cpp b/src/controls/qquickabstracttogglebutton.cpp
new file mode 100644
index 00000000..663817e0
--- /dev/null
+++ b/src/controls/qquickabstracttogglebutton.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttogglebutton_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToggleButton
+ \inherits Checkable
+ \instantiates QQuickAbstractToggleButton
+ \inqmlmodule QtQuick.Controls
+ \ingroup buttons
+ \brief A toggle button control.
+
+ TODO
+*/
+
+QQuickAbstractToggleButton::QQuickAbstractToggleButton(QQuickItem *parent) :
+ QQuickAbstractSwitch(parent)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttogglebutton_p.h b/src/controls/qquickabstracttogglebutton_p.h
new file mode 100644
index 00000000..d51de56c
--- /dev/null
+++ b/src/controls/qquickabstracttogglebutton_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTOGGLEBUTTON_P_H
+#define QQUICKABSTRACTTOGGLEBUTTON_P_H
+
+#include <QtQuickControls/private/qquickabstractswitch_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractToggleButton : public QQuickAbstractSwitch
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractToggleButton(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTOGGLEBUTTON_P_H
diff --git a/src/controls/qquickabstracttoolbar.cpp b/src/controls/qquickabstracttoolbar.cpp
new file mode 100644
index 00000000..29119be0
--- /dev/null
+++ b/src/controls/qquickabstracttoolbar.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstracttoolbar_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToolBar
+ \inherits Container
+ \instantiates QQuickAbstractToolBar
+ \inqmlmodule QtQuick.Controls
+ \ingroup containers
+ \brief A tool bar control.
+
+ TODO
+*/
+
+QQuickAbstractToolBar::QQuickAbstractToolBar(QQuickItem *parent) :
+ QQuickAbstractContainer(parent)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstracttoolbar_p.h b/src/controls/qquickabstracttoolbar_p.h
new file mode 100644
index 00000000..3a7bb885
--- /dev/null
+++ b/src/controls/qquickabstracttoolbar_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTTOOLBAR_P_H
+#define QQUICKABSTRACTTOOLBAR_P_H
+
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickAbstractToolBar : public QQuickAbstractContainer
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickAbstractToolBar(QQuickItem *parent = Q_NULLPTR);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTTOOLBAR_P_H
diff --git a/src/controls/qquickcontrol.cpp b/src/controls/qquickcontrol.cpp
new file mode 100644
index 00000000..65db0e96
--- /dev/null
+++ b/src/controls/qquickcontrol.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquickabstractapplicationwindow_p.h"
+#include <QtCore/qcoreapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Control
+ \inherits Item
+ \instantiates QQuickControl
+ \inqmlmodule QtQuick.Controls
+ \brief A basic control type.
+
+ TODO
+*/
+
+QQuickControlPrivate::QQuickControlPrivate() :
+ style(Q_NULLPTR), attributes(QQuickControl::Attr_Count), background(Q_NULLPTR), padding(Q_NULLPTR)
+{
+}
+
+void QQuickControlPrivate::mirrorChange()
+{
+ Q_Q(QQuickControl);
+ q->mirrorChange();
+}
+
+void QQuickControlPrivate::resolveStyle(QQuickStyle *res)
+{
+ Q_Q(QQuickControl);
+ if (!res && q->testAttribute(QQuickControl::Attr_HasStyle))
+ return;
+
+ // lookup parent style
+ if (!res) {
+ QQuickItem *item = q->parentItem();
+ while (!res && item) {
+ QQuickControl *control = qobject_cast<QQuickControl *>(item);
+ if (control && control->testAttribute(QQuickControl::Attr_HasStyle))
+ res = control->style();
+ item = item->parentItem();
+ }
+ }
+
+ // fallback to window or global style
+ if (!res) {
+ QQuickAbstractApplicationWindow *aw = qobject_cast<QQuickAbstractApplicationWindow *>(window);
+ if (aw)
+ res = aw->style();
+ if (!res)
+ res = QQuickStyle::instance(qmlEngine(q));
+ }
+
+ if (style != res) {
+ style = res;
+ emit q->styleChanged();
+ }
+}
+
+QQuickControl::QQuickControl(QQuickItem *parent) :
+ QQuickItem(*(new QQuickControlPrivate), parent)
+{
+}
+
+QQuickControl::QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent) :
+ QQuickItem(dd, parent)
+{
+}
+
+/*!
+ \qmlpropertygroup QtQuickControls2::Control::padding
+ \qmlproperty real QtQuickControls2::Control::padding.top
+ \qmlproperty real QtQuickControls2::Control::padding.left
+ \qmlproperty real QtQuickControls2::Control::padding.right
+ \qmlproperty real QtQuickControls2::Control::padding.bottom
+
+ This property holds the padding.
+*/
+QQuickPadding *QQuickControl::padding() const
+{
+ Q_D(const QQuickControl);
+ if (!d->padding)
+ d->padding = new QQuickPadding(const_cast<QQuickControl *>(this));
+ return d->padding;
+}
+
+/*!
+ \qmlproperty Style QtQuickControls2::Control::style
+
+ This property holds the style.
+*/
+QQuickStyle *QQuickControl::style() const
+{
+ Q_D(const QQuickControl);
+ if (!d->style)
+ const_cast<QQuickControl *>(this)->d_func()->resolveStyle();
+ return d->style;
+}
+
+void QQuickControl::setStyle(QQuickStyle *style)
+{
+ Q_D(QQuickControl);
+ if (d->style != style) {
+ setAttribute(Attr_HasStyle, style);
+ d->resolveStyle(style);
+
+ QEvent change(QEvent::StyleChange);
+ foreach (QQuickControl *control, findChildren<QQuickControl *>())
+ QCoreApplication::sendEvent(control, &change);
+ }
+}
+
+void QQuickControl::resetStyle()
+{
+ setStyle(Q_NULLPTR);
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Control::background
+
+ This property holds the background item.
+*/
+QQuickItem *QQuickControl::background() const
+{
+ Q_D(const QQuickControl);
+ return d->background;
+}
+
+void QQuickControl::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickControl);
+ if (d->background != background) {
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ }
+ emit backgroundChanged();
+ }
+}
+
+bool QQuickControl::testAttribute(Attribute attribute) const
+{
+ Q_D(const QQuickControl);
+ return d->attributes.testBit(attribute);
+}
+
+void QQuickControl::setAttribute(Attribute attribute, bool on)
+{
+ Q_D(QQuickControl);
+ d->attributes.setBit(attribute, on);
+}
+
+bool QQuickControl::event(QEvent *event)
+{
+ Q_D(QQuickControl);
+ if (event->type() == QEvent::StyleChange)
+ d->resolveStyle();
+ return QQuickItem::event(event);
+}
+
+void QQuickControl::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ Q_D(QQuickControl);
+ QQuickItem::itemChange(change, data);
+ if (change == ItemSceneChange || change == ItemParentHasChanged)
+ d->resolveStyle();
+}
+
+void QQuickControl::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickControl);
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+ if (d->background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->background);
+ if (!p->widthValid || qFuzzyCompare(d->background->width(), oldGeometry.width()))
+ d->background->setWidth(newGeometry.width());
+ if (!p->heightValid || qFuzzyCompare(d->background->height(), oldGeometry.height()))
+ d->background->setHeight(newGeometry.height());
+ }
+}
+
+bool QQuickControl::isMirrored() const
+{
+ Q_D(const QQuickControl);
+ return d->isMirrored();
+}
+
+void QQuickControl::mirrorChange()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickcontrol_p.h b/src/controls/qquickcontrol_p.h
new file mode 100644
index 00000000..48ceedcc
--- /dev/null
+++ b/src/controls/qquickcontrol_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTROL_P_H
+#define QQUICKCONTROL_P_H
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickStyle;
+class QQuickPadding;
+class QQuickControlPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickControl : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickPadding *padding READ padding CONSTANT FINAL)
+ Q_PROPERTY(QQuickStyle *style READ style WRITE setStyle RESET resetStyle NOTIFY styleChanged FINAL)
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+
+public:
+ explicit QQuickControl(QQuickItem *parent = Q_NULLPTR);
+
+ QQuickPadding *padding() const;
+
+ QQuickStyle *style() const;
+ void setStyle(QQuickStyle *style);
+ void resetStyle();
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ enum Attribute {
+ Attr_HasStyle = 1,
+ Attr_Count
+ };
+
+ bool testAttribute(Attribute attribute) const;
+ void setAttribute(Attribute attribute, bool on = true);
+
+Q_SIGNALS:
+ void styleChanged();
+ void backgroundChanged();
+
+protected:
+ QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
+
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange, const ItemChangeData &data) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+ bool isMirrored() const;
+ virtual void mirrorChange();
+
+private:
+ Q_DISABLE_COPY(QQuickControl)
+ Q_DECLARE_PRIVATE(QQuickControl)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCONTROL_P_H
diff --git a/src/controls/qquickcontrol_p_p.h b/src/controls/qquickcontrol_p_p.h
new file mode 100644
index 00000000..7ef5dec0
--- /dev/null
+++ b/src/controls/qquickcontrol_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTROL_P_P_H
+#define QQUICKCONTROL_P_P_H
+
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuickControls/private/qquickstyle_p.h>
+#include <QtQuickControls/private/qquickpadding_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickControlPrivate : public QQuickItemPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickControl)
+
+public:
+ QQuickControlPrivate();
+
+ void mirrorChange() Q_DECL_OVERRIDE;
+
+ void resolveStyle(QQuickStyle *other = 0);
+
+ QQuickStyle *style;
+ QBitArray attributes;
+ QQuickItem *background;
+ mutable QQuickPadding *padding;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCONTROL_P_P_H
diff --git a/src/controls/qquickexclusivegroup.cpp b/src/controls/qquickexclusivegroup.cpp
new file mode 100644
index 00000000..325dfe19
--- /dev/null
+++ b/src/controls/qquickexclusivegroup.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickexclusivegroup_p.h"
+#include <QtCore/private/qobject_p.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ExclusiveGroup
+ \inherits QtObject
+ \instantiates QQuickExclusiveGroup
+ \inqmlmodule QtQuick.Controls
+ \ingroup utilities
+ \brief A non-visual mutually exclusive group of checkable controls.
+
+ TODO
+*/
+
+class QQuickExclusiveGroupPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickExclusiveGroup)
+
+public:
+ QQuickExclusiveGroupPrivate() : current(Q_NULLPTR) { }
+
+ void _q_updateCurrent();
+
+ QObject *current;
+};
+
+void QQuickExclusiveGroupPrivate::_q_updateCurrent()
+{
+ Q_Q(QQuickExclusiveGroup);
+ QObject *object = q->sender();
+ if (object->property("checked").toBool())
+ q->setCurrent(object);
+}
+
+QQuickExclusiveGroup::QQuickExclusiveGroup(QObject *parent)
+ : QObject(*(new QQuickExclusiveGroupPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty QtObject QtQuickControls2::ExclusiveGroup::current
+
+ TODO
+*/
+QObject *QQuickExclusiveGroup::current() const
+{
+ Q_D(const QQuickExclusiveGroup);
+ return d->current;
+}
+
+void QQuickExclusiveGroup::setCurrent(QObject *current)
+{
+ Q_D(QQuickExclusiveGroup);
+ if (d->current != current) {
+ if (d->current)
+ d->current->setProperty("checked", false);
+ d->current = current;
+ if (current)
+ current->setProperty("checked", true);
+ emit currentChanged();
+ }
+}
+
+/*!
+ \qmlmethod void QtQuickControls2::ExclusiveGroup::addCheckable(QtObject object)
+
+ TODO
+*/
+void QQuickExclusiveGroup::addCheckable(QObject *object)
+{
+ connect(object, SIGNAL(checkedChanged()), this, SLOT(_q_updateCurrent()), Qt::UniqueConnection);
+ connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(removeCheckable(QObject*)), Qt::UniqueConnection);
+
+ if (object->property("checked").toBool())
+ setCurrent(object);
+}
+
+/*!
+ \qmlmethod void QtQuickControls2::ExclusiveGroup::removeCheckable(QtObject object)
+
+ TODO
+*/
+void QQuickExclusiveGroup::removeCheckable(QObject *object)
+{
+ Q_D(QQuickExclusiveGroup);
+ if (object->metaObject()->indexOfProperty("checked") != -1)
+ disconnect(object, SIGNAL(checkedChanged()), this, SLOT(_q_updateCurrent()));
+ disconnect(object, SIGNAL(destroyed(QObject*)), this, SLOT(removeCheckable(QObject*)));
+
+ if (d->current == object)
+ setCurrent(Q_NULLPTR);
+}
+
+/*!
+ \qmltype Exclusive
+ \inherits QtObject
+ \instantiates QQuickExclusive
+ \inqmlmodule QtQuick.Controls
+ \ingroup utilities
+ \brief TODO
+
+ TODO
+*/
+
+QQuickExclusiveAttached::QQuickExclusiveAttached(QObject *parent) :
+ QObject(parent), m_group(Q_NULLPTR)
+{
+}
+
+QQuickExclusiveAttached *QQuickExclusiveAttached::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickExclusiveAttached(object);
+}
+
+/*!
+ \qmlattachedproperty ExclusiveGroup QtQuickControls2::Exclusive::group
+
+ TODO
+*/
+QQuickExclusiveGroup *QQuickExclusiveAttached::group() const
+{
+ return m_group;
+}
+
+void QQuickExclusiveAttached::setGroup(QQuickExclusiveGroup *group)
+{
+ if (m_group != group) {
+ if (m_group)
+ m_group->removeCheckable(parent());
+ m_group = group;
+ if (m_group)
+ m_group->addCheckable(parent());
+ emit groupChanged();
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickexclusivegroup_p.cpp"
diff --git a/src/controls/qquickexclusivegroup_p.h b/src/controls/qquickexclusivegroup_p.h
new file mode 100644
index 00000000..d7a561a2
--- /dev/null
+++ b/src/controls/qquickexclusivegroup_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKEXCLUSIVEGROUP_P_H
+#define QQUICKEXCLUSIVEGROUP_P_H
+
+#include <QtCore/qobject.h>
+#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickExclusiveGroupPrivate;
+
+class Q_QUICKCONTROLS_EXPORT QQuickExclusiveGroup : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *current READ current WRITE setCurrent NOTIFY currentChanged)
+
+public:
+ explicit QQuickExclusiveGroup(QObject *parent = Q_NULLPTR);
+
+ QObject *current() const;
+ void setCurrent(QObject *current);
+
+public Q_SLOTS:
+ void addCheckable(QObject *object);
+ void removeCheckable(QObject *object);
+
+Q_SIGNALS:
+ void currentChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickExclusiveGroup)
+ Q_DECLARE_PRIVATE(QQuickExclusiveGroup)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_updateCurrent())
+};
+
+class Q_QUICKCONTROLS_EXPORT QQuickExclusiveAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickExclusiveGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
+
+public:
+ explicit QQuickExclusiveAttached(QObject *parent = Q_NULLPTR);
+
+ static QQuickExclusiveAttached *qmlAttachedProperties(QObject *object);
+
+ QQuickExclusiveGroup *group() const;
+ void setGroup(QQuickExclusiveGroup *group);
+
+Q_SIGNALS:
+ void groupChanged();
+
+private:
+ QQuickExclusiveGroup *m_group;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickExclusiveAttached, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKEXCLUSIVEGROUP_H
diff --git a/src/controls/qquickpadding_p.h b/src/controls/qquickpadding_p.h
new file mode 100644
index 00000000..22442d16
--- /dev/null
+++ b/src/controls/qquickpadding_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPADDING_P_H
+#define QQUICKPADDING_P_H
+
+#include <QtCore/qobject.h>
+#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickPadding : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal left MEMBER left NOTIFY leftChanged)
+ Q_PROPERTY(qreal top MEMBER top NOTIFY topChanged)
+ Q_PROPERTY(qreal right MEMBER right NOTIFY rightChanged)
+ Q_PROPERTY(qreal bottom MEMBER bottom NOTIFY bottomChanged)
+
+public:
+ QQuickPadding(QObject *parent = Q_NULLPTR) : QObject(parent),
+ top(0), left(0), right(0), bottom(0)
+ {
+ }
+
+ qreal top;
+ qreal left;
+ qreal right;
+ qreal bottom;
+
+Q_SIGNALS:
+ void leftChanged();
+ void topChanged();
+ void rightChanged();
+ void bottomChanged();
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPADDING_P_H
diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp
new file mode 100644
index 00000000..e52e8b3a
--- /dev/null
+++ b/src/controls/qquickstyle.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstyle_p.h"
+#include <QtCore/qfile.h>
+#include <QtCore/qjsondocument.h>
+#include <QtCore/qjsonobject.h>
+#include <QtCore/qjsonvalue.h>
+#include <QtCore/qdebug.h>
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Style
+ \inherits QtObject
+ \instantiates QQuickStyle
+ \inqmlmodule QtQuick.Controls
+ \ingroup utilities
+ \brief A style interface.
+
+ TODO
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::accentColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::backgroundColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::focusColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::frameColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::pressColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::selectedTextColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::selectionColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::shadowColor
+*/
+
+/*!
+ \qmlproperty color QtQuickControls2::Style::textColor
+*/
+
+/*!
+ \qmlproperty int QtQuickControls2::Style::padding
+*/
+
+/*!
+ \qmlproperty int QtQuickControls2::Style::roundness
+*/
+
+/*!
+ \qmlproperty int QtQuickControls2::Style::spacing
+*/
+
+/*!
+ \qmlproperty real QtQuickControls2::Style::disabledOpacity
+*/
+
+static QColor readColorValue(const QJsonValue &value, const QColor &defaultValue)
+{
+ if (value.isString())
+ return QColor(value.toString());
+ return QColor::fromRgba(value.toInt(defaultValue.rgba()));
+}
+
+static double readNumberValue(const QJsonValue &value, double defaultValue)
+{
+ return value.toDouble(defaultValue);
+}
+
+QQuickStyle::QQuickStyle(QObject *parent) : QObject(parent)
+{
+ QJsonDocument doc;
+
+ QFile file(QStringLiteral(":/qtquickcontrols/style.json"));
+ if (!file.open(QFile::ReadOnly | QFile::Text)) {
+ qDebug() << file.error();
+ qWarning() << "QQuickStyle: failed to open ':/qtquickcontrols/style.json': " << qPrintable(file.errorString());
+ } else {
+ QJsonParseError error;
+ doc = QJsonDocument::fromJson(file.readAll(), &error);
+ if (error.error != QJsonParseError::NoError)
+ qWarning() << "QQuickStyle: failed to parse ':/qtquickcontrols/style.json': " << qPrintable(error.errorString());
+ }
+
+ QJsonObject style = doc.object();
+ accentColor = readColorValue(style.value(QStringLiteral("accentColor")), QColor("#7bc258"));
+ backgroundColor = readColorValue(style.value(QStringLiteral("backgroundColor")), QColor("#ffffff"));
+ baseColor = readColorValue(style.value(QStringLiteral("baseColor")), QColor("#eeeeee"));
+ focusColor = readColorValue(style.value(QStringLiteral("focusColor")), QColor("#45a7d7"));
+ frameColor = readColorValue(style.value(QStringLiteral("frameColor")), QColor("#bdbebf"));
+ pressColor = readColorValue(style.value(QStringLiteral("pressColor")), QColor("#33333333"));
+ selectedTextColor = readColorValue(style.value(QStringLiteral("selectedTextColor")), QColor("#ffffff"));
+ selectionColor = readColorValue(style.value(QStringLiteral("selectionColor")), QColor("#45a7d7"));
+ shadowColor = readColorValue(style.value(QStringLiteral("shadowColor")), QColor("#28282a"));
+ textColor = readColorValue(style.value(QStringLiteral("textColor")), QColor("#26282a"));
+ padding = readNumberValue(style.value(QStringLiteral("padding")), 6);
+ roundness = readNumberValue(style.value(QStringLiteral("roundness")), 3);
+ spacing = readNumberValue(style.value(QStringLiteral("spacing")), 6);
+ disabledOpacity = readNumberValue(style.value(QStringLiteral("disabledOpacity")), 0.3);
+}
+
+QQuickStyle *QQuickStyle::instance(QQmlEngine *engine)
+{
+ static QHash<QQmlEngine *, QQuickStyle *> styles;
+ QHash<QQmlEngine *, QQuickStyle *>::iterator it = styles.find(engine);
+ if (it == styles.end())
+ it = styles.insert(engine, new QQuickStyle(engine));
+ return it.value();
+}
+
+QQuickStyle *QQuickStyle::qmlAttachedProperties(QObject *object)
+{
+ return instance(qmlEngine(object));
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickstyle_p.h b/src/controls/qquickstyle_p.h
new file mode 100644
index 00000000..d26f2976
--- /dev/null
+++ b/src/controls/qquickstyle_p.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLE_P_H
+#define QQUICKSTYLE_P_H
+
+#include <QtCore/qobject.h>
+#include <QtGui/qcolor.h>
+#include <QtQuickControls/private/qtquickcontrolsglobal_p.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngine;
+class QJSEngine;
+
+class Q_QUICKCONTROLS_EXPORT QQuickStyle : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor accentColor MEMBER accentColor NOTIFY accentColorChanged FINAL)
+ Q_PROPERTY(QColor backgroundColor MEMBER backgroundColor NOTIFY backgroundColorChanged FINAL)
+ Q_PROPERTY(QColor baseColor MEMBER baseColor NOTIFY baseColorChanged FINAL)
+ Q_PROPERTY(QColor focusColor MEMBER focusColor NOTIFY focusColorChanged FINAL)
+ Q_PROPERTY(QColor frameColor MEMBER frameColor NOTIFY frameColorChanged FINAL)
+ Q_PROPERTY(QColor pressColor MEMBER pressColor NOTIFY pressColorChanged FINAL)
+ Q_PROPERTY(QColor selectedTextColor MEMBER selectedTextColor NOTIFY selectedTextColorChanged FINAL)
+ Q_PROPERTY(QColor selectionColor MEMBER selectionColor NOTIFY selectionColorChanged FINAL)
+ Q_PROPERTY(QColor shadowColor MEMBER shadowColor NOTIFY shadowColorChanged FINAL)
+ Q_PROPERTY(QColor textColor MEMBER textColor NOTIFY textColorChanged FINAL)
+ Q_PROPERTY(int padding MEMBER padding NOTIFY paddingChanged FINAL)
+ Q_PROPERTY(int roundness MEMBER roundness NOTIFY roundnessChanged FINAL)
+ Q_PROPERTY(int spacing MEMBER spacing NOTIFY spacingChanged FINAL)
+ Q_PROPERTY(qreal disabledOpacity MEMBER disabledOpacity NOTIFY disabledOpacityChanged FINAL)
+
+public:
+ explicit QQuickStyle(QObject *parent = Q_NULLPTR);
+
+ static QQuickStyle *instance(QQmlEngine *engine);
+ static QQuickStyle *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void accentColorChanged();
+ void backgroundColorChanged();
+ void baseColorChanged();
+ void focusColorChanged();
+ void frameColorChanged();
+ void pressColorChanged();
+ void selectedTextColorChanged();
+ void selectionColorChanged();
+ void shadowColorChanged();
+ void textColorChanged();
+ void paddingChanged();
+ void roundnessChanged();
+ void spacingChanged();
+ void disabledOpacityChanged();
+
+private:
+ QColor accentColor;
+ QColor baseColor;
+ QColor backgroundColor;
+ QColor focusColor;
+ QColor frameColor;
+ QColor pressColor;
+ QColor selectedTextColor;
+ QColor selectionColor;
+ QColor shadowColor;
+ QColor textColor;
+ int padding;
+ int spacing;
+ int roundness;
+ qreal disabledOpacity;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPEINFO(QQuickStyle, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKSTYLE_P_H
diff --git a/src/controls/qtquickcontrolsglobal_p.h b/src/controls/qtquickcontrolsglobal_p.h
new file mode 100644
index 00000000..3d606db7
--- /dev/null
+++ b/src/controls/qtquickcontrolsglobal_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCONTROLSGLOBAL_P_H
+#define QTQUICKCONTROLSGLOBAL_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKCONTROLS_LIB)
+# define Q_QUICKCONTROLS_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKCONTROLS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKCONTROLS_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCONTROLSGLOBAL_P_H
diff --git a/src/controls/style.json b/src/controls/style.json
new file mode 100644
index 00000000..a1a79969
--- /dev/null
+++ b/src/controls/style.json
@@ -0,0 +1,16 @@
+{
+ "accentColor": "#7bc258",
+ "backgroundColor": "#ffffff",
+ "baseColor": "#eeeeee",
+ "focusColor": "#45a7d7",
+ "frameColor": "#bdbebf",
+ "pressColor": "#33333333",
+ "selectedTextColor": "#ffffff",
+ "selectionColor": "#45a7d7",
+ "shadowColor": "#28282a",
+ "textColor": "#26282a",
+ "padding": 6,
+ "roundness": 3,
+ "disabledOpacity": 0.3,
+ "spacing": 6
+}
diff --git a/src/extras/extras.pri b/src/extras/extras.pri
new file mode 100644
index 00000000..6b97f98c
--- /dev/null
+++ b/src/extras/extras.pri
@@ -0,0 +1,9 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qquickabstractdrawer_p.h \
+ $$PWD/qquickabstractsplitview_p.h
+
+SOURCES += \
+ $$PWD/qquickabstractdrawer.cpp \
+ $$PWD/qquickabstractsplitview.cpp
diff --git a/src/extras/extras.pro b/src/extras/extras.pro
new file mode 100644
index 00000000..70ebcfcc
--- /dev/null
+++ b/src/extras/extras.pro
@@ -0,0 +1,14 @@
+TARGET = QtQuickExtras
+MODULE = quickextras
+CONFIG += internal_module
+
+QT += quick
+QT += core-private gui-private qml-private quick-private quickcontrols-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ $$PWD/qtquickextrasglobal_p.h
+
+include(extras.pri)
+load(qt_module)
diff --git a/src/extras/qquickabstractdrawer.cpp b/src/extras/qquickabstractdrawer.cpp
new file mode 100644
index 00000000..d25a7f0d
--- /dev/null
+++ b/src/extras/qquickabstractdrawer.cpp
@@ -0,0 +1,388 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractdrawer_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuickControls/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDrawerPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractDrawer)
+
+public:
+ QQuickAbstractDrawerPrivate() : edge(Qt::LeftEdge), offset(0), position(0),
+ content(Q_NULLPTR), animation(Q_NULLPTR) { }
+
+ void updateContent();
+ bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
+
+ Qt::Edge edge;
+ qreal offset;
+ qreal position;
+ QPointF pressPoint;
+ QQuickItem *content;
+ QQuickPropertyAnimation *animation;
+};
+
+void QQuickAbstractDrawerPrivate::updateContent()
+{
+ Q_Q(QQuickAbstractDrawer);
+ if (!content)
+ return;
+
+ switch (edge) {
+ case Qt::LeftEdge:
+ content->setX((position - 1.0) * content->width());
+ break;
+ case Qt::RightEdge:
+ content->setX(q->width() + - position * content->width());
+ break;
+ case Qt::TopEdge:
+ content->setY((position - 1.0) * content->height());
+ break;
+ case Qt::BottomEdge:
+ content->setY(q->height() + - position * content->height());
+ break;
+ }
+}
+
+bool QQuickAbstractDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickAbstractDrawer);
+ pressPoint = q->mapFromItem(item, event->pos());
+
+ if (qFuzzyIsNull(position)) {
+ // only accept pressing at drag margins when fully closed
+ switch (edge) {
+ case Qt::LeftEdge:
+ event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(event->x(), Qt::XAxis, event));
+ break;
+ case Qt::RightEdge:
+ event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(q->width() - event->x(), Qt::XAxis, event));
+ break;
+ case Qt::TopEdge:
+ event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(event->y(), Qt::YAxis, event));
+ break;
+ case Qt::BottomEdge:
+ event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(q->height() - event->y(), Qt::YAxis, event));
+ break;
+ }
+ offset = 0;
+ } else {
+ event->accept();
+ offset = q->positionAt(pressPoint) - position;
+ }
+
+ return item == q;
+}
+
+bool QQuickAbstractDrawerPrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickAbstractDrawer);
+ QPointF movePoint = q->mapFromItem(item, event->pos());
+
+ if (!q->keepMouseGrab()) {
+ bool overThreshold = false;
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
+ overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event);
+ else
+ overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event);
+
+ if (window && overThreshold) {
+ QQuickItem *grabber = q->window()->mouseGrabberItem();
+ if (!grabber || !grabber->keepMouseGrab()) {
+ q->grabMouse();
+ q->setKeepMouseGrab(overThreshold);
+ }
+ }
+ }
+
+ if (q->keepMouseGrab())
+ q->setPosition(q->positionAt(event->pos()) - offset);
+ event->accept();
+
+ return q->keepMouseGrab();
+}
+
+bool QQuickAbstractDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickAbstractDrawer);
+ bool wasGrabbed = q->keepMouseGrab();
+ if (wasGrabbed) {
+// int startDragVelocity = QGuiApplication::styleHints()->startDragVelocity();
+// if (startDragVelocity && QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) {
+// QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
+// qreal vel = (edge == Qt::LeftEdge || edge == Qt::RightEdge) ? velocity.x() : velocity.y();
+// qDebug() << vel << "vs." << startDragVelocity;
+// }
+ if (position < 0.3) {
+ q->close();
+ } else if (position > 0.7) {
+ q->open();
+ } else {
+ switch (edge) {
+ case Qt::LeftEdge:
+ if (event->x() - pressPoint.x() > 0)
+ q->open();
+ else
+ q->close();
+ break;
+ case Qt::RightEdge:
+ if (event->x() - pressPoint.x() < 0)
+ q->open();
+ else
+ q->close();
+ break;
+ case Qt::TopEdge:
+ if (event->y() - pressPoint.y() > 0)
+ q->open();
+ else
+ q->close();
+ break;
+ case Qt::BottomEdge:
+ if (event->y() - pressPoint.y() < 0)
+ q->open();
+ else
+ q->close();
+ break;
+ }
+ }
+ q->setKeepMouseGrab(false);
+ } else {
+ if (item == q)
+ emit q->clicked();
+ }
+ pressPoint = QPoint();
+ event->accept();
+ return wasGrabbed;
+}
+
+QQuickAbstractDrawer::QQuickAbstractDrawer(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractDrawerPrivate), parent)
+{
+ setZ(1);
+ setFiltersChildMouseEvents(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+Qt::Edge QQuickAbstractDrawer::edge() const
+{
+ Q_D(const QQuickAbstractDrawer);
+ return d->edge;
+}
+
+void QQuickAbstractDrawer::setEdge(Qt::Edge edge)
+{
+ Q_D(QQuickAbstractDrawer);
+ if (d->edge != edge) {
+ d->edge = edge;
+ if (isComponentComplete())
+ d->updateContent();
+ emit edgeChanged();
+ }
+}
+
+qreal QQuickAbstractDrawer::position() const
+{
+ Q_D(const QQuickAbstractDrawer);
+ return d->position;
+}
+
+void QQuickAbstractDrawer::setPosition(qreal position)
+{
+ Q_D(QQuickAbstractDrawer);
+ position = qBound(0.0, position, 1.0);
+ if (!qFuzzyCompare(d->position, position)) {
+ d->position = position;
+ if (isComponentComplete())
+ d->updateContent();
+ emit positionChanged();
+ }
+}
+
+QQuickItem *QQuickAbstractDrawer::contentItem() const
+{
+ Q_D(const QQuickAbstractDrawer);
+ return d->content;
+}
+
+void QQuickAbstractDrawer::setContentItem(QQuickItem *item)
+{
+ Q_D(QQuickAbstractDrawer);
+ if (d->content != item) {
+ delete d->content;
+ d->content = item;
+ if (item)
+ item->setParentItem(this);
+ if (isComponentComplete())
+ d->updateContent();
+ emit contentItemChanged();
+ }
+}
+
+QQuickPropertyAnimation *QQuickAbstractDrawer::animation() const
+{
+ Q_D(const QQuickAbstractDrawer);
+ return d->animation;
+}
+
+void QQuickAbstractDrawer::setAnimation(QQuickPropertyAnimation *animation)
+{
+ Q_D(QQuickAbstractDrawer);
+ if (d->animation != animation) {
+ delete d->animation;
+ d->animation = animation;
+ if (animation) {
+ animation->setTargetObject(this);
+ animation->setProperty(QStringLiteral("position"));
+ }
+ emit animationChanged();
+ }
+}
+
+void QQuickAbstractDrawer::open()
+{
+ Q_D(QQuickAbstractDrawer);
+ if (d->animation) {
+ d->animation->stop();
+ d->animation->setFrom(d->position);
+ d->animation->setTo(1.0);
+ d->animation->start();
+ } else {
+ setPosition(1.0);
+ }
+}
+
+void QQuickAbstractDrawer::close()
+{
+ Q_D(QQuickAbstractDrawer);
+ if (d->animation) {
+ d->animation->stop();
+ d->animation->setFrom(d->position);
+ d->animation->setTo(0.0);
+ d->animation->start();
+ } else {
+ setPosition(0.0);
+ }
+}
+
+bool QQuickAbstractDrawer::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_D(QQuickAbstractDrawer);
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseMove:
+ return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
+ default:
+ return false;
+ }
+}
+
+void QQuickAbstractDrawer::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::mousePressEvent(event);
+ d->handleMousePressEvent(this, event);
+}
+
+void QQuickAbstractDrawer::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::mouseMoveEvent(event);
+ d->handleMouseMoveEvent(this, event);
+}
+
+void QQuickAbstractDrawer::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::mouseReleaseEvent(event);
+ d->handleMouseReleaseEvent(this, event);
+}
+
+void QQuickAbstractDrawer::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+}
+
+void QQuickAbstractDrawer::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ if (isComponentComplete())
+ d->updateContent();
+}
+
+void QQuickAbstractDrawer::componentComplete()
+{
+ Q_D(QQuickAbstractDrawer);
+ QQuickControl::componentComplete();
+ d->updateContent();
+}
+
+qreal QQuickAbstractDrawer::positionAt(const QPointF &point) const
+{
+ Q_D(const QQuickAbstractDrawer);
+ if (!d->content)
+ return 0.0;
+
+ switch (d->edge) {
+ case Qt::TopEdge:
+ return point.y() / d->content->height();
+ case Qt::LeftEdge:
+ return point.x() / d->content->width();
+ case Qt::RightEdge:
+ return (width() - point.x()) / d->content->width();
+ case Qt::BottomEdge:
+ return (height() - point.y()) / d->content->height();
+ default:
+ return 0;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/qquickabstractdrawer_p.h b/src/extras/qquickabstractdrawer_p.h
new file mode 100644
index 00000000..5c9d44ec
--- /dev/null
+++ b/src/extras/qquickabstractdrawer_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTDRAWER_P_H
+#define QQUICKABSTRACTDRAWER_P_H
+
+#include <QtQuickExtras/private/qtquickextrasglobal_p.h>
+#include <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPropertyAnimation;
+class QQuickAbstractDrawerPrivate;
+
+class Q_QUICKEXTRAS_EXPORT QQuickAbstractDrawer : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL)
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+ // TODO: make this a proper transition
+ Q_PROPERTY(QQuickPropertyAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentItem")
+
+public:
+ explicit QQuickAbstractDrawer(QQuickItem *parent = Q_NULLPTR);
+
+ Qt::Edge edge() const;
+ void setEdge(Qt::Edge edge);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ QQuickItem *contentItem() const;
+ void setContentItem(QQuickItem *item);
+
+ QQuickPropertyAnimation *animation() const;
+ void setAnimation(QQuickPropertyAnimation *animation);
+
+public Q_SLOTS:
+ void open();
+ void close();
+
+Q_SIGNALS:
+ void clicked();
+ void edgeChanged();
+ void positionChanged();
+ void contentItemChanged();
+ void animationChanged();
+
+protected:
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+ virtual qreal positionAt(const QPointF &point) const;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractDrawer)
+ Q_DECLARE_PRIVATE(QQuickAbstractDrawer)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTDRAWER_P_H
diff --git a/src/extras/qquickabstractsplitview.cpp b/src/extras/qquickabstractsplitview.cpp
new file mode 100644
index 00000000..cf20945e
--- /dev/null
+++ b/src/extras/qquickabstractsplitview.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractsplitview_p.h"
+
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractSplitViewPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QQuickAbstractSplitViewPrivate() : orientation(Qt::Horizontal) { }
+
+ bool resizing;
+ Qt::Orientation orientation;
+};
+
+QQuickAbstractSplitView::QQuickAbstractSplitView(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractSplitViewPrivate), parent)
+{
+}
+
+Qt::Orientation QQuickAbstractSplitView::orientation() const
+{
+ Q_D(const QQuickAbstractSplitView);
+ return d->orientation;
+}
+
+void QQuickAbstractSplitView::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickAbstractSplitView);
+ if (d->orientation != orientation) {
+ d->orientation = orientation;
+ emit orientationChanged();
+ }
+}
+
+bool QQuickAbstractSplitView::isResizing() const
+{
+ Q_D(const QQuickAbstractSplitView);
+ return d->resizing;
+}
+
+void QQuickAbstractSplitView::setResizing(bool resizing)
+{
+ Q_D(QQuickAbstractSplitView);
+ if (d->resizing != resizing) {
+ d->resizing = resizing;
+ emit resizingChanged();
+ }
+}
+
+void QQuickAbstractSplitView::addItem(QQuickItem *item)
+{
+ // TODO
+ Q_UNUSED(item);
+}
+
+void QQuickAbstractSplitView::componentComplete()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/qquickabstractsplitview_p.h b/src/extras/qquickabstractsplitview_p.h
new file mode 100644
index 00000000..e8bad706
--- /dev/null
+++ b/src/extras/qquickabstractsplitview_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTSPLITVIEW_P_H
+#define QQUICKABSTRACTSPLITVIEW_P_H
+
+#include <QtQuickExtras/private/qtquickextrasglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractSplitViewPrivate;
+
+class Q_QUICKEXTRAS_EXPORT QQuickAbstractSplitView : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(bool resizing READ isResizing NOTIFY resizingChanged FINAL)
+
+public:
+ explicit QQuickAbstractSplitView(QQuickItem *parent = Q_NULLPTR);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ bool isResizing() const;
+ void setResizing(bool resizing);
+
+public Q_SLOTS:
+ void addItem(QQuickItem *item);
+
+Q_SIGNALS:
+ void orientationChanged();
+ void resizingChanged();
+
+protected:
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractSplitView)
+ Q_DECLARE_PRIVATE(QQuickAbstractSplitView)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTSPLITVIEW_P_H
diff --git a/src/extras/qtquickextrasglobal_p.h b/src/extras/qtquickextrasglobal_p.h
new file mode 100644
index 00000000..d0922dca
--- /dev/null
+++ b/src/extras/qtquickextrasglobal_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKEXTRASGLOBAL_P_H
+#define QTQUICKEXTRASGLOBAL_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKEXTRAS_LIB)
+# define Q_QUICKEXTRAS_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKEXTRAS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKEXTRAS_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKEXTRASGLOBAL_P_H
diff --git a/src/imports/calendar/CalendarDelegate.qml b/src/imports/calendar/CalendarDelegate.qml
new file mode 100644
index 00000000..a6b000b7
--- /dev/null
+++ b/src/imports/calendar/CalendarDelegate.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+
+Item {
+ property alias text: label.text
+ property alias color: label.color
+ property real padding
+
+ implicitWidth: label.implicitWidth * 3
+ implicitHeight: label.implicitHeight * 3
+
+ Text {
+ id: label
+ x: padding
+ y: padding
+ width: parent.width - 2 * padding
+ height: parent.height - 2 * padding
+ minimumPointSize: 8
+ fontSizeMode: Text.Fit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/src/imports/calendar/CalendarView.qml b/src/imports/calendar/CalendarView.qml
new file mode 100644
index 00000000..ce6e9908
--- /dev/null
+++ b/src/imports/calendar/CalendarView.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+
+AbstractCalendarView {
+ id: control
+
+ property Component delegate: CalendarDelegate {
+ width: grid.width ? grid.width / 7 : implicitWidth
+ height: grid.height ? grid.height / 6 : implicitHeight
+ opacity: model.month === control.month ? 1 : 0
+ color: model.today ? style.accentColor : style.textColor
+ text: model.day
+ padding: style.padding
+ }
+
+ contentWidth: grid.implicitWidth
+ contentHeight: grid.implicitHeight
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + padding.top + padding.bottom)
+
+ Accessible.name: title
+
+ contentItem: Grid {
+ id: grid
+
+ rows: 6
+ columns: 7
+
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ Repeater {
+ id: repeater
+ model: control.source
+ delegate: control.delegate
+ }
+ }
+}
diff --git a/src/imports/calendar/DayOfWeekRow.qml b/src/imports/calendar/DayOfWeekRow.qml
new file mode 100644
index 00000000..5a33b5ee
--- /dev/null
+++ b/src/imports/calendar/DayOfWeekRow.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+
+AbstractDayOfWeekRow {
+ id: control
+
+ property Component delegate: Text {
+ text: model.shortName
+ font.bold: true
+ color: control.style.textColor
+ width: row.width ? row.width / 7 : implicitWidth
+ height: row.height ? row.height : implicitHeight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ contentWidth: row.implicitWidth
+ contentHeight: row.implicitHeight
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + padding.top + padding.bottom)
+
+ padding { top: style.padding; bottom: style.padding }
+
+ contentItem: Row {
+ id: row
+
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ Repeater {
+ model: control.source
+ delegate: control.delegate
+ }
+ }
+}
diff --git a/src/imports/calendar/WeekNumberColumn.qml b/src/imports/calendar/WeekNumberColumn.qml
new file mode 100644
index 00000000..e2d1f63c
--- /dev/null
+++ b/src/imports/calendar/WeekNumberColumn.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+import QtQuick.Calendar 2.0
+
+AbstractWeekNumberColumn {
+ id: control
+
+ property Component delegate: Text {
+ text: model.weekNumber
+ font.bold: true
+ color: control.style.textColor
+ width: column.width ? column.width : implicitWidth
+ height: column.height ? column.height / 6 : implicitHeight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ contentWidth: column.implicitWidth
+ contentHeight: column.implicitHeight
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + padding.top + padding.bottom)
+
+ padding { left: style.padding; right: style.padding }
+
+ contentItem: Column {
+ id: column
+
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ Repeater {
+ model: control.source
+ delegate: control.delegate
+ }
+ }
+}
diff --git a/src/imports/calendar/calendar.pro b/src/imports/calendar/calendar.pro
new file mode 100644
index 00000000..625be272
--- /dev/null
+++ b/src/imports/calendar/calendar.pro
@@ -0,0 +1,21 @@
+TARGET = qtquickcalendar2plugin
+TARGETPATH = QtQuick/Calendar.2
+IMPORT_VERSION = 2.0
+
+QT += qml quick
+QT += core-private gui-private qml-private quick-private quickcontrols-private quickcalendar-private
+
+OTHER_FILES += \
+ qmldir
+
+QML_FILES = \
+ CalendarDelegate.qml \
+ CalendarView.qml \
+ DayOfWeekRow.qml \
+ WeekNumberColumn.qml
+
+SOURCES += \
+ $$PWD/qtquickcalendar2plugin.cpp
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/imports/calendar/qmldir b/src/imports/calendar/qmldir
new file mode 100644
index 00000000..af87241f
--- /dev/null
+++ b/src/imports/calendar/qmldir
@@ -0,0 +1,7 @@
+module QtQuick.Calendar
+plugin qtquickcalendar2plugin
+classname QtQuickCalendar2Plugin
+CalendarDelegate 2.0 CalendarDelegate.qml
+CalendarView 2.0 CalendarView.qml
+DayOfWeekRow 2.0 DayOfWeekRow.qml
+WeekNumberColumn 2.0 WeekNumberColumn.qml
diff --git a/src/imports/calendar/qtquickcalendar2plugin.cpp b/src/imports/calendar/qtquickcalendar2plugin.cpp
new file mode 100644
index 00000000..8e84e094
--- /dev/null
+++ b/src/imports/calendar/qtquickcalendar2plugin.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+
+#include <QtQuickCalendar/private/qquickabstractcalendarview_p.h>
+#include <QtQuickCalendar/private/qquickabstractdayofweekrow_p.h>
+#include <QtQuickCalendar/private/qquickabstractweeknumbercolumn_p.h>
+#include <QtQuickCalendar/private/qquickcalendarmodel_p.h>
+#include <QtQuickCalendar/private/qquickdayofweekmodel_p.h>
+#include <QtQuickCalendar/private/qquickmonthmodel_p.h>
+#include <QtQuickCalendar/private/qquickweeknumbermodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickCalendar2Plugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ void registerTypes(const char *uri);
+};
+
+void QtQuickCalendar2Plugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<QQuickAbstractCalendarView>(uri, 2, 0, "AbstractCalendarView");
+ qmlRegisterType<QQuickAbstractDayOfWeekRow>(uri, 2, 0, "AbstractDayOfWeekRow");
+ qmlRegisterType<QQuickAbstractWeekNumberColumn>(uri, 2, 0, "AbstractWeekNumberColumn");
+ qmlRegisterType<QQuickCalendarModel>(uri, 2, 0, "CalendarModel");
+ qmlRegisterType<QQuickDayOfWeekModel>(uri, 2, 0, "DayOfWeekModel");
+ qmlRegisterType<QQuickMonthModel>(uri, 2, 0, "MonthModel");
+ qmlRegisterType<QQuickWeekNumberModel>(uri, 2, 0, "WeekNumberModel");
+}
+
+QT_END_NAMESPACE
+
+#include "qtquickcalendar2plugin.moc"
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml
new file mode 100644
index 00000000..036630e4
--- /dev/null
+++ b/src/imports/controls/ApplicationWindow.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+AbstractApplicationWindow {
+ id: window
+
+ color: style.backgroundColor
+ flags: Qt.Window | Qt.WindowFullscreenButtonHint
+
+ contentWidth: contentItem.children.length === 1 ? contentItem.children[0].implicitWidth : 0
+ contentHeight: contentItem.children.length === 1 ? contentItem.children[0].implicitHeight : 0
+
+ minimumWidth: Math.max(contentWidth,
+ (header ? header.implicitWidth : 0),
+ (footer ? footer.implicitWidth : 0))
+ minimumHeight: contentHeight + (header ? header.implicitHeight : 0)
+ + (footer ? footer.implicitHeight : 0)
+}
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
new file mode 100644
index 00000000..09abd9dc
--- /dev/null
+++ b/src/imports/controls/BusyIndicator.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractBusyIndicator {
+ id: control
+
+ implicitWidth: indicator.implicitWidth + padding.left + padding.right
+ implicitHeight: indicator.implicitHeight + padding.top + padding.bottom
+
+ Accessible.role: Accessible.Indicator
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ indicator: Item {
+ id: delegate
+ implicitWidth: 48
+ implicitHeight: 48
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width
+ height: parent.height
+
+ opacity: control.running ? 1 : 0
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: Math.min(parent.width, parent.height)
+ height: width
+ source: width <= 32 ? "qrc:/images/spinner_small.png" :
+ width >= 48 ? "qrc:/images/spinner_large.png" :
+ "qrc:/images/spinner_medium.png"
+
+ RotationAnimator on rotation {
+ duration: 800
+ loops: Animation.Infinite
+ from: 0
+ to: 360
+ running: control.visible && (control.running || delegate.opacity > 0)
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
new file mode 100644
index 00000000..8ec7065b
--- /dev/null
+++ b/src/imports/controls/Button.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + padding.left + padding.right : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ label ? label.implicitHeight + padding.top + padding.bottom : 0)
+
+ Accessible.name: text
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.Button
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ label: Text {
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ text: control.text
+ color: control.style.selectedTextColor
+ elide: Text.ElideRight
+ opacity: enabled ? 1.0 : control.style.disabledOpacity
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+
+ radius: style.roundness
+ opacity: control.enabled ? 1.0 : style.disabledOpacity
+ color: Qt.tint(Qt.tint(style.accentColor,
+ control.activeFocus ? style.focusColor : "transparent"),
+ control.pressed ? style.pressColor : "transparent")
+ }
+}
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
new file mode 100644
index 00000000..6bc8f473
--- /dev/null
+++ b/src/imports/controls/CheckBox.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractCheckBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? style.spacing : 0) + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + padding.top + padding.bottom)
+
+ Accessible.name: text
+ Accessible.checked: checked
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.CheckBox
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ indicator: Rectangle {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ implicitWidth: 20
+ implicitHeight: 20
+ x: text ? (mirror ? parent.width - width - padding.right : padding.left) : (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ radius: style.roundness
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? style.focusColor : style.frameColor
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ color: style.backgroundColor
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 12
+ height: 12
+ color: Qt.tint(Qt.tint(control.checked ? style.accentColor : style.baseColor,
+ control.checked && control.activeFocus ? style.focusColor : "transparent"),
+ control.pressed ? style.pressColor : "transparent")
+ border.width: control.checked || control.pressed ? 0 : 1
+ border.color: style.frameColor
+ }
+ }
+
+ label: Text {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ x: mirror ? padding.left : (indicator.x + indicator.width + control.style.spacing)
+ y: padding.top
+ width: parent.width - indicator.width - control.style.spacing - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ text: control.text
+ color: control.style.textColor
+ elide: Text.ElideRight
+ visible: control.text
+ opacity: enabled ? 1.0 : control.style.disabledOpacity
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
new file mode 100644
index 00000000..62582263
--- /dev/null
+++ b/src/imports/controls/Frame.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractFrame {
+ id: control
+
+ default property alias data: content.data
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + padding.top + padding.bottom)
+
+ contentWidth: content.children.length === 1 ? content.children[0].implicitWidth : 0
+ contentHeight: content.children.length === 1 ? content.children[0].implicitHeight : 0
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ contentItem: Item {
+ id: content
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+ }
+
+ background: Rectangle {
+ color: "transparent"
+ radius: style.roundness
+ border.color: style.frameColor
+ }
+}
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
new file mode 100644
index 00000000..39e45adb
--- /dev/null
+++ b/src/imports/controls/GroupBox.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractGroupBox {
+ id: control
+
+ default property alias data: content.data
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + padding.top + padding.bottom)
+
+ contentWidth: content.children.length === 1 ? content.children[0].implicitWidth : 0
+ contentHeight: content.children.length === 1 ? content.children[0].implicitHeight : 0
+
+ padding {
+ top: style.padding + (label && title ? label.implicitHeight + style.spacing : 0)
+ left: style.padding
+ right: style.padding
+ bottom: style.padding
+ }
+
+ contentItem: Item {
+ id: content
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+ }
+
+ label: Text {
+ x: padding.left
+ width: parent.width - padding.left - padding.right
+
+ text: control.title
+ color: control.style.textColor
+ elide: Text.ElideRight
+ opacity: enabled ? 1.0 : control.style.disabledOpacity
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ frame: Rectangle {
+ y: padding.top - style.padding
+ width: parent.width
+ height: parent.height - padding.top + style.padding
+
+ color: "transparent"
+ radius: style.roundness
+ border.color: style.frameColor
+ }
+}
diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml
new file mode 100644
index 00000000..872cb978
--- /dev/null
+++ b/src/imports/controls/Label.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+Text {
+ id: control
+
+ // TODO: color: style.textColor
+
+ Accessible.name: text
+ Accessible.role: Accessible.StaticText
+}
diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml
new file mode 100644
index 00000000..db6dbdde
--- /dev/null
+++ b/src/imports/controls/PageIndicator.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractPageIndicator {
+ id: control
+
+ property alias spacing: row.spacing
+
+ property Component delegate: Rectangle {
+ implicitWidth: 8
+ implicitHeight: 8
+
+ radius: width / 2
+ color: style.shadowColor // TODO
+
+ opacity: index === currentIndex ? 0.75 : 0.25
+ Behavior on opacity { OpacityAnimator { duration: 100 } }
+ }
+
+ Accessible.role: Accessible.Indicator
+
+ contentWidth: row.implicitWidth
+ contentHeight: row.implicitHeight
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + padding.top + padding.bottom)
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ contentItem: Row {
+ id: row
+
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ spacing: style.spacing
+
+ Repeater {
+ model: control.count
+ delegate: control.delegate
+ }
+ }
+}
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
new file mode 100644
index 00000000..8e6342ee
--- /dev/null
+++ b/src/imports/controls/ProgressBar.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractProgressBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ indicator ? indicator.implicitWidth : 0) + padding.left + padding.right
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + padding.top + padding.bottom
+
+ Accessible.role: Accessible.ProgressBar
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ indicator: Item {
+ x: padding.left
+ y: padding.top
+ width: parent.width - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+ scale: control.effectiveLayoutDirection === Qt.RightToLeft ? -1 : 1
+
+ Repeater {
+ model: indeterminate ? 2 : 1
+
+ Rectangle {
+ property real offset: indeterminate ? 0 : control.value
+
+ x: 2 + (indeterminate ? offset * parent.width - 4 : 0)
+ y: (parent.height - height) / 2
+ width: offset * (parent.width - x) - 2
+ height: 2
+
+ color: style.accentColor
+ radius: style.roundness
+
+ SequentialAnimation on offset {
+ loops: Animation.Infinite
+ running: indeterminate && visible
+ PauseAnimation { duration: index ? 520 : 0 }
+ NumberAnimation {
+ easing.type: Easing.OutCubic
+ duration: 1240
+ from: 0
+ to: 1
+ }
+ PauseAnimation { duration: index ? 0 : 520 }
+ }
+ }
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 120
+ implicitHeight: 6
+ x: padding.left
+ y: (parent.height - height) / 2
+ width: parent.width - padding.left - padding.bottom
+ height: 6
+
+ radius: style.roundness
+ border.color: style.frameColor
+ color: "transparent"
+ }
+}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
new file mode 100644
index 00000000..919ab947
--- /dev/null
+++ b/src/imports/controls/RadioButton.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractRadioButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? style.spacing : 0) + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + padding.top + padding.bottom)
+
+ Accessible.name: text
+ Accessible.checked: checked
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.RadioButton
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ indicator: Rectangle {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ implicitWidth: 20
+ implicitHeight: 20
+ x: text ? (mirror ? parent.width - width - padding.right : padding.left) : (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ radius: width / 2
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? style.focusColor : style.frameColor
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ color: style.backgroundColor
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 12
+ height: 12
+ radius: width / 2
+ color: Qt.tint(Qt.tint(control.checked ? style.accentColor : style.baseColor,
+ control.checked && control.activeFocus ? style.focusColor : "transparent"),
+ control.pressed ? style.pressColor : "transparent")
+ border.width: control.checked || control.pressed ? 0 : 1
+ border.color: style.frameColor
+ }
+ }
+
+ label: Text {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ x: mirror ? padding.left : (indicator.x + indicator.width + control.style.spacing)
+ y: padding.top
+ width: parent.width - indicator.width - control.style.spacing - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ text: control.text
+ color: control.style.textColor
+ elide: Text.ElideRight
+ visible: control.text
+ opacity: enabled ? 1.0 : control.style.disabledOpacity
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+}
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
new file mode 100644
index 00000000..83e8ac6b
--- /dev/null
+++ b/src/imports/controls/ScrollBar.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractScrollBar {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ handle.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ handle.implicitHeight + padding.top + padding.bottom)
+
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.ScrollBar
+
+ padding { top: 2; left: 2; right: 2; bottom: 2 }
+
+ handle: Rectangle {
+ id: handle
+
+ implicitWidth: 6
+ implicitHeight: 6
+
+ radius: width / 2
+ color: control.pressed ? style.shadowColor : style.frameColor
+ visible: control.size < 1.0
+ opacity: 0.0
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ x: padding.left + (horizontal ? control.position * control.width : 0)
+ y: padding.top + (horizontal ? 0 : control.position * control.height)
+ width: horizontal ? control.size * control.width - padding.left - padding.right : implicitWidth
+ height: horizontal ? implicitHeight : control.size * control.height - padding.top - padding.bottom
+
+ states: State {
+ name: "active"
+ when: control.active
+ PropertyChanges { target: handle; opacity: 1.0 - style.disabledOpacity }
+ }
+
+ transitions: Transition {
+ from: "active"
+ SequentialAnimation {
+ PauseAnimation { duration: 450 }
+ NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 }
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
new file mode 100644
index 00000000..7a4bbba6
--- /dev/null
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractScrollIndicator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ indicator.implicitWidth + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ indicator.implicitHeight + padding.top + padding.bottom)
+
+ Accessible.role: Accessible.Indicator
+
+ padding { top: 2; left: 2; right: 2; bottom: 2 }
+
+ indicator: Rectangle {
+ id: indicator
+
+ implicitWidth: 2
+ implicitHeight: 2
+
+ color: style.frameColor
+ visible: control.size < 1.0
+ opacity: 0.0
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ x: padding.left + (horizontal ? control.position * control.width : 0)
+ y: padding.top + (horizontal ? 0 : control.position * control.height)
+ width: horizontal ? control.size * control.width - padding.left - padding.right : implicitWidth
+ height: horizontal ? implicitHeight : control.size * control.height - padding.top - padding.bottom
+
+ states: State {
+ name: "active"
+ when: control.active
+ PropertyChanges { target: indicator; opacity: 1.0 - style.disabledOpacity }
+ }
+
+ transitions: [
+ Transition {
+ from: "active"
+ SequentialAnimation {
+ PauseAnimation { duration: 450 }
+ NumberAnimation { target: indicator; duration: 200; property: "opacity"; to: 0.0 }
+ }
+ }
+ ]
+ }
+}
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
new file mode 100644
index 00000000..fc6abc60
--- /dev/null
+++ b/src/imports/controls/Slider.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractSlider {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(track ? track.implicitWidth : 0,
+ handle ? handle.implicitWidth : 0) + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(track ? track.implicitHeight : 0,
+ handle ? handle.implicitHeight : 0) + padding.top + padding.bottom)
+
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.Slider
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ handle: Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? style.focusColor : style.frameColor
+ color: style.backgroundColor
+
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ x: horizontal ? control.visualPosition * (control.width - width) : (control.width - width) / 2
+ y: horizontal ? (control.height - height) / 2 : control.visualPosition * (control.height - height)
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 12
+ height: 12
+ radius: width / 2
+
+ color: Qt.tint(Qt.tint(style.accentColor,
+ control.activeFocus ? style.focusColor : "transparent"),
+ control.pressed ? style.pressColor : "transparent")
+ }
+ }
+
+ track: Rectangle {
+ readonly property bool horizontal: control.orientation === Qt.Horizontal
+ implicitWidth: horizontal ? 120 : 6
+ implicitHeight: horizontal ? 6 : 120
+ x: horizontal ? padding.left : (control.width - width) / 2
+ y: horizontal ? (control.height - height) / 2 : padding.top
+ width: horizontal ? parent.width - padding.left - padding.right : implicitWidth
+ height: horizontal ? implicitHeight : parent.height - padding.top - padding.bottom
+
+ radius: style.roundness
+ border.color: style.frameColor
+ color: style.backgroundColor
+ scale: control.effectiveLayoutDirection === Qt.RightToLeft ? -1 : 1
+
+ Rectangle {
+ x: 2
+ y: 2
+ width: control.position * parent.width - 4
+ height: 2
+
+ color: style.accentColor
+ radius: style.roundness
+ }
+ }
+}
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
new file mode 100644
index 00000000..cf11cfdb
--- /dev/null
+++ b/src/imports/controls/SpinBox.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractSpinBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (upButton ? upButton.implicitWidth : 0) +
+ (downButton ? downButton.implicitWidth : 0) +
+ (input ? input.implicitWidth : 0) + style.padding * 2)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (upButton ? upButton.implicitHeight : 0),
+ (downButton ? downButton.implicitHeight : 0),
+ (input ? input.implicitHeight : 0) + style.padding * 2)
+
+ Accessible.role: Accessible.SpinBox
+
+ input: TextInput {
+ x: upButton.width
+ width: parent.width - upButton.width - downButton.width
+ height: parent.height
+
+ color: style.textColor
+ selectionColor: style.selectionColor
+ selectedTextColor: style.selectedTextColor
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Keys.forwardTo: control
+ }
+
+ validator: IntValidator { }
+
+ upButton: Item {
+ implicitWidth: 26
+ height: parent.height
+ x: parent.width - width
+
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ clip: true
+ Rectangle {
+ x: -radius
+ width: parent.width + radius
+ height: parent.height
+ radius: style.roundness
+ color: Qt.tint(Qt.tint(style.accentColor,
+ control.activeFocus ? style.focusColor : "transparent"),
+ pressed === AbstractSpinBox.UpButton ? style.pressColor : "transparent")
+ }
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 3
+ height: 2
+ color: control.style.selectedTextColor
+ }
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 2
+ height: parent.height / 3
+ color: control.style.selectedTextColor
+ }
+ }
+
+ downButton: Item {
+ implicitWidth: 26
+ height: parent.height
+
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ clip: true
+ Rectangle {
+ width: parent.width + radius
+ height: parent.height
+ radius: style.roundness
+ color: Qt.tint(Qt.tint(style.accentColor,
+ control.activeFocus ? style.focusColor : "transparent"),
+ pressed === AbstractSpinBox.DownButton ? style.pressColor : "transparent")
+ }
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 3
+ height: 2
+ color: control.style.selectedTextColor
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 120
+ radius: style.roundness
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? style.focusColor : style.frameColor
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ color: input.acceptableInput ? "white" : "lightpink"
+ }
+}
diff --git a/src/imports/controls/StackView.js b/src/imports/controls/StackView.js
new file mode 100644
index 00000000..37e2066d
--- /dev/null
+++ b/src/imports/controls/StackView.js
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+var stackView = [];
+
+function push(p)
+{
+ if (!p)
+ return
+ stackView.push(p)
+ __depth++
+ return p
+}
+
+function pop()
+{
+ if (stackView.length === 0)
+ return null
+ var p = stackView.pop()
+ __depth--
+ return p
+}
+
+function current()
+{
+ if (stackView.length === 0)
+ return null
+ return stackView[stackView.length-1]
+}
+
diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml
new file mode 100644
index 00000000..2c75f063
--- /dev/null
+++ b/src/imports/controls/StackView.qml
@@ -0,0 +1,954 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.Controls 2.0
+import "StackView.js" as JSArray
+
+/*!
+ \qmltype StackView
+ \inherits Item
+ \ingroup views
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief Provides a stack-based navigation model.
+
+ \image stackview.png
+
+ StackView implements a stack-based navigation model, which can be used
+ with a set of interlinked information pages. Items are pushed onto the stack
+ as the user navigates deeper into the material, and popped off again when he
+ chooses to go back.
+
+ The \l{Qt Quick Controls - Touch Gallery}{touch gallery} example is a good
+ starting point to understand how StackView works. The following snippet
+ from the example shows how it can be used:
+
+ \qml
+ StackView {
+ id: stack
+ initialItem: view
+
+ Component {
+ id: view
+
+ MouseArea {
+ Text {
+ text: stack.depth
+ anchors.centerIn: parent
+ }
+ onClicked: stack.push(view)
+ }
+ }
+ }
+ \endqml
+
+ \section1 Using StackView in an Application
+ Using the StackView in the application is typically a simple matter of adding
+ the StackView as a child of a Window. The stack is usually anchored to the
+ edges of the window, except at the top or bottom where it might be anchored
+ to a status bar, or some other similar UI component. The stack can then be
+ used by invoking its navigation methods. The first item to show in the StackView
+ is commonly loaded assigning it to \l initialItem.
+
+ \note Items pushed onto the stack view have \l{Supported Attached Properties}{Stack attached properties}.
+
+ \section1 Basic Navigation
+ There are three primary navigation operations in StackView: push(), pop(), and
+ replace (replace by specifying argument \c replace to push()).
+ These correspond to classic stack operations where "push" adds an item to the
+ top of a stack, "pop" removes the top item from the stack, and "replace" is like a
+ pop followed by a push in that it replaces the topmost item on the stack with
+ a new item (but the applied transtition might be different). The topmost item
+ in the stack corresponds to the one that is \l{StackView::currentItem} {currently}
+ visible on the screen. That means that "push" is the logical equivalent of navigating
+ forward or deeper into the application, "pop" is the equivalent of navigating back,
+ and "replace" is the equivalent of replacing the current item.
+
+ Sometimes it is necessary to go back more than a single step in the stack, for
+ example, to return to a "main" item or some kind of section item in the application.
+ For this use case, it is possible to specify an item as a parameter for pop().
+ This is called an "unwind" operation as the stack gets unwound to the specified item.
+ If the item is not found then the stack unwinds until there is only a single item in
+ the stack, which becomes the current item. To explicitly unwind to the bottom
+ of the stack it is recommended to use \l{pop()} {pop(null)}, though technically any
+ non-existent item will do.
+
+ Given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push(D)} => [A, B, C, D] - "push" transition animation between C and D
+ \li pop() => [A, B] - "pop" transition animation between C and B
+ \li \l{push()}{push(D, replace)} => [A, B, D] - "replace" transition between C and D
+ \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A
+ \endlist
+
+ \note Note that when the stack is empty, a push() will not perform a
+ transition animation because there is nothing to transition from (typically during
+ application start-up). A pop() on a stack with depth 1 or 0 is a no-operation.
+ If removing all items from the stack is needed, a separate function clear() is
+ available.
+
+ Calling push() returns the item that was pushed onto the stack.
+ Calling pop() returns the item that was popped off the stack. When pop() is
+ called in an unwind operation the top-most item (the first item that was
+ popped, which will also be the one transitioning out) is returned.
+
+ \section1 Deep Linking
+ \e{Deep linking} means launching an application into a particular state. For example,
+ a newspaper application could be launched into showing a particular article,
+ bypassing the front item (and possibly a section item) that would normally have
+ to be navigated through to get to the article concerned. In terms of StackView, deep
+ linking means the ability to modify the state of the stack, so much so that it is
+ possible to push a set of items to the top of the stack, or to completely reset
+ the stack to a given state.
+
+ The API for deep linking in StackView is the same as for basic navigation. Pushing
+ an array instead of a single item, will involve that all the items in that array will
+ be pushed onto the stack. The transition animation, however, will be conducted as
+ if only the last item in the array was pushed onto the stack. The normal semantics
+ of push() apply for deep linking, meaning that push() adds whatever is pushed onto
+ the stack. Note also that only the last item of the array will be loaded.
+ The rest will be lazy-loaded as needed when entering the screen upon subsequent
+ calls to pop (or when requesting the item by using \a get).
+
+ This gives us the following result, given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition animation between C and F
+ \li \l{push()}{push([D, E, F], replace)} => [A, B, D, E, F] - "replace" transition animation between C and F
+ \li clear(); \l{push()}{push([D, E, F])} => [D, E, F] - no transition animation (since the stack was empty)
+ \endlist
+
+ \section1 Pushing items
+
+ An item pushed onto the StackView can be either an Item, a URL, a string
+ with a URL, or a Component. To push it, assign it to a property "item"
+ inside a property list, and send it as an argument to \l{StackView::push}{push}:
+
+ \code
+ stackView.push({item: yourItem})
+ \endcode
+
+ The list can contain several properties that control how the item should be pushed:
+ \list
+ \li \c item: this property is required, and holds the item to be pushed.
+ \li \c properties: a list of QML properties to be assigned to the item upon push. These
+ properties will be copied into the item at load time, or when the item will become
+ the current item (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, this property only needs to be set on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this boolean to true if StackView needs to destroy the item when
+ it is popped off the stack. By default (if \a destroyOnPop is not specified), StackView
+ will destroy items pushed as components or URLs. Items not destroyed will be re-parented
+ back to the original parents they had before being pushed onto the stack and hidden.
+ If you need to set this property, do it with care, so that items are not leaked.
+ \endlist
+
+ If the only argument needed is "item", the following short-hand notation can be applied:
+
+ \code
+ stackView.push(yourItem)
+ \endcode
+
+ You can push several items in one go by using an array of property lists. This is
+ optimizing compared to pushing items one by one, since StackView then can load only the
+ last item in the list. The rest will be loaded as they are about to become
+ the current item (which happens when the stack is popped). The following example shows how
+ to push an array of items:
+
+ \code
+ stackView.push([{item: yourItem1}, {item: yourItem2}])
+ \endcode
+
+ If an inline item is pushed, the item is temporarily re-parented into the StackView. When the item
+ is later popped off, it gets re-parented back to its original owner again.
+ If, however, an item is pushed as a component or a URL, the actual item will be created as an
+ item from that component. This happens automatically when the item is about to become the current
+ item in the stack. Ownership of the item will then normally be taken by the StackView. It will as
+ such automatically destroy the item when it is later popped off. The component that declared the item, by
+ contrast, remains in the ownership of the application and is not destroyed by the stack.
+ This can be overridden by explicitly setting \c{destroyOnPop} in the list of arguments given to push.
+
+ If the \c properties to be pushed are specified, they will be copied into the item at loading time
+ (in case of a component or URL), or when the item will become the current item (in case of an inline
+ item). The following example shows how this can be done:
+
+ \code
+ stackView.push({item: someItem, properties: {fgcolor: "red", bgcolor: "blue"}})
+ \endcode
+
+
+ \note Note that if an item is declared inside another item, and if that parent gets destroyed,
+ (even if a component was used), that child item will also be destroyed.
+ This follows normal Qt parent-child destruction rules, but sometimes comes as a surprise
+ for developers.
+
+ \section1 Lifecycle
+ An item's lifecycle in the StackView can have the following transitions:
+ \list 1
+ \li instantiation
+ \li inactive
+ \li activating
+ \li active
+ \li deactivating
+ \li inactive
+ \li destruction
+ \endlist
+
+ It can move any number of times between inactive and active. When an item is activated,
+ it's visible on the screen and is considered to be the current item. An item
+ in a StackView that is not visible is not activated, even if the item is currently the
+ top-most item in the stack. When the stack becomes visible, the item that is top-most gets
+ activated. Likewise if the stack is then hidden, the topmost item would be deactivated.
+ Popping the item off the top of the stack at this point would not result in further
+ deactivation since the item is not active.
+
+ There is an attached \l{Stack::status}{Stack.status} property that tracks the lifecycle. The
+ status values list is an enumeration with values \c Stack.Inactive, \c Stack.Activating,
+ \c Stack.Active and \c Stack.Deactivating. Combined with the normal \c Component.onComplete and
+ \c Component.onDestruction signals the entire lifecycle is thus:
+
+ \list
+ \li Created: Component.onCompleted()
+ \li Activating: Stack.onStatusChanged (Stack.status is Stack.Activating)
+ \li Acivated: Stack.onStatusChanged (Stack.status is Stack.Active)
+ \li Deactivating: Stack.onStatusChanged (Stack.status is Stack.Deactivating)
+ \li Deactivated: Stack.onStatusChanged (Stack.status is Stack.Inactive)
+ \li Destruction: Component.onDestruction()
+ \endlist
+
+ \section1 Finding items
+ Sometimes it is necessary to search for an item, for example, in order to unwind the stack to
+ an item to which the application does not have a reference. This is facilitated using a
+ function find() in StackView. The find() function takes a callback function as its
+ only argument. The callback gets invoked for each item in the stack (starting at the top).
+ If the callback returns true, then it signals that a match has been found and the find()
+ function returns that item. If the callback fails to return true (no match is found),
+ then find() returns \c null.
+
+ The code below searches for an item in the stack that has a name "order_id" and then unwinds to
+ that item. Note that since find() returns \c {null} if no item is found, and since pop unwinds to
+ the bottom of the stack if null is given as the target item, the code works well even in
+ case no matching item is found.
+
+ \code
+ stackView.pop(stackView.find(function(item) {
+ return item.name == "order_id";
+ }));
+ \endcode
+
+ You can also get to an item in the stack using \l {get()}{get(index)}. You should use
+ this function if your item depends on another item in the stack, as the function will
+ ensure that the item at the given index gets loaded before it is returned.
+
+ \code
+ previousItem = stackView.get(myItem.Stack.index - 1));
+ \endcode
+
+ \section1 Transitions
+
+ A transition is performed whenever a item is pushed or popped, and consists of
+ two items: enterItem and exitItem. The StackView itself will never move items
+ around, but instead delegate the job to an external animation set provided
+ by the style or the application developer. How items should visually enter and leave the stack
+ (and the geometry they should end up with) is therefore completely controlled from the outside.
+
+ When the transition starts, the StackView will search for a transition that
+ matches the operation executed. There are three transitions to choose
+ from: pushTransition, popTransition, and replaceTransition. Each implements how
+ enterItem should animate in, and exitItem out. The transitions are
+ collected inside a StackViewDelegate object assigned to
+ \l {StackView::delegate}{delegate}. By default, popTransition and
+ replaceTransition will be the same as pushTransition, unless you set them
+ to something else.
+
+ A simple fade transition could be implemented as:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.opacity = 1
+ }
+
+ pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "opacity"
+ from: 0
+ to: 1
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "opacity"
+ from: 1
+ to: 0
+ }
+ }
+ }
+ }
+ \endqml
+
+ PushTransition needs to inherit from StackViewTransition, which is a ParallelAnimation that
+ contains the properties \c enterItem and \c exitItem. You set the target of your
+ inner animations to those items. Since the same items instance can be pushed several
+ times to a StackView, you should always override
+ \l {StackViewDelegate::transitionFinished()}{StackViewDelegate.transitionFinished()}.
+ Implement this function to reset any properties animated on the exitItem so that later
+ transitions can expect the items to be in a default state.
+
+ A more complex example could look like the following. Here, the items are lying on the side before
+ being rotated to an upright position:
+
+ \qml
+ StackView {
+ delegate: StackViewDelegate {
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.rotation = 0
+ }
+
+ pushTransition: StackViewTransition {
+ SequentialAnimation {
+ ScriptAction {
+ script: enterItem.rotation = 90
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: enterItem.width
+ to: 0
+ }
+ PropertyAnimation {
+ target: enterItem
+ property: "rotation"
+ from: 90
+ to: 0
+ }
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -exitItem.width
+ }
+ }
+ }
+ }
+ \endqml
+
+ \section2 Advanced usage
+
+ When the StackView needs a new transition, it first calls
+ \l {StackViewDelegate::getTransition()}{StackViewDelegate.getTransition()}.
+ The base implementation of this function just looks for a property named \c properties.name inside
+ itself (root), which is how it finds \c {property Component pushTransition} in the examples above.
+
+ \code
+ function getTransition(properties)
+ {
+ return root[properties.name]
+ }
+ \endcode
+
+ You can override this function for your delegate if you need extra logic to decide which
+ transition to return. You could for example introspect the items, and return different animations
+ depending on the their internal state. StackView will expect you to return a Component that
+ contains a StackViewTransition, or a StackViewTransition directly. The former is easier, as StackView will
+ then create the transition and later destroy it when it's done, while avoiding any sideeffects
+ caused by the transition being alive long after it has run. Returning a StackViewTransition directly
+ can be useful if you need to write some sort of transition caching for performance reasons.
+ As an optimization, you can also return \c null to signal that you just want to show/hide the items
+ immediately without creating or running any transitions. You can also override this function if
+ you need to alter the items in any way before the transition starts.
+
+ \c properties contains the properties that will be assigned to the StackViewTransition before
+ it runs. In fact, you can add more properties to this object during the call
+ if you need to initialize additional properties of your custom StackViewTransition when the returned
+ component is instantiated.
+
+ The following example shows how you can decide which animation to use during runtime :
+
+ \qml
+ StackViewDelegate {
+ function getTransition(properties)
+ {
+ return (properties.enterItem.Stack.index % 2) ? horizontalTransition : verticalTransition
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property Component horizontalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 300
+ }
+ }
+
+ property Component verticalTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ }
+ }
+ \endqml
+
+ \section1 Supported Attached Properties
+
+ Items in a StackView support these attached properties:
+ \list
+ \li \l{Stack::index}{Stack.index} - Contains the index of the item inside the StackView
+ \li \l{Stack::view}{Stack.view} - Contains the StackView the item is in
+ \li \l{Stack::status}{Stack.status} - Contains the status of the item
+ \endlist
+*/
+
+AbstractStackView {
+ id: root
+
+ depth: root.__depth
+ currentItem: root.__currentItem
+ initialItem: null
+ busy: __currentTransition !== null
+
+ /*! The transitions to use when pushing or popping items.
+ For better understanding on how to apply custom transitions, read \l{Transitions}.
+ \sa {Stack::transitions}{Stack.transitions} */
+ property StackViewDelegate delegate: StackViewDelegate {}
+
+ /*! Pushes an item onto the stack. The function takes a property list as argument, which
+ should contain one or more of the following properties:
+ \list
+ \li \c item: this property is required, and holds the item you want to push.
+ \li \c properties: a list of QML properties that should be assigned
+ to the item upon push. These properties will be copied into the item when it is
+ loaded (in case of a component or URL), or when it becomes the current item for the
+ first time (normally upon push).
+ \li \c immediate: set this property to \c true to skip transition effects. When pushing
+ an array, you only need to set this property on the first element to make the
+ whole operation immediate.
+ \li \c replace: set this property to replace the current item on the stack. When pushing
+ an array, you only need to set this property on the first element to replace
+ as many elements on the stack as inside the array.
+ \li \c destroyOnPop: set this property to specify if the item needs to be destroyed
+ when its popped off the stack. By default (if \a destroyOnPop is not specified),
+ StackView will destroy items pushed as components or URLs. Items
+ not destroyed will be re-parented to the original parents they had before being
+ pushed onto the stack, and hidden. If you need to set this property, do it with
+ care, so that items are not leaked.
+ \endlist
+
+ You can also push an array of items (property lists) if you need to push several items
+ in one go. A transition will then only occur between the current item and the last
+ item in the list. Loading the other items will be deferred until needed.
+
+ Examples:
+ \list
+ \li stackView.push({item:anItem})
+ \li stackView.push({item:aURL, immediate: true, replace: true})
+ \li stackView.push({item:aRectangle, properties:{color:"red"}})
+ \li stackView.push({item:aComponent, properties:{color:"red"}})
+ \li stackView.push({item:aComponent.createObject(), destroyOnPop:true})
+ \li stackView.push([{item:anitem, immediate:true}, {item:aURL}])
+ \endlist
+
+ \note Note: if the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.push(anItem)}.
+
+ Returns the item that became current.
+
+ \sa initialItem
+ \sa {Pushing items}
+ */
+ function push(item) {
+ // Note: we support two different APIs in this function; The old meego API, and
+ // the new "property list" API. Hence the reason for hiding the fact that you
+ // can pass more arguments than shown in the signature:
+ if (__recursionGuard(true))
+ return
+ var properties = arguments[1]
+ var immediate = arguments[2]
+ var replace = arguments[3]
+ var arrayPushed = (item instanceof Array)
+ var firstItem = arrayPushed ? item[0] : item
+ immediate = (immediate || JSArray.stackView.length === 0)
+
+ if (firstItem && firstItem.item && firstItem.hasOwnProperty("x") === false) {
+ // Property list API used:
+ immediate = immediate || firstItem.immediate
+ replace = replace || firstItem.replace
+ }
+
+ // Create, and push, a new javascript object, called "element", onto the stack.
+ // This element contains all the information necessary to construct the item, and
+ // will, after loaded, also contain the loaded item:
+ if (arrayPushed) {
+ if (item.length === 0)
+ return
+ var outElement = replace ? JSArray.pop() : JSArray.current()
+ for (var i=0; i<item.length; ++i)
+ JSArray.push({itemComponent:item[i], loaded: false, index: __depth, properties: properties});
+ } else {
+ outElement = replace ? JSArray.pop() : JSArray.current()
+ JSArray.push({itemComponent:item, loaded: false, index: __depth, properties: properties})
+ }
+
+ var currentElement = JSArray.current()
+ var transition = {
+ inElement: currentElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: replace,
+ push: true
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return __currentItem
+ }
+
+ /*! Pops one or more items off the stack. The function takes a property list as argument
+ which can contain one or more of the following properties:
+ \list
+ \li \c item: if specified, all items down to (but not including) \a item will be
+ popped off. If \a item is \c null, all items down to (but not including) the
+ first item will be popped. If not specified, only the current item will be
+ popped.
+ \li \c immediate: set this property to \c true to skip transition effects.
+ \endlist
+
+ Examples:
+ \list
+ \li stackView.pop()
+ \li stackView.pop({item:someItem, immediate: true})
+ \li stackView.pop({immediate: true})
+ \li stackView.pop(null)
+ \endlist
+
+ \note Note: If the only argument needed is "item", you can apply the following short-
+ hand notation: \c{stackView.pop(anItem)}.
+
+ Returns the item that was popped off
+ \sa clear()
+ */
+ function pop(item) {
+ if (__depth <= 1)
+ return null
+ if (item && item.hasOwnProperty("x") === false) {
+ // Property list API used:
+ var immediate = (item.immediate === true)
+ item = item.item
+ } else {
+ immediate = (arguments[1] === true)
+ }
+
+ if (item === __currentItem)
+ return
+
+ if (__recursionGuard(true))
+ return
+
+ var outElement = JSArray.pop()
+ var inElement = JSArray.current()
+
+ if (__depth > 1 && item !== undefined && item !== inElement.item) {
+ // Pop from the top until we find 'item', and return the corresponding
+ // element. Skip all non-loaded items (except the first), since no one
+ // has any references to such items anyway:
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ while (__depth > 1 && item !== inElement.item) {
+ JSArray.pop()
+ __cleanup(inElement)
+ while (__depth > 1 && !JSArray.current().loaded)
+ JSArray.pop()
+ inElement = JSArray.current()
+ }
+ }
+
+ var transition = {
+ inElement: inElement,
+ outElement: outElement,
+ immediate: immediate,
+ replace: false,
+ push: false
+ }
+ __performTransition(transition)
+ __recursionGuard(false)
+ return outElement.item;
+ }
+
+ /*! Remove all items from the stack. No animations will be applied. */
+ function clear() {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ var count = __depth
+ for (var i=0; i<count; ++i) {
+ var element = JSArray.pop()
+ if (element.item)
+ __cleanup(element);
+ }
+ __recursionGuard(false)
+ }
+
+ /*! Search for a specific item inside the stack. \a func will
+ be called for each item in the stack (with the item as argument)
+ until the function returns true. Return value will be the item found. For
+ example:
+ find(function(item, index) { return item.isTheOne })
+ Set \a onlySearchLoadedItems to \c true to not load items that are
+ not loaded into memory */
+ function find(func, onlySearchLoadedItems) {
+ for (var i=__depth-1; i>=0; --i) {
+ var element = JSArray.stackView[i];
+ if (onlySearchLoadedItems !== true)
+ __loadElement(element)
+ else if (!element.item)
+ continue
+ if (func(element.item, i))
+ return element.item
+ }
+ return null;
+ }
+
+ /*! Returns the item at position \a index in
+ the stack. If \a dontLoad is true, the
+ item will not be forced to load (and \c null
+ will be returned if not yet loaded) */
+ function get(index, dontLoad)
+ {
+ if (index < 0 || index >= JSArray.stackView.length)
+ return null
+ var element = JSArray.stackView[index]
+ if (dontLoad !== true) {
+ __loadElement(element)
+ return element.item
+ } else if (element.item) {
+ return element.item
+ } else {
+ return null
+ }
+ }
+
+ /*! Immediately completes any ongoing transition.
+ /sa Animation.complete
+ */
+ function completeTransition()
+ {
+ if (__recursionGuard(true))
+ return
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __recursionGuard(false)
+ }
+
+ /********* DEPRECATED API *********/
+
+ /*! \internal
+ \deprecated Use Push() instead */
+ function replace(item, properties, immediate) {
+ push(item, properties, immediate, true)
+ }
+
+ /********* PRIVATE API *********/
+
+ /*! \internal The currently top-most item on the stack. */
+ property Item __currentItem: null
+ /*! \internal The number of items currently pushed onto the stack. */
+ property int __depth: 0
+ /*! \internal Stores the transition info while a transition is ongoing */
+ property var __currentTransition: null
+ /*! \internal Stops the user from pushing items while preparing a transition */
+ property bool __guard: false
+
+ Component.onCompleted: {
+ if (initialItem)
+ push(initialItem)
+ }
+
+ Component.onDestruction: {
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __currentItem = null
+ }
+
+ /*! \internal */
+ function __recursionGuard(use)
+ {
+ if (use && __guard) {
+ console.warn("Warning: StackView: You cannot push/pop recursively!")
+ console.trace()
+ return true
+ }
+ __guard = use
+ }
+
+ /*! \internal */
+ function __loadElement(element)
+ {
+ if (element.loaded) {
+ if (!element.item) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: The item has been deleted outside StackView!"
+ }
+ return
+ }
+ if (!element.itemComponent) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Invalid item (item was 'null'). "
+ + "This might indicate that the item was deleted outside StackView!"
+ return
+ }
+
+ var comp = __resolveComponent(element.itemComponent, element)
+
+ // Assign properties to item:
+ if (!element.properties)
+ element.properties = {}
+
+ if (comp.hasOwnProperty("createObject")) {
+ if (comp.status === Component.Error) {
+ element.item = invalidItemReplacement.createObject(root)
+ element.item.text = "\nError: Could not load: " + comp.errorString()
+ } else {
+ element.item = comp.createObject(root, element.properties)
+ // Destroy items we create unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = true
+ }
+ } else {
+ // comp is already an Item, so just re-parent it into the StackView:
+ element.item = comp
+ element.originalParent = parent
+ element.item.parent = root
+ for (var prop in element.properties) {
+ if (element.item.hasOwnProperty(prop))
+ element.item[prop] = element.properties[prop];
+ }
+ // Do not destroy items we didn't create, unless the user specified something else:
+ if (!element.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = false
+ }
+
+//TODO element.item.Stack.__index = element.index
+//TODO element.item.Stack.__view = root
+ // Let item fill all available space by default:
+ element.item.width = Qt.binding(function() { return root.width })
+ element.item.height = Qt.binding(function() { return root.height })
+ element.loaded = true
+ }
+
+ /*! \internal */
+ function __resolveComponent(unknownObjectType, element)
+ {
+ // We need this extra resolve function since we don't really
+ // know what kind of object the user pushed. So we try to
+ // figure it out by inspecting the object:
+ if (unknownObjectType.hasOwnProperty("createObject")) {
+ return unknownObjectType
+ } else if (typeof unknownObjectType == "string") {
+ return Qt.createComponent(unknownObjectType)
+ } else if (unknownObjectType.hasOwnProperty("x")) {
+ return unknownObjectType
+ } else if (unknownObjectType.hasOwnProperty("item")) {
+ // INVARIANT: user pushed a JS-object
+ element.properties = unknownObjectType.properties
+ if (!unknownObjectType.item)
+ unknownObjectType.item = invalidItemReplacement
+ if (unknownObjectType.hasOwnProperty("destroyOnPop"))
+ element.destroyOnPop = unknownObjectType.destroyOnPop
+ return __resolveComponent(unknownObjectType.item, element)
+ } else {
+ // We cannot determine the type, so assume its a URL:
+ return Qt.createComponent(unknownObjectType)
+ }
+ }
+
+ /*! \internal */
+ function __cleanup(element) {
+ // INVARIANT: element has been removed from JSArray. Destroy its
+ // item, or re-parent it back to the parent it had before it was pushed:
+ var item = element.item
+ if (element.destroyOnPop) {
+ item.destroy()
+ } else {
+ // Mark the item as no longer part of the StackView. It
+ // might reenter on pop if pushed several times:
+ item.visible = false
+ __setStatus(item, Stack.Inactive)
+//TODO item.Stack.__view = null
+//TODO item.Stack.__index = -1
+ if (element.originalParent)
+ item.parent = element.originalParent
+ }
+ }
+
+ /*! \internal */
+ function __setStatus(item, status) {
+ item.Stack.status = status
+ }
+
+ /*! \internal */
+ function __performTransition(transition)
+ {
+ // Animate item in "outElement" out, and item in "inElement" in. Set a guard to protect
+ // the user from pushing new items on signals that will fire while preparing for the transition
+ // (e.g Stack.onCompleted, Stack.onStatusChanged, Stack.onIndexChanged etc). Otherwise, we will enter
+ // this function several times, which causes the items to be updated half-way.
+ if (__currentTransition)
+ __currentTransition.animation.complete()
+ __loadElement(transition.inElement)
+
+ transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition")
+ var enterItem = transition.inElement.item
+ transition.enterItem = enterItem
+
+ // Since an item can be pushed several times, we need to update its properties:
+ enterItem.parent = root
+//TODO enterItem.Stack.__view = root
+//TODO enterItem.Stack.__index = transition.inElement.index
+ __currentItem = enterItem
+
+ if (!transition.outElement) {
+ // A transition consists of two items, but we got just one. So just show the item:
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ __setStatus(enterItem, Stack.Active)
+ return
+ }
+
+ var exitItem = transition.outElement.item
+ transition.exitItem = exitItem
+ if (enterItem === exitItem)
+ return
+
+ if (root.delegate) {
+ transition.properties = {
+ "name":transition.name,
+ "enterItem":transition.enterItem,
+ "exitItem":transition.exitItem,
+ "immediate":transition.immediate }
+ var anim = root.delegate.getTransition(transition.properties)
+ if (anim.createObject) {
+ anim = anim.createObject(null, transition.properties)
+ anim.runningChanged.connect(function(){ if (anim.running === false) anim.destroy() })
+ }
+ transition.animation = anim
+ }
+
+ if (!transition.animation) {
+ console.warn("Warning: StackView: no", transition.name, "found!")
+ return
+ }
+ if (enterItem.anchors.fill || exitItem.anchors.fill)
+ console.warn("Warning: StackView: cannot transition an item that is anchored!")
+
+ __currentTransition = transition
+ __setStatus(exitItem, Stack.Deactivating)
+ enterItem.visible = true
+ __setStatus(enterItem, Stack.Activating)
+ transition.animation.runningChanged.connect(animationFinished)
+ transition.animation.start()
+ // NB! For empty animations, "animationFinished" is already
+ // executed at this point, leaving __animation === null:
+ if (transition.immediate === true && transition.animation)
+ transition.animation.complete()
+ }
+
+ /*! \internal */
+ function animationFinished()
+ {
+ if (!__currentTransition || __currentTransition.animation.running)
+ return
+
+ __currentTransition.animation.runningChanged.disconnect(animationFinished)
+ __currentTransition.exitItem.visible = false
+ __setStatus(__currentTransition.exitItem, Stack.Inactive);
+ __setStatus(__currentTransition.enterItem, Stack.Active);
+ __currentTransition.properties.animation = __currentTransition.animation
+ root.delegate.transitionFinished(__currentTransition.properties)
+
+ if (!__currentTransition.push || __currentTransition.replace)
+ __cleanup(__currentTransition.outElement)
+
+ __currentTransition = null
+ }
+
+ /*! \internal */
+ property Component invalidItemReplacement: Component {
+ Text {
+ width: parent.width
+ height: parent.height
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+ }
+}
diff --git a/src/imports/controls/StackViewDelegate.qml b/src/imports/controls/StackViewDelegate.qml
new file mode 100644
index 00000000..2d4355bd
--- /dev/null
+++ b/src/imports/controls/StackViewDelegate.qml
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*!
+ \qmltype StackViewDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.1
+
+ \brief A delegate used by StackView for loading transitions.
+
+ See the documentation for the \l {StackView} component.
+
+*/
+QtObject {
+ id: root
+
+ property bool horizontal: true
+
+ function getTransition(properties)
+ {
+ return root[horizontal ? "horizontalSlide" : "verticalSlide"][properties.name]
+ }
+
+ function transitionFinished(properties)
+ {
+ properties.exitItem.x = 0
+ properties.exitItem.y = 0
+ }
+
+ property QtObject horizontalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: target.width
+ to: 0
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: -target.width
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "x"
+ from: -target.width
+ to: 0
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "x"
+ from: 0
+ to: target.width
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ }
+ property Component replaceTransition: pushTransition
+ }
+
+ property QtObject verticalSlide: QtObject {
+ property Component pushTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: -target.height
+ duration: 300
+ }
+ }
+
+ property Component popTransition: StackViewTransition {
+ PropertyAnimation {
+ target: enterItem
+ property: "y"
+ from: -target.height
+ to: 0
+ duration: 300
+ }
+ PropertyAnimation {
+ target: exitItem
+ property: "y"
+ from: 0
+ to: target.height
+ duration: 300
+ }
+ property Component replaceTransition: pushTransition
+ }
+ }
+}
diff --git a/src/imports/controls/StackViewTransition.qml b/src/imports/controls/StackViewTransition.qml
new file mode 100644
index 00000000..f057791c
--- /dev/null
+++ b/src/imports/controls/StackViewTransition.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+ParallelAnimation {
+ id: root
+ /*! The name of the animation that is running. Can be one of the following:
+ \list
+ \li 'PushTransition'
+ \li 'PopTransition'
+ \li 'ReplaceTransition'
+ \endlist
+ */
+ property string name
+ /*! The page that is transitioning in. */
+ property Item enterItem
+ /*! The page that is transitioning out */
+ property Item exitItem
+ /*! Set to \c true if the transition is told to
+ fast-forward directly to its end-state */
+ property bool immediate
+}
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
new file mode 100644
index 00000000..51768cc6
--- /dev/null
+++ b/src/imports/controls/Switch.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 2.0
+
+AbstractSwitch {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? style.spacing : 0) + padding.left + padding.right)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + padding.top + padding.bottom)
+
+ Accessible.name: text
+ Accessible.checkable: true
+ Accessible.checked: checked
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.Button // TODO: Switch?
+
+ padding { top: style.padding; left: style.padding; right: style.padding; bottom: style.padding }
+
+ indicator: Rectangle {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ implicitWidth: 36
+ implicitHeight: 20
+ x: text ? (mirror ? parent.width - width - padding.right : padding.left) : (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ radius: 10
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? style.focusColor : style.frameColor
+ opacity: enabled ? 1.0 : style.disabledOpacity
+ color: style.backgroundColor
+
+ Rectangle {
+ width: 12
+ height: 12
+ radius: 6
+
+ color: Qt.tint(Qt.tint(control.checked ? style.accentColor : style.baseColor,
+ control.checked && control.activeFocus ? style.focusColor : "transparent"),
+ control.pressed ? style.pressColor : "transparent")
+ border.width: control.checked || control.pressed ? 0 : 1
+ border.color: style.frameColor
+
+ x: Math.max(4, Math.min(parent.width - width - 4,
+ control.visualPosition * parent.width - (width / 2)))
+ y: (parent.height - height) / 2
+
+ Behavior on x {
+ enabled: !control.pressed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+ }
+
+ label: Text {
+ readonly property bool mirror: control.effectiveLayoutDirection == Qt.RightToLeft
+
+ x: mirror ? padding.left : (indicator.x + indicator.width + control.style.spacing)
+ y: padding.top
+ width: parent.width - indicator.width - control.style.spacing - padding.left - padding.right
+ height: parent.height - padding.top - padding.bottom
+
+ text: control.text
+ color: control.style.textColor
+ elide: Text.ElideRight
+