KTextEditor: Fix left border flicker when switching between documents
ClosedPublic

Authored by daandemeyer on Aug 23 2019, 9:05 AM.

Details

Summary

See https://mail.kde.org/pipermail/kwrite-devel/2019-August/005302.html

Because the Qt::WA_OpaquePaintEvent was not enabled, Qt was erasing the widget's area before repainting which briefly cause the background to appear which caused flickering when switching between documents. We can simply enable the Qt::WA_OpaquePaintEvent option which tells Qt to not erase the widget's area before repainting. This fixes the flickering when switching between documents.

This does assume the icon bar does not rely on the widget background color which is the case in my scenario but hopefully one of the maintainers can confirm that this is always the case.

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
daandemeyer created this revision.Aug 23 2019, 9:05 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 23 2019, 9:05 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
daandemeyer requested review of this revision.Aug 23 2019, 9:05 AM

Hmm, I thought one can enable that safely, if the widget paintEvent paints the full background anyways itself.
I think that should be ok for the iconborder but must take a look myself again ;=)

cullmann accepted this revision.Aug 23 2019, 12:09 PM

KateIconBorder::paintBorder seems to take care to paint the complete background,

// Paint background over full width...
     p.fillRect(lnX, y, w, h, iconBarColor);

> ok with this, thanks for the improvement.

This revision is now accepted and ready to land.Aug 23 2019, 12:09 PM

Looks good. Still, can the same be achieved with setAutoFillBackground(false)?

According to the documentation they should both achieve the same effect. However, Qt::WA_OpaquePaintEvent takes precedence if both are used.

Given we use setAttribute(Qt::WA_StaticContents); I think using this additional attribute is fine.

This revision was automatically updated to reflect the committed changes.