Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QListView IconMode - content problem

    General and Desktop
    2
    3
    266
    Loading More Posts
    • 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.
    • N
      Neko last edited by

      Hey guys,

      I have created a QListView and gave it the following settings:

      _listView = new QListView;
      _listView->setViewMode(QListView::IconMode);
      _listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      _listView->setFlow(QListView::LeftToRight);

      Then i created a new QStandardItemModel and set the ListView Model to the new one.
      After this i wanted to test it with this:

      for(int i = 0; i < 10; i++)
      {
      model->appendRow(new QStandardItem(QIcon("images/no.jpg"), "SomeTestText"));
      }

      Here is my result:

      0_1531296550296_968b927c-e50d-48a9-9fd7-3c34bb89fde1-image.png

      now my question:

      Why isn't it filling the grid until the end ?
      Which setting am i missing here ?

      Thanks for reading so far.

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        try to add
        ui->theview->setResizeMode(QListView::Adjust);

        1 Reply Last reply Reply Quote 3
        • N
          Neko last edited by

          Perfect, Thanks!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post