Important: Please read the Qt Code of Conduct -

How to create a framelesswindow and can resize the window's size?

  • I use this to create a frameless window,but this window can't resize

    ApplicationWindow {
    flags:  Qt.Window|Qt.FramelessWindowHint

    I want to resize the window like a Qt::SizeAllCursor at right bottom~

  • Moderators

    Hi @hezf,
    AFAIK we dont have something like QSizeGrip in QML yet. So I thought of giving a try to create our own QML based grip. Following is what seems to work. Ofcourse it needs lots of improvisation IMO :)
    On the right-bottom corner is a small rectangle on which you can press and drag it. It is added just for visualization.

    import QtQuick 2.5
    import QtQuick.Window 2.0
    Window {
        id: win
        width: 300
        height: 300
        visible: true
        flags: Qt.FramelessWindowHint
        Item {
            id: root //Dummy item as mapToItem requires Item
            anchors.fill: parent
            Rectangle {
                width: 10
                height: 10
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                color: "red"
                MouseArea {
                    anchors.fill: parent
                    onPositionChanged: {
                        win.width += mapToItem(root,mouseX,mouseY).x-root.width
                        win.height += mapToItem(root,mouseX,mouseY).y-root.height

    Can you try if it works for you ?
    If some one has better ideas to improve it please share.

  • @p3c0
    Thank you for your help.I will try it.
    If I know a better way to do this,I will share to you.

Log in to reply