[ui] add 'Message' structure to wrap high-level messages

* fix random segfault due to signals with 2+ arguments (PySide bug)
* group Connections to '_reconstruction' instance
This commit is contained in:
Yann Lanthony 2018-05-28 11:13:30 +02:00
parent 634eec5914
commit b46520009f
2 changed files with 39 additions and 24 deletions

View file

@ -197,22 +197,6 @@ ApplicationWindow {
id: dialogsFactory
}
// Bind log messages to DialogsFactory
Connections {
target: _reconstruction
function createDialog(func, args)
{
var dialog = func(_window)
// Set text afterwards to avoid dialog sizing issues
dialog.title = args[0]
dialog.text = args[1]
dialog.detailedText = args[2]
}
// onInfo: createDialog(dialogsFactory.info, arguments)
// onWarning: createDialog(dialogsFactory.warning, arguments)
// onError: createDialog(dialogsFactory.error, arguments)
}
Action {
id: undoAction
@ -316,6 +300,20 @@ ApplicationWindow {
0,
graphEditor.boundingBox().height + graphEditor.gridSpacing
)
// Bind messages to DialogsFactory
function createDialog(func, message)
{
var dialog = func(_window)
// Set text afterwards to avoid dialog sizing issues
dialog.title = message.title
dialog.text = message.text
dialog.detailedText = message.detailedText
}
onInfo: createDialog(dialogsFactory.info, arguments[0])
onWarning: createDialog(dialogsFactory.warning, arguments[0])
onError: createDialog(dialogsFactory.error, arguments[0])
}
Controls1.SplitView {