/*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright \n * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n * IN PART OR IN WHOLE, \n * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n * * \file ModalDialog.qml * \date 2019/10/21 * \author Behrouz NematiPour * */ // Qt import QtQuick 2.12 import QtQuick.Controls 2.12 // Project // Qml imports import "qrc:/globals" /*! * \brief The parent item for modal dialogs */ Dialog { id : _root property bool autoHide : false property int autoHideDuration : 1000 width : Variables.dialogWidth height : Variables.dialogHeight visible : false dim: true anchors.centerIn: parent enter: Transition { NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 } } exit : Transition { NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 } } closePolicy: Dialog.NoAutoClose Overlay.modeless : Rectangle { id : _borderRect anchors.fill: parent color: "transparent"//"#D00F0F0F" MouseArea { id : _modal anchors.fill: parent propagateComposedEvents: false } } background: Rectangle { id: _backgroundRect color: Colors.backgroundDialog radius: Variables.dialogRadius } onVisibleChanged: { if (autoHide && visible) { _autoHideAnimation.start() console.debug("_autoHideAnimation started") } } NumberAnimation { id: _autoHideAnimation running: false target: _root property: "opacity" duration: autoHideDuration //easing.type: Easing.InOutQuad onFinished: { console.debug("_autoHideAnimation finished") _root.visible = false } } }