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. Coloring the text inside the listwidget
QtWS25 Last Chance

Coloring the text inside the listwidget

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 443 Views
  • 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
    amarism
    wrote on last edited by
    #1

    I am taking a list widget with background color is black and listwidget containing the image and text. But when I try to display the list widget the image will display but the text disappears. I want to set the listwidget text color to white. How could I do this????

    JonBJ 1 Reply Last reply
    0
    • A amarism

      I am taking a list widget with background color is black and listwidget containing the image and text. But when I try to display the list widget the image will display but the text disappears. I want to set the listwidget text color to white. How could I do this????

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @amarism
      http://doc.qt.io/qt-5/qlistwidgetitem.html#setForeground ?

      1 Reply Last reply
      1
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #3

        An alternative that works for all QAbstractItemModels is listwidget->model()->setData(listwidget->model()->index(rowNumber,0),Qt::white,Qt::ForegroundRole);

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        3
        • A Offline
          A Offline
          amarism
          wrote on last edited by
          #4

          thanks to all its working

          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