Warning, /frameworks/qqc2-desktop-style/tests/exclusive-menuitem.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0003 0004 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls as QQC2 0009 0010 QQC2.ApplicationWindow { 0011 visible: true 0012 title: "Menu test" 0013 width: 500 0014 height: 500 0015 0016 QQC2.ActionGroup { 0017 id: actionGroupExclusive 0018 exclusive: true 0019 } 0020 0021 QQC2.ActionGroup { 0022 id: actionGroupNonExclusive 0023 exclusive: false 0024 } 0025 0026 QQC2.ButtonGroup { 0027 id: buttonGroupExclusive 0028 exclusive: true 0029 } 0030 0031 QQC2.ButtonGroup { 0032 id: buttonGroupNonExclusive 0033 exclusive: false 0034 } 0035 0036 QQC2.Menu { 0037 id: menu 0038 0039 title: "Top level menu" 0040 0041 QQC2.Menu { 0042 title: "Action menu exclusive" 0043 QQC2.MenuItem { 0044 action: QQC2.Action { 0045 text: "Action one" 0046 checkable: true 0047 QQC2.ActionGroup.group: actionGroupExclusive 0048 } 0049 } 0050 QQC2.MenuItem { 0051 action: QQC2.Action { 0052 text: "Action two" 0053 checkable: true 0054 QQC2.ActionGroup.group: actionGroupExclusive 0055 } 0056 } 0057 QQC2.MenuItem { 0058 action: QQC2.Action { 0059 text: "Action three" 0060 checkable: true 0061 QQC2.ActionGroup.group: actionGroupExclusive 0062 } 0063 } 0064 } 0065 0066 QQC2.Menu { 0067 title: "Action menu non-exclusive" 0068 QQC2.MenuItem { 0069 action: QQC2.Action { 0070 text: "Action one" 0071 checkable: true 0072 QQC2.ActionGroup.group: actionGroupNonExclusive 0073 } 0074 } 0075 QQC2.MenuItem { 0076 action: QQC2.Action { 0077 text: "Action two" 0078 checkable: true 0079 QQC2.ActionGroup.group: actionGroupNonExclusive 0080 } 0081 } 0082 QQC2.MenuItem { 0083 action: QQC2.Action { 0084 text: "Action three" 0085 checkable: true 0086 QQC2.ActionGroup.group: actionGroupNonExclusive 0087 } 0088 } 0089 } 0090 0091 QQC2.Menu { 0092 title: "Button menu exclusive" 0093 QQC2.MenuItem { 0094 text: "Button one" 0095 checkable: true 0096 QQC2.ButtonGroup.group: buttonGroupExclusive 0097 } 0098 QQC2.MenuItem { 0099 text: "Button two" 0100 checkable: true 0101 QQC2.ButtonGroup.group: buttonGroupExclusive 0102 } 0103 QQC2.MenuItem { 0104 text: "Button three" 0105 checkable: true 0106 QQC2.ButtonGroup.group: buttonGroupExclusive 0107 } 0108 } 0109 0110 QQC2.Menu { 0111 title: "Button menu non-exclusive" 0112 QQC2.MenuItem { 0113 text: "Button one" 0114 checkable: true 0115 QQC2.ButtonGroup.group: buttonGroupNonExclusive 0116 } 0117 QQC2.MenuItem { 0118 text: "Button two" 0119 checkable: true 0120 QQC2.ButtonGroup.group: buttonGroupNonExclusive 0121 } 0122 QQC2.MenuItem { 0123 text: "Button three" 0124 checkable: true 0125 QQC2.ButtonGroup.group: buttonGroupNonExclusive 0126 } 0127 } 0128 } 0129 0130 QQC2.Button { 0131 anchors.centerIn: parent 0132 text: "Open menu" 0133 onClicked: menu.popup(this, 0, height) 0134 } 0135 }