aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2016-08-16 14:17:48 +0200
committerDavid Schulz <david.schulz@qt.io>2016-08-22 05:40:50 +0000
commit8b21f687c0c81f309290343a6d2b9caba1eb93f0 (patch)
tree0edc54f11b2de77a11743d597c82ca4550962e86 /src/plugins/texteditor
parent5a40bddf08c18eaa3cc55e46d36f561730d0b3cf (diff)
Add default tool tips to text marks
The default tool tip should describe the general purpose of the mark which is displayed in the UI when no tool tip is explicitly set for the text mark. Change-Id: I27aff26cf0f3458d454428e805a9b323191dc393 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r--src/plugins/texteditor/textmark.cpp18
-rw-r--r--src/plugins/texteditor/textmark.h1
-rw-r--r--src/plugins/texteditor/textmarkregistry.h3
3 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 26f16b1b390..e764b2cfa1c 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -129,6 +129,11 @@ void TextMark::setCategoryColor(Id category, Theme::Color color)
TextEditorPlugin::baseTextMarkRegistry()->setCategoryColor(category, color);
}
+void TextMark::setDefaultToolTip(Id category, const QString &toolTip)
+{
+ TextEditorPlugin::baseTextMarkRegistry()->setDefaultToolTip(category, toolTip);
+}
+
void TextMark::updateMarker()
{
if (m_baseTextDocument)
@@ -259,6 +264,19 @@ void TextMarkRegistry::setCategoryColor(Id category, Theme::Color color)
m_colors[category] = color;
}
+QString TextMarkRegistry::defaultToolTip(Id category) const
+{
+ return m_defaultToolTips[category];
+}
+
+void TextMarkRegistry::setDefaultToolTip(Id category, const QString &toolTip)
+{
+ QString &defaultToolTip = m_defaultToolTips[category];
+ if (defaultToolTip == toolTip)
+ return;
+ defaultToolTip = toolTip;
+}
+
void TextMarkRegistry::editorOpened(IEditor *editor)
{
auto document = qobject_cast<TextDocument *>(editor ? editor->document() : 0);
diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h
index bdbf799e742..7569ddf0997 100644
--- a/src/plugins/texteditor/textmark.h
+++ b/src/plugins/texteditor/textmark.h
@@ -79,6 +79,7 @@ public:
static Utils::Theme::Color categoryColor(Core::Id category);
static bool categoryHasColor(Core::Id category);
static void setCategoryColor(Core::Id category, Utils::Theme::Color color);
+ static void setDefaultToolTip(Core::Id category, const QString &toolTip);
void setIcon(const QIcon &icon);
// call this if the icon has changed.
void updateMarker();
diff --git a/src/plugins/texteditor/textmarkregistry.h b/src/plugins/texteditor/textmarkregistry.h
index 33aa5edc405..a7e28f9c722 100644
--- a/src/plugins/texteditor/textmarkregistry.h
+++ b/src/plugins/texteditor/textmarkregistry.h
@@ -55,6 +55,8 @@ public:
Utils::Theme::Color categoryColor(Core::Id category);
bool categoryHasColor(Core::Id category);
void setCategoryColor(Core::Id category, Utils::Theme::Color color);
+ QString defaultToolTip(Core::Id category) const;
+ void setDefaultToolTip(Core::Id category, const QString &toolTip);
private:
void editorOpened(Core::IEditor *editor);
void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);
@@ -62,6 +64,7 @@ private:
QHash<Utils::FileName, QSet<TextMark *> > m_marks;
QHash<Core::Id, Utils::Theme::Color> m_colors;
+ QHash<Core::Id, QString> m_defaultToolTips;
};
} // namespace Internal