Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Put a color to some items of a ComboBox and keep it for the selected item
Forum Updated to NodeBB v4.3 + New Features

Put a color to some items of a ComboBox and keep it for the selected item

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 621 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alain38
    wrote on last edited by
    #1

    Hi,
    I have a combobox with a list of items. Some items need to have a specific text color related to an internal property of the associated object. To do this, I found on Internet that I have to do:
    @comboBox->setItemItem(pos, color, Qt::ForegroundRole);@

    This works well unless for the selected item. This one is always displayed in black. This combobox has not (for the moment) associated stylesheet. Hence it is really the basic display.

    So, how can I force it to keep the text color I set even when the item is selected?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved