summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-03-24 16:36:22 +0100
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-03-24 17:06:01 +0100
commitf36ea6785c201734d159906bab478e2b0cf51a9c (patch)
tree5d450e34941ed8538cb6e60bda5bfba567bfefca
parent0729ae019175f5f6b7314572dbe49c73d0460953 (diff)
downloadqt-creator-f36ea6785c201734d159906bab478e2b0cf51a9c.tar.gz
Allow configuring the color for the hover links
Cause blue doesn't fit nicely in all color schemes.
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp6
-rw-r--r--src/plugins/cppeditor/cppeditor.h1
-rw-r--r--src/plugins/texteditor/basetexteditor.h2
-rw-r--r--src/plugins/texteditor/texteditorconstants.h1
-rw-r--r--src/plugins/texteditor/texteditorsettings.cpp1
5 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 9e884448bf..3fda6bf532 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 35a46cb0c7..bd4b311d98 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 8c10618134..c3cae63467 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 654bba0d4b..e598a89114 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 cc55dec6b2..31204648a1 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")));