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. I want to move form(QWidget) by holding it from anywhere in the other form. How?
Forum Updated to NodeBB v4.3 + New Features

I want to move form(QWidget) by holding it from anywhere in the other form. How?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 274 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.
  • M Offline
    M Offline
    mduzoylum
    wrote on last edited by
    #1

    I did it myself keyboard qiwdget. And I removed the frame using this code: " setWindowFlags(Qt::FramelessWindowHint) " ..
    I want to move this form by holding it from anywhere in the other form.

    keypad.png

    How can i do it ?

    jsulmJ 1 Reply Last reply
    0
    • M mduzoylum

      I did it myself keyboard qiwdget. And I removed the frame using this code: " setWindowFlags(Qt::FramelessWindowHint) " ..
      I want to move this form by holding it from anywhere in the other form.

      keypad.png

      How can i do it ?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mduzoylum Overwrite https://doc.qt.io/qt-5/qwidget.html#mousePressEvent and https://doc.qt.io/qt-5/qwidget.html#mouseMoveEvent events
      In mousePressEvent you store the mouse cursor position inside the widget. In mouseMoveEvent you check whether left mouse button in pressed, if it is you move the widget to have the mouse cursor at the same position in the widget as it was in mousePressEvent

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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