在qml中恢复最小化的无框窗口

时间:2014-11-11 17:15:29

标签: c++ qt qml

我有一个默认的main.cpp文件,并在我的qml文件中写了一些代码。像这样:

ApplicationWindow {
id: mainWindow

width: 640
height: 480
color: "white"

visible: true

flags: Qt.FramelessWindowHint

      Rectangle {
            id: minimizeButton

            width: 32
            height: 32

            Rectangle {
                anchors {
                    bottom: parent.bottom
                    left: parent.left
                    right: parent.right
                }

                color: "grey"

                height: 2

                scale: mouse.pressed ? 0.8 : 1.0
                smooth: mouse.pressed
            }

            MouseArea {
                id: mouse
                anchors.fill: parent

                hoverEnabled: true

                onClicked: mainWindow.showMinimized()
            }
        }
}

所以,我的问题是:如何在我最小化窗口后恢复它?因为Windows中的控制面板上没有程序。

1 个答案:

答案 0 :(得分:5)

这在我的电脑上运行正常:

flags: Qt.FramelessWindowHint |
       Qt.WindowMinimizeButtonHint |
       Qt.Window

Window仍然是Frameless,但任务栏中有app图标。