Skip to content

Commit

Permalink
- Update LineNumberArea whenever ModelicaEditor setPlainText is calle…
Browse files Browse the repository at this point in the history
…d. Otherwise the ModelicaEditor hides on the left side.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10139 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 17, 2011
1 parent 07d7cf6 commit 97fa78f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion OMEdit/OMEditGUI/ModelicaEditor.cpp
Expand Up @@ -46,6 +46,7 @@ ModelicaEditor::ModelicaEditor(ProjectTab *pParent)
setTabStopWidth(Helper::tabWidth);
setObjectName(tr("ModelicaEditor"));
document()->setDocumentMargin(2);
setLineWrapMode(QPlainTextEdit::NoWrap);
// depending on the project tab readonly state set the text view readonly state
setReadOnly(mpParentProjectTab->isReadOnly());
connect(this, SIGNAL(focusOut()), mpParentProjectTab, SLOT(modelicaEditorTextChanged()));
Expand Down Expand Up @@ -273,7 +274,6 @@ void ModelicaEditor::highlightCurrentLine()
selection.cursor.clearSelection();
extraSelections.append(selection);
setExtraSelections(extraSelections);
setTextCursor(textCursor());
}

//! Slot activated when ModelicaEditor updateRequest signal is raised.
Expand Down Expand Up @@ -332,7 +332,10 @@ void ModelicaEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
void ModelicaEditor::setPlainText(const QString &text)
{
if (text != toPlainText())
{
QPlainTextEdit::setPlainText(text);
updateLineNumberAreaWidth(0);
}
}

//! Slot activated when ModelicaEditor textChanged signal is raised.
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/ModelicaEditor.h
Expand Up @@ -70,7 +70,7 @@ class ModelicaEditor : public QPlainTextEdit
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void highlightCurrentLine();
void updateLineNumberArea(const QRect &, int);
void updateLineNumberArea(const QRect &rect, int dy);
public slots:
void setPlainText(const QString &text);
void hasChanged();
Expand Down

0 comments on commit 97fa78f

Please sign in to comment.