View Full Version : How to implement radially rotated qpushbuttons?

23rd January 2013, 00:16
Hi All,

I'm trying to implement a gui with an array of 20 qpushbuttons placed radially. Think slide projector carousel viewed from the top. It looks like QXT only does 90 deg. increments. I've seen another post kind of describing this (http://www.qtcentre.org/archive/index.php/t-47057.html), but there's the scary "rectangular bounding box" part of that that sounds all wrong. I need the user to be able to hit each one easily on a touch screen, and it sounds like they'll overlap. Any ideas? I'm not wed to a qpushbutton-- I just need to emit a signal. I'm also using qtcreator, and am something of a novice, so if there's a plugin widget solution so much the better.


23rd January 2013, 21:05
Any ideas? Is this impossible in Qt?

Santosh Reddy
23rd January 2013, 21:14
Can you show us some screenshots? Just make something up, so that it is clear to visualize it.

23rd January 2013, 21:40
With widget you hardly can avoid the "rectangular bounding box" even if there are some tricks like transparent for mouse events, a custom click behavior... But depending on the complexity of your interface you could implement the ring of 20 buttons with a QGraphicsView or with QtQuick. Have you had a look at these?

23rd January 2013, 22:04
With a circular layout of buttons one can implement a custom widget that will draw and handle those 20 "buttons". Then there is no problem with the rectangular bounding box as a single widget already has a rectangular bouding box which a bounding box of the circle making up this ring of buttons. Of course the buttons would be fake so one has to handle all required events manually.

23rd January 2013, 22:48
8620 Thanks all for your input. Santosh, here's a quick scrawl of what I need to do. So there would be 20 buttons in the ring, like petals of a flower. Each one needs to change color when clicked (or when I want for some other reason) and send a "clicked()" signal.

Lykburg and Wysota-- I don't have any experience with any of the packages that you've mentioned. What do you think is the best shot at getting there, given that I'm a novice programmer?

Thanks a bunch,

23rd January 2013, 23:18
It really depends what you need it for. Maybe you don't need push buttons at all? Would simple coloured rectangles be sufficient?

23rd January 2013, 23:47
Yup, I just need two pngs displayed for states, and the ability to send a clicked signal. Does that simplify things?

24th January 2013, 00:03
And what do you need all this for?

24th January 2013, 00:48
It's part of the industrial design of a scientific instrument. It's for naming each sample in a carousel-- each petal/button corresponds to a sample, and needs labeling. This is done on a touchscreen on the device. touching a particular button pops up a dialog box with a virtual keyboard.

24th January 2013, 02:37
In that case I'd suggest to implement your UI in QML/QtQuick. If you don't feel up to it then use GraphicsView. Having rotated rectangles is very easy in both these technologies.