From b7635dda193d73d1192792c10a8467770944b03a Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Mon, 30 Nov 2009 19:13:20 +0100 Subject: [PATCH] tune editor mouse cursor behaviour the fix makes the mouse cursor visible when the editor loses focus. This fixes an issue with the completion box, where on mac and windows no mouse cursor would be visible (it worked on X11 due to the way X11 does mouse grabbing for popup windows). --- src/plugins/help/helpplugin.cpp | 2 +- src/plugins/texteditor/basetexteditor.cpp | 8 ++++++++ src/plugins/texteditor/basetexteditor.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 625be439674..d905a538fd9 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); a = new QAction(tr("Reset Font Size"), this); - cmd = am->registerAction(a, TextEditor::Constants::DECREASE_FONT_SIZE, + cmd = am->registerAction(a, TextEditor::Constants::RESET_FONT_SIZE, modecontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0"))); connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom())); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 2e30a1487e8..2a20ed857c4 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4179,6 +4179,14 @@ void BaseTextEditor::changeEvent(QEvent *e) } } +void BaseTextEditor::focusOutEvent(QFocusEvent *e) +{ + QPlainTextEdit::focusOutEvent(e); + if (viewport()->cursor().shape() == Qt::BlankCursor) + viewport()->setCursor(Qt::IBeamCursor); +} + + void BaseTextEditor::maybeSelectLine() { QTextCursor cursor = textCursor(); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 092d6c7f4b8..6c135b86f3c 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -418,6 +418,7 @@ protected: void keyPressEvent(QKeyEvent *e); void wheelEvent(QWheelEvent *e); void changeEvent(QEvent *e); + void focusOutEvent(QFocusEvent *e); void showEvent(QShowEvent *); -- GitLab