diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-02-26 13:52:56 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-03-23 12:46:11 +0000 |
commit | 0dd8a34f3b454d516f75e9b4be7691f934d2e849 (patch) | |
tree | 1b176eb891ce675e653093da645acd25253ff776 /src/imports/controls/Drawer.qml | |
parent | e346ed6f6db3fc0751c02b4b289f344d415cfdc9 (diff) |
Inherit QQuickDrawer from QQuickPopup
Change-Id: Icf71270e63aedd93ba975ab9743de68c3a54e849
Task-number: QTBUG-51007
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/Drawer.qml')
-rw-r--r-- | src/imports/controls/Drawer.qml | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 60abeb0c..bdab6376 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -35,18 +35,44 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Window 2.2 import Qt.labs.templates 1.0 as T T.Drawer { id: control - parent: T.ApplicationWindow.overlay || Window.contentItem - width: parent ? parent.width : 0 // TODO: Window.width - height: parent ? parent.height : 0 // TODO: Window.height + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) - // TODO: make this a proper transition - animation: SmoothedAnimation { - velocity: 5 + contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) + contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + + topPadding: control.edge === Qt.BottomEdge + leftPadding: control.edge === Qt.RightEdge + rightPadding: control.edge === Qt.LeftEdge + bottomPadding: control.edge === Qt.TopEdge + + //! [enter] + enter: Transition { SmoothedAnimation { velocity: 5 } } + //! [enter] + + //! [exit] + exit: Transition { SmoothedAnimation { velocity: 5 } } + //! [exit] + + //! [contentItem] + contentItem: Item { } + //! [contentItem] + + //! [background] + background: Rectangle { + Rectangle { + readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge + width: horizontal ? 1 : parent.width + height: horizontal ? parent.height : 1 + color: "#353637" + x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0 + y: control.edge === Qt.BottomEdge ? parent.height - 1 : 0 + } } + //! [background] } |