Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.6
- import QtQuick.Layouts 1.1
- import QtQuick.Window 2.2
- import QtQuick.Controls 2.0
- ApplicationWindow {
- width: 400
- height: 200
- visible: true
- onActiveFocusItemChanged: print("activeFocusItem", activeFocusItem)
- header: ToolBar {
- RowLayout {
- focus: false
- implicitWidth: children[0].implicitWidth
- implicitHeight: children[0].implicitHeight
- ToolButton {
- text: qsTr("File")
- onClicked: {
- print("@@@@@@@@@ clicked menu toolbutton")
- fileMenu.open()
- }
- Menu {
- id: fileMenu
- y: parent.height
- onClosed: print("@@@@@@@@@ closed menu")
- MenuItem {
- text: qsTr("New")
- }
- MenuItem {
- text: qsTr("open")
- }
- MenuItem {
- text: qsTr("Close")
- }
- }
- }
- }
- }
- FocusScope {
- id: focusScope
- focus: true
- anchors.fill: parent
- property bool toggled: false
- Keys.onPressed: {
- if (event.modifiers === Qt.AltModifier) {
- focusScope.toggled = true;
- }
- }
- Keys.onReleased: {
- if ((event.modifiers === Qt.AltModifier || event.key === Qt.Key_Alt) && !event.isAutoRepeat) {
- focusScope.toggled = false;
- }
- }
- RowLayout {
- anchors.centerIn: parent
- Button {
- id: penButton
- text: qsTr("Pen")
- highlighted: !focusScope.toggled
- }
- Button {
- id: eyedropperButton
- text: qsTr("Eyedropper")
- highlighted: focusScope.toggled
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment