Commit f335da7a authored by Eike Ziller's avatar Eike Ziller

Editors: Add option to not hide the mouse cursor when typing

Task-number: QTCREATORBUG-3584

Change-Id: Iae5551d36b72c5712f3276b15dfa85982a776dcf
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent def888d1
......@@ -1508,7 +1508,7 @@ static inline bool isModifier(QKeyEvent *e)
void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
{
if (!isModifier(e))
if (!isModifier(e) && mouseHidingEnabled())
viewport()->setCursor(Qt::BlankCursor);
ToolTip::hide();
......@@ -2268,6 +2268,16 @@ bool BaseTextEditorWidget::mouseNavigationEnabled() const
return d->m_behaviorSettings.m_mouseNavigation;
}
void BaseTextEditorWidget::setMouseHidingEnabled(bool b)
{
d->m_behaviorSettings.m_mouseHiding = b;
}
bool BaseTextEditorWidget::mouseHidingEnabled() const
{
return d->m_behaviorSettings.m_mouseHiding;
}
void BaseTextEditorWidget::setScrollWheelZoomingEnabled(bool b)
{
d->m_behaviorSettings.m_scrollWheelZooming = b;
......
......@@ -184,6 +184,9 @@ public:
void setMouseNavigationEnabled(bool b);
bool mouseNavigationEnabled() const;
void setMouseHidingEnabled(bool b);
bool mouseHidingEnabled() const;
void setScrollWheelZoomingEnabled(bool b);
bool scrollWheelZoomingEnabled() const;
......
......@@ -34,6 +34,7 @@
#include <QSettings>
#include <QString>
static const char mouseHidingKey[] = "MouseHiding";
static const char mouseNavigationKey[] = "MouseNavigation";
static const char scrollWheelZoomingKey[] = "ScrollWheelZooming";
static const char constrainTooltips[] = "ConstrainTooltips";
......@@ -44,6 +45,7 @@ static const char groupPostfix[] = "BehaviorSettings";
namespace TextEditor {
BehaviorSettings::BehaviorSettings() :
m_mouseHiding(true),
m_mouseNavigation(true),
m_scrollWheelZooming(true),
m_constrainHoverTooltips(false),
......@@ -65,6 +67,7 @@ void BehaviorSettings::fromSettings(const QString &category, const QSettings *s)
void BehaviorSettings::toMap(const QString &prefix, QVariantMap *map) const
{
map->insert(prefix + QLatin1String(mouseHidingKey), m_mouseHiding);
map->insert(prefix + QLatin1String(mouseNavigationKey), m_mouseNavigation);
map->insert(prefix + QLatin1String(scrollWheelZoomingKey), m_scrollWheelZooming);
map->insert(prefix + QLatin1String(constrainTooltips), m_constrainHoverTooltips);
......@@ -74,6 +77,8 @@ void BehaviorSettings::toMap(const QString &prefix, QVariantMap *map) const
void BehaviorSettings::fromMap(const QString &prefix, const QVariantMap &map)
{
m_mouseHiding =
map.value(prefix + QLatin1String(mouseHidingKey), m_mouseHiding).toBool();
m_mouseNavigation =
map.value(prefix + QLatin1String(mouseNavigationKey), m_mouseNavigation).toBool();
m_scrollWheelZooming =
......@@ -88,7 +93,8 @@ void BehaviorSettings::fromMap(const QString &prefix, const QVariantMap &map)
bool BehaviorSettings::equals(const BehaviorSettings &ds) const
{
return m_mouseNavigation == ds.m_mouseNavigation
return m_mouseHiding == ds.m_mouseHiding
&& m_mouseNavigation == ds.m_mouseNavigation
&& m_scrollWheelZooming == ds.m_scrollWheelZooming
&& m_constrainHoverTooltips == ds.m_constrainHoverTooltips
&& m_camelCaseNavigation == ds.m_camelCaseNavigation
......
......@@ -57,6 +57,7 @@ public:
bool equals(const BehaviorSettings &bs) const;
bool m_mouseHiding;
bool m_mouseNavigation;
bool m_scrollWheelZooming;
bool m_constrainHoverTooltips;
......
......@@ -98,6 +98,8 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
this, SLOT(slotStorageSettingsChanged()));
connect(d->m_ui.cleanIndentation, SIGNAL(clicked(bool)),
this, SLOT(slotStorageSettingsChanged()));
connect(d->m_ui.mouseHiding, SIGNAL(clicked()),
this, SLOT(slotBehaviorSettingsChanged()));
connect(d->m_ui.mouseNavigation, SIGNAL(clicked()),
this, SLOT(slotBehaviorSettingsChanged()));
connect(d->m_ui.scrollWheelZooming, SIGNAL(clicked(bool)),
......@@ -193,6 +195,7 @@ void BehaviorSettingsWidget::updateConstrainTooltipsBoxTooltip() const
void BehaviorSettingsWidget::setAssignedBehaviorSettings(const BehaviorSettings &behaviorSettings)
{
d->m_ui.mouseHiding->setChecked(behaviorSettings.m_mouseHiding);
d->m_ui.mouseNavigation->setChecked(behaviorSettings.m_mouseNavigation);
d->m_ui.scrollWheelZooming->setChecked(behaviorSettings.m_scrollWheelZooming);
d->m_ui.constrainTooltipsBox->setCurrentIndex(behaviorSettings.m_constrainHoverTooltips ? 1 : 0);
......@@ -203,6 +206,7 @@ void BehaviorSettingsWidget::setAssignedBehaviorSettings(const BehaviorSettings
void BehaviorSettingsWidget::assignedBehaviorSettings(BehaviorSettings *behaviorSettings) const
{
behaviorSettings->m_mouseHiding = d->m_ui.mouseHiding->isChecked();
behaviorSettings->m_mouseNavigation = d->m_ui.mouseNavigation->isChecked();
behaviorSettings->m_scrollWheelZooming = d->m_ui.scrollWheelZooming->isChecked();
behaviorSettings->m_constrainHoverTooltips = (d->m_ui.constrainTooltipsBox->currentIndex() == 1);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>441</height>
<width>801</width>
<height>459</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
......@@ -329,6 +329,13 @@ Specifies how backspace interacts with indentation.
<string>Mouse and Keyboard</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="mouseHiding">
<property name="text">
<string>Hide mouse cursor while typing</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mouseNavigation">
<property name="text">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment