How do i reimplement QPushButton such that its shape is a circle not rectangular
How do i reimplement QPushButton such that its shape is a circle not rectangular
You should exhaust the possibilities of using style sheets to gain the desired look first. If that cannot do it then subclass QPushButton and re-implement QWidget::paintEvent() to draw the widget however you want. You would also need to provide appropriate size hints.
Take class AeroButton. Use setRoundness( int roundness ) [0 - rectangle, 99 - oval]
everything seems ok except the size,i did reimplemented sizeHint() but i dont know where to put the call. my widget takes the size of the parent(QPushButton)
The sizeHint() function will be called by the layout the widget is in (or when the widget is shown for top level widgets). You don't have to call it explicitly.
Thank you every much.I am aware of that.everything working fine now.
Bookmarks