Pista
Pista

Reputation: 13

Customizing a library class in QT

I would like to create a specific QPlainTextEditor in Qt. Namely, I would like to highlight every second row with grey. Now, I've made a new QAbstractScrollArea class (HighlightedOddLineScrollArea) and I've modified its paintEvent, but I've no idea how to implement it into my text editor. Do I have to do it through a constructor, or is there a function to exchange the default one?

Upvotes: 0

Views: 68

Answers (1)

Zeks
Zeks

Reputation: 2385

You will need to subclass QPlainTextEditor and reimplement its paintEvent function. Since the function is virtual the one that you define will be called instead of the parent class'

Upvotes: 1

Related Questions