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. QScrollArea autoscroll on children drag
Qt 6.11 is out! See what's new in the release blog

QScrollArea autoscroll on children drag

Scheduled Pinned Locked Moved General and Desktop
14 Posts 3 Posters 8.3k Views 2 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome

    Hmm for Start()
    http://doc.qt.io/qt-5/qdrag-obsolete.html
    Docs says
    "Note: Although the drag and drop operation can take some time, this function does not block the event loop. Other events are still delivered to the application while the operation is performed."

    However for
    http://doc.qt.io/qt-5/qdrag.html#exec
    it says " On Windows, the Qt event loop is blocked during the operation. However, QDrag::exec() on Windows causes processEvents() to be called frequently to keep the GUI responsive. If any loops or operations are called while a drag operation is active, it will block the drag operation."

    So it should not block ? But it sounds like your experience is that it does?

    1 Reply Last reply
    2
    • D Offline
      D Offline
      DjMonkey
      wrote on last edited by
      #3

      Actually yes, that is half correct it seems.

      It appears that dragEnterEvent event is working whilst the QDrag is active, but not the dragMoveEvent.

      I'm using qt 4 and this tool is for Autodesk Maya if that makes and difference?

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Hmm
        We kinda need dragMoveEvent to be active to do some scrolling. This is not a uncommon
        use case so others might have a good idea besides using dragMoveEvent.

        • I'm using qt 4 and this tool is for Autodesk Maya if that makes and difference?
          I think not as it seems to be same doc for Qt4.

        So platform is Windows?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DjMonkey
          wrote on last edited by
          #5

          I would like this to work across Windows and Linux :)

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

            Hi,

            How are you implementing your dragEnter event ?

            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
            • D Offline
              D Offline
              DjMonkey
              wrote on last edited by
              #7

              Hi SGaist,

              I am creating a new class inheriting the QScrollArea object.

              There are widgets inside it with mouseMoveEvents() that instigate a QDrag event.

              I have tried putting various mouse events in the new inherited class like the dragEnter event. The dragEnter event actually appears to work. But its the dragMoveEvent that I'm having trouble with! :(

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #8

                Seems that QScrollArea is different from others widgets in that regards
                as it seems the views can do it.
                ( scrolling during drag operation )

                D 1 Reply Last reply
                2
                • mrjjM mrjj

                  Seems that QScrollArea is different from others widgets in that regards
                  as it seems the views can do it.
                  ( scrolling during drag operation )

                  D Offline
                  D Offline
                  DjMonkey
                  wrote on last edited by DjMonkey
                  #9

                  @mrjj I've just tried scrolling this way on my QScrollArea but it's not doing the same thing. Isn't the widget you're demonstrating a QListWidget?

                  mrjjM 1 Reply Last reply
                  0
                  • D DjMonkey

                    @mrjj I've just tried scrolling this way on my QScrollArea but it's not doing the same thing. Isn't the widget you're demonstrating a QListWidget?

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

                    @DjMonkey
                    Yes, as i write "as it seems the views can do it."
                    Meaning List/Tree/xxx - Views.
                    Which means (seems that) that the default drag&drop do not block
                    the dragMoveEvent or have some other way to make this work.
                    So you could take a look in their source code to see how they do it. :)

                    D 1 Reply Last reply
                    2
                    • mrjjM mrjj

                      @DjMonkey
                      Yes, as i write "as it seems the views can do it."
                      Meaning List/Tree/xxx - Views.
                      Which means (seems that) that the default drag&drop do not block
                      the dragMoveEvent or have some other way to make this work.
                      So you could take a look in their source code to see how they do it. :)

                      D Offline
                      D Offline
                      DjMonkey
                      wrote on last edited by
                      #11

                      @mrjj ah my apologies! I understand now :)

                      I'll try to get to the bottom of this then, thanks

                      mrjjM 1 Reply Last reply
                      0
                      • D DjMonkey

                        @mrjj ah my apologies! I understand now :)

                        I'll try to get to the bottom of this then, thanks

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

                        @DjMonkey
                        Oh no need for apologies, it was not really clear from my post :)
                        Well please do post back if you find out.

                        Also if you have some test code, ill be happy to play with it.

                        D 1 Reply Last reply
                        1
                        • mrjjM mrjj

                          @DjMonkey
                          Oh no need for apologies, it was not really clear from my post :)
                          Well please do post back if you find out.

                          Also if you have some test code, ill be happy to play with it.

                          D Offline
                          D Offline
                          DjMonkey
                          wrote on last edited by
                          #13

                          @mrjj I have figured out a solution!

                          It seems to work by moving the dragMoveEvent onto the child widget instead of the QScrollArea that is holding them. If I implement my logic into that and use a pointer to the QSrollArea to change its scroll bar position - that works :)

                          mrjjM 1 Reply Last reply
                          1
                          • D DjMonkey

                            @mrjj I have figured out a solution!

                            It seems to work by moving the dragMoveEvent onto the child widget instead of the QScrollArea that is holding them. If I implement my logic into that and use a pointer to the QSrollArea to change its scroll bar position - that works :)

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

                            @DjMonkey
                            Super. That would work. Hopefully there are no side effects :)

                            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