Results 1 to 4 of 4

Thread: How to remove title bar of QWidget which is inside QTabWidget

  1. #1
    Join Date
    Jul 2019
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to remove title bar of QWidget which is inside QTabWidget

    Hello,

    I am developing an application in QT4 but I have a problem still not solving.
    I hope someone can help me.

    My app UI have a QTabwidget and inside tabwidget, there is a Qwidget. But when I open the app, the Title bar of QWidget display under the Title bar of mainwindow.
    Currently, I don't know how to remove or hide that title bar. I found some solution but they didn't work such as window.setWindowFlags(Qt::Window | Qt::FramelessWindowHint);

    The screen like as below:
    up.jpg

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,019
    Thanks
    233
    Thanked 638 Times in 628 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to remove title bar of QWidget which is inside QTabWidget

    The title bar is probably -not- the title bar of the QWidget that is inside the QTabWidget. Instead it is the title bar that your window system (Windows, X, MacOS) puts on top-level windows. If your tab widget is the top-level widget for your app, and you do not want it to have a title bar, then you will want to set the FramelessWindowHint window flag. Be warned though - without a frame, you will probably not be able to move the window around the desktop using the mouse, nor will you be able to maximize, minimize, or close the window with the mouse.
    <=== 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.

  3. #3
    Join Date
    Jul 2019
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to remove title bar of QWidget which is inside QTabWidget

    I am sure that title bar is Qwidget title bar inside QTabWidget because when I minimize that Qwidget, it disappear.
    I tried many way to remove it but impossible
    This is my Layout, could you help me to remove it?
    Attached Files Attached Files

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,019
    Thanks
    233
    Thanked 638 Times in 628 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to remove title bar of QWidget which is inside QTabWidget

    According to your UI file, you have commented out the code that sets the "centralWidget" and have replaced it with a QTabWidget that is simply a child of the QMainWindow and not the centralWidget. You have also commented out the code for the menu bar and the status bar. Qt is therefore doing the best it can to create a UI on screen according to your broken specification.

    Tab widgets are not top-level widgets and do not have title bars, but it is possible that Qt is thinking it is also taking the place of a top-level widget, so the operating system (not Qt) is putting a title bar on it. That is sort of implied because there does not seem to be a window title in it from what I can see in the screenshot. A MainWindow title bar would have the app name in it.

    If you do not want the features of a QMainWindow in your app, then do not use it as the main top-level container widget. Use QDialog instead, and set the frameless hint. However, make sure you put your top-level tab widget into a layout for the QDialog (hbox or vbox, it doesn't matter since there is only one widget). If you do not use a layout, then the tab widget will not resize with the dialog.
    <=== 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. remove title of QwtPlot
    By MickyJhon in forum Qwt
    Replies: 2
    Last Post: 8th April 2014, 08:01
  2. Replies: 2
    Last Post: 10th May 2013, 10:20
  3. how to remove the window title bar?
    By tsuibin in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 03:17
  4. Remove window title
    By marcel in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2007, 05:06
  5. Remove Window title bar
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2007, 12:56

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.