Change the appearance of a dragged QStandardItem
-
Hello!
In the development of my application, I'd like to drag'n'drop QStandardItems from a TreeView into another QWidget. I'm able to do this easily enabling dragging of the TreeView and the item to drag, though I'd like the dragged item to change it's appearance, so that the textual representation in the tree view changes into a more elaborated widget of my creation.
Is it thus possible to transform the appearance of the "ghost" of the dragged item into something different, loaded for example from a .ui file?
P.S.
I'm posting here in the General and Desktop because I think it's not bound to, but I'm using PySide6, if it might matter.Thank you :)
-
What QWidget do you want to use in your dragEvent ?
-
I need to create a custom QWidget which graphically appears something like the elements in this image:
I'm actually trying to kind of replicate that flow chart interface. I was thinking of creating the widget in a .ui file, or directly creating it entirely programmatically (is it possible?) using a factory / builder to setup the inputs, the outputs, the name and the header's color.
The idea thus is to be able to drag not a text, but the ghost of the element which will be then dropped in the working area (see the following screenshot of my WIP).
-
You will want to check the Graphics View framework.
And yes, that kind of interface will be easier to code. The "core" part with the item view and the central widget can be done with designer but you will have to use widget promotion for your custom tree view.
-
Sure you can, the usual way, subclass and reimplement.