-
Draggable Button
Hello,
I'm searching for a possibility to drag'n'drop buttons, just as it is possible in QtDesigner.
What I want is, that on running the application someone can reorder buttons in a way he want. Maybe there is someone, who performed so.
I'm just working with Qt for 2 weeks. Maybe there is a functionality I've overlooked.
Thanks for help.
Mirko
-
Re: Draggable Button
http://doc.trolltech.com/4.4/dragand...ableicons.html This should be about the same as what you are asking for, right?
-
Re: Draggable Button
Yes, thanks, thats what I'm looking for.
Now I tried to change the QLabel to QPushButton but it doesn't work. I get a button on a new widget, not on the main widget. Maybe I'm doing wrong something with the MimeData. Or do I have to write my own moveButton instead?
-
Re: Draggable Button
Now I'm having the Button on the widget. But it won't move. I've changed the mousePressEvent, but just don't know, what MimeData I've got to drag and drop. Anybody some ideas?
-
Re: Draggable Button
I guess you will need custom buttons to be able to move it.
You have left side and right side. On left side u have buttons with drag enabled logic. On right you have Widget which acts like a drop site, and with the mime data creates a MyPushButton. This MyPushButton is coded to move on mouse move events.
You can see Shaped Clock example in Qt Demos-> Widgets to how to move a widget.
Hope this helps :)