Skip to content

Commit

Permalink
switch edit box base class
Browse files Browse the repository at this point in the history
the base class of EditBox was changed from the more complex QTextEdit
to the simpler QPlainTextEdit class
  • Loading branch information
thunder422 committed Feb 2, 2013
1 parent 8cf236c commit 497c46a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions editbox.cpp
Expand Up @@ -31,21 +31,18 @@


EditBox::EditBox(QWidget *parent) :
QTextEdit(parent),
QPlainTextEdit(parent),
m_lineModified(-1),
m_lineModType(LineChanged),
m_undoActive(false),
m_ignoreChange(false)
{
// set to only paste plain text into the edit box
setAcceptRichText(false);

// set the edit box to a fixed width font
QFont font = currentFont();
QFont font = this->font();
font.setFixedPitch(true);
font.setFamily("Monospace");
font.setStyleHint(QFont::Monospace);
setCurrentFont(font);
setFont(font);

// connect to catch document changes
connect(document(), SIGNAL(contentsChanged()),
Expand Down Expand Up @@ -112,7 +109,7 @@ void EditBox::keyPressEvent(QKeyEvent *event)
}
}
}
QTextEdit::keyPressEvent(event);
QPlainTextEdit::keyPressEvent(event);
}


Expand Down Expand Up @@ -211,7 +208,7 @@ void EditBox::undo(void)
m_ignoreChange = true;
}
int line = textCursor().blockNumber();
QTextEdit::undo();
QPlainTextEdit::undo();
m_ignoreChange = false; // reset flag if still set

if (line != textCursor().blockNumber())
Expand Down Expand Up @@ -251,7 +248,7 @@ void EditBox::redo(void)
{
m_ignoreChange = true;
}
QTextEdit::redo();
QPlainTextEdit::redo();
m_ignoreChange = false; // reset flag if still set

if (m_lineModified == -1)
Expand Down
4 changes: 2 additions & 2 deletions editbox.h
Expand Up @@ -25,11 +25,11 @@
#ifndef EDITBOX_H
#define EDITBOX_H

#include <QTextEdit>
#include <QPlainTextEdit>

class QEvent;

class EditBox : public QTextEdit
class EditBox : public QPlainTextEdit
{
Q_OBJECT
public:
Expand Down

0 comments on commit 497c46a

Please sign in to comment.