Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qdrag

    Log in to post
    • All categories
    • Y

      Unsolved Is allow to use the QDrag class in Qt Webassembly?
      Qt for WebAssembly • qdrag qt 6.5.1 webassembly qeventloop qthread • • Yash001

      2
      0
      Votes
      2
      Posts
      82
      Views

      lorn.potter

      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

    • D

      Unsolved QTreeView/QstandardItemModel drag/drop - internal move lose icon ?
      General and Desktop • qstandarditem qstandarditemmo qdrag qdrag drag drop qicon • • Dariusz

      2
      0
      Votes
      2
      Posts
      76
      Views

      SGaist

      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 ?

    • R

      Unsolved QDrag / QDropEvent combase error : Class not registered
      General and Desktop • qdrag drag drop qdrag onecore error combase error mime • • rtavakko

      16
      0
      Votes
      16
      Posts
      4440
      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

    • D

      Solved QTreeView drag/drop "icon" Transparency
      General and Desktop • qtreeview qdrag drag drop qdrag indicator • • Dariusz

      5
      0
      Votes
      5
      Posts
      581
      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.

    • D

      Solved QStyledItemDelegate - implement drag event?
      General and Desktop • qstyleditemdele qdrag qdrag drag drop qtreeview • • Dariusz

      2
      0
      Votes
      2
      Posts
      336
      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!

    • D

      Unsolved QOpenGLWindow - drag event?
      General and Desktop • qopenglwindow qdrag drag drop qdrag • • Dariusz

      7
      0
      Votes
      7
      Posts
      482
      Views

      D

      Woah sweet! will do that thanks!

    • D

      Solved QTreeView drag/drop action change between in/out of view?
      General and Desktop • qtreeview qdrag • • Dariusz

      1
      0
      Votes
      1
      Posts
      306
      Views

      No one has replied

    • D

      Unsolved QTreeView dropping on item - filtering ?
      General and Desktop • qtreeview qdrag qdrop • • Dariusz

      6
      0
      Votes
      6
      Posts
      805
      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

    • D

      Solved QTreeView/Model drop action - no expand sign ?
      General and Desktop • qabstractitemmo qtreeview qdrag qdrop • • Dariusz

      3
      0
      Votes
      3
      Posts
      552
      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

    • Joel Bodenmann

      Unsolved Generating mousePress event for drag event
      General and Desktop • qdrag mouse event generate event • • Joel Bodenmann

      6
      0
      Votes
      6
      Posts
      1699
      Views

      mrjj

      @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. :)