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/material/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/material/Drawer.qml')
-rw-r--r-- | src/imports/controls/material/Drawer.qml | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml index 133ea9c8..939beb5d 100644 --- a/src/imports/controls/material/Drawer.qml +++ b/src/imports/controls/material/Drawer.qml @@ -35,19 +35,43 @@ ****************************************************************************/ import QtQuick 2.6 -import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 import Qt.labs.templates 1.0 as T import Qt.labs.controls.material 1.0 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) + + //! [enter] + enter: Transition { SmoothedAnimation { velocity: 5 } } + //! [enter] + + //! [exit] + exit: Transition { SmoothedAnimation { velocity: 5 } } + //! [exit] + + //! [contentItem] + contentItem: Item { } + //! [contentItem] + + //! [background] + background: Rectangle { + color: control.Material.dialogColor + + layer.enabled: control.position > 0 + layer.effect: DropShadow { + horizontalOffset: control.edge === Qt.LeftEdge ? 1 : control.edge === Qt.RightEdge ? -1 : 0 + verticalOffset: control.edge === Qt.TopEdge ? 1 : control.edge === Qt.BottomEdge ? -1 : 0 + color: control.Material.dropShadowColor + samples: 15 + spread: 0.5 + } } + //! [background] } |