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. QTableWidget::itemSelectionChanged
Forum Updated to NodeBB v4.3 + New Features

QTableWidget::itemSelectionChanged

Scheduled Pinned Locked Moved General and Desktop
26 Posts 6 Posters 8.4k Views 3 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.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by
    #5

    click an item, keep the left mouse button pressed, then drag it to the next row so that it changes its selection.

    mrjjM 1 Reply Last reply
    0
    • MegamouseM Megamouse

      click an item, keep the left mouse button pressed, then drag it to the next row so that it changes its selection.

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

      @Megamouse
      Hi
      What Qt version are u using ?
      I cant seem to reproducing it not calling currentRow on drag to extend selection or
      on single selection only.

      alt text

      alt text

      1 Reply Last reply
      3
      • MegamouseM Offline
        MegamouseM Offline
        Megamouse
        wrote on last edited by
        #7

        no. I am calling currentRow

        mrjjM 1 Reply Last reply
        0
        • MegamouseM Megamouse

          no. I am calling currentRow

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

          @Megamouse
          Hi
          So do i

          void MainWindow::on_listWidget_currentRowChanged(int currentRow) {
           ui->label->setText( QString::number(currentRow) );
          }
          
          

          Update:
          You mean u manually call currentRow and then its out of sync?

          1 Reply Last reply
          1
          • MegamouseM Offline
            MegamouseM Offline
            Megamouse
            wrote on last edited by
            #9

            call currentrow in the slot for itemSelectionChanged

            1 Reply Last reply
            0
            • MegamouseM Offline
              MegamouseM Offline
              Megamouse
              wrote on last edited by Megamouse
              #10

              it will be different depending if you click or click and drag.

              btw Qt version is the awful 5.11.1 that completely broke the nativeevent message

              mrjjM 1 Reply Last reply
              0
              • MegamouseM Megamouse

                it will be different depending if you click or click and drag.

                btw Qt version is the awful 5.11.1 that completely broke the nativeevent message

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

                @Megamouse
                Hi
                Tried with

                void MainWindow::on_listWidget_itemSelectionChanged() {
                  ui->label->setText( QString::number(ui->listWidget->currentRow()) );
                }
                

                and it follows fine. So not sure why you see different results.
                (also using 5.11.1)

                • 5.11.1 that completely broke the nativeevent message
                  in what way ?
                1 Reply Last reply
                0
                • MegamouseM Offline
                  MegamouseM Offline
                  Megamouse
                  wrote on last edited by Megamouse
                  #12

                  Can you send me the sample you use?

                  For the nativeevent:
                  Apparently it is already fixed for Qt 5.11.2.
                  But to explain:
                  One of the devs added a copy pasta mistake and now we need to cast the nativeEvent messages like this for Qt 5.11.1:

                  #if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
                  MSG* msg = *reinterpret_cast<MSG**>(message);
                  #else
                  MSG* msg = reinterpret_cast<MSG*>(message);
                  #endif
                  

                  For some programs this breaks the whole application

                  mrjjM HojjatJafaryH 2 Replies Last reply
                  1
                  • MegamouseM Megamouse

                    Can you send me the sample you use?

                    For the nativeevent:
                    Apparently it is already fixed for Qt 5.11.2.
                    But to explain:
                    One of the devs added a copy pasta mistake and now we need to cast the nativeEvent messages like this for Qt 5.11.1:

                    #if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
                    MSG* msg = *reinterpret_cast<MSG**>(message);
                    #else
                    MSG* msg = reinterpret_cast<MSG*>(message);
                    #endif
                    

                    For some programs this breaks the whole application

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

                    @Megamouse
                    ofc but its just default gui project with ListWidget
                    https://www.dropbox.com/s/y6dxx17dd6mc1cd/untitled68.zip?dl=0

                    oh, i see. type was changed to **
                    Well good they fixed it so fast :)

                    1 Reply Last reply
                    0
                    • MegamouseM Offline
                      MegamouseM Offline
                      Megamouse
                      wrote on last edited by
                      #14

                      in the second half you can see what i mean

                      0_1532863484741_ugh.gif

                      mrjjM 1 Reply Last reply
                      0
                      • MegamouseM Megamouse

                        in the second half you can see what i mean

                        0_1532863484741_ugh.gif

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

                        @Megamouse
                        Ah, yes, now i can do it too.
                        Holding left and rapid move up and down seems to lag behind one.
                        Funny enough the signal is correct. (right side)
                        alt text

                        Seems to be the order of signals.
                        As if i make a button

                        void MainWindow::on_pushButton_released()
                        {
                            ui->label->setText( QString::number(ui->listWidget->currentRow()) );
                        }
                        

                        and then ask it, its correct.
                        so it seems when in itemSelectionChanged and not released the left buttons, its
                        not updated yet.

                        1 Reply Last reply
                        0
                        • MegamouseM Offline
                          MegamouseM Offline
                          Megamouse
                          wrote on last edited by
                          #16

                          exactly. and in my opinion that's missing in the documentation.
                          or even wrong in general

                          mrjjM 1 Reply Last reply
                          0
                          • MegamouseM Megamouse

                            exactly. and in my opinion that's missing in the documentation.
                            or even wrong in general

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

                            @Megamouse
                            Well it might be border case and hence the slightly odd behavior.
                            Since we are using SingleSelection, the dragging is really not needed as user
                            can just click on the one he wants.

                            1 Reply Last reply
                            0
                            • MegamouseM Offline
                              MegamouseM Offline
                              Megamouse
                              wrote on last edited by
                              #18

                              Well.
                              I use the selection as a direct visual indication.
                              Meaning if you change the list object the view will show corresponding data on another table.

                              So if i were to use currentrow in this case the data would be wrong.

                              mrjjM 1 Reply Last reply
                              0
                              • MegamouseM Megamouse

                                Well.
                                I use the selection as a direct visual indication.
                                Meaning if you change the list object the view will show corresponding data on another table.

                                So if i were to use currentrow in this case the data would be wrong.

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

                                @Megamouse

                                Well did you try the signal for that. seems to be correct even
                                when ui->listWidget->currentRow() is off. ?

                                1 Reply Last reply
                                0
                                • MegamouseM Offline
                                  MegamouseM Offline
                                  Megamouse
                                  wrote on last edited by
                                  #20

                                  don't worry about it. It's fixed anyway. I just think it's a weird glitch or "feature"

                                  mrjjM 1 Reply Last reply
                                  0
                                  • MegamouseM Megamouse

                                    don't worry about it. It's fixed anyway. I just think it's a weird glitch or "feature"

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

                                    @Megamouse

                                    indeed it is.

                                    1 Reply Last reply
                                    0
                                    • MegamouseM Megamouse

                                      Can you send me the sample you use?

                                      For the nativeevent:
                                      Apparently it is already fixed for Qt 5.11.2.
                                      But to explain:
                                      One of the devs added a copy pasta mistake and now we need to cast the nativeEvent messages like this for Qt 5.11.1:

                                      #if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
                                      MSG* msg = *reinterpret_cast<MSG**>(message);
                                      #else
                                      MSG* msg = reinterpret_cast<MSG*>(message);
                                      #endif
                                      

                                      For some programs this breaks the whole application

                                      HojjatJafaryH Offline
                                      HojjatJafaryH Offline
                                      HojjatJafary
                                      wrote on last edited by HojjatJafary
                                      #22

                                      @Megamouse
                                      native events!
                                      How did you find it? where they announced something like that?
                                      but thank you ... you saved my life ;)

                                      MegamouseM 1 Reply Last reply
                                      0
                                      • HojjatJafaryH HojjatJafary

                                        @Megamouse
                                        native events!
                                        How did you find it? where they announced something like that?
                                        but thank you ... you saved my life ;)

                                        MegamouseM Offline
                                        MegamouseM Offline
                                        Megamouse
                                        wrote on last edited by
                                        #23

                                        @HojjatJafary It was on a hunch. After searching for native event problems for a while, I found an issue on the Qt issue tracker in which the solution to the bug was shared in the comment section.

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

                                          Can you share the link to the bug report ?

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

                                          MegamouseM 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