[Interest] QML popup window closing

Juhani Matilainen juhani at theocbase.net
Wed Nov 11 20:26:40 CET 2015


This works even worse on Windows. Popup window is not closed when clicked parent window (works on Mac). 

What is right way to do this? Basicly I'd need combobox with multiple columns. I didn't find way to do this with ComboBox in QtQuick Controls. That's why I tried with TableView in popup Window. 

Juhani 

> Juhani Matilainen <juhani at theocbase.net> kirjoitti 10.11.2015 kello 23.39:
> 
> Hello,
> 
> I posted the same question to forum but no answers. I hope you can help. 
> 
> I have modal dialog (qml window) that includes popup window. Popup is closed ok when mouse is clicked outside of popup in modal window. But I'd like to close popup also when is clicked anywhere on screen but outside the popup. So behaviour should be the same as the combobox or menu  How this can be done?
> 
> 
> 
> Here is my example code:
> 
> 	import QtQuick 2.3
> 
> 	import QtQuick.Controls 1.2
> 
> 	import QtQuick.Window 2.1
> 
> 		
> 
> 	ApplicationWindow {
> 
> 		    visible: true
> 
> 		    width: 640
> 
> 		    height: 480
> 
> 		
> 
> 		    Button {
> 
> 		        text: "Open modal window"
> 
> 		        anchors.centerIn: parent
> 
> 		        onClicked: { modalWindow.show() }
> 
> 		    }
> 
> 		
> 
> 		    Window {
> 
> 		        id: modalWindow
> 
> 		        width: 300
> 
> 		        height: 400
> 
> 		        modality: Qt.ApplicationModal
> 
> 		        Rectangle {
> 
> 		            anchors.fill: parent
> 
> 		            border.width: 1
> 
> 		            MouseArea {
> 
> 		                anchors.fill: parent
> 
> 		                onClicked: {
> 
> 		                    popupWindow.show()
> 
> 		                }
> 
> 		            }
> 
> 		            Button {
> 
> 		                anchors.top: parent.top
> 
> 		                anchors.right: parent.right
> 
> 		                text: "Close"
> 
> 		                onClicked: modalWindow.close()
> 
> 		            }
> 
> 		        }     
> 
> 		
> 
> 		        Window {
> 
> 		            id: popupWindow
> 
> 		            flags: Qt.Popup
> 
> 		            width: 100
> 
> 		            height: 100
> 
> 		            x: Screen.width / 2
> 
> 		            y: Screen.height / 2
> 
> 		            Rectangle {
> 
> 		                anchors.fill: parent
> 
> 		                color: "green"
> 
> 		            }
> 
> 		        }       
> 
> 		    }
> 
> 	}
> 
> 
> Qt Forum
> Detect mouse click			de the modal windo
> 
> Thanks in advanced
> Juhani
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151111/812d7853/attachment.html>


More information about the Interest mailing list