QPainter::setClipping(false) is not working(Qt 4.8)
-
@dheerendra
Thanks.I am trying to do like attached image. At a time only one button can be focused and when it gets focused I want to show button's horizontal centre aligned action description below the button. The issue is description can come under another button also and can grow out of buttons bounds.
-
You are slightly over engineering the task. You don't need the painting or subclassing. As @aha_1980 said, it can be managed with simple visual elements like QLabel & Layouts.
-
Out of curiosity, why it there a need for such a description ?
-
@dheerendra
Can you please explain how to do it? Also please note that all the buttons will be dynamic based on some backend response and also spacing between them can change in some scenarios. I tried even this. https://stackoverflow.com/questions/53785115/qpainter-ignores-clipping-inside-paintevent/53785991?noredirect=1#comment94442586_53785991 -
You could have simple QLabel that you would move as need and from which you update the text when the buttons get their focus changed.
-
@SGaist Yes I tried that only. But first time when we switch into the view it doesn't appear properly. Btw button is inside horizontal layout. We kind of wanted to make it reusable since we have that in many places, so I subclassed QPushButton.
-
You can make a "container widget" that will handle the showing of the label properly.