git-svn-id: svn://db.shs.com.ru/libs@19 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
prev_lc = auto_comp_pl = -1;
|
||||
textCode = textLines = 0;
|
||||
|
||||
timer = 0;
|
||||
_ignore_focus_out = false;
|
||||
_first = true;
|
||||
es_line.format.setBackground(QColor(240, 245, 240));
|
||||
es_line.format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||
completer.setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
@@ -24,7 +26,6 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
completer.setColumnCount(2);
|
||||
completer.setRootIsDecorated(false);
|
||||
completer.setHeaderHidden(true);
|
||||
completer.installEventFilter(this);
|
||||
completer.header()->setDefaultAlignment(Qt::AlignCenter);
|
||||
completer.header()->
|
||||
#if (QT_VERSION >= 0x050000)
|
||||
@@ -42,8 +43,6 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
textCode->setFrameShape(QFrame::NoFrame);
|
||||
textCode->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
textCode->setTabChangesFocus(false);
|
||||
textCode->installEventFilter(this);
|
||||
textCode->viewport()->installEventFilter(this);
|
||||
textLines->setFrameShadow(QFrame::Plain);
|
||||
textLines->setFrameShape(QFrame::NoFrame);
|
||||
textLines->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
@@ -54,7 +53,6 @@ QCodeEdit::QCodeEdit(QWidget * parent): QWidget(parent) {
|
||||
textLines->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
textLines->viewport()->setAutoFillBackground(false);
|
||||
textLines->viewport()->setCursor(Qt::ArrowCursor);
|
||||
textLines->viewport()->installEventFilter(this);
|
||||
textLines->setFixedWidth(textLines->fontMetrics().width(" "));
|
||||
setLayout(new QBoxLayout(QBoxLayout::BottomToTop));
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
@@ -311,6 +309,16 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) {
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::showEvent(QShowEvent * ) {
|
||||
if (!_first) return;
|
||||
_first = false;
|
||||
completer.installEventFilter(this);
|
||||
textCode->installEventFilter(this);
|
||||
textCode->viewport()->installEventFilter(this);
|
||||
textLines->viewport()->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
||||
void QCodeEdit::timerEvent(QTimerEvent * ) {
|
||||
parse();
|
||||
emit parseRequest();
|
||||
|
||||
Reference in New Issue
Block a user