Fixed deprecated method QFontMetrics::width (#2509)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-03-13 14:47:02 +01:00
committed by GitHub
parent d94d9e74dd
commit 0e99527e8c
5 changed files with 19 additions and 16 deletions
+3 -3
View File
@@ -119,11 +119,11 @@ int NotebookTab::normalTabWidth()
if (this->hasXButton())
{
width = (metrics.width(this->getTitle()) + int(32 * scale));
width = (metrics.horizontalAdvance(this->getTitle()) + int(32 * scale));
}
else
{
width = (metrics.width(this->getTitle()) + int(16 * scale));
width = (metrics.horizontalAdvance(this->getTitle()) + int(16 * scale));
}
if (this->height() > 150 * scale)
@@ -390,7 +390,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
textRect.setRight(textRect.right() - this->height() / 2);
}
int width = metrics.width(this->getTitle());
int width = metrics.horizontalAdvance(this->getTitle());
Qt::Alignment alignment = width > textRect.width()
? Qt::AlignLeft | Qt::AlignVCenter
: Qt::AlignHCenter | Qt::AlignVCenter;