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. How can I put an tag on the item in a Iconmode Qlistwidget??
Forum Updated to NodeBB v4.3 + New Features

How can I put an tag on the item in a Iconmode Qlistwidget??

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 470 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.
  • L Offline
    L Offline
    LexiWang
    wrote on last edited by
    #1

    Hi all!
    I'm doing a dicom viewer with thumbnail list on the left side, just like Radiant.
    The thumbnail list is a Iconmode Qlistwidget ,
    and I want to add a little number tag on each item in the lower right corner ,
    (the tag is the number of picture in the series)
    but I have no idea how to do it..

    For example,
    This is my list now,
    螢幕擷取畫面 2021-10-04 230253.png
    And I want to add the number in the red circle ,
    螢幕擷取畫面 2021-10-04 230129.png
    (this is a screen shot of Radiant)

    How can I do it?
    Is there anything similar to what I'm saying that I can use in Pyqt5?
    Sorry for my poor English.
    Thank you very much!

    eyllanescE 1 Reply Last reply
    0
    • L LexiWang

      Hi all!
      I'm doing a dicom viewer with thumbnail list on the left side, just like Radiant.
      The thumbnail list is a Iconmode Qlistwidget ,
      and I want to add a little number tag on each item in the lower right corner ,
      (the tag is the number of picture in the series)
      but I have no idea how to do it..

      For example,
      This is my list now,
      螢幕擷取畫面 2021-10-04 230253.png
      And I want to add the number in the red circle ,
      螢幕擷取畫面 2021-10-04 230129.png
      (this is a screen shot of Radiant)

      How can I do it?
      Is there anything similar to what I'm saying that I can use in Pyqt5?
      Sorry for my poor English.
      Thank you very much!

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @LexiWang If you have a QPixmap then just use QPainter to draw the number.

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      L 1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Are you generating the thumbnail yourself ?
        If so, as @eyllanesc suggested you can draw the number on it using QPainter.

        Otherwise, create a QStyledItemDelegate subclass and paint it there.

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

        1 Reply Last reply
        2
        • eyllanescE eyllanesc

          @LexiWang If you have a QPixmap then just use QPainter to draw the number.

          L Offline
          L Offline
          LexiWang
          wrote on last edited by
          #4

          @eyllanesc Ok, I will try it, thanks!!
          How about the black background of each item? Can it be done by Qpixmap, too?
          (As shown the Radiant example, all item in the list is in a black frame. But there's no such frame for each item in my list, wonder how to do it.)

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You can compose a new image. Fill it with black and draw your thumbnail on top of it.

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

            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