viewer: clean up some font related functions

This commit is contained in:
itsmattkc
2022-10-29 11:24:12 -07:00
parent b5bd73c314
commit 274687dbb3
2 changed files with 3 additions and 12 deletions
+3 -8
View File
@@ -40,7 +40,6 @@ ViewerTextEditor::ViewerTextEditor(double scale, QWidget *parent) :
super(parent),
transparent_clone_(nullptr),
block_update_toolbar_signal_(false),
listen_to_focus_events_(false),
forced_default_(false)
{
// Ensure default text color is white
@@ -208,10 +207,7 @@ void ViewerTextEditor::SetFamily(const QString &s)
ViewerTextEditorToolBar *toolbar = static_cast<ViewerTextEditorToolBar *>(sender());
QTextCharFormat f;
f.setFontFamily(s);
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
f.setFontFamilies({s});
#endif
ApplyStyle(&f, s, toolbar->GetFontStyleName());
@@ -271,9 +267,8 @@ void ViewerTextEditor::ApplyStyle(QTextCharFormat *format, const QString &family
{
// NOTE: Windows appears to require setting weight and italic manually, while macOS and Linux are
// perfectly fine with just the style name
QFontDatabase fd;
format->setFontWeight(fd.weight(family, style));
format->setFontItalic(fd.italic(family, style));
format->setFontWeight(QFontDatabase::weight(family, style));
format->setFontItalic(QFontDatabase::italic(family, style));
format->setFontStyleName(style);
}
@@ -541,7 +536,7 @@ void ViewerTextEditorToolBar::UpdateFontStyleList(const QString &family)
style_combo_->blockSignals(true);
style_combo_->clear();
QStringList l = QFontDatabase().styles(family);
QStringList l = QFontDatabase::styles(family);
foreach (const QString &style, l) {
style_combo_->addItem(style);
}