diff options
author | Ken Moore <ken@pcbsd.org> | 2016-09-12 10:47:47 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2016-09-12 10:47:47 -0400 |
commit | 11f26a3cb825823f2e89b2b3d2a5a1a34965d73e (patch) | |
tree | 548315c7ab55de2b984e206ffb0291efa032ccd6 /src-qt5/desktop-utils/lumina-textedit | |
parent | Add a font selector option to LTE, so monospaced fonts can be used as needed ... (diff) | |
download | lumina-11f26a3cb825823f2e89b2b3d2a5a1a34965d73e.tar.gz lumina-11f26a3cb825823f2e89b2b3d2a5a1a34965d73e.tar.bz2 lumina-11f26a3cb825823f2e89b2b3d2a5a1a34965d73e.zip |
Add status tips for the cursor position.
Now you can see which column the cursor is on if the user needs to keep under a particular number.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit')
4 files changed, 19 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index aacb0424..1dd8cd2f 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -159,6 +159,7 @@ void MainUI::OpenFile(QString file){ PlainTextEditor *edit = new PlainTextEditor(settings, this); connect(edit, SIGNAL(FileLoaded(QString)), this, SLOT(updateTab(QString)) ); connect(edit, SIGNAL(UnsavedChanges(QString)), this, SLOT(updateTab(QString)) ); + connect(edit, SIGNAL(statusTipChanged()), this, SLOT(updateStatusTip()) ); ui->tabWidget->addTab(edit, files[i].section("/",-1)); edit->showLineNumbers(ui->actionLine_Numbers->isChecked()); edit->setLineWrapMode( ui->actionWrap_Lines->isChecked() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap); @@ -194,6 +195,12 @@ void MainUI::fontChanged(const QFont &font){ QApplication::setFont(font, "PlainTextEditor"); } +void MainUI::updateStatusTip(){ + QString msg = currentEditor()->statusTip(); + //ui->statusbar->clearMessage(); + ui->statusbar->showMessage(msg); +} + void MainUI::UpdateHighlighting(QAction *act){ if(act!=0){ //Single-editor change diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h index fd42428c..78eb5ad7 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h @@ -50,6 +50,7 @@ private slots: void SaveFile(); void SaveFileAs(); void fontChanged(const QFont &font); + void updateStatusTip(); //Other Menu Actions void UpdateHighlighting(QAction *act = 0); diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp index d79bdc5f..99a0ed75 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp @@ -35,6 +35,7 @@ PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEd connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(LNW_highlightLine()) ); connect(this, SIGNAL(updateRequest(const QRect&, int)), this, SLOT(LNW_update(const QRect&, int)) ); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(checkMatchChar()) ); + connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorMoved()) ); connect(this, SIGNAL(textChanged()), this, SLOT(textChanged()) ); connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged()) ); LNW_updateWidth(); @@ -282,6 +283,14 @@ void PlainTextEditor::textChanged(){ else{ emit FileLoaded(this->whatsThis()); } } +void PlainTextEditor::cursorMoved(){ + //Update the status tip for the editor to show the row/column number for the cursor + QTextCursor cur = this->textCursor(); + QString stat = tr("Row Number: %1, Column Number: %2"); + this->setStatusTip(stat.arg(QString::number(cur.blockNumber()+1) , QString::number(cur.columnNumber()) ) ); + emit statusTipChanged(); +} + //Function for prompting the user if the file changed externally void PlainTextEditor::fileChanged(){ qDebug() << "File Changed:" << currentFile(); diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h index 075ed742..64ff256b 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h @@ -63,6 +63,7 @@ private slots: void checkMatchChar(); //Functions for notifying the parent widget of changes void textChanged(); + void cursorMoved(); //Function for prompting the user if the file changed externally void fileChanged(); @@ -72,7 +73,7 @@ protected: signals: void UnsavedChanges(QString); //filename void FileLoaded(QString); - + void statusTipChanged(); }; //=========================================================== |