Drag&Drop in QScrollArea

  • Hi everyone,

    I'm stack with this. I'm trying to combine this two things. After I drop QLabel item and do a scrolling, position of the dropped item is fix in window.

  • Qt Champions 2016

    Can you show the code u have so far ?
    And explain what part is not working.
    If you drag an item to scroll box, and make sure its inserted into the layout it should be as expected so
    im not sure what effect/function your are after.

    "item is fix in window."

    Meaning its not scrolling with the QScrollArea ?

  • Hi mrjj,
    Currently I'm not near my PC, but I uploaded pictures http://imgur.com/a/CLBnk. Maybe this help to understand what I aiming for. On third picture you can see that Table 1 stay on same position in window even if I scroll to right.

  • Qt Champions 2016

    ahh, yes its super with pictures.
    It seems when you drag it, its not insert into the layout/scroll area again so
    check the Parent before and after dragging.

    I would guess on something like that.

  • @mrjj
    I'm guessing the same. May be I choose wrong layout. I'm working with QGridLayout. Which layout fit best for drag&drop function with QScrollArea?

  • Qt Champions 2016

    Depends on the effect you want.
    Some layouts would insert in end. But QGridLayout should also work fine since
    the other do scroll.

Log in to reply