Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Don't scroll palette on foreground change
Carsten Hartenfelsdbca4eb7d894
diff --git a/libs/widgets/kis_palette_view.cpp b/libs/widgets/kis_palette_view.cppindex 075995aa1a..165755f139 100644--- a/libs/widgets/kis_palette_view.cpp+++ b/libs/widgets/kis_palette_view.cpp@@ -12,6 +12,7 @@#include <QLineEdit>#include <QCheckBox>#include <QComboBox>+#include <QScopedValueRollback>#include <KConfigGroup>#include <KSharedConfig>@@ -37,6 +38,7 @@ int KisPaletteView::MINIMUM_ROW_HEIGHT = 10;struct KisPaletteView::Private{QPointer<KisPaletteModel> model;+ bool foregroundColorChangeInProgress = false;};KisPaletteView::KisPaletteView(QWidget *parent)@@ -155,6 +157,13 @@ bool KisPaletteView::addGroupWithDialog()return false;}+void KisPaletteView::scrollTo(const QModelIndex &index, ScrollHint hint)+{+ if(!d->foregroundColorChangeInProgress) {+ QTableView::scrollTo(index, hint);+ }+}+bool KisPaletteView::removeEntryWithDialog(QModelIndex index){bool keepColors = false;@@ -202,6 +211,7 @@ const KoColor KisPaletteView::closestColor(const KoColor &color) constvoid KisPaletteView::slotFGColorChanged(const KoColor &color){+ QScopedValueRollback<bool> rollback(d->foregroundColorChangeInProgress, true);selectClosestColor(color);}diff --git a/libs/widgets/kis_palette_view.h b/libs/widgets/kis_palette_view.hindex c9777d416b..74b0799670 100644--- a/libs/widgets/kis_palette_view.h+++ b/libs/widgets/kis_palette_view.h@@ -90,6 +90,8 @@ public:*/bool addGroupWithDialog();+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;+Q_SIGNALS:void sigIndexSelected(const QModelIndex &index);void sigColorSelected(const KoColor &);