summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-03 13:35:53 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-03 13:36:35 +0100
commit38b808f830f9c0ef4ee4068d93379e14e39c1988 (patch)
treef2a36cbee801c516c590351e7d1f498c0a08023f
parent6d6cace9ee25fb96fed91321ddb0e99652676823 (diff)
parent31803eb51bb2dde55776317b678d48d76f0e27fe (diff)
downloadqtquickcontrols-38b808f830f9c0ef4ee4068d93379e14e39c1988.tar.gz
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I8dbf36b760f72a60b745197367b812185ead8133
-rw-r--r--src/controls/Private/CalendarHeaderModel.qml29
-rw-r--r--src/controls/Private/EditMenu_base.qml6
-rw-r--r--src/controls/Private/HoverButton.qml5
-rw-r--r--src/controls/Styles/Base/ButtonStyle.qml4
-rw-r--r--src/controls/Styles/Base/CheckBoxStyle.qml4
-rw-r--r--src/controls/TabView.qml1
-rw-r--r--src/controls/TableView.qml1
-rw-r--r--src/controls/qmldir1
-rw-r--r--tests/auto/controls/data/tst_calendar.qml51
-rw-r--r--tests/auto/controls/data/tst_tabview.qml17
10 files changed, 105 insertions, 14 deletions
diff --git a/src/controls/Private/CalendarHeaderModel.qml b/src/controls/Private/CalendarHeaderModel.qml
index ef57e65b..8adfcc1a 100644
--- a/src/controls/Private/CalendarHeaderModel.qml
+++ b/src/controls/Private/CalendarHeaderModel.qml
@@ -68,6 +68,28 @@ ListModel {
*/
property var locale
+ ListElement {
+ dayOfWeek: Locale.Sunday
+ }
+ ListElement {
+ dayOfWeek: Locale.Monday
+ }
+ ListElement {
+ dayOfWeek: Locale.Tuesday
+ }
+ ListElement {
+ dayOfWeek: Locale.Wednesday
+ }
+ ListElement {
+ dayOfWeek: Locale.Thursday
+ }
+ ListElement {
+ dayOfWeek: Locale.Friday
+ }
+ ListElement {
+ dayOfWeek: Locale.Saturday
+ }
+
Component.onCompleted: {
var daysOfWeek = [Locale.Sunday, Locale.Monday, Locale.Tuesday,
Locale.Wednesday, Locale.Thursday, Locale.Friday, Locale.Saturday];
@@ -76,9 +98,10 @@ ListModel {
var shifted = daysOfWeek.splice(firstDayOfWeek, daysOfWeek.length - firstDayOfWeek);
daysOfWeek = shifted.concat(daysOfWeek)
- for (var i = 0; i < daysOfWeek.length; ++i) {
- var element = { dayOfWeek: daysOfWeek[i] }
- root.append(element);
+ if (firstDayOfWeek !== Locale.Sunday) {
+ for (var i = 0; i < daysOfWeek.length; ++i) {
+ root.setProperty(i, "dayOfWeek", daysOfWeek[i]);
+ }
}
}
}
diff --git a/src/controls/Private/EditMenu_base.qml b/src/controls/Private/EditMenu_base.qml
index 354b9c66..0078c895 100644
--- a/src/controls/Private/EditMenu_base.qml
+++ b/src/controls/Private/EditMenu_base.qml
@@ -70,7 +70,7 @@ Item {
Component {
id: cutAction
Action {
- text: "Cu&t"
+ text: qsTr("Cu&t")
shortcut: StandardKey.Cut
iconName: "edit-cut"
enabled: !input.readOnly && selectionStart !== selectionEnd
@@ -84,7 +84,7 @@ Item {
Component {
id: copyAction
Action {
- text: "&Copy"
+ text: qsTr("&Copy")
shortcut: StandardKey.Copy
iconName: "edit-copy"
enabled: input.selectionStart !== input.selectionEnd
@@ -98,7 +98,7 @@ Item {
Component {
id: pasteAction
Action {
- text: "&Paste"
+ text: qsTr("&Paste")
shortcut: StandardKey.Paste
iconName: "edit-paste"
enabled: input.canPaste
diff --git a/src/controls/Private/HoverButton.qml b/src/controls/Private/HoverButton.qml
index 1b79e087..964d30d3 100644
--- a/src/controls/Private/HoverButton.qml
+++ b/src/controls/Private/HoverButton.qml
@@ -62,9 +62,10 @@ Item {
Image {
id: image
- width: implicitWidth/2
- height: implicitHeight/2
+ width: Math.min(implicitWidth, parent.width * 0.4)
+ height: Math.min(implicitHeight, parent.height * 0.4)
anchors.centerIn: parent
+ fillMode: Image.PreserveAspectFit
opacity: 0.6
}
diff --git a/src/controls/Styles/Base/ButtonStyle.qml b/src/controls/Styles/Base/ButtonStyle.qml
index 9b55d26d..b9d34b46 100644
--- a/src/controls/Styles/Base/ButtonStyle.qml
+++ b/src/controls/Styles/Base/ButtonStyle.qml
@@ -83,7 +83,7 @@ Style {
padding {
top: 4
left: 4
- right: control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 4
+ right: 4 + (control.menu !== null ? Math.round(TextSingleton.implicitHeight * 0.5) : 0)
bottom: 4
}
@@ -121,7 +121,7 @@ Style {
source: "images/arrow-down.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
- anchors.rightMargin: padding.right
+ anchors.rightMargin: 4
opacity: control.enabled ? 0.6 : 0.5
}
}
diff --git a/src/controls/Styles/Base/CheckBoxStyle.qml b/src/controls/Styles/Base/CheckBoxStyle.qml
index 6fbdaede..e89e862a 100644
--- a/src/controls/Styles/Base/CheckBoxStyle.qml
+++ b/src/controls/Styles/Base/CheckBoxStyle.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import QtQuick.Controls.Private 1.0
@@ -168,7 +169,7 @@ Style {
sourceComponent: background
anchors.fill: parent
}
- Row {
+ RowLayout {
id: row
anchors.fill: parent
@@ -185,6 +186,7 @@ Style {
}
Loader {
id: labelLoader
+ Layout.fillWidth: true
sourceComponent: label
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/src/controls/TabView.qml b/src/controls/TabView.qml
index 71dc9b26..f8cf78b8 100644
--- a/src/controls/TabView.qml
+++ b/src/controls/TabView.qml
@@ -277,7 +277,6 @@ FocusScope {
if (completed)
tab.Component.onDestruction.connect(stack.onDynamicTabDestroyed.bind(tab))
__tabs.append({tab: tab})
- __didInsertIndex(__tabs.count - 1)
tabAdded = true
}
}
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index fb940c44..0d104b06 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -872,6 +872,7 @@ ScrollView {
if (rowItem) {
rowItem.visible = false;
rowItem.parent = null;
+ rowItem.rowIndex = -1;
listView.rowItemStack.push(rowItem); // return rowItem to cache
}
}
diff --git a/src/controls/qmldir b/src/controls/qmldir
index 6506b7f9..a07b4b99 100644
--- a/src/controls/qmldir
+++ b/src/controls/qmldir
@@ -3,3 +3,4 @@ plugin qtquickcontrolsplugin
classname QtQuickControlsPlugin
typeinfo plugins.qmltypes
designersupported
+depends QtQuick.Window 2.2
diff --git a/tests/auto/controls/data/tst_calendar.qml b/tests/auto/controls/data/tst_calendar.qml
index a0035fcb..34ea6775 100644
--- a/tests/auto/controls/data/tst_calendar.qml
+++ b/tests/auto/controls/data/tst_calendar.qml
@@ -39,6 +39,8 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.3
+import QtQuick.Controls.Styles 1.3
import QtQuick.Controls.Private 1.0
import QtTest 1.0
@@ -51,8 +53,8 @@ Item {
id: testcase
name: "Tests_Calendar"
when: windowShown
- readonly property int navigationBarHeight: calendar !== undefined ? calendar.__panel.navigationBarItem.height : 0
- readonly property int dayOfWeekHeaderRowHeight: calendar !== undefined ? calendar.__panel.dayOfWeekHeaderRow.height : 0
+ readonly property int navigationBarHeight: calendar ? calendar.__panel.navigationBarItem.height : 0
+ readonly property int dayOfWeekHeaderRowHeight: calendar ? calendar.__panel.dayOfWeekHeaderRow.height : 0
readonly property int firstDateCellX: 0
readonly property int firstDateCellY: navigationBarHeight + dayOfWeekHeaderRowHeight
readonly property int previousMonthButtonX: navigationBarHeight / 2
@@ -96,6 +98,9 @@ Item {
clickedSignalSpy.clear();
releasedSignalSpy.clear();
pressAndHoldSignalSpy.clear();
+
+ if (calendar)
+ calendar.destroy();
}
function toPixelsX(cellPosX) {
@@ -894,5 +899,47 @@ Item {
compare(releasedSignalSpy.count, 1);
compare(pressAndHoldSignalSpy.count, 1);
}
+
+ property var aysncDelegatesConstructed: []
+ property var aysncDelegatesDestructed: []
+
+ Loader {
+ id: asyncCalendarLoader
+ active: false
+ asynchronous: true
+
+ sourceComponent: Calendar {
+
+ style: CalendarStyle {
+ dayOfWeekDelegate: Component {
+ Text {
+ text: styleData.dayOfWeek
+ Component.onCompleted: testcase.aysncDelegatesConstructed[styleData.index] = true
+ Component.onDestruction: testcase.aysncDelegatesDestructed[styleData.index] = true
+ }
+ }
+ }
+ }
+ }
+
+ function test_asynchronous() {
+ verify(!asyncCalendarLoader.item);
+ asyncCalendarLoader.active = true;
+ tryCompare(asyncCalendarLoader, "status", Component.Ready);
+
+ var asyncCalendar = asyncCalendarLoader.item;
+ asyncCalendar.parent = container;
+ waitForRendering(asyncCalendar);
+
+ for (var i = 0; i < testcase.aysncDelegatesConstructed.length; ++i) {
+ tryCompare(testcase.aysncDelegatesConstructed, i, true);
+ }
+
+ asyncCalendarLoader.active = false;
+
+ for (i = 0; i < testcase.aysncDelegatesDestructed.length; ++i) {
+ tryCompare(testcase.aysncDelegatesDestructed, i, true);
+ }
+ }
}
}
diff --git a/tests/auto/controls/data/tst_tabview.qml b/tests/auto/controls/data/tst_tabview.qml
index 9e556dd1..46df9177 100644
--- a/tests/auto/controls/data/tst_tabview.qml
+++ b/tests/auto/controls/data/tst_tabview.qml
@@ -443,6 +443,23 @@ TestCase {
item.destroy()
}
+ function test_43701() {
+ var test_tabView = ' \
+ import QtQuick 2.2; \
+ import QtQuick.Controls 1.3; \
+ TabView { \
+ id: tabView; \
+ currentIndex: 2; \
+ Tab {} Tab {} Tab {} \
+ } '
+
+ var tabView = Qt.createQmlObject(test_tabView, testCase, '')
+ compare(tabView.count, 3)
+ compare(tabView.currentIndex, 2)
+
+ tabView.destroy()
+ }
+
function printGeometry(control) {
console.log("printGeometry:" + control)
console.log("x=" + control.x + ",y=" + control.y + ",w=" + control.width + ",h=" + control.height)