PDA

View Full Version : PushButton



acuce
13th July 2012, 07:45
I am writing a .EXE to load a .DLL file which someone provided before, There is a PushButton in the .DLL,
i want to rotate the PushButton to 90 degree.How to do it?

By the way, i do not have original source code of the DLL

Thanks buddy.

sonulohani
13th July 2012, 08:38
change the pushbutton coordinate as per your rotation.

d_stranz
13th July 2012, 20:06
By the way, i do not have original source code of the DLL

I assume that somehow you can get a pointer to the QPushButton instance that you want to rotate, is that right? You either need to get that directly, or somehow search for it in the list of children of some widget that contains it.

More to the point - I don't know of any way that you can rotate a standard QPushButton. If you make a custom pushbutton class derived from QPushButton, you can set a QPainter transform in the paint event, but you have no way to do that on an already-created QPushButton in a DLL. Not only that, but if the button is embedded in a form or other composite widget controlled by a layout, the layout might prevent the resizing needed to show the button correctly after it has been rotated.

Changing the position or geometry will simply move the button around (if allowed by the layout); it won't rotate it.

Edit: There is one possible way that might work but you will have to test it: If you can embed the QWidget pointer to the button into a QGraphicsProxyWidget, you can use it in the Graphics/View environment and rotate it that way. But that's a hack.