Setting widget "hitbox"
-
Hi,
Just to be sure we are on the same line, what would you use that hitbox for ?
-
Then that's something you have to do yourself.
See the setAcceptHoverEvents, you'll have the related methods linked there that you may have to overload in order to do what you want.
-
Would it be better to simply "glue" some rectangulars widgets together, connecting directly the signals of the small widgets to the signals of the bigger one ?
-
@mrjj Sorry, I mean Items, i'm not very familiar with the QGraphics* classes. That's just some pixmaps in want to display.
@Pylvain
Hi
thats super fine.
I just wanted to be sure you didnt use actual std widgets as that's also possible.If the goal is to have some images with some shapes
and you want to only be able to click inside the actual visual shape,
i think you can use
https://doc.qt.io/qt-5/qgraphicsitem.html#shape
for that. But you would have to create a QPainterPath that follows the visual image so to speak. -
@mrjj i saw that article, but i did'nt find anything useful. That can detect colisions, but nothing related with events. The more i think of it, the more i think it's best to use rectangular units glued together. It's simpler optimisationwise, and connecting signals to signals seems very elegant to me.
-
@mrjj i saw that article, but i did'nt find anything useful. That can detect colisions, but nothing related with events. The more i think of it, the more i think it's best to use rectangular units glued together. It's simpler optimisationwise, and connecting signals to signals seems very elegant to me.