Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to create a resizable frameless window?

How to create a resizable frameless window?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 426 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kamichanw
    wrote on last edited by
    #1

    I'm trying to create a resizable frameless window. In onPositionChanged of a MouseArea that fills entire Window, here is part of my code

    if (resizable && cursorShape !== Qt.ArrowCursor) {
        // resize
        var leftTop = Qt.point(control.x, control.y)
        var rightBottom = Qt.point(control.x + width, control.y + height)
        var globalMouse = mapToGlobal(Qt.point(mouseX, mouseY))
        if (edgeFlag & ShadowWindow.Edge.Left)
                  leftTop.x = globalMouse.x
        // TODO...
        control.x = leftTop.x
        control.width = rightBottom.x - leftTop.x
    }
    

    Currently, I just have written the code for resizing when mouse presses on left edge of my Window. And edgeFlag here represents the position of mouse. Now, there are two problems.

    1. Resizing only works when I move the mouse press on the left edge to the right, i.e. shrink the window.
    2. Window shakes violently when resizing.
      Can anyone help me?
    GrecKoG 1 Reply Last reply
    0
    • K Kamichanw

      I'm trying to create a resizable frameless window. In onPositionChanged of a MouseArea that fills entire Window, here is part of my code

      if (resizable && cursorShape !== Qt.ArrowCursor) {
          // resize
          var leftTop = Qt.point(control.x, control.y)
          var rightBottom = Qt.point(control.x + width, control.y + height)
          var globalMouse = mapToGlobal(Qt.point(mouseX, mouseY))
          if (edgeFlag & ShadowWindow.Edge.Left)
                    leftTop.x = globalMouse.x
          // TODO...
          control.x = leftTop.x
          control.width = rightBottom.x - leftTop.x
      }
      

      Currently, I just have written the code for resizing when mouse presses on left edge of my Window. And edgeFlag here represents the position of mouse. Now, there are two problems.

      1. Resizing only works when I move the mouse press on the left edge to the right, i.e. shrink the window.
      2. Window shakes violently when resizing.
        Can anyone help me?
      GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by GrecKo
      #2

      @Kamichanw you can do it simply with QWindow::startSystemResize (and its friend startSystemMove)

      K 1 Reply Last reply
      0
      • GrecKoG GrecKo

        @Kamichanw you can do it simply with QWindow::startSystemResize (and its friend startSystemMove)

        K Offline
        K Offline
        Kamichanw
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • K Kamichanw has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved