Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/GUI/BoxesList/boxsinglewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ BoxSingleWidget::BoxSingleWidget(BoxScroller * const parent)

mColorButton = new ColorAnimatorButton(nullptr, this);
mMainLayout->addWidget(mColorButton, Qt::AlignRight);
mColorButton->setFixedHeight(mColorButton->height() - 6);
mColorButton->setContentsMargins(0, 3, 0, 3);
mColorButton->setFixedHeight(mColorButton->height() - 2);
mColorButton->setContentsMargins(0, 1, 0, 1);

mPropertyComboBox = createCombo(this);
mMainLayout->addWidget(mPropertyComboBox);
Expand Down
13 changes: 9 additions & 4 deletions src/core/GUI/coloranimatorbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ ColorAnimatorButton::ColorAnimatorButton(QWidget * const parent)
{
connect(this, &BoxesListActionButton::pressed,
this, &ColorAnimatorButton::openColorSettingsDialog);
eSizesUI::widget.add(this, [this](const int size) {
setFixedHeight(size);
setFixedWidth(size * 3 - 2);
});
}

ColorAnimatorButton::ColorAnimatorButton(ColorAnimator * const colorTarget,
Expand Down Expand Up @@ -73,6 +77,7 @@ void ColorAnimatorButton::paintEvent(QPaintEvent *)
{
QPainter p(this);

const QColor currentColor = color();
const QRectF rect(0.0, 0.0, width(), height());
const float borderWidth = 2.0;
const QRectF innerRect = rect.adjusted(borderWidth,
Expand All @@ -81,19 +86,19 @@ void ColorAnimatorButton::paintEvent(QPaintEvent *)
-borderWidth);

if (mHover) {
const QColor color = ThemeSupport::getLightDarkColor(mColor, 130);
const QColor color = ThemeSupport::getLightDarkColor(currentColor, 130);
p.setPen(color);
p.setBrush(color);
p.drawRoundedRect(rect,
borderWidth + 2,
borderWidth + 2);
p.setBrush(mColor);
p.setBrush(currentColor);
p.drawRoundedRect(innerRect,
borderWidth,
borderWidth);
} else {
p.setPen(mColor);
p.setBrush(mColor);
p.setPen(currentColor);
p.setBrush(currentColor);
p.drawRoundedRect(rect,
borderWidth + 2,
borderWidth + 2);
Expand Down