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).
This commit is contained in:
mae
2009-11-30 19:13:20 +01:00
parent a21ebf5475
commit b7635dda19
3 changed files with 10 additions and 1 deletions

View File

@@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
a = new QAction(tr("Reset Font Size"), this); 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); modecontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom())); connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));

View File

@@ -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() void BaseTextEditor::maybeSelectLine()
{ {
QTextCursor cursor = textCursor(); QTextCursor cursor = textCursor();

View File

@@ -418,6 +418,7 @@ protected:
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
void wheelEvent(QWheelEvent *e); void wheelEvent(QWheelEvent *e);
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
void focusOutEvent(QFocusEvent *e);
void showEvent(QShowEvent *); void showEvent(QShowEvent *);