QGraphicsScene borders ?



  • Hi Qt community ,

    What's the safest and shortest in code way to catch colliding between a QGraphicsItem and the borders of the QGraphicsScene ?

    I don't believe that manually declaring the borders one by one is the best way to do it .

    Thanks for your comprehension ;)



  • As far as I know there is no "built-in" way to do this.
    My approach would be to create four QGraphicsLineItems and arrange them along the borders of the scene.
    If you want them to be invisible you can simply set the opacity to 0.



  • @Joel-Bodenmann
    That's the manual way i talked about uptop but thanks anyways :)
    It reassures me that i'm not "re-inventing" the wheel by applying this method .



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.