fix: turn on "auto hide scroller" will crash app.
This commit is contained in:
parent
92d7916288
commit
bae50693b9
|
@ -41,6 +41,8 @@
|
|||
#include <QTextEdit>
|
||||
#include <QMimeData>
|
||||
|
||||
#define MAX_LINE_WIDTH_CHANGED_EVENT ((QEvent::Type)(QEvent::User+1))
|
||||
|
||||
namespace QSynedit {
|
||||
QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
||||
mEditingCount{0},
|
||||
|
@ -70,7 +72,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
connect(mDocument.get(), &Document::inserted, this, &QSynEdit::onLinesInserted);
|
||||
connect(mDocument.get(), &Document::putted, this, &QSynEdit::onLinesPutted);
|
||||
connect(mDocument.get(), &Document::maxLineWidthChanged,
|
||||
this, &QSynEdit::updateHScrollbar);
|
||||
this, &QSynEdit::onMaxLineWidthChanged);
|
||||
connect(mDocument.get(), &Document::cleared, this, &QSynEdit::updateVScrollbar);
|
||||
connect(mDocument.get(), &Document::deleted, this, &QSynEdit::updateVScrollbar);
|
||||
connect(mDocument.get(), &Document::inserted, this, &QSynEdit::updateVScrollbar);
|
||||
|
@ -1743,6 +1745,12 @@ QString QSynEdit::getDisplayStringAtLine(int line) const
|
|||
return s;
|
||||
}
|
||||
|
||||
void QSynEdit::onMaxLineWidthChanged()
|
||||
{
|
||||
QEvent * event = new QEvent(MAX_LINE_WIDTH_CHANGED_EVENT);
|
||||
qApp->postEvent(this,event);
|
||||
}
|
||||
|
||||
void QSynEdit::doDeleteLastChar()
|
||||
{
|
||||
if (mReadOnly)
|
||||
|
@ -5952,6 +5960,9 @@ void QSynEdit::timerEvent(QTimerEvent *event)
|
|||
bool QSynEdit::event(QEvent *event)
|
||||
{
|
||||
switch(event->type()) {
|
||||
case MAX_LINE_WIDTH_CHANGED_EVENT:
|
||||
updateHScrollbar();
|
||||
break;
|
||||
case QEvent::KeyPress:{
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if(keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab)
|
||||
|
|
|
@ -650,6 +650,7 @@ private:
|
|||
|
||||
|
||||
private slots:
|
||||
void onMaxLineWidthChanged();
|
||||
void onBookMarkOptionsChanged();
|
||||
void onGutterChanged();
|
||||
void onLinesChanged();
|
||||
|
|
Loading…
Reference in New Issue