diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 9e884448bf58cace91fffaa5ee3ddaf84e53187e..3fda6bf5329bc275681f5776cfb5d468b1df8f30 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -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)); } diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 35a46cb0c7249fbc8918e724fcb34f5979304d7c..bd4b311d98abb55ce494783442d80990c0446089 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -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; diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 8c106181349edbde83d0f8c4a82f6dc9aba51633..c3cae63467fa8afb8058f6b5c6544742748eda5c 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -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 diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index 654bba0d4bcbc96d1ad060285ae80c5ab1d67122..e598a8911484cba9c91c427d7a5c0d35779cd0a6 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -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"; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index cc55dec6b24c6726a8c1abd655bd36a98d6a394d..31204648a1d2a778f8f94d897348c2caf8c28507 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -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")));