From 1b5cb34a106560e5ee7d2d00c77fddf61ff4c327 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 29 Sep 2017 13:05:35 +0300 Subject: Fix CustomComboBox It's not possible to calculate popup height from the ComboBox y coordinate, it does not work with columns and rows. Height must be set by the user of the component who can calculate it correctly. Added itemsVisible property for quick height selection. Task-number: QTBUG-63091 Change-Id: I3f1a86545b7df58f453b98ce2e1f3a7bce9cc732 Reviewed-by: Kari Oikarinen Reviewed-by: Teemu Holappa --- src/settingsui/timedate/CustomComboBox.qml | 4 ++-- src/settingsui/timedate/ManualTime.qml | 9 ++++++++- src/settingsui/timedate/TimeDate.qml | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/settingsui/timedate/CustomComboBox.qml b/src/settingsui/timedate/CustomComboBox.qml index e7e1da4..3c8e752 100644 --- a/src/settingsui/timedate/CustomComboBox.qml +++ b/src/settingsui/timedate/CustomComboBox.qml @@ -32,6 +32,7 @@ import QtGraphicalEffects 1.0 ComboBox { id: comboBox + property int itemsVisible: 5 indicator: Image { id: indicatorImage height: comboBox.height * 0.4 @@ -69,13 +70,12 @@ ComboBox { popup: Popup { y: comboBox.height -1 width: comboBox.width - implicitHeight: contentItem.implicitHeight + height: comboBox.height * comboBox.itemsVisible padding: 1 contentItem: ListView { id: listView clip: true - implicitHeight: root.height - (comboBox.y + comboBox.height) model: comboBox.popup.visible ? comboBox.delegateModel : null currentIndex: comboBox.currentIndex onCurrentIndexChanged: positionViewAtIndex(listView.currentIndex, ListView.beginning) diff --git a/src/settingsui/timedate/ManualTime.qml b/src/settingsui/timedate/ManualTime.qml index 7448629..0db33d9 100644 --- a/src/settingsui/timedate/ManualTime.qml +++ b/src/settingsui/timedate/ManualTime.qml @@ -26,7 +26,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.6 import QtQuick.Controls 2.0 import QtDeviceUtilities.QtButtonImageProvider 1.0 import QtDeviceUtilities.TimeDateSettings 1.0 @@ -54,6 +54,7 @@ Item { // Row of date comboboxes Row { spacing: pluginMain.spacing + leftPadding: pluginMain.margin CustomComboBox { id: dayBox @@ -63,6 +64,7 @@ Item { property var date: new Date(firstYear, 1, 0) model: 31 + itemsVisible: 10 delegate: ItemDelegate { id: dayDelegate @@ -96,6 +98,7 @@ Item { width: root.width * 0.35 height: pluginMain.buttonHeight model: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] + itemsVisible: 12 delegate: ItemDelegate { id: monthDelegate height: monthBox.height @@ -121,6 +124,7 @@ Item { property var date: new Date() model: 50 + itemsVisible: 8 delegate: ItemDelegate { id: yearDelegate height: yearBox.height @@ -149,6 +153,7 @@ Item { // Row of time comboboxes Row { spacing: pluginMain.spacing + leftPadding: pluginMain.margin CustomComboBox { id: hourBox @@ -158,6 +163,7 @@ Item { property int hour: currentIndex model: 24 + itemsVisible: 8 delegate: ItemDelegate { id: hourDelegate @@ -183,6 +189,7 @@ Item { property int minute: currentIndex model: 60 + itemsVisible: 8 delegate: ItemDelegate { id: minuteDelegate diff --git a/src/settingsui/timedate/TimeDate.qml b/src/settingsui/timedate/TimeDate.qml index c8719e2..9110d80 100644 --- a/src/settingsui/timedate/TimeDate.qml +++ b/src/settingsui/timedate/TimeDate.qml @@ -110,13 +110,12 @@ Item { Row { leftPadding: pluginMain.margin - height: 500 CustomComboBox { id: timeZoneBox width: automaticButton.width + manualButton.width + pluginMain.spacing height: pluginMain.buttonHeight textRole: "id" - popup.height: 200 + itemsVisible: 7 model: TimezonesFilter delegate: ItemDelegate { id: timeZoneDelegate -- cgit v1.2.3