質問

So I have 2 QGraphicsScenes with QGraphicsViews in my ui. In those QGraphicScenes are QGraphicsItems, now I want to make my program wait to let the user select one QGraphicsItem om each Scene, but how do I do this?

I've tried things like:

while(scene->selectedItems().length()<1 || bordScene->selectedItems().length()<1)
    ;

But this will just cause the program to go in an infinite loop and the user still won't be able to select items.

This is probably a pretty simple question but I can't seem to find a simple solution

役に立ちましたか?

解決

you can make a slot and connect the selectionChanged signals of both GraphicsScenes to it. in the slot, you can check the selected items. since the slot is only triggered when the selection of one of the connected GraphicsScenes has changed, you have no infinite loop and your programm will not be blocked.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top