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. Change color of an inputed text in a QListWidget
Forum Updated to NodeBB v4.3 + New Features

Change color of an inputed text in a QListWidget

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 486 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.
  • D Offline
    D Offline
    Daemonitas
    wrote on last edited by
    #1

    So what I'm trying to do here is making the Output from the Add funds button to green in the List Widget

    f10c0ef7-0b8f-4457-ad1a-445ea9f3cd39-image.png
    What I tried to do is
    36a76ffd-29bc-49de-b9d7-b09d8debe188-image.png

    and here are the errors it gave me
    805d5b0e-37af-45a1-ab97-78a04c62b613-image.png

    Can someone give me pointers on this?

    I am still quite new to Qt and I apologize in advance if this problem seems trivial.

    Christian EhrlicherC 1 Reply Last reply
    0
    • D Daemonitas

      So what I'm trying to do here is making the Output from the Add funds button to green in the List Widget

      f10c0ef7-0b8f-4457-ad1a-445ea9f3cd39-image.png
      What I tried to do is
      36a76ffd-29bc-49de-b9d7-b09d8debe188-image.png

      and here are the errors it gave me
      805d5b0e-37af-45a1-ab97-78a04c62b613-image.png

      Can someone give me pointers on this?

      I am still quite new to Qt and I apologize in advance if this problem seems trivial.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      As you can see, QListWidget::addItem() does not return a QListWidgetItem.
      Use the other function QListWidget::addItem(QListWidgetItem*).

      Also QListWidgetItem has no function setTextColor - use other functions you can find in the documentation.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      D 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        As you can see, QListWidget::addItem() does not return a QListWidgetItem.
        Use the other function QListWidget::addItem(QListWidgetItem*).

        Also QListWidgetItem has no function setTextColor - use other functions you can find in the documentation.

        D Offline
        D Offline
        Daemonitas
        wrote on last edited by
        #3

        @Christian-Ehrlicher
        I'm sorry I don't really fully understand it, could you elaborate it further?

        SGaistS 1 Reply Last reply
        0
        • D Daemonitas

          @Christian-Ehrlicher
          I'm sorry I don't really fully understand it, could you elaborate it further?

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Daemonitas hi,

          It boils down to:

          • create the QListWidgetItem yourself
          • check the class documentation to see the customization available for what you want to do

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          0
          • SGaistS SGaist

            @Daemonitas hi,

            It boils down to:

            • create the QListWidgetItem yourself
            • check the class documentation to see the customization available for what you want to do
            D Offline
            D Offline
            Daemonitas
            wrote on last edited by
            #5

            @SGaist
            Thankyou I got it to work now
            c68a6af0-2196-464b-9546-e997b4027add-image.png

            1 Reply Last reply
            0
            • D Daemonitas has marked this topic as solved on

            • Login

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