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. QTreeWidgetItems and gradients, is it possible?

QTreeWidgetItems and gradients, is it possible?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k 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.
  • N Offline
    N Offline
    nirslsk
    wrote on last edited by
    #1

    Hi there,

    I have a QTreeWidget where I need the text of the different items to be of different colors. QTreeWidgetItem::setForeground works great as long as you use a brush that's a single color, but I thought it'd be nice to use linear gradients instead. However nothing I do seems to work. For example:

    @
    QLinearGradient l_gradient(0,0,100,100);
    l_gradient.setColorAt(0, Qt::blue);
    l_gradient.setColorAt(1, Qt::white);

    QBrush l_brush (l_gradient);
    lp_item->setForeground(0, l_brush);
    @

    appears to do nothing. Am I doing it wrong, or are gradients for tree widget items just not supported at this point?

    Thanks, Nir

    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