Results 1 to 2 of 2

Thread: How to move and resize a Application with no title bar and border?

  1. #1
    Join Date
    Jun 2017
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to move and resize a Application with no title bar and border?

    i used
    Qt Code:
    1. w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    To copy to clipboard, switch view to plain text mode 
    to make the windows boderless and i have Few forms and Tabs on the Application i want to use the bottom left to resize the Window and top Form to move the application

    main.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8.  
    9. w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    10. w.show();
    11.  
    12.  
    13.  
    14. return a.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to move and resize a Application with no title bar and border?

    You need to implement moving and resizing yourself on the MainWindow. Here's how to do the moving.

    For resizing, since you have no "grab handles" you need to somehow differentiate between a move operation and a resize operation, because the mouse events on the main window are all you have when there is no frame or title bar. A couple of ideas come to mind: If the mouse down occurs within "x" pixels (say 5) of any of the window's edges, you grow or shrink the window width or height instead of moving it. If it occurs within "x" pixels of both an x and y side (i.e. in a corner) then you resize both width and height. Another option might be to resize when the Shift key is pressed and move otherwise, but this is non-standard behavior.

    In any case, you should change the cursor during the operation so the user has some feedback as to what is happening. On the mouse released event, you reset the cursor to normal.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QwtPlot display title border problem
    By menda90 in forum Qwt
    Replies: 7
    Last Post: 11th November 2014, 16:17
  2. How to remove title but with frame border?
    By shaoli.xie in forum Qt Programming
    Replies: 4
    Last Post: 11th April 2012, 15:14
  3. Replies: 5
    Last Post: 26th June 2011, 12:43
  4. How to remove QMainWindow's title and border
    By meraj ansari in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2010, 18:22
  5. Replies: 4
    Last Post: 13th July 2009, 19:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.