diff --git a/src/editor.h b/src/editor.h index b229523f..ecd20d91 100644 --- a/src/editor.h +++ b/src/editor.h @@ -15,7 +15,7 @@ public: virtual ~EditorInterface() {} virtual QSize sizeHint(){ QSize size; return size;} virtual void setInitialSizeHint(const QSize&) { } - virtual void wheelEvent (QWheelEvent*) { } + virtual void wheelEvent(QWheelEvent*) { } virtual void setTabStopWidth(int) { } virtual QString toPlainText() = 0; virtual QTextDocument *document(){QTextDocument *t = new QTextDocument; return t;} diff --git a/src/legacyeditor.cc b/src/legacyeditor.cc index b228071a..53c2f8d2 100644 --- a/src/legacyeditor.cc +++ b/src/legacyeditor.cc @@ -15,7 +15,7 @@ LegacyEditor::LegacyEditor(QWidget *parent) : EditorInterface(parent) this->highlighter = new Highlighter(this->textedit->document()); - connect(this->textedit, SIGNAL(textChanged()), this, SIGNAL(textChanged())); + connect(this->textedit, SIGNAL(textChanged()), this, SIGNAL(contentsChanged())); connect(this->textedit, SIGNAL(modificationChanged(bool)), this, SIGNAL(modificationChanged(bool))); } @@ -95,12 +95,12 @@ void LegacyEditor::zoomIn() // See also QT's implementation in QLegacyEditor.cpp QSettings settings; QFont tmp_font = this->font() ; - if ( font().pointSize() >= 1 ) - tmp_font.setPointSize( 1 + font().pointSize() ); + if (font().pointSize() >= 1) + tmp_font.setPointSize(1 + font().pointSize()); else - tmp_font.setPointSize( 1 ); + tmp_font.setPointSize(1); settings.setValue("editor/fontsize", tmp_font.pointSize()); - this->setFont( tmp_font ); + this->setFont(tmp_font); } void LegacyEditor::zoomOut() @@ -108,26 +108,26 @@ void LegacyEditor::zoomOut() QSettings settings; QFont tmp_font = this->font(); - if ( font().pointSize() >= 2 ) - tmp_font.setPointSize( -1 + font().pointSize() ); + if (font().pointSize() >= 2) + tmp_font.setPointSize(-1 + font().pointSize()); else - tmp_font.setPointSize( 1 ); + tmp_font.setPointSize(1); settings.setValue("editor/fontsize", tmp_font.pointSize()); - this->setFont( tmp_font ); + this->setFont(tmp_font); } -void LegacyEditor::wheelEvent ( QWheelEvent * event ) +void LegacyEditor::wheelEvent(QWheelEvent *event) { QSettings settings; bool wheelzoom_enabled = Preferences::inst()->getValue("editor/ctrlmousewheelzoom").toBool(); - if ((event->modifiers() == Qt::ControlModifier) && wheelzoom_enabled ) { - if (event->delta() > 0 ) + if ((event->modifiers() == Qt::ControlModifier) && wheelzoom_enabled) { + if (event->delta() > 0) zoomIn(); - else if (event->delta() < 0 ) + else if (event->delta() < 0) zoomOut(); } else { - QWidget::wheelEvent( event ); + QWidget::wheelEvent(event); } } @@ -149,10 +149,10 @@ void LegacyEditor::setPlainText(const QString &text) void LegacyEditor::highlightError(int error_pos) { - highlighter->highlightError( error_pos ); + highlighter->highlightError(error_pos); QTextCursor cursor = this->textCursor(); - cursor.setPosition( error_pos ); - this->setTextCursor( cursor ); + cursor.setPosition(error_pos); + this->setTextCursor(cursor); } @@ -163,7 +163,7 @@ void LegacyEditor::unhighlightLastError() void LegacyEditor::setHighlightScheme(const QString &name) { - highlighter->assignFormatsToTokens( name ); + highlighter->assignFormatsToTokens(name); highlighter->rehighlight(); // slow on large files } diff --git a/src/legacyeditor.h b/src/legacyeditor.h index b7f04e77..46b0620d 100644 --- a/src/legacyeditor.h +++ b/src/legacyeditor.h @@ -19,7 +19,7 @@ public: QSize sizeHint() const; void setInitialSizeHint(const QSize&); void setTabStopWidth(int); - void wheelEvent (QWheelEvent*); + void wheelEvent(QWheelEvent*); QString toPlainText(); QTextCursor textCursor() const; void setTextCursor (const QTextCursor&);