Qt : QScroolArea paintEvent

Qt : QScroolArea PaintEvent

I want to create paintEvent in QScroolArea. This is a tutorial how to implement QScroolArea paintEvent method.  I have confused how to create drawingEvent in the QScroolArea. So, after searching and try some of method, I create tutorial  how QScroolArea implement paintEvent. This is the steps how to implemnt QScroolArea paintEvent method :

  1. Create a widget. Implement paintEvent mehtod in this widget.
  2. Create QScroolArea. add the last widget int this QScroorArea.

This is a simple method how QScroolArea implement paintEvent method.

I am create a method drawingData to draw a QLinearGradient at the widget. I am adding paintEvent method in the widget, so when we change size (resize window), the program will automatic redrawing picture. This is the output from this QScroolArea paintEvent method :

paintQScroolArea
paintQScroolArea

You can get the complete code how to implementated QScroolArea paintEvent at here

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.