Browse Source

improved closed handling

Close now works for popups/dialogs with no view below
pull/2/head
Skycoder42 7 years ago
parent
commit
40c03b7c88
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 3
      src/imports/mvvmquick/DialogPresenter.qml
  2. 3
      src/imports/mvvmquick/PopupPresenter.qml
  3. 10
      src/imports/mvvmquick/PresentingStackView.qml
  4. 3
      src/imports/mvvmquick/QtMvvmApp.qml

3
src/imports/mvvmquick/DialogPresenter.qml

@ -56,6 +56,9 @@ QtObject {
*/
property Item rootItem: null
//TODO document
readonly property bool empty: _popups.length == 0
/*! @brief The primary presenting method to present a dialog
*
* @param type:MessageConfig config The message configuration to create a dialog of

3
src/imports/mvvmquick/PopupPresenter.qml

@ -55,6 +55,9 @@ QtObject {
*/
property Item rootItem: null
//TODO document
readonly property bool empty: _popups.length == 0
//! Internal property
property var _popups: []

10
src/imports/mvvmquick/PresentingStackView.qml

@ -113,14 +113,10 @@ StackView {
return true;
}
if(_presenterStack.depth <= 1)
if(_presenterStack.safePop())
return true;
else
return false;
else {
if(_presenterStack.safePop())
return true;
else
return false;
}
}
/*! @brief Pop and delete a view

3
src/imports/mvvmquick/QtMvvmApp.qml

@ -172,6 +172,9 @@ ApplicationWindow {
closed = _drawerLoader.item.closeAction();
if(!closed)
closed = _rootStack.closeAction();
//if everything was closed -> still accept it
if(closed && _rootDialogs.emtpy && _rootPopup.empty && _rootStack.empty)
closed = false;
return closed;
}

Loading…
Cancel
Save