From 2faf24e3d5a1a7124a575ddd8d4f82f090fca853 Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 1 Nov 2018 10:16:55 +0100 Subject: [PATCH] improved rendering of notebook tab with scaling --- src/widgets/Notebook.cpp | 2 +- src/widgets/helper/NotebookTab.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 540aea934..48bc558fe 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -395,7 +395,7 @@ void Notebook::performLayout(bool animated) /// Layout tab item.tab->moveAnimated(QPoint(x, y), animated); - x += item.tab->width() + int(scale * 1); + x += item.tab->width() + std::max(1, int(scale * 1)); } /// Update which tabs are in the last row diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index c57d44b18..5b3d09551 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -300,14 +300,14 @@ void NotebookTab::paintEvent(QPaintEvent *) // fill the tab background auto bgRect = rect(); - bgRect.setTop(bgRect.top() + 2); + bgRect.setTop(ceil((this->selected_ ? 0.f : 1.f) * scale)); painter.fillRect(bgRect, tabBackground); // top line painter.fillRect( - QRectF(0, (this->selected_ ? 0.f : 1.f) * scale, this->width(), - (this->selected_ ? 2.f : 1.f) * scale), + QRectF(0, ceil((this->selected_ ? 0.f : 1.f) * scale), this->width(), + ceil((this->selected_ ? 2.f : 1.f) * scale)), this->mouseOver_ ? colors.line.hover : (windowFocused ? colors.line.regular : colors.line.unfocused));