aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp7
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp13
2 files changed, 13 insertions, 7 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
index 41fc6788..c8d5cbc2 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
@@ -303,10 +303,12 @@ void MainUI::showLineNumbers(bool show){
void MainUI::wrapLines(bool wrap){
settings->setValue("wrapLines",wrap);
- for(int i=0; i<tabWidget->count(); i++){
+ if(currentEditor() == 0){ return; }
+ currentEditor()->setLineWrapMode( wrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
+ /*for(int i=0; i<tabWidget->count(); i++){
PlainTextEditor *edit = static_cast<PlainTextEditor*>(tabWidget->widget(i));
edit->setLineWrapMode( wrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
- }
+ }*/
}
void MainUI::ModifyColors(){
@@ -353,6 +355,7 @@ void MainUI::tabChanged(){
//Update the font/size widgets to reflect what is set on this tab
fontbox->setCurrentFont(font);
fontSizes->setValue( font.pointSize() );
+ ui->actionWrap_Lines->setChecked( cur->lineWrapMode()==QPlainTextEdit::WidgetWidth );
}
void MainUI::tabClosed(int tab){
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 865798e2..57bc35a6 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -134,13 +134,16 @@ int PlainTextEditor::LNWWidth(){
int lines = this->blockCount();
if(lines<1){ lines = 1; }
int chars = 1;
- qDebug() << "point 1" << this->document()->defaultFont();
+ //qDebug() << "point 1" << this->document()->defaultFont();
while(lines>=10){ chars++; lines/=10; }
QFontMetrics metrics(this->document()->defaultFont());
return (metrics.width("9")*chars); //make sure to add a tiny bit of padding
}
void PlainTextEditor::paintLNW(QPaintEvent *ev){
+ //qDebug() << "Paint LNW Event:" << ev->rect() << LNW->geometry();
+ //if(ev->rect().height() < (QFontMetrics(this->document()->defaultFont()).height() *1.5) ){ return; }
+ //qDebug() << " -- paint line numbers";
QPainter P(LNW);
//First set the background color
P.fillRect(ev->rect(), QColor("lightgrey"));
@@ -153,15 +156,15 @@ void PlainTextEditor::paintLNW(QPaintEvent *ev){
P.setFont(this->document()->defaultFont());
//Now loop over the blocks (lines) and write in the numbers
QFontMetrics metrics(this->document()->defaultFont());
- qDebug() << "point 2" << this->document()->defaultFont();
+ //qDebug() << "point 2" << this->document()->defaultFont();
P.setPen(Qt::black); //setup the font color
while(block.isValid() && bTop<=ev->rect().bottom()){ //ensure block below top of viewport
bBottom = bTop+blockBoundingRect(block).height();
if(block.isVisible() && bBottom >= ev->rect().top()){ //ensure block above bottom of viewport
P.drawText(0,bTop, LNW->width(), metrics.height(), Qt::AlignRight, QString::number(block.blockNumber()+1) );
- qDebug() << "bTop" << bTop;
- qDebug() << "LNW->width()" << LNW->width();
- qDebug() << "metrics.height()" << metrics.height();
+ //qDebug() << "bTop" << bTop;
+ //qDebug() << "LNW->width()" << LNW->width();
+ //qDebug() << "metrics.height()" << metrics.height();
}
//Go to the next block
block = block.next();
bgstack15