[ktexteditor] src/utils: Only update the palette once for the change event belonging to qApp.

Dominik Haumann dhaumann at gmail.com
Sun Jan 31 12:06:12 UTC 2016


On Saturday 30 January 2016 16:10:12 Milian Wolff wrote:
> Git commit 8c6a18964e0c0684d5ec068e686ed41aeb0fd657 by Milian Wolff.
> Committed on 30/01/2016 at 16:03.
> Pushed by mwolff into branch 'master'.
> 
> Only update the palette once for the change event belonging to qApp.
> 
> This fixes the massive freeze that occurs when the global color
> palette is changed. Note that the qApp event filter includes change
> events to many objects, but we only want to update once.
> 
> BUG: 358526
> 
> M  +2    -3    src/utils/kateglobal.cpp
> 
> http://commits.kde.org/ktexteditor/8c6a18964e0c0684d5ec068e686ed41aeb0fd657
> 
> diff --git a/src/utils/kateglobal.cpp b/src/utils/kateglobal.cpp
> index 66b70e2..38b6882 100644
> --- a/src/utils/kateglobal.cpp
> +++ b/src/utils/kateglobal.cpp
> @@ -481,9 +481,8 @@ void KTextEditor::EditorPrivate::copyToClipboard(const QString &text)
>  
>  bool KTextEditor::EditorPrivate::eventFilter(QObject *obj, QEvent *event)
>  {
> -    Q_UNUSED(obj);
> -
> -    if (event->type() == QEvent::ApplicationPaletteChange) {
> +    if (obj == qApp && event->type() == QEvent::ApplicationPaletteChange) {
> +        // only update the color once for the event that belongs to the qApp
>          updateColorPalette();

Interesting & nice catch.

Btw, if that works now, you may want to look at the KDevelop patch I
once posted and discarded that does the same for KDevelop:

  https://git.reviewboard.kde.org/r/119693/

Maybe all this is already done, have not checked (and the patch
is probably missing a similar check of obj == qApp).

Greetings,
Dominik


More information about the KDevelop-devel mailing list