forked from qt-creator/qt-creator
Added an option to disable the mouse navigation
It's conflicting too much with pasting for some, so better have the option to just turn it off.
This commit is contained in:
@@ -189,6 +189,7 @@ CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
|
|||||||
|
|
||||||
CPPEditor::CPPEditor(QWidget *parent)
|
CPPEditor::CPPEditor(QWidget *parent)
|
||||||
: TextEditor::BaseTextEditor(parent)
|
: TextEditor::BaseTextEditor(parent)
|
||||||
|
, m_mouseNavigationEnabled(true)
|
||||||
, m_showingLink(false)
|
, m_showingLink(false)
|
||||||
{
|
{
|
||||||
setParenthesesMatchingEnabled(true);
|
setParenthesesMatchingEnabled(true);
|
||||||
@@ -901,7 +902,7 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e)
|
|||||||
{
|
{
|
||||||
bool linkFound = false;
|
bool linkFound = false;
|
||||||
|
|
||||||
if (e->modifiers() & Qt::ControlModifier) {
|
if (m_mouseNavigationEnabled && e->modifiers() & Qt::ControlModifier) {
|
||||||
// Link emulation behaviour for 'go to definition'
|
// Link emulation behaviour for 'go to definition'
|
||||||
const QTextCursor cursor = cursorForPosition(e->pos());
|
const QTextCursor cursor = cursorForPosition(e->pos());
|
||||||
|
|
||||||
@@ -1027,6 +1028,11 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
|||||||
m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK));
|
m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPPEditor::setDisplaySettings(const TextEditor::DisplaySettings &ds)
|
||||||
|
{
|
||||||
|
TextEditor::BaseTextEditor::setDisplaySettings(ds);
|
||||||
|
m_mouseNavigationEnabled = ds.m_mouseNavigation;
|
||||||
|
}
|
||||||
|
|
||||||
void CPPEditor::unCommentSelection()
|
void CPPEditor::unCommentSelection()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setFontSettings(const TextEditor::FontSettings &);
|
virtual void setFontSettings(const TextEditor::FontSettings &);
|
||||||
|
virtual void setDisplaySettings(const TextEditor::DisplaySettings &);
|
||||||
void setSortedMethodOverview(bool sort);
|
void setSortedMethodOverview(bool sort);
|
||||||
void switchDeclarationDefinition();
|
void switchDeclarationDefinition();
|
||||||
void jumpToDefinition();
|
void jumpToDefinition();
|
||||||
@@ -153,11 +154,13 @@ private:
|
|||||||
|
|
||||||
void showLink(const Link &);
|
void showLink(const Link &);
|
||||||
void clearLink();
|
void clearLink();
|
||||||
bool m_showingLink;
|
|
||||||
|
|
||||||
Link findLinkAt(const QTextCursor &, bool lookupDefinition = true);
|
Link findLinkAt(const QTextCursor &, bool lookupDefinition = true);
|
||||||
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
|
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||||
bool openCppEditorAt(const Link &);
|
bool openCppEditorAt(const Link &);
|
||||||
|
|
||||||
|
bool m_mouseNavigationEnabled;
|
||||||
|
bool m_showingLink;
|
||||||
QTextCharFormat m_linkFormat;
|
QTextCharFormat m_linkFormat;
|
||||||
|
|
||||||
CppTools::CppModelManagerInterface *m_modelManager;
|
CppTools::CppModelManagerInterface *m_modelManager;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void BehaviorSettingsPage::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
|
void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
|
||||||
StorageSettings &storageSettings) const
|
StorageSettings &storageSettings) const
|
||||||
{
|
{
|
||||||
tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
|
tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
|
||||||
tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked();
|
tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked();
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers";
|
|||||||
static const char * const highlightCurrentLineKey = "HighlightCurrentLineKeyV2";
|
static const char * const highlightCurrentLineKey = "HighlightCurrentLineKeyV2";
|
||||||
static const char * const highlightBlocksKey = "HighlightBlocksKey";
|
static const char * const highlightBlocksKey = "HighlightBlocksKey";
|
||||||
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
|
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
|
||||||
|
static const char * const mouseNavigationKey = "MouseNavigation";
|
||||||
static const char * const groupPostfix = "DisplaySettings";
|
static const char * const groupPostfix = "DisplaySettings";
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
@@ -56,7 +57,8 @@ DisplaySettings::DisplaySettings() :
|
|||||||
m_displayFoldingMarkers(true),
|
m_displayFoldingMarkers(true),
|
||||||
m_highlightCurrentLine(false),
|
m_highlightCurrentLine(false),
|
||||||
m_highlightBlocks(false),
|
m_highlightBlocks(false),
|
||||||
m_animateMatchingParentheses(true)
|
m_animateMatchingParentheses(true),
|
||||||
|
m_mouseNavigation(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +77,7 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const
|
|||||||
s->setValue(QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine);
|
s->setValue(QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine);
|
||||||
s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks);
|
s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks);
|
||||||
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
|
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
|
||||||
|
s->setValue(QLatin1String(mouseNavigationKey), m_mouseNavigation);
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +99,7 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s)
|
|||||||
m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool();
|
m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool();
|
||||||
m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool();
|
m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool();
|
||||||
m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool();
|
m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool();
|
||||||
|
m_mouseNavigation = s->value(group + QLatin1String(mouseNavigationKey), m_mouseNavigation).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisplaySettings::equals(const DisplaySettings &ds) const
|
bool DisplaySettings::equals(const DisplaySettings &ds) const
|
||||||
@@ -109,6 +113,7 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
|
|||||||
&& m_highlightCurrentLine == ds.m_highlightCurrentLine
|
&& m_highlightCurrentLine == ds.m_highlightCurrentLine
|
||||||
&& m_highlightBlocks == ds.m_highlightBlocks
|
&& m_highlightBlocks == ds.m_highlightBlocks
|
||||||
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
|
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
|
||||||
|
&& m_mouseNavigation == ds.m_mouseNavigation
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ struct TEXTEDITOR_EXPORT DisplaySettings
|
|||||||
bool m_highlightCurrentLine;
|
bool m_highlightCurrentLine;
|
||||||
bool m_highlightBlocks;
|
bool m_highlightBlocks;
|
||||||
bool m_animateMatchingParentheses;
|
bool m_animateMatchingParentheses;
|
||||||
|
bool m_mouseNavigation;
|
||||||
|
|
||||||
bool equals(const DisplaySettings &ds) const;
|
bool equals(const DisplaySettings &ds) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const
|
|||||||
displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked();
|
displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked();
|
||||||
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
|
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
|
||||||
displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked();
|
displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked();
|
||||||
displaySettings.m_animateMatchingParentheses= m_d->m_page.animateMatchingParentheses->isChecked();
|
displaySettings.m_animateMatchingParentheses = m_d->m_page.animateMatchingParentheses->isChecked();
|
||||||
|
displaySettings.m_mouseNavigation = m_d->m_page.mouseNavigation->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySettingsPage::settingsToUI()
|
void DisplaySettingsPage::settingsToUI()
|
||||||
@@ -138,6 +139,7 @@ void DisplaySettingsPage::settingsToUI()
|
|||||||
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
|
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
|
||||||
m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks);
|
m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks);
|
||||||
m_d->m_page.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses);
|
m_d->m_page.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses);
|
||||||
|
m_d->m_page.mouseNavigation->setChecked(displaySettings.m_mouseNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplaySettings DisplaySettingsPage::displaySettings() const
|
DisplaySettings DisplaySettingsPage::displaySettings() const
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>381</width>
|
<width>381</width>
|
||||||
<height>335</height>
|
<height>402</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -128,6 +128,22 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBoxNavigation">
|
||||||
|
<property name="title">
|
||||||
|
<string>Navigation</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mouseNavigation">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable &mouse navigation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
Reference in New Issue
Block a user