Results 1 to 7 of 7

Thread: width and height of QTabWidget

  1. #1
    Join Date
    May 2007
    Posts
    16
    Thanked 1 Time in 1 Post

    Default width and height of QTabWidget

    Hi

    I have created tabwidget using QTabWidget. I have added two tabs. TabBar width and height came with default size.
    my question is:
    1) How do I increase width and height of the TabBar

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: width and height of QTabWidget

    QTabBar inherits QWidget so you can use all dimensioning support in QWidget, such as QWiget::setMinimumHeight or QWidget::setFixedHeight.

  3. #3
    Join Date
    May 2007
    Posts
    16
    Thanked 1 Time in 1 Post

    Default Re: width and height of QTabWidget

    QWidget::setFixedHeight or QWidget::setFixedWidth sets the widget size , which i donot want.

    I want to set the Tab bar size. not the whole widget size.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: width and height of QTabWidget

    tab bar or a single tab? If the former, you can access the tab bar and change its dimensions. I doubt it will work the way you want, but you can try it anyway.

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: width and height of QTabWidget

    Yes, I know. Subclass QTabWidget and you will have access to the protected function QTabWidget::tabBar(), which returns the tabbar. You can then use the functions mentioned earlier to set its height.

  6. #6
    Join Date
    May 2007
    Posts
    16
    Thanked 1 Time in 1 Post

    Default Re: width and height of QTabWidget

    QTabWidget::tabBar() returns const QTabBar(). So I canot call setFixedSize() on QTabWidget::tabBar()

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: width and height of QTabWidget

    Quote Originally Posted by chikkireddi View Post
    QTabWidget::tabBar() returns const QTabBar(). So I canot call setFixedSize() on QTabWidget::tabBar()
    Actually it returns a non-const pointer to QTabBar, whereas the method is a const-method:
    QTabBar* QTabWidget::tabBar() const
    J-P Nurmi

Similar Threads

  1. Increasing the width of a row in a TreeView
    By Shambhavi in forum Qt Programming
    Replies: 3
    Last Post: 13th January 2006, 17:13

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.