Remove visibilityChanged connection in favor of existing eventFilter
ClosedPublic

Authored by broulik on Jul 18 2019, 8:10 AM.

Details

Summary

KMainWindow compresses saving its configuration by a 500ms timer. However, for QDockWidget visibilityChanged a direct connection to the setSettingsDirty method is made, which immediately saves settings.
Since there is already an eventFilter also listening for QEvent::Show and QEvent::Hide, the connection to visibilityChanged is redundant since that signal is emitted from the respective event handler anyway.
The main benefit is that the eventFilter code compresses the configuration save, not jeopardizing startup time for applications with lots of dock widgets like Dolphin.

Test Plan

Noticed that Dolphin repeatedly saved its configuration on startup, found this.
Previously it did 4 save calls (probably for every QDockWidget added) and then another queued one after startup was finished.
With this patch it only does a save call shortly after startup has completed.
Unittests still pass. Manually hiding dock widgets still has its configuration saved, albeit slightly delayed to before.

Diff Detail

Repository
R263 KXmlGui
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Jul 18 2019, 8:10 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 18 2019, 8:10 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Jul 18 2019, 8:10 AM
dfaure accepted this revision.Jul 19 2019, 6:42 AM

Good catch.

This revision is now accepted and ready to land.Jul 19 2019, 6:42 AM
This revision was automatically updated to reflect the committed changes.