PDA

View Full Version : Drag&Drop problem



m1k3l3
24th September 2008, 10:54
Hi,

i want make a simple "simulator logic circuits" with only AND, OR, NOT gate (C++/QT).

For make the circuit i use Drag&Drop, i begin the project editing this example ( http://doc.trolltech.com/4.4/draganddrop-draggableicons.html ).

Now my problems are:

- how can i delete the images?

- And i need to link the image with a line. I thought to drag the gate and drop over another gate and make the line with the images coordinates ...but i dont know how i can do that.

jpn
24th September 2008, 12:58
i want make a simple "simulator logic circuits" with only AND, OR, NOT gate (C++/QT).
Sounds like a perfect candidate for yet another graphics view (http://doc.trolltech.com/latest/graphicsview.html) based application. :)


For make the circuit i use Drag&Drop, i begin the project editing this example ( http://doc.trolltech.com/4.4/draganddrop-draggableicons.html ).
That application was written to demonstrate DnD functionality in a simple way. I'm not convinced it is flexible enough for your purposes.


- how can i delete the images?
From user's point of view, how do you want to delete them?


- And i need to link the image with a line. I thought to drag the gate and drop over another gate and make the line with the images coordinates ...but i dont know how i can do that.
If you really insist doing it the hard way, store a list of labels in the parent (or find them dynamically at run-time) and paint lines between labels' positions.

m1k3l3
24th September 2008, 16:42
Sounds like a perfect candidate for yet another graphics view (http://doc.trolltech.com/latest/graphicsview.html) based application. :)

I look graphics view and it is cool...but i like the simple way...if that way is possible:p


That application was written to demonstrate DnD functionality in a simple way. I'm not convinced it is flexible enough for your purposes.

That it's very bad for me...
i editing this code:
Now I have two Horizontal Layer:
on the left Menu (AND, OR, NOT gate)
and on the right Drawing Area where is possible to create a copy of the Menu gates with Drag&Drop.
When i create a copy, insert a pointer of gate in a list, and that allow me to store the gates in memory. In future i will store the links between the gates.
It's wrong idea?


From user's point of view, how do you want to delete them?

I don't know now, but in the simple way not for user but for me!:D What do you suggest for this problem?


If you really insist doing it the hard way, store a list of labels in the parent (or find them dynamically at run-time) and paint lines between labels' positions.

I dont insist, but don't know another method to link the layer. What do you suggest for this problem?

m1k3l3
26th September 2008, 11:53
Nobody can help me?:o

caduel
26th September 2008, 12:07
imo QGraphicsView is the simple way.
The time you need to get up to speed with it is well invested. Do yourself a favour and give it a try. (There are also lots of examples for QGraphicsView in the Qt docs.)