diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-11-30 21:30:40 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-11-30 21:30:40 (GMT) |
commit | 75692592e49da1af2b1c8857298ca7085cd5b3d5 (patch) | |
tree | 33e5ee1aae1b9eb4514d735f00281a21f17325a0 /src | |
parent | fd715c6526e961cb7f3d6ba6a0563788d7d1674d (diff) | |
parent | f175bae46a8f15823780c5a9c89b11476acb3107 (diff) |
Merge branch 'master' into issue410x
Diffstat (limited to 'src')
-rw-r--r-- | src/editor.cc | 14 | ||||
-rw-r--r-- | src/editor.h | 2 | ||||
-rw-r--r-- | src/mainwin.cc | 1 | ||||
-rw-r--r-- | src/version_check.h | 8 |
4 files changed, 25 insertions, 0 deletions
diff --git a/src/editor.cc b/src/editor.cc index 08bf005..069101f 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -108,3 +108,17 @@ void Editor::wheelEvent ( QWheelEvent * event ) } } +void Editor::setPlainText(const QString &text) +{ + int y = verticalScrollBar()->sliderPosition(); + // Save current cursor position + QTextCursor cursor = textCursor(); + int n = cursor.position(); + QTextEdit::setPlainText(text); + // Restore cursor position + if (n < text.length()) { + cursor.setPosition(n); + setTextCursor(cursor); + verticalScrollBar()->setSliderPosition(y); + } +} diff --git a/src/editor.h b/src/editor.h index 09484f5..8d092a9 100644 --- a/src/editor.h +++ b/src/editor.h @@ -2,6 +2,7 @@ #include <QString> #include <QWidget> #include <QWheelEvent> +#include <QScrollBar> #include <QTextEdit> class Editor : public QTextEdit @@ -9,6 +10,7 @@ class Editor : public QTextEdit Q_OBJECT public: Editor(QWidget *parent) : QTextEdit(parent) { setAcceptRichText(false); } + void setPlainText(const QString &text); public slots: void zoomIn(); void zoomOut(); diff --git a/src/mainwin.cc b/src/mainwin.cc index 5b986b1..1ad8bc8 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -504,6 +504,7 @@ MainWindow::openFile(const QString &new_filename) } #endif setFileName(actual_filename); + editor->setPlainText(""); fileChangedOnDisk(); // force cached autoReloadId to update refreshDocument(); diff --git a/src/version_check.h b/src/version_check.h index 86e769c..fbea077 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -108,5 +108,13 @@ a time, to avoid confusion. #endif // MPFR #endif // GMP +// see github issue #552 +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +#if GCC_VERSION == 40802 +#error OpenSCAD isn't compatible with gcc 4.8.2. Please try a different version +#endif + #endif // OPENSCAD_SKIP_VERSION_CHECK |