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. sorting qlistwidget items
Servers for Qt installer are currently down

sorting qlistwidget items

Scheduled Pinned Locked Moved Unsolved General and Desktop
sortingqlistwidget
6 Posts 4 Posters 5.5k 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
    Lorence
    wrote on 11 Dec 2015, 15:23 last edited by
    #1

    im trying to sory qlistwidget items

    sortItems(Qt::AscendingOrder);
    when i call this function, the items are sucessfully sorted but i have to trigger an event (ie. right click on listwidget,leftclick,or anything) before it show the sorted items.

    M 1 Reply Last reply 11 Dec 2015, 19:15
    0
    • M Offline
      M Offline
      mchinand
      wrote on 11 Dec 2015, 16:39 last edited by
      #2

      Does it display them sorted if you call update() after sorting the items?

      1 Reply Last reply
      0
      • L Lorence
        11 Dec 2015, 15:23

        im trying to sory qlistwidget items

        sortItems(Qt::AscendingOrder);
        when i call this function, the items are sucessfully sorted but i have to trigger an event (ie. right click on listwidget,leftclick,or anything) before it show the sorted items.

        M Offline
        M Offline
        mjsurette
        wrote on 11 Dec 2015, 19:15 last edited by
        #3

        @Lorence
        Have you tried calling invalidate() on your model?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 11 Dec 2015, 23:27 last edited by
          #4

          Hi,

          Can you show how your are setting up your QListWidget ?

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

          L 1 Reply Last reply 12 Dec 2015, 14:29
          0
          • S SGaist
            11 Dec 2015, 23:27

            Hi,

            Can you show how your are setting up your QListWidget ?

            L Offline
            L Offline
            Lorence
            wrote on 12 Dec 2015, 14:29 last edited by Lorence 12 Dec 2015, 14:48
            #5

            @SGaist

            my QListWidget object in ui is a MyListWidget

            heres my contrsuctor
            MyListWidget::MyListWidget(QWidget* parent)
            :QListWidget(parent)
            {

            }

            what do you mean by "how i set up my qlistwidget"?

            L 1 Reply Last reply 12 Dec 2015, 16:03
            0
            • L Lorence
              12 Dec 2015, 14:29

              @SGaist

              my QListWidget object in ui is a MyListWidget

              heres my contrsuctor
              MyListWidget::MyListWidget(QWidget* parent)
              :QListWidget(parent)
              {

              }

              what do you mean by "how i set up my qlistwidget"?

              L Offline
              L Offline
              Lorence
              wrote on 12 Dec 2015, 16:03 last edited by
              #6

              @Lorence now its working, i dont know what happens yesterday

              1 Reply Last reply
              0

              2/6

              11 Dec 2015, 16:39

              topic:navigator.unread, 4
              • Login

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