Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Window with Qt.Popup not closed

$
0
0
Thanks for the link, p3c0! I have found a way to hack around this. Unfortunately it involves using internal QtQuick features by importing “QtQuick.Controls.Private”, but for the moment this is better than nothing :-) import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Window 2.2 import QtQuick.Controls.Private 1.0   ApplicationWindow {     id: mainWindow     title: qsTr("Hello World")     width: 640     height: 480     visible: true       property var popup: null       function togglePopup() {         if (popup == null) {             popup = Qt.createQmlObject(                         "import QtQuick 2.4                         import QtQuick.Controls 1.3                         import QtQuick.Window 2.2                         import QtQuick.Controls.Private 1.0                         PopupWindow {                            id: mypopup                            Rectangle {                                width: 100                                height: 100                                Button {                                    id: button2                                    anchors.centerIn: parent                                    text: 'Close'                                    onClicked: dismissPopup()                                }                            }                        }",                         button1 )             popup.onPopupDismissed.connect( afterPopupDismissed )             popup.x = button1.x + button1.width             popup.y = button1.y             setTitle( "Popup created" )             popup.show()         } else {             popup.destroy()             popup = null         }     }       function afterPopupDismissed() {         popup.destroy()         popup = null         setTitle( "Popup dismissed" )     }       Button {         id: button1         text: "Click me"         onClicked: togglePopup()     }   }

Viewing all articles
Browse latest Browse all 4972

Trending Articles