Results 1 to 4 of 4

Thread: Customize QTabBar or QTabWidget

  1. #1
    Join Date
    Jan 2006
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Customize QTabBar or QTabWidget

    Dear everybody out there,

    I have developed my program based on QT 4.0.0 and have a requirement to set different color for each tab page title (or text in QT language). Does anyone have experience with QTabBar and QTabWidget ? If someone knows (as I hope) please do me a favour.

    Greatly appreciated all your helps. Thanks in advance

    Have a nice day

    Ps: it's nice of you to give me some sample code snippet.

  2. #2
    Join Date
    Jan 2006
    Location
    N.B. Canada
    Posts
    47
    Thanked 8 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Customize QTabBar or QTabWidget

    QTabBar has a method setTabTextColor

    With QTabWidget, I think you would have to inherit a QTabWidget, and that way you would have access to the protected method QTabBar * tabBar () const. And then you can use the above function to change the text color for each tab.

    Bojan
    The march of progress:
    C:
    printf("%10.2f", x);
    C++:
    cout << setw(10) << setprecision(2) << showpoint << x;
    Java:
    java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(2);
    formatter.setMaximumFractionDigits(2);
    String s = formatter.format(x);
    for (int i = s.length(); i < 10; i++) System.out.print(' ');
    System.out.print(s);

  3. #3
    Join Date
    Jan 2006
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Customize QTabBar or QTabWidget

    Thank you Bojan

    Your answer is good, but unfortunately the Qt version 4.0.0 I am using doesn't have any method which is so-called setTabTextColor even with QTabBar class. Thanks anyway

    Regards

    ps: If you find some way with Qt version 4.0.0 pls reply to me.

  4. #4
    Join Date
    Jan 2006
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Urgence: Customize QTabBar or QTabWidget

    Hi everybody

    Could any body set the color for each tab in different color for QTabWidget object in Qt 4.0.0.

    Thanks in advance

Similar Threads

  1. Using QTabBar as QTabWidget replacement
    By invictus in forum Qt Programming
    Replies: 0
    Last Post: 16th August 2008, 01:57
  2. Problems with CSS for QTabBar and QTabWidget
    By visor_ua in forum Qt Programming
    Replies: 1
    Last Post: 25th July 2008, 08:38
  3. Hiding the QTabBar of a QTabWidget
    By elcuco in forum Qt Programming
    Replies: 4
    Last Post: 26th March 2007, 14:59
  4. QTabWidget, QTabBar, double-click the tabText
    By jcr in forum Qt Programming
    Replies: 3
    Last Post: 21st September 2006, 20:44

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.