QtMvvm  1.0.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.0
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 
48  readonly property alias moreMenu: _moreMenu
62  default property alias menuContent: _moreMenu.contentData
63 
64  MouseArea { //used to catch mouse events to prevent flickering
65  visible: _moreMenu.visible
66  anchors.fill: parent
67  }
68 
69  Menu {
70  id: _moreMenu
71  visible: _menuButton.checked
72  }
73 
74  Component.onCompleted: {
75  if(QuickPresenter.currentStyle !== "Material") {
76  _moreMenu.y = Qt.binding(function(){
77  return _menuButton.height + Math.max(0, (parent.height - _menuButton.height)/2);
78  });
79  } else {
80  _moreMenu.y = Qt.binding(function(){
81  return Math.min(0, (_menuButton.height - parent.height)/2);
82  });
83  }
84  }
85 }
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.