forked from qt-creator/qt-creator
TextEditorWidget: Simplify code
* Prevent potential nullptr access while at it. Change-Id: Icee9e711b8a09b11e5644b0643d4751909b96101 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -2617,17 +2617,21 @@ void TextEditorWidget::convertPosition(int pos, int *line, int *column) const
|
||||
|
||||
bool TextEditorWidget::event(QEvent *e)
|
||||
{
|
||||
if (!d)
|
||||
return QPlainTextEdit::event(e);
|
||||
|
||||
// FIXME: That's far too heavy, and triggers e.g for ChildEvent
|
||||
if (d && e->type() != QEvent::InputMethodQuery)
|
||||
d->m_contentsChanged = false;
|
||||
switch (e->type()) {
|
||||
case QEvent::InputMethodQuery:
|
||||
d->m_contentsChanged = false;
|
||||
break;
|
||||
case QEvent::ShortcutOverride:
|
||||
if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape && d->m_snippetOverlay->isVisible()) {
|
||||
e->accept();
|
||||
return true;
|
||||
} else {
|
||||
e->ignore(); // we are a really nice citizen
|
||||
d->m_maybeFakeTooltipEvent = false;
|
||||
}
|
||||
e->ignore(); // we are a really nice citizen
|
||||
d->m_maybeFakeTooltipEvent = false;
|
||||
return true;
|
||||
case QEvent::ApplicationPaletteChange: {
|
||||
// slight hack: ignore palette changes
|
||||
|
Reference in New Issue
Block a user