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. QListWidget-two rows
Forum Updated to NodeBB v4.3 + New Features

QListWidget-two rows

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 1.1k 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
    drd1988on
    wrote on last edited by
    #1

    Hi
    I wants to add a set of images and labels for corresponding images in in QListWidget.
    I am a newbie.I couldn't find any examples.
    Regards
    Divya

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

      https://stackoverflow.com/questions/34287588/align-items-by-text-in-a-qlistwidget-icon-mode

      "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
      1
      • D Offline
        D Offline
        drd1988on
        wrote on last edited by
        #3

        hi I am using the same code like below,still it is not showing text

        pListWidgetItem =new
        QListWidgetItem(QIcon("E:/Kostal_Widget/QWidgetCorousel/QWidgetCorousel/images/2.png"),"Preset1");

        m_CorouselWidget->addItem(pListWidgetItem);
        pListWidgetItem->setTextAlignment(Qt::AlignCenter|Qt::AlignBottom);
        pListWidgetItem->setTextColor("black");
        pListWidgetItem->setSizeHint(QSize(100,120));
        
        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          hi
          That is a bit odd. using same code ( other image)
          i get
          alt text

          It does show image for you ?

          JonBJ 1 Reply Last reply
          0
          • mrjjM mrjj

            hi
            That is a bit odd. using same code ( other image)
            i get
            alt text

            It does show image for you ?

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

            @mrjj
            Does QIcon("E:/non-existent-path.png") throw if it's handed a non-existent path/file?

            @drd1988on

            E:/Kostal_Widget/QWidgetCorousel/QWidgetCorousel/images/2.png

            I don't know where you got that from. You sure it's not spelled QWidgetCarousel?

            mrjjM 1 Reply Last reply
            0
            • JonBJ JonB

              @mrjj
              Does QIcon("E:/non-existent-path.png") throw if it's handed a non-existent path/file?

              @drd1988on

              E:/Kostal_Widget/QWidgetCorousel/QWidgetCorousel/images/2.png

              I don't know where you got that from. You sure it's not spelled QWidgetCarousel?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @JonB said in QListWidget-two rows:

              Does QIcon("E:/non-existent-path.png") throw if it's handed a non-existent path/file?

              Nope. its just invalid and draws nothing.

              JonBJ 1 Reply Last reply
              0
              • mrjjM mrjj

                @JonB said in QListWidget-two rows:

                Does QIcon("E:/non-existent-path.png") throw if it's handed a non-existent path/file?

                Nope. its just invalid and draws nothing.

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

                @mrjj
                ...which might be what the OP means by "still it is not showing "? Oh, maybe I misunderstood, it's to do with not showing text or the icon? Might help if he screen-shotted.

                mrjjM 1 Reply Last reply
                1
                • JonBJ JonB

                  @mrjj
                  ...which might be what the OP means by "still it is not showing "? Oh, maybe I misunderstood, it's to do with not showing text or the icon? Might help if he screen-shotted.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @JonB
                  Im not sure. i read it as shows image, but no text.

                  1 Reply Last reply
                  1
                  • D Offline
                    D Offline
                    drd1988on
                    wrote on last edited by
                    #9

                    Hi

                    It worked for me .The issue was icon was overlapping the text .When I reduced the icon size it is showing both image and text.

                    Thank You

                    1 Reply Last reply
                    3

                    • Login

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