Skip to content
  • 0 Votes
    2 Posts
    303 Views
    lorn.potterL

    Drag and drop has never worked very well in QtWebAssembly.
    But it is working in 6.6.0beta1 single threaded release.

    You need to use asyncify though:
    https://doc.qt.io/qt-6/wasm.html#asyncify

    Good news is, you no longer have to rebuild Qt to get asyncify, you just need to add a linker argument.
    cmake: target_link_options(<target> PUBLIC -sASYNCIFY -Os)
    qmake: QMAKE_LFLAGS += -sASYNCIFY -Os

  • 0 Votes
    2 Posts
    191 Views
    SGaistS

    Hi,

    I would venture to say no :-)

    Which version of Qt are you using ?
    In which OS ?
    Are doing the move at the same level ?
    Do you have a filter ?

  • 0 Votes
    16 Posts
    5k Views
    R

    @jazzco2 Right, but what's the solution? If an older windows dll fixes things, I could try finding and swapping it

    P.S. that thread talks about a different issue. It is a crash not a warning with strange behaviour and there is no solution there either

  • 0 Votes
    5 Posts
    940 Views
    D

    @raven-worx said in QTreeView drag/drop "icon" Transparency:

    @Dariusz
    the only way currenlty is to start the drag entirely yourself by overwriting QAbstractItemView::startDrag()
    Its not that hard. Simply get the data for all selected indexes from the model and set a custom drag pixmap and call QDrag::exec()

    Hey

    Id love to do it but sadly it does not work. For example >

    def startDrag(self, supportedActions): d = QDrag(self) data = self.model().mimeData(self.selectedIndexes()) d.setMimeData(data) d.exec_(supportedActions)

    It Will, not produce the same effect as native action. Simply because when you look at source code where >

    if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction) d->clearOrRemove();

    Which handles the items state after their drag.
    I can not reproduce the action without a large rewrite of the startDrag event I'm afraid.

    I wish that the function that they use for Pixmap generation >

    QPixmap pixmap = d->renderToPixmap(indexes, &rect); rect.adjust(horizontalOffset(), verticalOffset(), 0, 0); QDrag *drag = new QDrag(this); drag->setPixmap(pixmap);

    Would be a virtual function so that I can overwrite it and provide my own pixmap at that level without messing up entire drag Qt logic.

  • 0 Votes
    2 Posts
    513 Views
    D

    Yo

    It appears that I was almost there... just need to create a proper drag!

    def initializeDrag(self, event, option, index): self.dragInitialized = True print("Drag initialized!") drag = QDrag(self) mim = QMimeData() mim.setText("yoyoyooy") drag.setMimeData(mim) val = drag.exec_() print("Return drag val : ", val) self.dragInitialized = False

    Once thats made, I then have to handle dragEnterEvent on QTreeView and then pass it to proper function from there... yay!

  • 0 Votes
    7 Posts
    837 Views
    D

    Woah sweet! will do that thanks!

  • 0 Votes
    1 Posts
    358 Views
    No one has replied
  • 0 Votes
    6 Posts
    1k Views
    D

    I've wrote 1 treeView/model system last year that had it all re-implemented from scratch, a few days ago I decided to rewrite it to increase performance and relay more on native functions of QT. Which I did and works great but the margin thing is a sticking point. I remember how much work it was before to get it to work properly... took a while as I had to write quite a few functions before I got to the point of margin detection. I'm very surprised there is no

    margin = (qt code ) + userMarginOverrideVal

    in the canDrop() function... this would have allowed us to just say, hey add +5 pixels to detection or something like that...

    Perhaps I should add it to feature request, would posting it in a bug report tracker be a good place? I don't see feature requests and I have no idea how to get the source to compile (Just didn't spend enough time on it) and add it myself & post to qt as commit...

    As far as I can tell we need like 2 functions, setOverrideMargin(int val) and getOverrideMargin(), skipping setting flag true/false if we want to use it as defaultVal should just be 0...

    TIA

  • 0 Votes
    3 Posts
    695 Views
    D

    @raven-worx said in QTreeView/Model drop action - no expand sign ?:

    Also did you emit the dataChanged() signal on the parent index?

    I've just read the post. I forgot to correct it. This is what I edit:

    bool testModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { ... Q_EMIT dataChanged(itemFirst.index(),itemLast.index()) }

    Hmmmm so I tried this, the parent is the object that is in function above.

    Q_EMIT dataChanged(parent, parent)

    Now this now "magically" works, I get extra ">" when I drop item on another item...
    I also learned that I also need to call Q_EMIT layoutChanged({parent}/flag) to update view if I drop items on expanded parent...

    Ok all good then, thanks! Weird issue o.o

  • 0 Votes
    6 Posts
    2k Views
    mrjjM

    @Joel-Bodenmann

    Well actually its not super weird. If you active
    accessibility settings in windows, (on some pads)
    you can get this for drag & drop to help
    people where is hard to hold down mouse. :)