forked from qt-creator/qt-creator
TextEditor: Support tooltips for buttons in text mark tooltips
In case users don't find the icon self-explanatory. Task-number: QTCREATORBUG-25150 Change-Id: I481b1ea7f510f065f83badcb91e127ac1c81f5a1 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -237,6 +237,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
|
||||
QVector<QAction *> actions;
|
||||
QAction *action = new QAction();
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", Icons::COPY.icon()));
|
||||
action->setToolTip(tr("Copy to Clipboard"));
|
||||
QObject::connect(action, &QAction::triggered, [diagnostic]() {
|
||||
const QString text = ClangDiagnosticWidget::createText({diagnostic},
|
||||
ClangDiagnosticWidget::InfoBar);
|
||||
@@ -249,6 +250,7 @@ ClangTextMark::ClangTextMark(const FilePath &fileName,
|
||||
if (project && isDiagnosticConfigChangable(project, diagnostic)) {
|
||||
action = new QAction();
|
||||
action->setIcon(Icons::BROKEN.icon());
|
||||
action->setToolTip(tr("Disable Diagnostic in Current Project"));
|
||||
QObject::connect(action, &QAction::triggered, [diagnostic]() {
|
||||
disableDiagnosticInCurrentProjectConfig(diagnostic);
|
||||
});
|
||||
|
@@ -59,6 +59,7 @@ DiagnosticMark::DiagnosticMark(const Diagnostic &diagnostic)
|
||||
QVector<QAction *> actions;
|
||||
QAction *action = new QAction();
|
||||
action->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
|
||||
action->setToolTip(tr("Copy to Clipboard"));
|
||||
QObject::connect(action, &QAction::triggered, [diagnostic]() {
|
||||
const QString text = createFullLocationString(diagnostic.location)
|
||||
+ ": "
|
||||
|
@@ -310,6 +310,7 @@ void TextMark::addToToolTipLayout(QGridLayout *target) const
|
||||
QTC_ASSERT(!action->icon().isNull(), continue);
|
||||
auto button = new QToolButton;
|
||||
button->setIcon(action->icon());
|
||||
button->setToolTip(action->toolTip());
|
||||
QObject::connect(button, &QToolButton::clicked, action, &QAction::triggered);
|
||||
QObject::connect(button, &QToolButton::clicked, []() {
|
||||
Utils::ToolTip::hideImmediately();
|
||||
@@ -398,6 +399,7 @@ void TextMark::setSettingsPage(Id settingsPage)
|
||||
delete m_settingsAction;
|
||||
m_settingsAction = new QAction;
|
||||
m_settingsAction->setIcon(Utils::Icons::SETTINGS_TOOLBAR.icon());
|
||||
m_settingsAction->setToolTip(tr("Show Diagnostic Settings"));
|
||||
QObject::connect(m_settingsAction, &QAction::triggered, [this, settingsPage] {
|
||||
Core::ICore::showOptionsDialog(settingsPage);
|
||||
});
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <utils/optional.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QIcon>
|
||||
#include <QVector>
|
||||
|
||||
@@ -50,6 +51,7 @@ class TextDocument;
|
||||
|
||||
class TEXTEDITOR_EXPORT TextMark
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(TextEditor::TextMark)
|
||||
public:
|
||||
TextMark(const Utils::FilePath &fileName,
|
||||
int lineNumber,
|
||||
|
Reference in New Issue
Block a user