Results 1 to 4 of 4

Thread: styling Tabbar of QDockWidgets

  1. #1
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default styling Tabbar of QDockWidgets

    Hi,

    now I want to customize the TabBars when QDockWidgets are tabbed. I can change the tabs, but I can't access the tab-bar and the pane. See the desired result in attached image. I want to add a background color gradient and a border around the pane and I want to move the tabs by 3 px to the right.

    Qt Code:
    1. /* Tab */
    2. QTabWidget::pane /* this does not work with tabbed QDockWidgets! */
    3. {
    4. margin-top:-26Px;
    5. background-color:red;
    6. border:1px solid #959595;
    7. padding-top:2px;
    8. border-radius: 2px;
    9. }
    10.  
    11. QTabWidget::tab-bar /* this does not work with tabbed QDockWidgets! */
    12. {
    13. border:none;
    14. left:3px;
    15. }
    To copy to clipboard, switch view to plain text mode 

    is there any special way to access tabbars/pane of tabbed qdockwidgets?

    thanks!
    Felix
    Attached Images Attached Images

  2. #2
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: styling Tabbar of QDockWidgets

    Did You try this:
    QList<QDockWidget *> QMainWindow::tabifiedDockWidgets ( QDockWidget * dockwidget ) const

    Access desired widget from the list and get it's parent! It's parent can be either QMainWindow or QTabWidget.
    QObject * QObject::parent () const

    If You have pointer to desired QTabWidget You can just get it's parrent without geting the list of pointers.

  3. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: styling Tabbar of QDockWidgets

    thank you for your reply. I did not try your method because findChildren<QTabBar*>() does the same. Of course I can access the QTabBars that way. But I want to set a StyleSheet which does not work for elements "QTabWidget:ane" and "QTabWidget::tab-bar".

    Now I found the reason and a solution: tabbing QDockWidgets does not create a QTabWidget. But, I can change QTabBar directly

    Qt Code:
    1. {
    2. height:26px;
    3. background-image:url(:/assets/tabBackground);
    4. border:1px solid #959595;
    5. padding-top:3px;
    6. border-top-left-radius: 2px;
    7. border-top-right-radius: 2px;
    8. margin-top:5px;
    9. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jul 2011
    Location
    India
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: styling Tabbar of QDockWidgets

    dont know whether this will help you or not...

    http://labs.qt.nokia.com/2007/06/22/...he-tab-widget/

Similar Threads

  1. hide tabbar
    By wirasto in forum Qt Programming
    Replies: 5
    Last Post: 10th June 2014, 08:26
  2. StyleSheet for TabBar
    By sdastagirmca in forum Qt Programming
    Replies: 11
    Last Post: 15th May 2012, 16:45
  3. TabBar empty area
    By wirasto in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2010, 16:56
  4. show Tabbar only if there are more than 1 tabs.
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 23rd September 2007, 20:07
  5. how to put the tabbar at the left in a tabwidget
    By qtopiahooo in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2006, 06:49

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.