PDA

View Full Version : tab order implementation



yazwas
25th November 2009, 21:47
hello all

i have multiple QGraphicsPolygonItem items. i want the user to be able to order them by clicking on them by mouse, much like the tab order used in Qt Creator.

My question is what is the best method to do this, should i create another graphics item, like a little square, and attach every item of them to the polygon items, and override the mouse click button to order them, or is there a better way you can suggest?

thanks in advance

axeljaeger
28th November 2009, 13:08
I think the idea you posted is the way to go. Remember that each of the small rects has to react slightly different: Moving only horizontal/vertical, adjust pos, adjust size and so on. I think you have a rect for any combination of them.

yazwas
2nd December 2009, 16:34
Hey axel

Thanks for the reply, I did not a little differently though, I had 2 modes (view, and order), and instead of having small rects over the items, I added a QGraphicsSimpleTextItem item to the top left of each polygon item that contains the item order number, and its ONLY visible when we are in the order mode.

for the ordering itself, I had 2 cases for the mouseReleaseEvent function, if its on the view mode, I let it do what it does, but if its on the order mode, I call my orderItem function to order the items,

this solution works fine for me, and I can provide source code for the way I did the ordering itself

regards, yazan