QScrollArea and Painting issue
I've built my own QScrollArea-based widget, it will have or not have a scrollbar.
If it has a scrollbar, a content widget will be added and painting would be happened on content widget.
If it doesn't have a scrollbar, it would work as a simple frame widget.
However, I found that when there was no scrollbar, I can't paint anything on it in overridden paintEvent(). The paint event was received and some paintings was done, but no effect.
I'm wondering it's that QSrcollArea disabled painting by default.
I'm looking for someone could help me confirm it.
Thx.
Re: QScrollArea and Painting issue
Please provide a minimal compilable example reproducing the problem.
Re: QScrollArea and Painting issue
also play around with viewport() and viewportwidget, and have your paintevent on the relevant widget
1 Attachment(s)
Re: QScrollArea and Painting issue
Quote:
Originally Posted by
wysota
Please provide a minimal compilable example reproducing the problem.
Pls check out attachment. I quickly built a demo, but weird, both paintEvent never got called.
Attachment 5805
Quote:
Originally Posted by
MrDeath
also play around with viewport() and viewportwidget, and have your paintevent on the relevant widget
I just learned about viewport() which said QScrollArea will assign a new QWidget anyway for viewport if I missed set one, I'm afraid that if it's quite appropriate for my initial purpose of making it being a normal frame widget if there's no scrollbar.
Re: QScrollArea and Painting issue
consider using a stackwidget for displaying your two views. set one to QFrame and another to QScrollArea