Results 1 to 3 of 3

Thread: Custom tab widget question

  1. #1
    Join Date
    Jan 2006
    Posts
    17
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Custom tab widget question

    I would like to add widgets in the same horizontal line as the tab area on a QTabWidget. Qt has the API to add a small widget to the left or right hand side but there are a lot of size limits (only 1 button will fit for example).

    So I began mocking up a custom tab widget that mimics the QTabWidget but would allow any number of buttons to be entered in that same area, it works just fine but I can't figure out how to get the border to look like the normal QTabWidget. The border that goes up around the tab, and then down around the entire stacked widget. I posted an image where I added a border to the stack widget (just to show where it is at) and the QTabBar with some buttons.

    Any idea how to make the bordering look like the QTabWidget (or is there an easier way to get what I want without a custom tab widget)?
    How does the normal QTabWidget integrate the border of the QTabBar with the QStackedWidget to make it look like one seamless widget?
    Attached Images Attached Images

  2. #2
    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: Custom tab widget question

    I suppose QStyle::drawControl(QStyle::CE_TabBarTab) is responsible for drawing it like that. The passed style option contains various bits of information how the tab in question is supposed to be drawn.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom tab widget question

    How about putting all those nice buttons into a single QWidget, and then using that new QWidget as the corner widget of QTabWidget...?

Similar Threads

  1. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 08:00
  2. Replies: 1
    Last Post: 6th November 2006, 00:50
  3. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 11:05
  4. Replies: 3
    Last Post: 12th April 2006, 09:20
  5. Replies: 4
    Last Post: 24th March 2006, 23:50

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.