diff --git a/src/config/uicoloreditor.cpp b/src/config/uicoloreditor.cpp index 300712d4..504b3e30 100644 --- a/src/config/uicoloreditor.cpp +++ b/src/config/uicoloreditor.cpp @@ -16,7 +16,6 @@ // along with Flameshot. If not, see . #include "uicoloreditor.h" -#include "color_wheel.hpp" #include "src/capture/button.h" #include #include @@ -54,22 +53,22 @@ void UIcolorEditor::updateLocalColor(const QColor c) { } void UIcolorEditor::initColorWheel() { - color_widgets::ColorWheel *colorWheel = new color_widgets::ColorWheel(this); - connect(colorWheel, &color_widgets::ColorWheel::mouseReleaseOnColor, this, + m_colorWheel = new color_widgets::ColorWheel(this); + connect(m_colorWheel, &color_widgets::ColorWheel::mouseReleaseOnColor, this, &UIcolorEditor::updateUIcolor); - connect(colorWheel, &color_widgets::ColorWheel::colorChanged, this, + connect(m_colorWheel, &color_widgets::ColorWheel::colorChanged, this, &UIcolorEditor::updateLocalColor); QSettings settings; m_uiColor = settings.value("uiColor").value(); - colorWheel->setColor(m_uiColor); - colorWheel->setFixedSize(100,100); + m_colorWheel->setColor(m_uiColor); + m_colorWheel->setFixedSize(100,100); - colorWheel->setToolTip(tr("Change the color moving the selectors and see" + m_colorWheel->setToolTip(tr("Change the color moving the selectors and see" " the changes in the preview buttons.")); - hLayout->addWidget(colorWheel); + hLayout->addWidget(m_colorWheel); } void UIcolorEditor::initButtons() { @@ -125,5 +124,11 @@ void UIcolorEditor::updateButtonIcon() { } void UIcolorEditor::changeLastButton(Button *b) { - m_lastButtonPressed = b; + if (m_lastButtonPressed != b) { + m_lastButtonPressed = b; + QString type = b == m_buttonMainColor ? "uiColor" : "contastUiColor"; + QColor c = QSettings().value(type).value(); + m_colorWheel->setColor(c); + + } } diff --git a/src/config/uicoloreditor.h b/src/config/uicoloreditor.h index 1d64c055..25824db7 100644 --- a/src/config/uicoloreditor.h +++ b/src/config/uicoloreditor.h @@ -18,6 +18,7 @@ #ifndef UICOLORPICKER_H #define UICOLORPICKER_H +#include "color_wheel.hpp" #include class QVBoxLayout; @@ -40,6 +41,7 @@ private: Button *m_buttonMainColor; Button *m_buttonContrast; Button *m_lastButtonPressed; + color_widgets::ColorWheel *m_colorWheel; QHBoxLayout *hLayout; QVBoxLayout *vLayout;