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. Different styles of items in QListWidget
Forum Updated to NodeBB v4.3 + New Features

Different styles of items in QListWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.2k 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
    A1exander_Z
    wrote on last edited by
    #1

    Is it possible to set different styles (via stylesheets) for different items in a QListWidget? Basically, I have two kinds of items, one kind with a custom widget inserted by QListWidget::setItemWidget, and another - plain items with text and icons. I would like to apply two distinct styles to them (not to customs widgets within items on one kind - they are already styled properly). I have found that QListWidgetItem does not have an object name, so I do not know how to differentiate two kinds of items in a stylesheet.

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      maybe "this stylesheetdelegate":http://qt-project.org/forums/viewthread/166
      can help

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • A Offline
        A Offline
        A1exander_Z
        wrote on last edited by
        #3

        Thank you for suggestion, it is an interesting component which may be useful for another part of my work. As for this particular case, I have found it easier to use custom widgets in both kinds of items. I do not have a model and I simply use QListWidget as a (relatively) convenient container.

        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