Commit f36ea678 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Allow configuring the color for the hover links

Cause blue doesn't fit nicely in all color schemes.
parent 0729ae01
...@@ -236,7 +236,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable) ...@@ -236,7 +236,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
policy.setHorizontalPolicy(QSizePolicy::Expanding); policy.setHorizontalPolicy(QSizePolicy::Expanding);
m_methodCombo->setSizePolicy(policy); m_methodCombo->setSizePolicy(policy);
QTreeView *methodView = new OverviewTreeView(); QTreeView *methodView = new OverviewTreeView;
methodView->header()->hide(); methodView->header()->hide();
methodView->setItemsExpandable(false); methodView->setItemsExpandable(false);
m_methodCombo->setView(methodView); m_methodCombo->setView(methodView);
...@@ -833,8 +833,8 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e) ...@@ -833,8 +833,8 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e)
} else { } else {
sel.cursor.select(QTextCursor::WordUnderCursor); sel.cursor.select(QTextCursor::WordUnderCursor);
} }
sel.format = m_linkFormat;
sel.format.setFontUnderline(true); sel.format.setFontUnderline(true);
sel.format.setForeground(Qt::blue);
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel); setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
hasDestination = true; hasDestination = true;
cursorShape = Qt::PointingHandCursor; cursorShape = Qt::PointingHandCursor;
...@@ -921,6 +921,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) ...@@ -921,6 +921,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories); const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories);
highlighter->setFormats(formats.constBegin(), formats.constEnd()); highlighter->setFormats(formats.constBegin(), formats.constEnd());
highlighter->rehighlight(); highlighter->rehighlight();
m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK));
} }
......
...@@ -151,6 +151,7 @@ private: ...@@ -151,6 +151,7 @@ private:
Link findLinkAt(const QTextCursor &); Link findLinkAt(const QTextCursor &);
static Link linkToSymbol(CPlusPlus::Symbol *symbol); static Link linkToSymbol(CPlusPlus::Symbol *symbol);
bool openCppEditorAt(const Link &); bool openCppEditorAt(const Link &);
QTextCharFormat m_linkFormat;
CppTools::CppModelManagerInterface *m_modelManager; CppTools::CppModelManagerInterface *m_modelManager;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
** **
**************************************************************************/ **************************************************************************/
#ifndef BASETEXTEDITOR_H #ifndef BASETEXTEDITOR_H
#define BASETEXTEDITOR_H #define BASETEXTEDITOR_H
...@@ -42,7 +41,6 @@ ...@@ -42,7 +41,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QLabel; class QLabel;
class QTextCharFormat;
class QToolBar; class QToolBar;
QT_END_NAMESPACE QT_END_NAMESPACE
......
...@@ -65,6 +65,7 @@ const char * const C_TEXTEDITOR_MIMETYPE_XML = "application/xml"; ...@@ -65,6 +65,7 @@ const char * const C_TEXTEDITOR_MIMETYPE_XML = "application/xml";
// Text color and style categories // Text color and style categories
const char * const C_TEXT = "Text"; const char * const C_TEXT = "Text";
const char * const C_LINK = "Link";
const char * const C_SELECTION = "Selection"; const char * const C_SELECTION = "Selection";
const char * const C_LINE_NUMBER = "LineNumber"; const char * const C_LINE_NUMBER = "LineNumber";
const char * const C_SEARCH_RESULT = "SearchResult"; const char * const C_SEARCH_RESULT = "SearchResult";
......
...@@ -65,6 +65,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent) ...@@ -65,6 +65,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
// Special categories // Special categories
const QPalette p = QApplication::palette(); const QPalette p = QApplication::palette();
formatDescriptions.push_back(FormatDescription(QLatin1String(C_LINK), tr("Link"), Qt::blue));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_SELECTION), tr("Selection"), p.color(QPalette::HighlightedText))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_SELECTION), tr("Selection"), p.color(QPalette::HighlightedText)));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_LINE_NUMBER), tr("Line Number"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LINE_NUMBER), tr("Line Number")));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result")));
......
Supports Markdown
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