mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
ed32dcc677
Since the Yami QSS changes the default font for widgets, we need to force the system fixed font for plain text edits.
20 lines
512 B
C++
20 lines
512 B
C++
#include "plain-text-edit.hpp"
|
|
#include <QFontDatabase>
|
|
|
|
OBSPlainTextEdit::OBSPlainTextEdit(QWidget *parent, bool monospace)
|
|
: QPlainTextEdit(parent)
|
|
{
|
|
// Fix display of tabs & multiple spaces
|
|
document()->setDefaultStyleSheet("font { white-space: pre; }");
|
|
|
|
if (monospace) {
|
|
const QFont fixedFont =
|
|
QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
|
|
|
setStyleSheet(
|
|
QString("font-family: %1; font-size: %2pt;")
|
|
.arg(fixedFont.family(),
|
|
QString::number(fixedFont.pointSize())));
|
|
}
|
|
}
|