diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4e5972..f417f7ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index f70d9417..7aa08b01 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -705,7 +705,7 @@ void Notebook::setShowAddButton(bool value) void Notebook::resizeAddButton() { - float h = (NOTEBOOK_TAB_HEIGHT - 1) * this->scale(); + int h = static_cast((NOTEBOOK_TAB_HEIGHT - 1) * this->scale()); this->addButton_->setFixedSize(h, h); } diff --git a/src/widgets/buttons/DrawnButton.cpp b/src/widgets/buttons/DrawnButton.cpp index 3e28149e..afa2da5e 100644 --- a/src/widgets/buttons/DrawnButton.cpp +++ b/src/widgets/buttons/DrawnButton.cpp @@ -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; diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 26740e6a..cabe695d 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -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();