Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] Resize frameless window

    General and Desktop
    2
    2
    4209
    Loading More Posts
    • 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.
    • B
      beowulf last edited by

      Hi guys, i'm trying to resize my frameless window.

      @setWindowFlags(Qt::FramelessWindowHint)@

      I can do this using QSizeGrip, but it's different from the original. Example:

      QSizeGrip:

      !http://www.tbi.univie.ac.at/~pmg/tutorials/QT/html/qsizegrip-m.png(http://www.tbi.univie.ac.at/~pmg/tutorials/QT/html/qsizegrip-m.png)!

      Original:

      !http://i5.minus.com/jb2em5OyNcQXbj.jpg(http://i5.minus.com/jb2em5OyNcQXbj.jpg)!

      How to make a frameless window resize like the "original"?

      -- 0x00

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        Well, frames serve exactly that purpose so it's a little weird to remove them and try to mimic their functionality, unless you're trying to style the window on you're own of course.

        What you can do is sorta drag and drop. On mouse press determine if and on which border or corner user has pressed and store it in some variable. On mouse move check if you're in a "drag mode" via the said variable and if you are, resize and move the window in the appropriate direction. On mouse release clear the variable.

        Since you're on Windows 7 (judging by the screenshot) don't forget to also handle things like double-click on the upper edge to maximize/demaximize, snap a window to an edge/maximize when dragged to a screen border, demaximize by dragging a window down. Some of those may require you to use some native Window APIs.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post