From 449d410ce04e6bb4244e1c2d24e3c7433bcaaf1b Mon Sep 17 00:00:00 2001 From: fourtf Date: Fri, 1 Jun 2018 14:50:35 +0200 Subject: [PATCH] added minimuk size for tabs --- src/widgets/helper/notebooktab.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/widgets/helper/notebooktab.cpp b/src/widgets/helper/notebooktab.cpp index d992d4f7..917d2aaf 100644 --- a/src/widgets/helper/notebooktab.cpp +++ b/src/widgets/helper/notebooktab.cpp @@ -82,29 +82,24 @@ void NotebookTab::themeRefreshEvent() void NotebookTab::updateSize() { - auto app = getApp(); float scale = getScale(); int width; QFontMetrics metrics = getApp()->fonts->getFontMetrics( - FontStyle::UiTabs, this->getScale() * this->devicePixelRatioF()); + FontStyle::UiTabs, float(this->getScale() * this->devicePixelRatioF())); if (this->hasXButton()) { - width = (int)((metrics.width(this->title) + 32) * scale); + width = int((metrics.width(this->title) + 32) * scale); } else { - width = (int)((metrics.width(this->title) + 16) * scale); + width = int((metrics.width(this->title) + 16) * scale); } - width = std::min((int)(150 * scale), width); + width = std::max(this->height(), std::min(int(150 * scale), width)); if (this->width() != width) { - this->resize(width, (int)(NOTEBOOK_TAB_HEIGHT * scale)); + this->resize(width, int(NOTEBOOK_TAB_HEIGHT * scale)); this->notebook->performLayout(); } - - // if (this->parent() != nullptr) { - // (static_cast(this->parent()))->performLayout(true); - // } } const QString &NotebookTab::getTitle() const