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. 4
      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 property Item rootItem: null
//TODO document
readonly property bool empty: _popups.length == 0
/*! @brief The primary presenting method to present a dialog /*! @brief The primary presenting method to present a dialog
* *
* @param type:MessageConfig config The message configuration to create a dialog of * @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 property Item rootItem: null
//TODO document
readonly property bool empty: _popups.length == 0
//! Internal property //! Internal property
property var _popups: [] property var _popups: []

4
src/imports/mvvmquick/PresentingStackView.qml

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

3
src/imports/mvvmquick/QtMvvmApp.qml

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

Loading…
Cancel
Save