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. FramelessWindowHint removes the abbility to drag/move the window
Qt 6.11 is out! See what's new in the release blog

FramelessWindowHint removes the abbility to drag/move the window

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 470 Views 1 Watching
  • 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
    Kris Revi
    wrote on last edited by
    #1

    So as the title says when using setWindowFlag(Qt::FramelessWindowHint); it also removes the abbility to drag/move the window!

    by searching i found this here on this Qt Forum but it's from 2013 and i suspect it's old as i get some errors when trying this code

    private:
        void mousePressEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);
        int m_nMouseClick_X_Coordinate;
        int m_nMouseClick_Y_Coordinate;
    And this to .cpp file:
    
    void MainWindow::mousePressEvent(QMouseEvent *event) {
        m_nMouseClick_X_Coordinate = event->x();
        m_nMouseClick_Y_Coordinate = event->y();
    }
    
    void MainWindow::mouseMoveEvent(QMouseEvent *event) {
        move(event->globalX()-m_nMouseClick_X_Coordinate,event->globalY()-m_nMouseClick_Y_Coordinate);
    }
    

    errors i get is

    Code:
        m_nMouseClick_X_Coordinate = event->x();
        m_nMouseClick_Y_Coordinate = event->y();
        move(event->globalX()-m_nMouseClick_X_Coordinate,event->globalY()-m_nMouseClick_Y_Coordinate);
    
    Error:
        member access into incomplete type 'QMouseEvent'
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Yes when removing the caption, one can no longer drag it around.

      To fix you compile error do
      #include "QMouseEvent"

      You also must add resize if needed.

      One of the better version of this, i know is
      https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle

      1 Reply Last reply
      2

      • Login

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