From 8c57d6137818cbd6a766e11e8e1799afb692002d Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 19 Apr 2016 12:18:55 -0400 Subject: Some more work on lumina-textedit. --- desktop-utilities/lumina-textedit/MainUI.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'desktop-utilities/lumina-textedit/MainUI.cpp') diff --git a/desktop-utilities/lumina-textedit/MainUI.cpp b/desktop-utilities/lumina-textedit/MainUI.cpp index 53fa0ca6..d477071d 100644 --- a/desktop-utilities/lumina-textedit/MainUI.cpp +++ b/desktop-utilities/lumina-textedit/MainUI.cpp @@ -27,6 +27,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->menuSyntax_Highlighting->addAction(smodes[i]); } ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() ); + ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() ); //Setup any connections connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) ); connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) ); @@ -38,6 +39,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()) ); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) ); connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) ); + connect(ui->actionWrap_Lines, SIGNAL(toggled(bool)), this, SLOT(wrapLines(bool)) ); connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) ); updateIcons(); //Now load the initial size of the window @@ -115,6 +117,7 @@ void MainUI::OpenFile(QString file){ connect(edit, SIGNAL(UnsavedChanges(QString)), this, SLOT(updateTab(QString)) ); ui->tabWidget->addTab(edit, files[i].section("/",-1)); edit->showLineNumbers(ui->actionLine_Numbers->isChecked()); + edit->setLineWrapMode( ui->actionWrap_Lines->isChecked() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap); ui->tabWidget->setCurrentWidget(edit); edit->LoadFile(files[i]); edit->setFocus(); @@ -153,6 +156,14 @@ void MainUI::showLineNumbers(bool show){ } } +void MainUI::wrapLines(bool wrap){ + settings->setValue("wrapLines",wrap); + for(int i=0; itabWidget->count(); i++){ + PlainTextEditor *edit = static_cast(ui->tabWidget->widget(i)); + edit->setLineWrapMode( wrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap); + } +} + void MainUI::ModifyColors(){ } -- cgit