Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -236,7 +236,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
policy.setHorizontalPolicy(QSizePolicy::Expanding);
m_methodCombo->setSizePolicy(policy);
QTreeView *methodView = new OverviewTreeView();
QTreeView *methodView = new OverviewTreeView;
methodView->header()->hide();
methodView->setItemsExpandable(false);
m_methodCombo->setView(methodView);
......@@ -833,8 +833,8 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e)
} else {
sel.cursor.select(QTextCursor::WordUnderCursor);
}
sel.format = m_linkFormat;
sel.format.setFontUnderline(true);
sel.format.setForeground(Qt::blue);
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
hasDestination = true;
cursorShape = Qt::PointingHandCursor;
......@@ -921,6 +921,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories);
highlighter->setFormats(formats.constBegin(), formats.constEnd());
highlighter->rehighlight();
m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK));
}
......
......@@ -151,6 +151,7 @@ private:
Link findLinkAt(const QTextCursor &);
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
bool openCppEditorAt(const Link &);
QTextCharFormat m_linkFormat;
CppTools::CppModelManagerInterface *m_modelManager;
......
......@@ -27,7 +27,6 @@
**
**************************************************************************/
#ifndef BASETEXTEDITOR_H
#define BASETEXTEDITOR_H
......@@ -42,7 +41,6 @@
QT_BEGIN_NAMESPACE
class QLabel;
class QTextCharFormat;
class QToolBar;
QT_END_NAMESPACE
......
......@@ -65,6 +65,7 @@ const char * const C_TEXTEDITOR_MIMETYPE_XML = "application/xml";
// Text color and style categories
const char * const C_TEXT = "Text";
const char * const C_LINK = "Link";
const char * const C_SELECTION = "Selection";
const char * const C_LINE_NUMBER = "LineNumber";
const char * const C_SEARCH_RESULT = "SearchResult";
......
......@@ -65,6 +65,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
// Special categories
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_LINE_NUMBER), tr("Line Number")));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result")));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment