Recently, the company is working on a C ++ project, and its functions are almost done. Now it is an interface modification. To make a good-looking interface, the title bar is a problem. So I chose to remove the title bar, the method to remove the title bar is relatively simple, just a line of code this-> setWindowFlags (Qt: FramelessWindowHint); after removing it, another problem is that the window cannot be moved, so I overwrote three mouse events. The Code is as follows. code of the hfile: # include <QMouseEvent> protected: void mousePressEvent (QMouseEvent * e); void mouseMoveEvent (QMouseEvent * e); void mouseReleaseEvent (QMouseEvent * e ); http://www.bcwhy.com/thread-17852-1-1.htmlprivate: QPoint last ;. cpp file code // you can In the constructor, the last variable uses its member function setX and setY. // The next step is to overwrite the three mouse events void MainWindow: mousePressEvent (QMouseEvent * e) {last = e-> globalPos ();} void MainWindow: mouseMoveEvent (QMouseEvent * e) {www.2cto.com int dx = e-> globalX ()-last. x (); int dy = e-> globalY ()-last. y (); last = e-> globalPos (); move (x () + dx, y () + dy);} void MainWindow: mouseReleaseEvent (QMouseEvent * e) {int dx = e-> globalX ()-last. x (); int dy = e-> glo BalY ()-last. y (); move (x () + dx, y () + dy);} remember to change the Class Name When copying it ~ In this way, you can drag the form after removing the title bar of the window.