Paste P142

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on Dec 8 2017, 1:37 PM.
From cb8dccbbf4bdfaa96ce70c79771ee2f14a21d547 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Fri, 8 Dec 2017 16:37:05 +0300
Subject: [PATCH] Fix cycling update signals in KoDualButton
The internal color space of the internal color selector may have a
different color profile, therefore, when you choose the the color with
it, the color space of the selected color may change. The cycling signal
connection would mean that the color profile of the currently selected
color space will fluctuate depending on the order of signals
---
libs/ui/widgets/KoDualColorButton.cpp | 11 ++++++++++-
.../tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp | 7 +++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/libs/ui/widgets/KoDualColorButton.cpp b/libs/ui/widgets/KoDualColorButton.cpp
index 7cedac6..46fa217 100644
--- a/libs/ui/widgets/KoDualColorButton.cpp
+++ b/libs/ui/widgets/KoDualColorButton.cpp
@@ -27,6 +27,8 @@
#include <QColorDialog>
#include "dialogs/kis_dlg_internal_color_selector.h"
+#include "kis_signals_blocker.h"
+
#include <QBrush>
#include <QDrag>
#include <QDragEnterEvent>
@@ -152,7 +154,14 @@ QSize KoDualColorButton::sizeHint() const
void KoDualColorButton::setForegroundColor( const KoColor &color )
{
d->foregroundColor = color;
- d->colorSelectorDialog->slotColorUpdated(color);
+ {
+ /**
+ * The internal color selector might emit the color of a different profile, so
+ * we should break this cycling dependency somehow.
+ */
+ KisSignalsBlocker b(d->colorSelectorDialog);
+ d->colorSelectorDialog->slotColorUpdated(color);
+ }
repaint();
}
diff --git a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp
index b7f37b1..6cc6d07 100644
--- a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp
+++ b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.cpp
@@ -155,12 +155,9 @@ void KisToolLazyBrushOptionsWidget::hideEvent(QHideEvent *event)
void KisToolLazyBrushOptionsWidget::entrySelected(QModelIndex index)
{
- qDebug()<<"triggered";
if (!index.isValid()) return;
- qDebug()<<index;
const int i = m_d->colorModel->idFromIndex(index);
- qDebug()<<i;
if (i >= 0 && i < (int)m_d->colorSet.nColors()) {
KoColorSetEntry entry = m_d->colorModel->colorSetEntryFromIndex(index);
@@ -192,7 +189,9 @@ void KisToolLazyBrushOptionsWidget::slotCurrentFgColorChanged(const KoColor &col
m_d->ui->btnTransparent->setChecked(false);
}
- QModelIndex newIndex = m_d->colorModel->indexFromId(selectedIndex);
+ QModelIndex newIndex =
+ selectedIndex >= 0 ?
+ m_d->colorModel->indexFromId(selectedIndex) : QModelIndex();
if (newIndex != m_d->ui->colorView->currentIndex()) {
m_d->ui->colorView->setCurrentIndex(newIndex);
--
2.7.4
dkazakov edited the content of this paste. (Show Details)Dec 8 2017, 1:37 PM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.