QtMvvm  1.0.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
PresentingDrawer.qml
1 import QtQuick 2.10
2 import QtQuick.Controls 2.3
3 
42 Drawer {
43  id: _presentingDrawer
44 
45  width: Math.min(300, parent.width - 24);
46  height: parent.height - y
47 
49  property Item _mainChild: null
50 
52  function toggle() {
53  if(visible)
54  close();
55  else
56  open();
57  }
58 
69  function presentDrawerContent(item) {
70  if(_mainChild)
71  _mainChild.destroy();
72  item.parent = _presentingDrawer.contentItem;
73  item.drawer = _presentingDrawer;
74  _mainChild = item;
75  return true;
76  }
77 
87  function closeAction() {
88  if(_mainChild && typeof _mainChild.closeAction == "function") {
89  if(_mainChild.closeAction())
90  return true;
91  }
92 
93  if(visible) {
94  close();
95  return true;
96  } else
97  return false;
98  }
99 }