Use QtQuick.Templates
Change-Id: I3d1822457efd740e7c9d91747e978d787c0dd4b8 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
parent
8a02b7560a
commit
399a4403b4
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Calendar 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
import QtQuick.Layouts 1.0
|
||||
import io.qt.examples.calendar 1.0
|
||||
|
||||
|
@ -181,7 +182,7 @@ ApplicationWindow {
|
|||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
visible: AbstractStackView.index === stackView.currentIndex
|
||||
visible: T.StackView.index === stackView.currentIndex
|
||||
|
||||
DateTimePicker {
|
||||
id: dateTimePicker
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
|
@ -221,7 +222,7 @@ ApplicationWindow {
|
|||
}
|
||||
Slider {
|
||||
width: parent.width
|
||||
snapMode: AbstractSlider.SnapAlways
|
||||
snapMode: T.Slider.SnapAlways
|
||||
stepSize: 0.2
|
||||
value: 0.8
|
||||
}
|
||||
|
@ -232,6 +233,6 @@ ApplicationWindow {
|
|||
Item { width: 1; height: 12 }
|
||||
}
|
||||
|
||||
AbstractScrollIndicator.vertical: ScrollIndicator { anchors.right: parent.right }
|
||||
T.ScrollIndicator.vertical: ScrollIndicator { anchors.right: parent.right }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import QtQuick 2.6
|
|||
import QtQuick.Extras 2.0
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
import QtQuick.XmlListModel 2.0
|
||||
|
||||
ApplicationWindow {
|
||||
|
@ -180,7 +181,7 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
AbstractScrollIndicator.vertical: ScrollIndicator { }
|
||||
T.ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
|
@ -272,7 +273,7 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
AbstractScrollIndicator.vertical: ScrollIndicator { }
|
||||
T.ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
|
@ -71,7 +72,7 @@ ApplicationWindow {
|
|||
|
||||
Component {
|
||||
id: pageComponent
|
||||
Control {
|
||||
T.Control {
|
||||
id: page
|
||||
Theme.accentColor: Qt.hsla(colorSlider.position, 0.5, 0.5, 1.0)
|
||||
Theme.backgroundColor: darkButton.checked ? "#444" : "#fff"
|
||||
|
@ -169,7 +170,7 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
|
||||
AbstractScrollIndicator.vertical: ScrollIndicator { }
|
||||
T.ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractApplicationWindow {
|
||||
T.ApplicationWindow {
|
||||
id: window
|
||||
|
||||
color: Theme.backgroundColor
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractBusyIndicator {
|
||||
T.BusyIndicator {
|
||||
id: control
|
||||
|
||||
implicitWidth: indicator.implicitWidth + leftPadding + rightPadding
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractButton {
|
||||
T.Button {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractCheckBox {
|
||||
T.CheckBox {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractFrame {
|
||||
T.Frame {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractGroupBox {
|
||||
T.GroupBox {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractLabel {
|
||||
T.Label {
|
||||
id: control
|
||||
|
||||
Accessible.name: text
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractPageIndicator {
|
||||
T.PageIndicator {
|
||||
id: control
|
||||
|
||||
Accessible.role: Accessible.Indicator
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractProgressBar {
|
||||
T.ProgressBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractRadioButton {
|
||||
T.RadioButton {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractScrollBar {
|
||||
T.ScrollBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractScrollIndicator {
|
||||
T.ScrollIndicator {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractSlider {
|
||||
T.Slider {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractStackView {
|
||||
T.StackView {
|
||||
id: root
|
||||
|
||||
//! [popEnter]
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractSwitch {
|
||||
T.Switch {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractTabBar {
|
||||
T.TabBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractTabButton {
|
||||
T.TabButton {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractTextArea {
|
||||
T.TextArea {
|
||||
id: control
|
||||
|
||||
Accessible.name: text
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractTextField {
|
||||
T.TextField {
|
||||
id: control
|
||||
|
||||
Accessible.name: text
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractToggleButton {
|
||||
T.ToggleButton {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractToolBar {
|
||||
T.ToolBar {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
AbstractToolButton {
|
||||
T.ToolButton {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
|
|
|
@ -35,33 +35,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
#include "qquicktheme_p.h"
|
||||
|
||||
#include <QtQuickControls/private/qquickapplicationwindow_p.h>
|
||||
#include <QtQuickControls/private/qquickbusyindicator_p.h>
|
||||
#include <QtQuickControls/private/qquickbutton_p.h>
|
||||
#include <QtQuickControls/private/qquickcheckbox_p.h>
|
||||
#include <QtQuickControls/private/qquickframe_p.h>
|
||||
#include <QtQuickControls/private/qquickgroupbox_p.h>
|
||||
#include <QtQuickControls/private/qquicklabel_p.h>
|
||||
#include <QtQuickControls/private/qquickpageindicator_p.h>
|
||||
#include <QtQuickControls/private/qquickprogressbar_p.h>
|
||||
#include <QtQuickControls/private/qquickradiobutton_p.h>
|
||||
#include <QtQuickControls/private/qquickscrollbar_p.h>
|
||||
#include <QtQuickControls/private/qquickscrollindicator_p.h>
|
||||
#include <QtQuickControls/private/qquickslider_p.h>
|
||||
#include <QtQuickControls/private/qquickstackview_p.h>
|
||||
#include <QtQuickControls/private/qquickswitch_p.h>
|
||||
#include <QtQuickControls/private/qquicktabbar_p.h>
|
||||
#include <QtQuickControls/private/qquicktabbutton_p.h>
|
||||
#include <QtQuickControls/private/qquicktextarea_p.h>
|
||||
#include <QtQuickControls/private/qquicktextfield_p.h>
|
||||
#include <QtQuickControls/private/qquicktogglebutton_p.h>
|
||||
#include <QtQuickControls/private/qquicktoolbar_p.h>
|
||||
#include <QtQuickControls/private/qquicktoolbutton_p.h>
|
||||
|
||||
#include <QtQuickControls/private/qquickcontrol_p.h>
|
||||
#include <QtQuickControls/private/qquickexclusivegroup_p.h>
|
||||
#include "qquicktheme_p.h"
|
||||
|
||||
void initResources()
|
||||
{
|
||||
|
@ -82,39 +57,10 @@ public:
|
|||
|
||||
void QtQuickControls2Plugin::registerTypes(const char *uri)
|
||||
{
|
||||
qmlRegisterType<QQuickApplicationWindow>(uri, 2, 0, "AbstractApplicationWindow");
|
||||
qmlRegisterType<QQuickBusyIndicator>(uri, 2, 0, "AbstractBusyIndicator");
|
||||
qmlRegisterType<QQuickButton>(uri, 2, 0, "AbstractButton");
|
||||
qmlRegisterType<QQuickCheckBox>(uri, 2, 0, "AbstractCheckBox");
|
||||
qmlRegisterType<QQuickFrame>(uri, 2, 0, "AbstractFrame");
|
||||
qmlRegisterType<QQuickGroupBox>(uri, 2, 0, "AbstractGroupBox");
|
||||
qmlRegisterType<QQuickLabel>(uri, 2, 0, "AbstractLabel");
|
||||
qmlRegisterType<QQuickPageIndicator>(uri, 2, 0, "AbstractPageIndicator");
|
||||
qmlRegisterType<QQuickProgressBar>(uri, 2, 0, "AbstractProgressBar");
|
||||
qmlRegisterType<QQuickRadioButton>(uri, 2, 0, "AbstractRadioButton");
|
||||
qmlRegisterType<QQuickScrollBar>(uri, 2, 0, "AbstractScrollBar");
|
||||
qmlRegisterType<QQuickScrollIndicator>(uri, 2, 0, "AbstractScrollIndicator");
|
||||
qmlRegisterType<QQuickSlider>(uri, 2, 0, "AbstractSlider");
|
||||
qmlRegisterType<QQuickStackView>(uri, 2, 0, "AbstractStackView");
|
||||
qmlRegisterType<QQuickSwitch>(uri, 2, 0, "AbstractSwitch");
|
||||
qmlRegisterType<QQuickTabBar>(uri, 2, 0, "AbstractTabBar");
|
||||
qmlRegisterType<QQuickTabButton>(uri, 2, 0, "AbstractTabButton");
|
||||
qmlRegisterType<QQuickTextArea>(uri, 2, 0, "AbstractTextArea");
|
||||
qmlRegisterType<QQuickTextField>(uri, 2, 0, "AbstractTextField");
|
||||
qmlRegisterType<QQuickToggleButton>(uri, 2, 0, "AbstractToggleButton");
|
||||
qmlRegisterType<QQuickToolBar>(uri, 2, 0, "AbstractToolBar");
|
||||
qmlRegisterType<QQuickToolButton>(uri, 2, 0, "AbstractToolButton");
|
||||
|
||||
qmlRegisterUncreatableType<QQuickStackAttached>(uri, 2, 0, "Stack", "Stack is an attached property");
|
||||
qmlRegisterUncreatableType<QQuickThemeAttached>(uri, 2, 0, "Theme", "Theme is an attached property");
|
||||
|
||||
qmlRegisterType<QQuickControl>(uri, 2, 0, "Control");
|
||||
qmlRegisterType<QQuickExclusiveGroup>(uri, 2, 0, "ExclusiveGroup");
|
||||
qmlRegisterType<QQuickExclusiveGroupAttached>();
|
||||
|
||||
qmlRegisterRevision<QQuickText, 6>(uri, 2, 0);
|
||||
qmlRegisterRevision<QQuickTextInput, 6>(uri, 2, 0);
|
||||
qmlRegisterRevision<QQuickTextEdit, 6>(uri, 2, 0);
|
||||
}
|
||||
|
||||
void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtTest 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -52,7 +53,7 @@ TestCase {
|
|||
|
||||
Component {
|
||||
id: component
|
||||
Control { }
|
||||
T.Control { }
|
||||
}
|
||||
|
||||
SignalSpy {
|
||||
|
@ -267,7 +268,7 @@ TestCase {
|
|||
|
||||
Component {
|
||||
id: component2
|
||||
Control {
|
||||
T.Control {
|
||||
id: item2
|
||||
objectName: "item2"
|
||||
property alias item2_2: _item2_2;
|
||||
|
@ -275,10 +276,10 @@ TestCase {
|
|||
property alias item2_4: _item2_4;
|
||||
property alias item2_5: _item2_5;
|
||||
font.family: "Arial"
|
||||
Control {
|
||||
T.Control {
|
||||
id: _item2_2
|
||||
objectName: "_item2_2"
|
||||
Control {
|
||||
T.Control {
|
||||
id: _item2_3
|
||||
objectName: "_item2_3"
|
||||
}
|
||||
|
@ -391,7 +392,7 @@ TestCase {
|
|||
|
||||
Component {
|
||||
id: component3
|
||||
Control {
|
||||
T.Control {
|
||||
id: item3
|
||||
objectName: "item3"
|
||||
property alias item3_2: _item3_2;
|
||||
|
@ -404,13 +405,13 @@ TestCase {
|
|||
Item {
|
||||
id: _item3_2
|
||||
objectName: "_item3_2"
|
||||
Control {
|
||||
T.Control {
|
||||
id: _item3_3
|
||||
objectName: "_item3_3"
|
||||
Item {
|
||||
id: _item3_6
|
||||
objectName: "_item3_6"
|
||||
Control {
|
||||
T.Control {
|
||||
id: _item3_7
|
||||
objectName: "_item3_7"
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtTest 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -94,7 +95,7 @@ TestCase {
|
|||
compare(vertical.active, false)
|
||||
compare(vertical.orientation, Qt.Vertical)
|
||||
|
||||
container.AbstractScrollBar.vertical = vertical
|
||||
container.T.ScrollBar.vertical = vertical
|
||||
compare(vertical.parent, container)
|
||||
compare(vertical.orientation, Qt.Vertical)
|
||||
compare(vertical.size, container.visibleArea.heightRatio)
|
||||
|
@ -107,7 +108,7 @@ TestCase {
|
|||
compare(horizontal.active, false)
|
||||
compare(horizontal.orientation, Qt.Vertical)
|
||||
|
||||
container.AbstractScrollBar.horizontal = horizontal
|
||||
container.T.ScrollBar.horizontal = horizontal
|
||||
compare(horizontal.parent, container)
|
||||
compare(horizontal.orientation, Qt.Horizontal)
|
||||
compare(horizontal.size, container.visibleArea.widthRatio)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtTest 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -79,7 +80,7 @@ TestCase {
|
|||
compare(vertical.active, false)
|
||||
compare(vertical.orientation, Qt.Vertical)
|
||||
|
||||
container.AbstractScrollIndicator.vertical = vertical
|
||||
container.T.ScrollIndicator.vertical = vertical
|
||||
compare(vertical.parent, container)
|
||||
compare(vertical.orientation, Qt.Vertical)
|
||||
compare(vertical.size, container.visibleArea.heightRatio)
|
||||
|
@ -92,7 +93,7 @@ TestCase {
|
|||
compare(horizontal.active, false)
|
||||
compare(horizontal.orientation, Qt.Vertical)
|
||||
|
||||
container.AbstractScrollIndicator.horizontal = horizontal
|
||||
container.T.ScrollIndicator.horizontal = horizontal
|
||||
compare(horizontal.parent, container)
|
||||
compare(horizontal.orientation, Qt.Horizontal)
|
||||
compare(horizontal.size, container.visibleArea.widthRatio)
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtTest 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -75,7 +76,7 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
compare(control.stepSize, 0)
|
||||
compare(control.snapMode, AbstractSlider.NoSnap)
|
||||
compare(control.snapMode, T.Slider.NoSnap)
|
||||
compare(control.orientation, Qt.Horizontal)
|
||||
|
||||
control.destroy()
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
import QtQuick 2.2
|
||||
import QtTest 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
|
||||
TestCase {
|
||||
id: testCase
|
||||
|
@ -82,7 +83,7 @@ TestCase {
|
|||
compare(control.currentItem, item)
|
||||
control.push(component)
|
||||
verify(control.currentItem !== item)
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(control.currentItem, item)
|
||||
control.destroy()
|
||||
}
|
||||
|
@ -107,23 +108,23 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
var item1 = component.createObject(control)
|
||||
compare(item1.AbstractStackView.status, AbstractStackView.Inactive)
|
||||
compare(item1.T.StackView.status, T.StackView.Inactive)
|
||||
control.push(item1)
|
||||
compare(item1.AbstractStackView.status, AbstractStackView.Active)
|
||||
compare(item1.T.StackView.status, T.StackView.Active)
|
||||
|
||||
var item2 = component.createObject(control)
|
||||
compare(item2.AbstractStackView.status, AbstractStackView.Inactive)
|
||||
compare(item2.T.StackView.status, T.StackView.Inactive)
|
||||
control.push(item2)
|
||||
compare(item2.AbstractStackView.status, AbstractStackView.Activating)
|
||||
compare(item1.AbstractStackView.status, AbstractStackView.Deactivating)
|
||||
tryCompare(item2.AbstractStackView, "status", AbstractStackView.Active)
|
||||
tryCompare(item1.AbstractStackView, "status", AbstractStackView.Inactive)
|
||||
compare(item2.T.StackView.status, T.StackView.Activating)
|
||||
compare(item1.T.StackView.status, T.StackView.Deactivating)
|
||||
tryCompare(item2.T.StackView, "status", T.StackView.Active)
|
||||
tryCompare(item1.T.StackView, "status", T.StackView.Inactive)
|
||||
|
||||
control.pop()
|
||||
compare(item2.AbstractStackView.status, AbstractStackView.Deactivating)
|
||||
compare(item1.AbstractStackView.status, AbstractStackView.Activating)
|
||||
tryCompare(item2.AbstractStackView, "status", AbstractStackView.Inactive)
|
||||
tryCompare(item1.AbstractStackView, "status", AbstractStackView.Active)
|
||||
compare(item2.T.StackView.status, T.StackView.Deactivating)
|
||||
compare(item1.T.StackView.status, T.StackView.Activating)
|
||||
tryCompare(item2.T.StackView, "status", T.StackView.Inactive)
|
||||
tryCompare(item1.T.StackView, "status", T.StackView.Active)
|
||||
|
||||
control.destroy()
|
||||
}
|
||||
|
@ -133,19 +134,19 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
var item1 = component.createObject(control)
|
||||
compare(item1.AbstractStackView.index, -1)
|
||||
control.push(item1, AbstractStackView.Immediate)
|
||||
compare(item1.AbstractStackView.index, 0)
|
||||
compare(item1.T.StackView.index, -1)
|
||||
control.push(item1, T.StackView.Immediate)
|
||||
compare(item1.T.StackView.index, 0)
|
||||
|
||||
var item2 = component.createObject(control)
|
||||
compare(item2.AbstractStackView.index, -1)
|
||||
control.push(item2, AbstractStackView.Immediate)
|
||||
compare(item2.AbstractStackView.index, 1)
|
||||
compare(item1.AbstractStackView.index, 0)
|
||||
compare(item2.T.StackView.index, -1)
|
||||
control.push(item2, T.StackView.Immediate)
|
||||
compare(item2.T.StackView.index, 1)
|
||||
compare(item1.T.StackView.index, 0)
|
||||
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
compare(item2.AbstractStackView.index, -1)
|
||||
compare(item1.AbstractStackView.index, 0)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(item2.T.StackView.index, -1)
|
||||
compare(item1.T.StackView.index, 0)
|
||||
|
||||
control.destroy()
|
||||
}
|
||||
|
@ -155,19 +156,19 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
var item1 = component.createObject(control)
|
||||
compare(item1.AbstractStackView.view, null)
|
||||
control.push(item1, AbstractStackView.Immediate)
|
||||
compare(item1.AbstractStackView.view, control)
|
||||
compare(item1.T.StackView.view, null)
|
||||
control.push(item1, T.StackView.Immediate)
|
||||
compare(item1.T.StackView.view, control)
|
||||
|
||||
var item2 = component.createObject(control)
|
||||
compare(item2.AbstractStackView.view, null)
|
||||
control.push(item2, AbstractStackView.Immediate)
|
||||
compare(item2.AbstractStackView.view, control)
|
||||
compare(item1.AbstractStackView.view, control)
|
||||
compare(item2.T.StackView.view, null)
|
||||
control.push(item2, T.StackView.Immediate)
|
||||
compare(item2.T.StackView.view, control)
|
||||
compare(item1.T.StackView.view, control)
|
||||
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
compare(item2.AbstractStackView.view, null)
|
||||
compare(item1.AbstractStackView.view, control)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(item2.T.StackView.view, null)
|
||||
compare(item1.T.StackView.view, control)
|
||||
|
||||
control.destroy()
|
||||
}
|
||||
|
@ -176,17 +177,17 @@ TestCase {
|
|||
var control = stackView.createObject(testCase)
|
||||
verify(control)
|
||||
compare(control.depth, 0)
|
||||
control.push(item, AbstractStackView.Immediate)
|
||||
control.push(item, T.StackView.Immediate)
|
||||
compare(control.depth, 1)
|
||||
control.push(item, AbstractStackView.Immediate)
|
||||
control.push(item, T.StackView.Immediate)
|
||||
compare(control.depth, 2)
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(control.depth, 1)
|
||||
control.push(component, AbstractStackView.Immediate)
|
||||
control.push(component, T.StackView.Immediate)
|
||||
compare(control.depth, 2)
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(control.depth, 1)
|
||||
control.pop(AbstractStackView.Immediate) // ignored
|
||||
control.pop(T.StackView.Immediate) // ignored
|
||||
compare(control.depth, 1)
|
||||
control.clear()
|
||||
compare(control.depth, 0)
|
||||
|
@ -212,12 +213,12 @@ TestCase {
|
|||
control.forceActiveFocus()
|
||||
verify(control.activeFocus)
|
||||
|
||||
control.push(textField, AbstractStackView.Immediate)
|
||||
control.push(textField, T.StackView.Immediate)
|
||||
compare(control.currentItem, textField)
|
||||
textField.forceActiveFocus()
|
||||
verify(textField.activeFocus)
|
||||
|
||||
control.pop(AbstractStackView.Immediate)
|
||||
control.pop(T.StackView.Immediate)
|
||||
compare(control.currentItem, item)
|
||||
verify(control.activeFocus)
|
||||
verify(!textField.activeFocus)
|
||||
|
@ -233,9 +234,9 @@ TestCase {
|
|||
var item2 = component.createObject(control, {objectName: "2"})
|
||||
var item3 = component.createObject(control, {objectName: "3"})
|
||||
|
||||
control.push(item1, AbstractStackView.Immediate)
|
||||
control.push(item2, AbstractStackView.Immediate)
|
||||
control.push(item3, AbstractStackView.Immediate)
|
||||
control.push(item1, T.StackView.Immediate)
|
||||
control.push(item2, T.StackView.Immediate)
|
||||
control.push(item3, T.StackView.Immediate)
|
||||
|
||||
compare(control.find(function(item, index) { return index === 0 }), item1)
|
||||
compare(control.find(function(item) { return item.objectName === "1" }), item1)
|
||||
|
@ -256,15 +257,15 @@ TestCase {
|
|||
var control = stackView.createObject(testCase)
|
||||
verify(control)
|
||||
|
||||
control.push([item, component, component], AbstractStackView.Immediate)
|
||||
control.push([item, component, component], T.StackView.Immediate)
|
||||
|
||||
verify(control.get(0, AbstractStackView.DontLoad))
|
||||
compare(control.get(0, AbstractStackView.ForceLoad), item)
|
||||
verify(control.get(0, T.StackView.DontLoad))
|
||||
compare(control.get(0, T.StackView.ForceLoad), item)
|
||||
|
||||
verify(!control.get(1, AbstractStackView.DontLoad))
|
||||
verify(!control.get(1, T.StackView.DontLoad))
|
||||
|
||||
verify(control.get(2, AbstractStackView.DontLoad))
|
||||
verify(control.get(2, AbstractStackView.ForceLoad))
|
||||
verify(control.get(2, T.StackView.DontLoad))
|
||||
verify(control.get(2, T.StackView.ForceLoad))
|
||||
|
||||
control.destroy()
|
||||
}
|
||||
|
@ -274,47 +275,47 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
// missing arguments
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: push: missing arguments")
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: push: missing arguments")
|
||||
compare(control.push(), null)
|
||||
|
||||
// nothing to push
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: push: nothing to push")
|
||||
compare(control.push(AbstractStackView.Immediate), null)
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: push: nothing to push")
|
||||
compare(control.push(T.StackView.Immediate), null)
|
||||
|
||||
// push(item)
|
||||
var item1 = component.createObject(control, {objectName:"1"})
|
||||
compare(control.push(item1, AbstractStackView.Immediate), item1)
|
||||
compare(control.push(item1, T.StackView.Immediate), item1)
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item1)
|
||||
|
||||
// push([item])
|
||||
var item2 = component.createObject(control, {objectName:"2"})
|
||||
compare(control.push([item2], AbstractStackView.Immediate), item2)
|
||||
compare(control.push([item2], T.StackView.Immediate), item2)
|
||||
compare(control.depth, 2)
|
||||
compare(control.currentItem, item2)
|
||||
|
||||
// push(item, {properties})
|
||||
var item3 = component.createObject(control)
|
||||
compare(control.push(item3, {objectName:"3"}, AbstractStackView.Immediate), item3)
|
||||
compare(control.push(item3, {objectName:"3"}, T.StackView.Immediate), item3)
|
||||
compare(item3.objectName, "3")
|
||||
compare(control.depth, 3)
|
||||
compare(control.currentItem, item3)
|
||||
|
||||
// push([item, {properties}])
|
||||
var item4 = component.createObject(control)
|
||||
compare(control.push([item4, {objectName:"4"}], AbstractStackView.Immediate), item4)
|
||||
compare(control.push([item4, {objectName:"4"}], T.StackView.Immediate), item4)
|
||||
compare(item4.objectName, "4")
|
||||
compare(control.depth, 4)
|
||||
compare(control.currentItem, item4)
|
||||
|
||||
// push(component, {properties})
|
||||
var item5 = control.push(component, {objectName:"5"}, AbstractStackView.Immediate)
|
||||
var item5 = control.push(component, {objectName:"5"}, T.StackView.Immediate)
|
||||
compare(item5.objectName, "5")
|
||||
compare(control.depth, 5)
|
||||
compare(control.currentItem, item5)
|
||||
|
||||
// push([component, {properties}])
|
||||
var item6 = control.push([component, {objectName:"6"}], AbstractStackView.Immediate)
|
||||
var item6 = control.push([component, {objectName:"6"}], T.StackView.Immediate)
|
||||
compare(item6.objectName, "6")
|
||||
compare(control.depth, 6)
|
||||
compare(control.currentItem, item6)
|
||||
|
@ -330,34 +331,34 @@ TestCase {
|
|||
for (var i = 0; i < 7; ++i)
|
||||
items.push(component.createObject(control, {objectName:i}))
|
||||
|
||||
control.push(items, AbstractStackView.Immediate)
|
||||
control.push(items, T.StackView.Immediate)
|
||||
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: pop: too many arguments")
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: pop: too many arguments")
|
||||
compare(control.pop(1, 2, 3), null)
|
||||
|
||||
// pop the top most item
|
||||
compare(control.pop(AbstractStackView.Immediate), items[6])
|
||||
compare(control.pop(T.StackView.Immediate), items[6])
|
||||
compare(control.depth, 6)
|
||||
compare(control.currentItem, items[5])
|
||||
|
||||
// pop down to (but not including) the Nth item
|
||||
compare(control.pop(items[3], AbstractStackView.Immediate), items[5])
|
||||
compare(control.pop(items[3], T.StackView.Immediate), items[5])
|
||||
compare(control.depth, 4)
|
||||
compare(control.currentItem, items[3])
|
||||
|
||||
// pop the top most item
|
||||
compare(control.pop(undefined, AbstractStackView.Immediate), items[3])
|
||||
compare(control.pop(undefined, T.StackView.Immediate), items[3])
|
||||
compare(control.depth, 3)
|
||||
compare(control.currentItem, items[2])
|
||||
|
||||
// don't pop non-existent item
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: pop: unknown argument: " + testCase)
|
||||
compare(control.pop(testCase, AbstractStackView.Immediate), null)
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: pop: unknown argument: " + testCase)
|
||||
compare(control.pop(testCase, T.StackView.Immediate), null)
|
||||
compare(control.depth, 3)
|
||||
compare(control.currentItem, items[2])
|
||||
|
||||
// pop all items down to (but not including) the 1st item
|
||||
control.pop(null, AbstractStackView.Immediate)
|
||||
control.pop(null, T.StackView.Immediate)
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, items[0])
|
||||
|
||||
|
@ -369,47 +370,47 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
// missing arguments
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: replace: missing arguments")
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: replace: missing arguments")
|
||||
compare(control.replace(), null)
|
||||
|
||||
// nothing to push
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":59:9: QML AbstractStackView: replace: nothing to push")
|
||||
compare(control.replace(AbstractStackView.Immediate), null)
|
||||
ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":60:9: QML StackView: replace: nothing to push")
|
||||
compare(control.replace(T.StackView.Immediate), null)
|
||||
|
||||
// replace(item)
|
||||
var item1 = component.createObject(control, {objectName:"1"})
|
||||
compare(control.replace(item1, AbstractStackView.Immediate), item1)
|
||||
compare(control.replace(item1, T.StackView.Immediate), item1)
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item1)
|
||||
|
||||
// replace([item])
|
||||
var item2 = component.createObject(control, {objectName:"2"})
|
||||
compare(control.replace([item2], AbstractStackView.Immediate), item2)
|
||||
compare(control.replace([item2], T.StackView.Immediate), item2)
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item2)
|
||||
|
||||
// replace(item, {properties})
|
||||
var item3 = component.createObject(control)
|
||||
compare(control.replace(item3, {objectName:"3"}, AbstractStackView.Immediate), item3)
|
||||
compare(control.replace(item3, {objectName:"3"}, T.StackView.Immediate), item3)
|
||||
compare(item3.objectName, "3")
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item3)
|
||||
|
||||
// replace([item, {properties}])
|
||||
var item4 = component.createObject(control)
|
||||
compare(control.replace([item4, {objectName:"4"}], AbstractStackView.Immediate), item4)
|
||||
compare(control.replace([item4, {objectName:"4"}], T.StackView.Immediate), item4)
|
||||
compare(item4.objectName, "4")
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item4)
|
||||
|
||||
// replace(component, {properties})
|
||||
var item5 = control.replace(component, {objectName:"5"}, AbstractStackView.Immediate)
|
||||
var item5 = control.replace(component, {objectName:"5"}, T.StackView.Immediate)
|
||||
compare(item5.objectName, "5")
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item5)
|
||||
|
||||
// replace([component, {properties}])
|
||||
var item6 = control.replace([component, {objectName:"6"}], AbstractStackView.Immediate)
|
||||
var item6 = control.replace([component, {objectName:"6"}], T.StackView.Immediate)
|
||||
compare(item6.objectName, "6")
|
||||
compare(control.depth, 1)
|
||||
compare(control.currentItem, item6)
|
||||
|
@ -429,7 +430,7 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
var item1 = component.createObject(control)
|
||||
control.push(item1, AbstractStackView.Immediate)
|
||||
control.push(item1, T.StackView.Immediate)
|
||||
verify(item1.visible)
|
||||
|
||||
var item2 = component.createObject(control)
|
||||
|
@ -503,12 +504,12 @@ TestCase {
|
|||
|
||||
function test_ownership_data() {
|
||||
return [
|
||||
{tag:"item, transition", arg: indestructibleItem, operation: AbstractStackView.Transition, destroyed: false},
|
||||
{tag:"item, immediate", arg: indestructibleItem, operation: AbstractStackView.Immediate, destroyed: false},
|
||||
{tag:"component, transition", arg: destructibleComponent, operation: AbstractStackView.Transition, destroyed: true},
|
||||
{tag:"component, immediate", arg: destructibleComponent, operation: AbstractStackView.Immediate, destroyed: true},
|
||||
{tag:"url, transition", arg: Qt.resolvedUrl("TestItem.qml"), operation: AbstractStackView.Transition, destroyed: true},
|
||||
{tag:"url, immediate", arg: Qt.resolvedUrl("TestItem.qml"), operation: AbstractStackView.Immediate, destroyed: true}
|
||||
{tag:"item, transition", arg: indestructibleItem, operation: T.StackView.Transition, destroyed: false},
|
||||
{tag:"item, immediate", arg: indestructibleItem, operation: T.StackView.Immediate, destroyed: false},
|
||||
{tag:"component, transition", arg: destructibleComponent, operation: T.StackView.Transition, destroyed: true},
|
||||
{tag:"component, immediate", arg: destructibleComponent, operation: T.StackView.Immediate, destroyed: true},
|
||||
{tag:"url, transition", arg: Qt.resolvedUrl("TestItem.qml"), operation: T.StackView.Transition, destroyed: true},
|
||||
{tag:"url, immediate", arg: Qt.resolvedUrl("TestItem.qml"), operation: T.StackView.Immediate, destroyed: true}
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -517,7 +518,7 @@ TestCase {
|
|||
verify(control)
|
||||
|
||||
// push-pop
|
||||
control.push(data.arg, AbstractStackView.Immediate)
|
||||
control.push(data.arg, T.StackView.Immediate)
|
||||
verify(control.currentItem)
|
||||
verify(control.currentItem.hasOwnProperty("destroyedCallback"))
|
||||
var destroyed = false
|
||||
|
@ -528,7 +529,7 @@ TestCase {
|
|||
compare(destroyed, data.destroyed)
|
||||
|
||||
// push-replace
|
||||
control.push(data.arg, AbstractStackView.Immediate)
|
||||
control.push(data.arg, T.StackView.Immediate)
|
||||
verify(control.currentItem)
|
||||
verify(control.currentItem.hasOwnProperty("destroyedCallback"))
|
||||
destroyed = false
|
||||
|
|
Loading…
Reference in New Issue