Add visualParent to dialogs, QueryDialog example

This commit is contained in:
Sebastian Kügler 2013-02-22 02:17:14 +01:00
parent 006eb99b55
commit 16d42cc955
3 changed files with 49 additions and 9 deletions

View File

@ -28,12 +28,13 @@ import org.kde.qtextracomponents 0.1 as QtExtras
Item {
id: dialogsPage
width: 400
width: 300
height: 300
signal closeMe()
Rectangle {
color: "green"
anchors.margins: 24
//anchors.margins: 24
opacity: 0.1
anchors.fill: parent
}
PlasmaComponents.TextArea {

View File

@ -49,6 +49,7 @@ PlasmaComponents.Page {
text: "QtQuick2.Window"
}
Window {
title: radio.text
id: qWindow
visible: radio.checked
width: childrenRect.width
@ -82,7 +83,8 @@ PlasmaComponents.Page {
PlasmaCore.Dialog {
id: pcDialog
windowFlags: Qt.Popup
//windowFlags: Qt.Popup
visualParent: dialogsPage
//mainItem: dContent2
color: Qt.rgba(0,0,0,0)
@ -99,7 +101,13 @@ PlasmaComponents.Page {
text: "PlasmaComponents.Dialog"
iconSource: "dialog-ok-apply"
checkable: true
onCheckedChanged: pcompDialog.visible = checked
onCheckedChanged: {
if (checked) {
pcompDialog.open();
} else {
pcompDialog.close();
}
}
}
PlasmaComponents.Label {
text: pcompDialog.visible ? "shown" : "hidden"
@ -108,10 +116,10 @@ PlasmaComponents.Page {
PlasmaComponents.Dialog {
id: pcompDialog
//windowFlags: Qt.Popup
content: dContent3
DialogContent {
visualParent: dialogsPage
content: DialogContent {
id: dContent3
onCloseMe: pcompDialog.visible = false
onCloseMe: pcompDialog.close()
}
buttons: PlasmaComponents.ButtonRow {
PlasmaComponents.Button {
@ -125,12 +133,43 @@ PlasmaComponents.Page {
text: "Accept";
onClicked: {
print("Accepting...");
pcompDialog.accept()
pcompDialog.accept();
pcompDialog.close();
}
}
}
}
}
Row {
height: _h
spacing: _s
PlasmaComponents.Button {
text: "PlasmaComponents.QueryDialog"
iconSource: "dialog-ok-apply"
checkable: true
onCheckedChanged: {
if (checked) {
queryDialog.open();
} else {
queryDialog.close();
}
}
}
PlasmaComponents.Label {
text: queryDialog.visible ? "shown" : "hidden"
}
PlasmaComponents.QueryDialog {
id: queryDialog
//windowFlags: Qt.Popup
visualParent: dialogsPage
titleText: "Fruit Inquiry"
message: "Would you rather have apples or oranges?"
acceptButtonText: i18n("Apples")
rejectButtonText: i18n("Oranges")
onButtonClicked: close()
}
}
}
}

View File

@ -53,7 +53,7 @@ Item {
onWidthChanged: applet.width = width
onHeightChanged: applet.height = height
}
onActiveWindowChanged: {
if (!activeWindow) {
// plasmoid.expanded = false