mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-05-18 20:07:48 +00:00
Changed clang format to new agreement
This commit is contained in:
committed by
borgmanJeremy
parent
2cbccc3d0a
commit
0d5386edd4
@@ -24,13 +24,13 @@
|
||||
CaptureButton::CaptureButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
init();
|
||||
init();
|
||||
}
|
||||
|
||||
CaptureButton::CaptureButton(const QString& text, QWidget* parent)
|
||||
: QPushButton(text, parent)
|
||||
{
|
||||
init();
|
||||
init();
|
||||
}
|
||||
|
||||
CaptureButton::CaptureButton(const QIcon& icon,
|
||||
@@ -38,56 +38,52 @@ CaptureButton::CaptureButton(const QIcon& icon,
|
||||
QWidget* parent)
|
||||
: QPushButton(icon, text, parent)
|
||||
{
|
||||
init();
|
||||
init();
|
||||
}
|
||||
|
||||
void
|
||||
CaptureButton::init()
|
||||
void CaptureButton::init()
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
auto dsEffect = new QGraphicsDropShadowEffect(this);
|
||||
dsEffect->setBlurRadius(5);
|
||||
dsEffect->setOffset(0);
|
||||
dsEffect->setColor(QColor(Qt::black));
|
||||
auto dsEffect = new QGraphicsDropShadowEffect(this);
|
||||
dsEffect->setBlurRadius(5);
|
||||
dsEffect->setOffset(0);
|
||||
dsEffect->setColor(QColor(Qt::black));
|
||||
|
||||
setGraphicsEffect(dsEffect);
|
||||
setGraphicsEffect(dsEffect);
|
||||
}
|
||||
|
||||
QString
|
||||
CaptureButton::globalStyleSheet()
|
||||
QString CaptureButton::globalStyleSheet()
|
||||
{
|
||||
return CaptureButton(nullptr).styleSheet();
|
||||
return CaptureButton(nullptr).styleSheet();
|
||||
}
|
||||
|
||||
QString
|
||||
CaptureButton::styleSheet() const
|
||||
QString CaptureButton::styleSheet() const
|
||||
{
|
||||
QString baseSheet = "CaptureButton { border: none;"
|
||||
"padding: 3px 8px;"
|
||||
"background-color: %1; color: %4 }"
|
||||
"CaptureToolButton { border-radius: %3;"
|
||||
"padding: 0; }"
|
||||
"CaptureButton:hover { background-color: %2; }"
|
||||
"CaptureButton:pressed:!hover { "
|
||||
"background-color: %1; }";
|
||||
// define color when mouse is hovering
|
||||
QColor contrast = ColorUtils::contrastColor(m_mainColor);
|
||||
// foreground color
|
||||
QColor color = ColorUtils::colorIsDark(m_mainColor) ? Qt::white : Qt::black;
|
||||
QString baseSheet = "CaptureButton { border: none;"
|
||||
"padding: 3px 8px;"
|
||||
"background-color: %1; color: %4 }"
|
||||
"CaptureToolButton { border-radius: %3;"
|
||||
"padding: 0; }"
|
||||
"CaptureButton:hover { background-color: %2; }"
|
||||
"CaptureButton:pressed:!hover { "
|
||||
"background-color: %1; }";
|
||||
// define color when mouse is hovering
|
||||
QColor contrast = ColorUtils::contrastColor(m_mainColor);
|
||||
// foreground color
|
||||
QColor color = ColorUtils::colorIsDark(m_mainColor) ? Qt::white : Qt::black;
|
||||
|
||||
return baseSheet.arg(m_mainColor.name())
|
||||
.arg(contrast.name())
|
||||
.arg(GlobalValues::buttonBaseSize() / 2)
|
||||
.arg(color.name());
|
||||
return baseSheet.arg(m_mainColor.name())
|
||||
.arg(contrast.name())
|
||||
.arg(GlobalValues::buttonBaseSize() / 2)
|
||||
.arg(color.name());
|
||||
}
|
||||
|
||||
void
|
||||
CaptureButton::setColor(const QColor& c)
|
||||
void CaptureButton::setColor(const QColor& c)
|
||||
{
|
||||
m_mainColor = c;
|
||||
setStyleSheet(styleSheet());
|
||||
m_mainColor = c;
|
||||
setStyleSheet(styleSheet());
|
||||
}
|
||||
|
||||
QColor CaptureButton::m_mainColor = ConfigHandler().uiMainColorValue();
|
||||
|
||||
Reference in New Issue
Block a user