Results 1 to 6 of 6

Thread: How to highlight a character of tabText of the TabWidget?

  1. #1
    Join Date
    Mar 2009
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1

    Default How to highlight a character of tabText of the TabWidget?

    Dear all,
    I want to highlight a character of the text of the QTabWidget,for example, the tabText is "Display Tab" , and I want to change it to "Diaplay Tab *" , but how to do it ?
    Thanks!

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

    Default Re: How to highlight a character of tabText of the TabWidget?

    There is no straightforward way to do that. You'd have to subclass QTabBar, reimplement tab drawing routines and then subclass QTabWidget and use your new TabBar.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: How to highlight a character of tabText of the TabWidget?

    Am not sure if it will work...but you can try using rich text while setting the tab text..
    something like -
    setTabText(index,"Display Tab <red> *</red>");

  4. #4
    Join Date
    Mar 2009
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: How to highlight a character of tabText of the TabWidget?

    Dear ,
    Thanks for your advice.
    Wysota's idea should meet my request, but my Qt's version is 4.3, so some function like "setTabButton() ..." can not support.
    I will try aamer4yu's idea. Thanks again.

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

    Default Re: How to highlight a character of tabText of the TabWidget?

    I was not talking about setTabButton. I was talking about QTabWidget::setTabBar(). Rich text doesn't work on tabs so you can safely skip trying it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Mar 2009
    Posts
    20
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: How to highlight a character of tabText of the TabWidget?

    Dear wysota,
    According to your advice, I have done it, thanks for your support

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
  •  
Qt is a trademark of The Qt Company.