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. [SOLVED] What widget is better to show images in a list?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] What widget is better to show images in a list?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.2k 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
    Leon
    wrote on last edited by
    #1

    So what i want is this

    !http://i.imgur.com/UDf4R.png(image)!

    What is the better widget on creating something like this? I am very familiar with listwidget and my friend has reached this point:
    !http://i.imgur.com/BmAcn.png(image2)!

    but i dont like every image to have a text under it.. so if i remove the text something ugly happens:
    !http://i.imgur.com/7Fu7z.png(image3)!

    there is a gray line under the images..

    So what must i use? qlistwidget, qlistview or what?
    And if it is qlistview, could you quide me just a little?

    1 Reply Last reply
    0
    • H Offline
      H Offline
      henryxuv
      wrote on last edited by
      #2

      Can't see the pics.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        henryxuv
        wrote on last edited by
        #3

        Ah,I think you can try the QStackedLayout to implement this effect.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          You can use a list view and a model.
          Just return the pixmap as Qt::DisplayRole, that should not put any text below it, right?

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            [quote author="Gerolf" date="1346400224"]You can use a list view and a model.
            Just return the pixmap as Qt::DisplayRole, that should not put any text below it, right?[/quote]

            i am a complete newbie to listview so i tried it..

            what i managed is this:

            @ QStandardItem* Item1 = new QStandardItem(QIcon(":/image1.png"), "Text1");
            QStandardItem* Item2 = new QStandardItem(QIcon(":/image2.png"), "Text2");
            QStandardItem* Item3 = new QStandardItem(QIcon(":/image3.png"), "Text3");
            QStandardItemModel* ListModel = new QStandardItemModel();
            ListModel->appendRow(Item1);
            ListModel->appendRow(Item2);
            ListModel->appendRow(Item3);

            ui->listView->setModel(ListModel);@
            

            1st i can't remove the "Text".. What should i do for this..
            and 2nd i don't want the items to be showen every row.. but as the screenshots at the 1st post.. it seems i can see only appendrow/column not something like additem..

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Leon
              wrote on last edited by
              #6

              [quote author="henryxuv" date="1346400067"]Ah,I think you can try the QStackedLayout to implement this effect.[/quote]

              No this isn't what i want.. Listview is what i want.. can anyone answer what i asked above?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DerManu
                wrote on last edited by
                #7

                Have you tried subclassing QAbstractItemModel or QAbstractListModel instead of using QStandardItemModel? Further: To have items fill from left to right and wrap, use setFlow and setWrapping, but that seems to be in place already considering your posted screenshots.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Leon
                  wrote on last edited by
                  #8

                  Well we ended up using listwidget! About the grey thing that appears, we found a "solution" , with this:

                          @item->setSizeHint(QSize(width,height));@
                  

                  which height is smaller making the grey thing not appear!

                  I took a screenshot to show it, in which i zoomed in one item ;)

                  !http://i.imgur.com/X22B7.jpg(1)!

                  Even the qt exampe Puzzle had and yet has this problem:
                  !http://i.imgur.com/uPhTk.png(1)!

                  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