aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-06-09 14:26:35 -0400
committerKen Moore <ken@ixsystems.com>2017-06-09 14:26:35 -0400
commit1a40663edebd0cdc4a0ebea6bfe4f0c95f362b02 (patch)
treeb2d5a1710c1a21c59304b5b7ec005a17644ec0e3 /src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
parentGet the new syntax highlighting support framework functional with the C++ rul... (diff)
downloadlumina-1a40663edebd0cdc4a0ebea6bfe4f0c95f362b02.tar.gz
lumina-1a40663edebd0cdc4a0ebea6bfe4f0c95f362b02.tar.bz2
lumina-1a40663edebd0cdc4a0ebea6bfe4f0c95f362b02.zip
Clean up the loading/changing of font family/size (still need to update the font boxes to reflect the currently visible tab).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/MainUI.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp16
1 files changed, 11 insertions, 5 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){
bgstack15