aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp16
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp3
2 files changed, 12 insertions, 7 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
index 40ff2c71..e6c523ee 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
@@ -213,6 +213,9 @@ void MainUI::OpenFile(QString file){
edit->showLineNumbers(ui->actionLine_Numbers->isChecked());
edit->setLineWrapMode( ui->actionWrap_Lines->isChecked() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
edit->setFocusPolicy(Qt::ClickFocus); //no "tabbing" into this widget
+ QFont font = fontbox->currentFont();
+ font.setPointSize( fontSizes->value() );
+ edit->document()->setDefaultFont(font);
}
tabWidget->setCurrentWidget(edit);
edit->LoadFile(files[i]);
@@ -238,17 +241,20 @@ void MainUI::SaveFileAs(){
cur->SaveFile(true);
}
-void MainUI::fontChanged(const QFont &font){
+void MainUI::fontChanged(const QFont&){
+ if(currentEditor()==0){ return; }
//Save this font for later
+ QFont font = fontbox->currentFont();
+ font.setPointSize( fontSizes->value() );
settings->setValue("lastfont", font.toString());
- //Now apply this font to all the open editors
- //QApplication::setFont(font, "PlainTextEditor");
+ currentEditor()->document()->setDefaultFont(font);
}
void MainUI::changeFontSize(int newFontSize){
- QFont currentFont = fontbox->currentFont();
+ if(currentEditor()==0){ return; }
+ QFont currentFont = currentEditor()->document()->defaultFont();
currentFont.setPointSize(newFontSize);
- //QApplication::setFont(currentFont, "PlainTextEditor");
+ currentEditor()->document()->setDefaultFont(currentFont);
}
void MainUI::changeTabsLocation(QAction *act){
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
index 9c264fca..46ca056b 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
@@ -61,8 +61,7 @@ void SyntaxFile::SetupDocument(QPlainTextEdit* editor){
QString type = formatObj.value("font_type").toString();
QFont font = editor->document()->defaultFont(); // current font
if(type=="monospace"){
- font = QFont("monospace");
- //font = QFontDatabase::systemFont(QFontDatabase::FixedFont); //get the default fixed-size font for the system
+ font.setFamily("monospace"); //Make sure we don't change other properties of the font like size
}
font.setStyle(QFont::StyleNormal);
font.setStyleStrategy(QFont::PreferAntialias);
bgstack15