Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Implementing draggable windows
Forum Update on Monday, May 27th 2025

[SOLVED] Implementing draggable windows

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 906 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.
  • N Offline
    N Offline
    nicky j
    wrote on 18 Apr 2014, 01:38 last edited by
    #1

    Hello!

    I have been playing around with making frameless windows. When you remove the OS-given frame from a window, you lose the ability to drag the window around the screen. How can I reimplement this feature?

    Thanks!

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on 18 Apr 2014, 04:10 last edited by
      #2

      Well you can implement something like this:
      @void Dialog::mouseMoveEvent(QMouseEvent *event)
      {
      if(event->buttons() & Qt::LeftButton)
      {
      this->move(event->globalPos() - cursorPos);
      }
      }

      void Dialog::mousePressEvent(QMouseEvent *event)
      {
      if(event->buttons() & Qt::LeftButton)
      {
      cursorPos = event->pos();
      }
      }@

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nicky j
        wrote on 18 Apr 2014, 04:36 last edited by
        #3

        Figured it out. Thanks!

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qxoz
          wrote on 18 Apr 2014, 05:37 last edited by
          #4

          You're welcome. Don't forget mark thread as solved :) .

          1 Reply Last reply
          0

          1/4

          18 Apr 2014, 01:38

          • Login

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