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: Merged top/bottom and left/right notebook layouts. (#6215)
|
||||
- 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 "Chatters" button an SVG. (#6397)
|
||||
- Dev: Made "Moderation" button an SVG. (#6398, #6412, #6414)
|
||||
|
||||
@@ -705,7 +705,7 @@ void Notebook::setShowAddButton(bool value)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ void DrawnButton::themeChangedEvent()
|
||||
switch (this->symbol)
|
||||
{
|
||||
case Symbol::Plus: {
|
||||
o.padding = 3;
|
||||
o.padding = 4;
|
||||
o.thickness = 1;
|
||||
|
||||
o.foreground = this->theme->messages.textColors.system;
|
||||
@@ -107,6 +107,21 @@ void DrawnButton::paintContent(QPainter &painter)
|
||||
QRect inner;
|
||||
inner.setSize(innerSize);
|
||||
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 bottom = inner.bottom();
|
||||
@@ -114,11 +129,9 @@ void DrawnButton::paintContent(QPainter &painter)
|
||||
auto left = inner.left();
|
||||
auto right = inner.right();
|
||||
|
||||
QLine vertical(center.x(), top + padding, center.x(),
|
||||
bottom - padding);
|
||||
QLine vertical(center.x(), top, center.x(), bottom);
|
||||
painter.drawLine(vertical);
|
||||
QLine horizontal(left + padding, center.y(), right - padding,
|
||||
center.y());
|
||||
QLine horizontal(left, center.y(), right, center.y());
|
||||
painter.drawLine(horizontal);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1101,9 +1101,10 @@ void SplitHeader::themeChangedEvent()
|
||||
}
|
||||
this->titleLabel_->setPalette(palette);
|
||||
|
||||
auto bg = this->theme->splits.header.background;
|
||||
this->addButton_->setOptions({
|
||||
.background = this->theme->messages.backgrounds.regular,
|
||||
.backgroundHover = this->theme->messages.backgrounds.regular,
|
||||
.background = bg,
|
||||
.backgroundHover = bg,
|
||||
});
|
||||
|
||||
this->update();
|
||||
|
||||
Reference in New Issue
Block a user