Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Created November 5, 2014 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmaster128/c0724440033ef153bb96 to your computer and use it in GitHub Desktop.
Save webmaster128/c0724440033ef153bb96 to your computer and use it in GitHub Desktop.
import QtQuick 2.3
import QtQuick.Controls 1.1
import QtQuick.Window 2.1
ApplicationWindow {
visible: true
width: 300
height: 300
title: qsTr("Hello World")
Window {
id: childWindow
title: qsTr("Child Window")
visible: true
width: 200
height: 200
onClosing: {
console.log("Child window is closing …")
close.accepted = false
}
function close() {
var closeEvent = { accepted: true };
childWindow.closing(closeEvent)
if (closeEvent.accepted)
{
visible = false
}
else
{
console.log("Closing denied")
}
}
Column {
anchors.centerIn: parent
Button {
text: qsTr("Run close()")
onClicked: childWindow.close()
}
Button {
text: qsTr("Set visible = false")
onClicked: childWindow.visible = false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment