Restore minimized frameless window in qml

2019-07-17 16:39发布

I have a default main.cpp file and write some code in my qml file. Something like this:

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()
            }
        }
}

So, my question is: how after i have minimized window to restore it? Because there's no programm on control panel in Windows.

标签: c++ qt qml
1条回答
欢心
2楼-- · 2019-07-17 17:11

This works properly on my computer:

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

Window is still Frameless but there is app icon in taskbar.

查看更多
登录 后发表回答