fix: self drawn add button alignment and color (#6385)
This commit is contained in:
+1
-1
@@ -97,7 +97,7 @@
|
|||||||
- Dev: Fixed incorrect lua generation of static methods for typescript plugins. (#6190, #6223)
|
- Dev: Fixed incorrect lua generation of static methods for typescript plugins. (#6190, #6223)
|
||||||
- Dev: Merged top/bottom and left/right notebook layouts. (#6215)
|
- Dev: Merged top/bottom and left/right notebook layouts. (#6215)
|
||||||
- Dev: Refactored `Button` and friends. (#6102, #6255, #6266, #6302, #6268, #6334, #6371, #6372)
|
- Dev: Refactored `Button` and friends. (#6102, #6255, #6266, #6302, #6268, #6334, #6371, #6372)
|
||||||
- Dev: Made "add split" button (part of the split header) a natively rendered button. (#6349)
|
- Dev: Made "add split" button (part of the split header) a natively rendered button. (#6349, #6385)
|
||||||
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
- Dev: Made Settings & Account button on Linux/macOS SVGs. (#6267)
|
||||||
- Dev: Made "Chatters" button an SVG. (#6397)
|
- Dev: Made "Chatters" button an SVG. (#6397)
|
||||||
- Dev: Made "Moderation" button an SVG. (#6398, #6412, #6414)
|
- Dev: Made "Moderation" button an SVG. (#6398, #6412, #6414)
|
||||||
|
|||||||
@@ -705,7 +705,7 @@ void Notebook::setShowAddButton(bool value)
|
|||||||
|
|
||||||
void Notebook::resizeAddButton()
|
void Notebook::resizeAddButton()
|
||||||
{
|
{
|
||||||
float h = (NOTEBOOK_TAB_HEIGHT - 1) * this->scale();
|
int h = static_cast<int>((NOTEBOOK_TAB_HEIGHT - 1) * this->scale());
|
||||||
this->addButton_->setFixedSize(h, h);
|
this->addButton_->setFixedSize(h, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void DrawnButton::themeChangedEvent()
|
|||||||
switch (this->symbol)
|
switch (this->symbol)
|
||||||
{
|
{
|
||||||
case Symbol::Plus: {
|
case Symbol::Plus: {
|
||||||
o.padding = 3;
|
o.padding = 4;
|
||||||
o.thickness = 1;
|
o.thickness = 1;
|
||||||
|
|
||||||
o.foreground = this->theme->messages.textColors.system;
|
o.foreground = this->theme->messages.textColors.system;
|
||||||
@@ -107,6 +107,21 @@ void DrawnButton::paintContent(QPainter &painter)
|
|||||||
QRect inner;
|
QRect inner;
|
||||||
inner.setSize(innerSize);
|
inner.setSize(innerSize);
|
||||||
inner.moveCenter(this->rect().center());
|
inner.moveCenter(this->rect().center());
|
||||||
|
inner = inner.marginsRemoved({padding, padding, padding, padding});
|
||||||
|
|
||||||
|
// make sure that the inner size is always odd:
|
||||||
|
// (width): [====outer====][|inner|][====outer====]
|
||||||
|
// -> 2 * outer_w + inner_w
|
||||||
|
// -> 2 * outer_w + 1dp
|
||||||
|
// -> odd
|
||||||
|
if ((inner.width() % 2) == 0)
|
||||||
|
{
|
||||||
|
inner.setRight(inner.right() + 1);
|
||||||
|
}
|
||||||
|
if ((inner.height() % 2) == 0)
|
||||||
|
{
|
||||||
|
inner.setTop(inner.top() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
auto top = inner.top();
|
auto top = inner.top();
|
||||||
auto bottom = inner.bottom();
|
auto bottom = inner.bottom();
|
||||||
@@ -114,11 +129,9 @@ void DrawnButton::paintContent(QPainter &painter)
|
|||||||
auto left = inner.left();
|
auto left = inner.left();
|
||||||
auto right = inner.right();
|
auto right = inner.right();
|
||||||
|
|
||||||
QLine vertical(center.x(), top + padding, center.x(),
|
QLine vertical(center.x(), top, center.x(), bottom);
|
||||||
bottom - padding);
|
|
||||||
painter.drawLine(vertical);
|
painter.drawLine(vertical);
|
||||||
QLine horizontal(left + padding, center.y(), right - padding,
|
QLine horizontal(left, center.y(), right, center.y());
|
||||||
center.y());
|
|
||||||
painter.drawLine(horizontal);
|
painter.drawLine(horizontal);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1101,9 +1101,10 @@ void SplitHeader::themeChangedEvent()
|
|||||||
}
|
}
|
||||||
this->titleLabel_->setPalette(palette);
|
this->titleLabel_->setPalette(palette);
|
||||||
|
|
||||||
|
auto bg = this->theme->splits.header.background;
|
||||||
this->addButton_->setOptions({
|
this->addButton_->setOptions({
|
||||||
.background = this->theme->messages.backgrounds.regular,
|
.background = bg,
|
||||||
.backgroundHover = this->theme->messages.backgrounds.regular,
|
.backgroundHover = bg,
|
||||||
});
|
});
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
|
|||||||
Reference in New Issue
Block a user