From b31acc2e53202c20cdce752bd5b7b28aec9387d5 Mon Sep 17 00:00:00 2001 From: Denis Mulalic Date: Tue, 4 Apr 2017 13:11:09 -0600 Subject: added font size box --- src-qt5/desktop-utils/lumina-textedit/MainUI.cpp | 11 +++++++++++ src-qt5/desktop-utils/lumina-textedit/MainUI.h | 3 +++ src-qt5/desktop-utils/lumina-textedit/main.cpp | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index b5790cc5..49314e1f 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -24,8 +24,12 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ fontbox->setFocusPolicy(Qt::NoFocus); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + fontSizes = new QSpinBox(this); + fontSizes->setRange(5, 72); + fontSizes->setValue(9); ui->toolBar->addWidget(spacer); ui->toolBar->addWidget(fontbox); + ui->toolBar->addWidget(fontSizes); //Load settings settings = new QSettings("lumina-desktop","lumina-textedit"); if(settings->contains("lastfont")){ @@ -77,6 +81,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ connect(ui->line_replace, SIGNAL(returnPressed()), this, SLOT(replaceOne()) ); connect(colorDLG, SIGNAL(colorsChanged()), this, SLOT(UpdateHighlighting()) ); connect(fontbox, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(fontChanged(const QFont&)) ); + connect(fontSizes, SIGNAL(valueChanged(int)), this, SLOT(changeFontSize(int))); updateIcons(); //Now load the initial size of the window QSize lastSize = settings->value("lastSize",QSize()).toSize(); @@ -212,6 +217,12 @@ void MainUI::fontChanged(const QFont &font){ QApplication::setFont(font, "PlainTextEditor"); } +void MainUI::changeFontSize(int newFontSize){ + QFont currentFont = fontbox->currentFont(); + currentFont.setPointSize(newFontSize); + QApplication::setFont(currentFont, "PlainTextEditor"); +} + void MainUI::updateStatusTip(){ QString msg = currentEditor()->statusTip(); //ui->statusbar->clearMessage(); diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h index 097b747e..69ea589c 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h @@ -12,6 +12,7 @@ #include #include #include +#include #include "PlainTextEditor.h" #include "ColorDialog.h" @@ -37,6 +38,7 @@ private: ColorDialog *colorDLG; QSettings *settings; QShortcut *closeFindS; + QSpinBox *fontSizes; //Simplification functions PlainTextEditor* currentEditor(); @@ -51,6 +53,7 @@ private slots: void SaveFileAs(); void fontChanged(const QFont &font); void updateStatusTip(); + void changeFontSize(int newFontSize); //Other Menu Actions void UpdateHighlighting(QAction *act = 0); diff --git a/src-qt5/desktop-utils/lumina-textedit/main.cpp b/src-qt5/desktop-utils/lumina-textedit/main.cpp index ec4503a0..61f6672e 100644 --- a/src-qt5/desktop-utils/lumina-textedit/main.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/main.cpp @@ -18,12 +18,14 @@ int main(int argc, char *argv[]) { LUtils::LoadTranslation(&a, "l-te"); //Now go ahead and setup the app //LuminaThemeEngine theme(&a); - QStringList args; + QStringList args; //list in c++11 stl container. for(int i=1; i