From c5498ff385df6b092374ef5d36dd27ced52495fc Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Sat, 26 May 2018 18:55:05 +0200 Subject: [PATCH] Integrate Pin widget with user defined colors --- src/tools/pin/pinwidget.cpp | 10 +++++++--- src/tools/pin/pinwidget.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index e2097d35..330c37ff 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -16,6 +16,7 @@ // along with Flameshot. If not, see . #include "pinwidget.h" +#include "src/utils/confighandler.h" #include #include #include @@ -30,13 +31,16 @@ PinWidget::PinWidget(const QPixmap &pixmap, QWidget *parent) : //set the bottom widget background transparent setAttribute(Qt::WA_TranslucentBackground); + ConfigHandler conf; + m_baseColor = conf.uiMainColorValue(); + m_hoverColor = conf.uiContrastColorValue(); m_layout = new QVBoxLayout(this); const int margin = this->margin(); m_layout->setContentsMargins(margin, margin, margin, margin); m_shadowEffect = new QGraphicsDropShadowEffect(this); - m_shadowEffect->setColor(Qt::lightGray); + m_shadowEffect->setColor(m_baseColor); m_shadowEffect->setBlurRadius(2 * margin); m_shadowEffect->setOffset(0, 0); setGraphicsEffect(m_shadowEffect); @@ -66,10 +70,10 @@ void PinWidget::wheelEvent(QWheelEvent *e) { } void PinWidget::enterEvent(QEvent *) { - m_shadowEffect->setColor(QColor(3, 150, 255)); + m_shadowEffect->setColor(m_hoverColor); } void PinWidget::leaveEvent(QEvent *) { - m_shadowEffect->setColor(Qt::lightGray); + m_shadowEffect->setColor(m_baseColor); } void PinWidget::mouseDoubleClickEvent(QMouseEvent *) { diff --git a/src/tools/pin/pinwidget.h b/src/tools/pin/pinwidget.h index 0069a8c4..3bfa2923 100644 --- a/src/tools/pin/pinwidget.h +++ b/src/tools/pin/pinwidget.h @@ -47,4 +47,5 @@ private: QPoint m_dragStart; qreal m_offsetX, m_offsetY; QGraphicsDropShadowEffect *m_shadowEffect; + QColor m_baseColor, m_hoverColor; };