Commit c9ae6c8b authored by Leander Schulten's avatar Leander Schulten

UI: ControlPane: Use Popups instead of Dialogs. See #57

parent 55a87d86
import QtQuick 2.7 import QtQuick 2.12
import QtQuick.Controls 2.2 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Dialogs 1.2
import custom.licht 1.0 import custom.licht 1.0
import "../HelpSystem" import "../HelpSystem"
...@@ -157,10 +156,11 @@ ControlPanel{ ...@@ -157,10 +156,11 @@ ControlPanel{
} }
Dialog{ Dialog{
modality: Qt.WindowModal modal: true
x: (parent.width - width) / 2
y: (parent.height - height) / 2
id:selectProgramDialog id:selectProgramDialog
property int select: ControlView.Select.Program property int select: ControlView.Select.Program
title: select === ControlView.Select.Program?"Select Program":"Select ProgramBlock"
width:300 width:300
function createProgram(){ function createProgram(){
select = ControlView.Select.Program; select = ControlView.Select.Program;
...@@ -170,38 +170,38 @@ ControlPanel{ ...@@ -170,38 +170,38 @@ ControlPanel{
select = ControlView.Select.ProgramBlock; select = ControlView.Select.ProgramBlock;
visible = true; visible = true;
} }
contentItem: RowLayout { contentItem: ColumnLayout{
Pane{ spacing: 8
Label{
text: selectProgramDialog.select === ControlView.Select.Program ? "Select Program" : "Select ProgramBlock"
font.bold: true
font.pointSize: 14
}
ComboBox{
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout{ id:programmSelect
anchors.left: parent.left model: selectProgramDialog.select === ControlView.Select.Program?programmModel:programBlocksModel
anchors.right: parent.right textRole: "display"
spacing: 10 }
ComboBox{ RowLayout{
Layout.fillWidth: true Button{
id:programmSelect Layout.fillWidth: true
model: selectProgramDialog.select === ControlView.Select.Program?programmModel:programBlocksModel text:"Abbrechen"
textRole: "display" onClicked: selectProgramDialog.visible = false
} }
RowLayout{ Button{
Button{ Layout.fillWidth: true
Layout.fillWidth: true text:"Hinzufügen"
text:"Abbrechen" onClicked: {
onClicked: selectProgramDialog.visible = false selectProgramDialog.visible = false;
if(selectProgramDialog.select === ControlView.Select.Program){
addProgrammControl(programmModel.data(programmModel.index(programmSelect.currentIndex,0),-1));
}else{
addProgramBlockControl(programBlocksModel.data(programBlocksModel.index(programmSelect.currentIndex,0),-1));
} }
Button{
Layout.fillWidth: true
text:"Hinzufügen"
onClicked: {
selectProgramDialog.visible = false;
if(selectProgramDialog.select === ControlView.Select.Program){
addProgrammControl(programmModel.data(programmModel.index(programmSelect.currentIndex,0),-1));
}else{
addProgramBlockControl(programBlocksModel.data(programBlocksModel.index(programmSelect.currentIndex,0),-1));
}
}
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment