Warning, /plasma/libplasma/tests/dialog_positioning2.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2014 Vishesh Handa <vhanda@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.0
0008 
0009 import QtQuick.Controls 2.15 as Controls
0010 import QtQuick.Layouts 1.1
0011 
0012 import org.kde.plasma.core 2.0 as PlasmaCore
0013 import org.kde.plasma.components 2.0 as PlasmaComponents
0014 import org.kde.plasma.extras 2.0 as PlasmaExtras
0015 
0016 ColumnLayout
0017 {
0018     Controls.Label {
0019         text: "Press the button and make sure the popup is on the correct place"
0020         wrapMode: Text.WordWrap
0021     }
0022     PlasmaComponents.Button {
0023         id: settingsButton
0024         iconSource: "configure"
0025         text: "Press Me"
0026         Layout.alignment: Qt.AlignHCenter
0027 
0028         onClicked: {
0029             contextMenu.visible = !contextMenu.visible;
0030         }
0031     }
0032 
0033     PlasmaCore.Dialog {
0034         id: contextMenu
0035         visualParent: settingsButton
0036 
0037         location: PlasmaCore.Types.BottomEdge
0038         type: PlasmaCore.Dialog.PopupMenu
0039         flags: Qt.Popup | Qt.FramelessWindowHint | Qt.WindowDoesNotAcceptFocus
0040 
0041         mainItem: ColumnLayout {
0042             id: menuColumn
0043             Layout.minimumWidth: menuColumn.implicitWidth
0044             Layout.minimumHeight: menuColumn.implicitHeight
0045             spacing: PlasmaCore.Units.smallSpacing
0046 
0047             PlasmaExtras.Heading {
0048                 level: 3
0049                 text: "Panel Alignment"
0050             }
0051 
0052             PlasmaComponents.ButtonColumn {
0053                 spacing: 0
0054                 Layout.fillWidth: true
0055                 PlasmaComponents.ToolButton {
0056                     anchors {
0057                         left: parent.left
0058                         right: parent.right
0059                     }
0060                     text: "Left"
0061                     checkable: true
0062                     flat: false
0063                 }
0064                 PlasmaComponents.ToolButton {
0065                     anchors {
0066                         left: parent.left
0067                         right: parent.right
0068                     }
0069                     text: "Center"
0070                     checkable: true
0071                     flat: false
0072                 }
0073             }
0074         }
0075     }
0076 }