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

0001 /*
0002     SPDX-FileCopyrightText: 2014 Vishesh Handa <vhanda@kde.org>
0003     SPDX-FileCopyrightText: 2014 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick
0009 
0010 import QtQuick.Controls as Controls
0011 import QtQuick.Layouts
0012 
0013 import org.kde.plasma.core as PlasmaCore
0014 
0015 Item {
0016     id: root
0017     Layout.minimumWidth: 300
0018     Layout.minimumHeight: 300
0019     Controls.Button {
0020         id: button
0021         anchors.centerIn: parent
0022         text: "Show Dialog"
0023         onClicked: {
0024             //changing the minimumHeight of the mainItem of an hidden dialog
0025             //shouldn't
0026             rect.Layout.minimumHeight = rect.Layout.minimumHeight + 1
0027             rect.Layout.minimumWidth = rect.Layout.minimumWidth + 1
0028             subDialog.visible = !subDialog.visible
0029         }
0030     }
0031     PlasmaCore.Dialog {
0032         id: subDialog
0033         location: PlasmaCore.Types.Floating
0034         visualParent: button
0035         visible: false
0036 
0037         Rectangle {
0038             id: rect
0039             Layout.minimumWidth: 300
0040             Layout.minimumHeight: 300
0041             Layout.maximumHeight: 500
0042             property int fixedHeight: 500
0043             width: 500
0044             height: fixedHeight
0045 
0046             color: "red"
0047             border {
0048                 color: "blue"
0049                 width: 3
0050             }
0051 
0052             Controls.Button {
0053                 text: "Resize"
0054                 anchors.centerIn: parent
0055                 onClicked: {
0056                     rect.fixedHeight = rect.Layout.minimumHeight = rect.Layout.maximumHeight = (rect.fixedHeight == 500 ? rect.fixedHeight = 100 : rect.fixedHeight = 500)
0057 
0058                     //subDialog.height = (subDialog.height == 500 ? subDialog.height = 100 : subDialog.height = 500)
0059                 }
0060             }
0061         }
0062     }
0063 }