Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableView clicked() versus doubleClicked()
Qt 6.12 LTS is out! See what's new in the release blog

QTableView clicked() versus doubleClicked()

Scheduled Pinned Locked Moved Unsolved General and Desktop
27 Posts 5 Posters 8.7k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #18

    Do you want to show the full image size ?
    Otherwise creating a cache with small versions of them might be a better solution in terms of speed and only load the real version when really needed.

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

    1 Reply Last reply
    1
    • PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #19

      Still need to load them - I am caching once loaded.

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

        Hence my suggestion, have a "pre-processing" phase where you create thumbnails to show quickly and load the complete file in the background. Once it's done notify your application and do what you need with it.

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

        1 Reply Last reply
        0
        • PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by Perdrix
          #21

          No I can't do thumbnails as I don't know a-priori what files are involved and there might be 100s of them.

          Now back to the problem - selectionChanged works fine to detect the newly selected row to trigger image loading.

          Unfortunately, double clicking on a editable cell still results in selectionChanged driving the image loading to start.

          What it doesn't do is open the editor on the cell that was double clicked!

          I had a quick look at the code of mouseDoubleClickEvent in QAbstractItemView.cpp, and I think it is written so that it should always open the editor. I suspect that the way mousePressedEvent() is written means that the double click event isn't generated if the selection change is driven from there (I don't think it should be driven from there - rather it should be driven from a mouseClickedEvent()) which isn't present. I do see code in mousPressedEvent() that is intended to open the editor, but don't quite "get" why that wasn't invoked.

          David

          M 1 Reply Last reply
          0
          • PerdrixP Perdrix

            No I can't do thumbnails as I don't know a-priori what files are involved and there might be 100s of them.

            Now back to the problem - selectionChanged works fine to detect the newly selected row to trigger image loading.

            Unfortunately, double clicking on a editable cell still results in selectionChanged driving the image loading to start.

            What it doesn't do is open the editor on the cell that was double clicked!

            I had a quick look at the code of mouseDoubleClickEvent in QAbstractItemView.cpp, and I think it is written so that it should always open the editor. I suspect that the way mousePressedEvent() is written means that the double click event isn't generated if the selection change is driven from there (I don't think it should be driven from there - rather it should be driven from a mouseClickedEvent()) which isn't present. I do see code in mousPressedEvent() that is intended to open the editor, but don't quite "get" why that wasn't invoked.

            David

            M Offline
            M Offline
            mpergand
            wrote on last edited by
            #22

            @Perdrix said in QTableView clicked() versus doubleClicked():

            What it doesn't do is open the editor on the cell that was double clicked!

            Check editTriggers is set to QAbstractItemView::DoubleClicked

            1 Reply Last reply
            0
            • PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by
              #23

              It must be set because I can d-click the cell later (after the image has loaded) and it opens the editor just fine

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

                Did you keep any custom code / event filter after changing to use the selection model ?

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

                PerdrixP 1 Reply Last reply
                0
                • SGaistS SGaist

                  Did you keep any custom code / event filter after changing to use the selection model ?

                  PerdrixP Offline
                  PerdrixP Offline
                  Perdrix
                  wrote on last edited by
                  #25

                  @SGaist No Sir

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

                    Then please share a minimal compilable example that shows this behaviour.

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

                    1 Reply Last reply
                    0
                    • PerdrixP Offline
                      PerdrixP Offline
                      Perdrix
                      wrote on last edited by
                      #27

                      It behaves as I would expect and hope on Qt 6.4.0 😊

                      David

                      1 Reply Last reply
                      1

                      • Login

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