Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Coloring the text inside the listwidget

    General and Desktop
    3
    4
    241
    Loading More Posts
    • 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
      amarism last edited by

      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????

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @amarism last edited by

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

        1 Reply Last reply Reply Quote 1
        • VRonin
          VRonin last edited by VRonin

          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 Reply Quote 3
          • A
            amarism last edited by

            thanks to all its working

            1 Reply Last reply Reply Quote 0
            • First post
              Last post