Accurate Button Placement in QDesigner
-
As the title suggests, I'm struggling to accurately place buttons in QDesigner as they seem to have to be anchored to the dots within the background of the Widget within QDesigner.
I have a background image of a climbing wall like this:
And I've cut out the holds in Photoshop. I've extended the QLabel Widget to turn the photos of the holds into checkable buttons, and I obviously want to overlay them on the background image above to create the holds as buttons within the app.
However, when I'm placing them in QDesigner it's not possible with my current knowledge to place them exactly in the holes of the image because it seems the center of the label needs to be anchored to one of the background dots in QDesigner.
Am I going about this in completely the wrong way or is there something obvious I'm missing? I'm completely self-taught so I am probably ignorant of a lot of features.
I'm also not caught up on this approach - if there was a way to make custom shaped buttons that I could overlay instead that would be great!
Am I missing something with layouts?
Should I just be creating custom buttons and the Painter?
At the moment I'm just using normal transparent squares over the top of the holds, but I'm trying to make the app look a little more professional!
Thanks :)
-
Hi and welcome to devnet,
If you want precise positioning, you should do that in code.
As for having push buttons with arbitrary geometries, it's something you would have to do yourself.
Depending on your final goal, did you consider using the Graphics View framework ? It might be better suited.
-
@LREGS said in Accurate Button Placement in QDesigner:
However, when I'm placing them in QDesigner it's not possible with my current knowledge to place them exactly in the holes of the image because it seems the center of the label needs to be anchored to one of the background dots in QDesigner.
This is probably the snap to grid behavior. From the menu toolbar: Tools -> Form Editor -> Form Settings ...
Check the Grid checkbox, and then uncheck Snap.@SGaist's suggestions are likely easier to deal with in the long run.