diff options
Diffstat (limited to 'examples/quick/controls/gallery/main.qml')
-rw-r--r-- | examples/quick/controls/gallery/main.qml | 227 |
1 files changed, 95 insertions, 132 deletions
diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml index 7da74031..ec00627b 100644 --- a/examples/quick/controls/gallery/main.qml +++ b/examples/quick/controls/gallery/main.qml @@ -51,10 +51,11 @@ import "content" ApplicationWindow { title: "Component Gallery" - width: 580 + width: 600 height: 400 minimumHeight: 400 - minimumWidth: 340 + minimumWidth: 570 + property string loremIpsum: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor "+ @@ -69,150 +70,112 @@ ApplicationWindow { onAccepted: imageViewer.open(fileUrl) } - toolBar: ToolBar { - id: toolbar - RowLayout { - spacing: 2 - anchors.verticalCenter: parent.verticalCenter - ToolButton { - iconSource: "images/window-new.png" - anchors.verticalCenter: parent.verticalCenter - onClicked: window1.visible = !window1.visible - Accessible.name: "New window" - tooltip: "Toggle visibility of the second window" - } - ToolButton { - action: openAction - } - ToolButton { - iconSource: "images/document-save-as.png" - anchors.verticalCenter: parent.verticalCenter - tooltip: "(Pretend to) save as..." - } - } + Action { + id: openAction + text: "&Open" + shortcut: "Ctrl+O" + iconSource: "images/document-open.png" + onTriggered: fileDialog.open() + tooltip: "Open an image" + } - ChildWindow { id: window1 } + Action { + id: copyAction + text: "&Copy" + shortcut: "Ctrl+C" + iconName: "edit-copy" + enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) + onTriggered: activeFocusItem.copy() + } - Action { - id: openAction - text: "&Open" - shortcut: "Ctrl+O" - iconSource: "images/document-open.png" - onTriggered: fileDialog.open() - tooltip: "open an image" - } + Action { + id: cutAction + text: "Cu&t" + shortcut: "Ctrl+X" + iconName: "edit-cut" + enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) + onTriggered: activeFocusItem.cut() + } + + Action { + id: pasteAction + text: "&Paste" + shortcut: "Ctrl+V" + iconName: "edit-paste" + enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) + onTriggered: activeFocusItem.paste() + } + + ExclusiveGroup { + id: textFormatGroup Action { - id: copyAction - text: "&Copy" - shortcut: "Ctrl+C" - iconName: "edit-copy" - enabled: (!!activeFocusItem && !!activeFocusItem["copy"]) - onTriggered: activeFocusItem.copy() + id: a1 + text: "Align Left" + checkable: true + Component.onCompleted: checked = true } Action { - id: cutAction - text: "Cu&t" - shortcut: "Ctrl+X" - iconName: "edit-cut" - enabled: (!!activeFocusItem && !!activeFocusItem["cut"]) - onTriggered: activeFocusItem.cut() + id: a2 + text: "Center" + checkable: true } Action { - id: pasteAction - text: "&Paste" - shortcut: "Ctrl+V" - iconName: "edit-paste" - enabled: (!!activeFocusItem && !!activeFocusItem["paste"]) - onTriggered: activeFocusItem.paste() + id: a3 + text: "Align Right" + checkable: true } + } - ExclusiveGroup { - id: textFormatGroup - - Action { - id: a1 - text: "Align Left" - checkable: true - Component.onCompleted: checked = true - } - - Action { - id: a2 - text: "Center" - checkable: true - } - - Action { - id: a3 - text: "Align Right" - checkable: true - } - } + ChildWindow { id: window1 } + Menu { + id: editmenu + MenuItem { action: cutAction } + MenuItem { action: copyAction } + MenuItem { action: pasteAction } + MenuSeparator {} Menu { - id: editmenu - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - MenuSeparator {} - Menu { - title: "Text Format" - MenuItem { action: a1 } - MenuItem { action: a2 } - MenuItem { action: a3 } - MenuSeparator { } - MenuItem { text: "Allow Hyphenation"; checkable: true } - MenuSeparator { } - Menu { - title: "More Stuff" - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - MenuSeparator { } - Menu { - title: "More Stuff" - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - MenuSeparator { } - Menu { - title: "More Stuff" - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - MenuSeparator { } - Menu { - title: "More Stuff" - MenuItem { action: cutAction } - MenuItem { action: copyAction } - MenuItem { action: pasteAction } - } - } - } - } - } - Menu { - title: "Font Style" - MenuItem { text: "Bold"; checkable: true } - MenuItem { text: "Italic"; checkable: true } - MenuItem { text: "Underline"; checkable: true } - } + title: "Text Format" + MenuItem { action: a1 } + MenuItem { action: a2 } + MenuItem { action: a3 } + MenuSeparator { } + MenuItem { text: "Allow Hyphenation"; checkable: true } } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.RightButton - onPressed: editmenu.popup() + Menu { + title: "Font Style" + MenuItem { text: "Bold"; checkable: true } + MenuItem { text: "Italic"; checkable: true } + MenuItem { text: "Underline"; checkable: true } } + } - CheckBox { - id: enabledCheck - text: "Enabled" - checked: true - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter + toolBar: ToolBar { + id: toolbar + RowLayout { + id: toolbarLayout + spacing: 0 + width: parent.width + ToolButton { + iconSource: "images/window-new.png" + onClicked: window1.visible = !window1.visible + Accessible.name: "New window" + tooltip: "Toggle visibility of the second window" + } + ToolButton { action: openAction } + ToolButton { + iconSource: "images/document-save-as.png" + tooltip: "(Pretend to) Save as..." + } + Item { Layout.fillWidth: true } + CheckBox { + id: enabledCheck + text: "Enabled" + checked: true + } } } @@ -265,7 +228,7 @@ ApplicationWindow { enabled: enabledCheck.checked tabPosition: controlPage.item ? controlPage.item.tabPosition : Qt.TopEdge anchors.fill: parent - anchors.margins: Qt.platform.os === "mac" ? 12 : 2 + anchors.margins: Qt.platform.os === "osx" ? 12 : 2 Tab { id: controlPage @@ -281,8 +244,8 @@ ApplicationWindow { Styles { anchors.fill: parent } } Tab { - title: "Sidebar" - Panel { anchors.fill:parent } + title: "Layouts" + Layouts { anchors.fill:parent } } } } |