Results 1 to 5 of 5

Thread: How to remove title but with frame border?

  1. #1

    Question How to remove title but with frame border?

    hello, friends..
    i wanna to put my widget on the title bar with qt

    on window platform,
    i use Qt::FrameLessWindowHint to hide the caption, and use WM_NCHITTEST to deal with move and resize.
    but without borders, i move the window to screen edge, window can't maximum or restore by system.......

    then , i tried to use SetWindowLong() to make border back...it works, but too ugly....code and the widget..
    at last, i make client area over title bar with WM_NCCALCSIZE message, it works, but have many bugs....then, i changes lots of QtGui's codes to make it deal with WM_NCCALCSIZE... update frameStruct and client Rect etc..

    but, on linux platform, i can't find any help from XLib Api... can i create canvas intead of window?
    or use Qt::FrameLessWindowHint, and try to solver Scrren Edge problem?

    thanks for any reply...

    so poor my english....

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to remove title but with frame border?

    Hmm I don't quite understand what you mean by 'put my widget on the title bar with qt'.

    Do you want to get rid of the title bar of a widget (top part of a widget with title, max/min/close buttons)?
    Or do you want to get rid of entry on the window task bar (on the bottom of the screen when icon of your app appears)?

    Whatever you want, I can bet that there's no need to go native, this way you make your code not-portable.
    Qt should suffice.

    And what 'screen edge problem' you mean?

  3. #3
    Join Date
    Mar 2011
    Location
    Denmark
    Posts
    74
    Thanks
    7
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to remove title but with frame border?

    If you have a frameless window and want to be able to maximize / minimize / close it by the system you need to add some more window flags

    Qt Code:
    1. FramelessWindow::FramelessWindow()
    2. : QWidget(0, Qt::WindowFlags(Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint))
    To copy to clipboard, switch view to plain text mode 

    If you want to be able to grab the edges of your window and resize it you will have to implement this yourself or use a utility like Frameless Window Helper

  4. #4

    Default Re: How to remove title but with frame border?

    er..like this..Attachment 7576
    like opera, firefox or chrome 's title bar.
    1. it was able to resize and move....
    2. i move my window to the top of Screen, then release mouse, my window will be maximized......(with borders, my window can recieve WM_SIZE messages from system.)
    like this, Attachment 7577
    everything is perfect on Window Platform...after change some QtGui 's code...

    but i don't know how to do the same thing in linux.
    i know how to use Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint...but without border, i can't drag my window to the edge of screen, and do something..

    thanks.


    Added after 10 minutes:


    i can't find any method to remove window title bar, but keep the window border in Qt.
    so i have to use Native Api ... so i have to do the same thing in different platform....is ok, i don't care..
    Last edited by shaoli.xie; 11th April 2012 at 11:03.

  5. #5
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to remove title but with frame border?

    Your attachements are not working.

    but without border, i can't drag my window to the edge of screen, and do something..
    With border you can't either. You want to remove title bar but AFAIK that's only way to drag the window around. Borders change only window size.

    If you want to change that behaviour, take a simple frameless window, make border out of it to implement dragging and stick all the content you want insde.
    Simple and cross-platform solution.

Similar Threads

  1. Replies: 2
    Last Post: 21st March 2012, 15:30
  2. Replies: 5
    Last Post: 26th June 2011, 12:43
  3. How to remove QMainWindow's title and border
    By meraj ansari in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2010, 18:22
  4. Border and Frame
    By big4mil in forum Newbie
    Replies: 3
    Last Post: 12th March 2010, 20:46
  5. Replies: 4
    Last Post: 13th July 2009, 19:18

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.