diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-22 12:10:12 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-22 14:09:23 +0000 |
commit | 7427e2808324388678eefda45b3e83c675979290 (patch) | |
tree | 2fe0308a0c84d8fd55ff1a3664565b2f5536dd6b /src/imports/controls/universal/ComboBox.qml | |
parent | 482ecb0fdc011687eec3df5803653be88f14f539 (diff) |
Refactor Popup
Added relevant properties to make it almost like a Control: x, y,
width, height, padding, background... This change makes popup use
an internal item where the style/user-supplied contentItem and
background are re-parented. This way we can provide a default style
(background) for Popup.
Change-Id: I3e7933562464c5c852e4ba4bc37d9ac25691c714
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/universal/ComboBox.qml')
-rw-r--r-- | src/imports/controls/universal/ComboBox.qml | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml index b91e4581..32e28e53 100644 --- a/src/imports/controls/universal/ComboBox.qml +++ b/src/imports/controls/universal/ComboBox.qml @@ -109,29 +109,27 @@ T.ComboBox { //! [popup] popup: T.Popup { - contentItem: Rectangle { - // TODO: Popup::anchors - readonly property var above: popup.visible ? control.mapToItem(null, 0, control.height - height) : Qt.point(0, 0) - readonly property var below: popup.visible ? control.mapToItem(null, 0, 0) : Qt.point(0, 0) + readonly property var above: popup.visible ? control.mapToItem(null, 0, control.height - height) : Qt.point(0, 0) + readonly property var below: popup.visible ? control.mapToItem(null, 0, 0) : Qt.point(0, 0) - x: below.x - y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y - width: control.width - height: listview.height - - color: control.Universal.chromeMediumLowColor + x: below.x + y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y + width: control.width + height: Math.min(200, listview.contentHeight) // TODO: 396 - ListView { - id: listview - width: control.width - height: Math.min(200, contentHeight) // TODO: 396 + contentItem: ListView { + id: listview + clip: true + model: control.delegateModel + currentIndex: control.highlightedIndex - clip: true - model: control.delegateModel - currentIndex: control.highlightedIndex +// ScrollIndicator.vertical: ScrollIndicator { } + } -// ScrollIndicator.vertical: ScrollIndicator { } - } + background: Rectangle { + color: control.Universal.chromeMediumLowColor + border.color: control.Universal.chromeHighColor + border.width: 1 // FlyoutBorderThemeThickness } } //! [popup] |