QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
MenuButton.qml
1 import QtQuick 2.10
2 import QtQuick.Controls 2.3
3 import de.skycoder42.QtMvvm.Quick 1.1
4 
29  id: _menuButton
30  icon.name: "view-more-symbolic"
31  icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_more_vert.svg"
32  text: qsTr("Moreā€¦")
33  checkable: true
34  checked: _moreMenu.visible
35 
47  readonly property alias moreMenu: _moreMenu
61  default property alias menuContent: _moreMenu.contentData
62 
63  MouseArea { //used to catch mouse events to prevent flickering
64  visible: _moreMenu.visible
65  anchors.fill: parent
66  }
67 
68  Menu {
69  id: _moreMenu
70  visible: _menuButton.checked
71  }
72 
73  Component.onCompleted: {
74  if(QuickPresenter.currentStyle !== "Material") {
75  _moreMenu.y = Qt.binding(function(){
76  return _menuButton.height + Math.max(0, (parent.height - _menuButton.height)/2);
77  });
78  } else {
79  _moreMenu.y = Qt.binding(function(){
80  return Math.min(0, (_menuButton.height - parent.height)/2);
81  });
82  }
83  }
84 }
QString currentStyle
The name of the currently active Quick Controls 2 Style.
The QML import for the QtMvvmQuick QML module.
Definition: ActionButton.qml:4
An extension of the ToolButton for better appearance.
A QML singleton to access common presenter methods globally.