Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to get text of QListWidget?

How to get text of QListWidget?

Scheduled Pinned Locked Moved Solved Qt for Python
4 Posts 2 Posters 2.0k 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.
  • I Offline
    I Offline
    Igor86
    wrote on last edited by
    #1

    Hi all!

    I have a QListWidget, and connected its currentRowChanged Signal to my function. So far so good.

    Probelm is, i cannot figure out how to read the value of the selected row. (the string, not the row index..)

    I've been looking everywhere and all samples I found assume that there can be multiple rows selected. In my case i have set it to single selection and there will only be a single selected row.

    How can I read the value?

    self.lwImages.currentItem.toString did not work...

    any help appreciated.

    Thank you

    jsulmJ 1 Reply Last reply
    0
    • I Igor86

      Hi all!

      I have a QListWidget, and connected its currentRowChanged Signal to my function. So far so good.

      Probelm is, i cannot figure out how to read the value of the selected row. (the string, not the row index..)

      I've been looking everywhere and all samples I found assume that there can be multiple rows selected. In my case i have set it to single selection and there will only be a single selected row.

      How can I read the value?

      self.lwImages.currentItem.toString did not work...

      any help appreciated.

      Thank you

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Igor86 Isn't https://doc.qt.io/qt-5/qlistwidgetitem.html#text what you need?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Igor86
        wrote on last edited by
        #3

        @jsulm thank you, i tried self.lwImages.currentItem.text but it tells me that it has no attribute text.
        how can I access the ListWidgetItem that is currently selected if its not done with currentItem?

        thank you

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Igor86
          wrote on last edited by
          #4

          Never mind, i figured out i forgot some parenthesis.. Thank you for your help!!

          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