Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Weird behavior with drag and drop in native mode but not raster



  • We have a treewidget class that implements drag and drop and when we use raster mode for the graphics mode of the application, we can see the text of the dragged tree item shown while dragging. When we use native, we see a blank gray rectangle of the size of the label for the dragged tree item. Anyone experience this?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show the relevant code ?



  • The code was working as expected until we moved to 4.8.7 to correct some bugs that we traced down to the trolltech library code. When we upgraded to 4.8.7 the performance slowed significantly in some deployed configurations so we had to add in QApplication:setGraphicsMode to force "native" on those systems. When we added QApplication::setGraphicsMode("native") to the code, the drag and drop functionality worked, but the pixmap associated with the treewidgetitem turned grey. If we forced "raster" the widget's pixmap shows while dragging. I'm not sure I can isolate a meaningful example since the code is large and presentation and business logic is intermingled plus the sourcecode is tightly controlled.



  • Ok, so I can see this on my macbook or my linux machine at home over "ssh -Y" but it takes a while for the label to show with either setGraphicsMode("raster") or setGraphicsMode("native") but it doesn't show in Xvnc and AIX's native display server. This code has been functioning without a hiccup since 2011.


  • Lifetime Qt Champion

    Which version of Qt did you use before ?

    Depending on that, you might want to consider back porting the fixes you need rather than do a full update.



  • Turns out that for some reason the boilerplate code for the TreeWidget doesn't like to show in the one configuration that we needed. We overrode startDrag and got the pixmap we needed from a QLabel we made into a QDrag and it showed up fine. Kind of wierd. The default behavior shows up fine with X on linux, but VNC and AIX's server doesn't show right.


  • Lifetime Qt Champion

    Not the same protocols so there might be bugs with them.


Log in to reply