forked from qt-creator/qt-creator
ModelEditor: Remove multiline text from action text
It is supposed to be shown in the tool tip, so set the tool tip instead. Fixes: QTCREATORBUG-29174 Change-Id: Ib2572b71dfccf18276e63fadb7dbe386949b0275 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -7,12 +7,13 @@
|
|||||||
#include "modeleditor_constants.h"
|
#include "modeleditor_constants.h"
|
||||||
#include "modeleditortr.h"
|
#include "modeleditortr.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/icon.h>
|
#include <utils/icon.h>
|
||||||
|
#include <utils/stringutils.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@@ -161,11 +162,17 @@ void ActionHandler::createActions()
|
|||||||
QKeySequence(), QIcon(":/modelinglib/48x48/class.png"));
|
QKeySequence(), QIcon(":/modelinglib/48x48/class.png"));
|
||||||
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), Tr::tr("Add Canvas Diagram"),
|
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), Tr::tr("Add Canvas Diagram"),
|
||||||
QKeySequence(), QIcon(":/modelinglib/48x48/canvas-diagram.png"));
|
QKeySequence(), QIcon(":/modelinglib/48x48/canvas-diagram.png"));
|
||||||
d->synchronizeBrowserAction = registerCommand(
|
d->synchronizeBrowserAction
|
||||||
Constants::ACTION_SYNC_BROWSER, nullptr, Core::Context(),
|
= registerCommand(
|
||||||
Tr::tr("Synchronize Browser and Diagram") + "<br><i><small>"
|
Constants::ACTION_SYNC_BROWSER,
|
||||||
+ Tr::tr("Press && Hold for Options") + "</small></i>", QKeySequence(),
|
nullptr,
|
||||||
Utils::Icons::LINK_TOOLBAR.icon())->action();
|
Core::Context(),
|
||||||
|
Tr::tr("Synchronize Browser and Diagram"),
|
||||||
|
QKeySequence(),
|
||||||
|
Utils::Icons::LINK_TOOLBAR.icon(),
|
||||||
|
Tr::tr("Synchronize Browser and Diagram") + "<br><i><small>"
|
||||||
|
+ Utils::stripAccelerator(Tr::tr("Press && Hold for Options")) + "</small></i>")
|
||||||
|
->action();
|
||||||
d->synchronizeBrowserAction->setCheckable(true);
|
d->synchronizeBrowserAction->setCheckable(true);
|
||||||
|
|
||||||
auto editPropertiesAction = new QAction(Tr::tr("Edit Element Properties"),
|
auto editPropertiesAction = new QAction(Tr::tr("Edit Element Properties"),
|
||||||
@@ -205,13 +212,20 @@ std::function<void()> invokeOnCurrentModelEditor(void (ModelEditor::*function)()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Command *ActionHandler::registerCommand(const Utils::Id &id, void (ModelEditor::*function)(),
|
Core::Command *ActionHandler::registerCommand(
|
||||||
const Core::Context &context, const QString &title,
|
const Utils::Id &id,
|
||||||
const QKeySequence &keySequence, const QIcon &icon)
|
void (ModelEditor::*function)(),
|
||||||
|
const Core::Context &context,
|
||||||
|
const QString &title,
|
||||||
|
const QKeySequence &keySequence,
|
||||||
|
const QIcon &icon,
|
||||||
|
const QString &toolTip)
|
||||||
{
|
{
|
||||||
auto action = new QAction(title, this);
|
auto action = new QAction(title, this);
|
||||||
if (!icon.isNull())
|
if (!icon.isNull())
|
||||||
action->setIcon(icon);
|
action->setIcon(icon);
|
||||||
|
if (!toolTip.isEmpty())
|
||||||
|
action->setToolTip(toolTip);
|
||||||
Core::Command *command = Core::ActionManager::registerAction(action, id, context, /*scriptable=*/true);
|
Core::Command *command = Core::ActionManager::registerAction(action, id, context, /*scriptable=*/true);
|
||||||
if (!keySequence.isEmpty())
|
if (!keySequence.isEmpty())
|
||||||
command->setDefaultKeySequence(keySequence);
|
command->setDefaultKeySequence(keySequence);
|
||||||
|
@@ -56,10 +56,14 @@ private:
|
|||||||
void onEditProperties();
|
void onEditProperties();
|
||||||
void onEditItem();
|
void onEditItem();
|
||||||
|
|
||||||
Core::Command *registerCommand(const Utils::Id &id, void (ModelEditor::*function)(),
|
Core::Command *registerCommand(
|
||||||
const Core::Context &context, const QString &title = QString(),
|
const Utils::Id &id,
|
||||||
const QKeySequence &keySequence = QKeySequence(),
|
void (ModelEditor::*function)(),
|
||||||
const QIcon &icon = QIcon());
|
const Core::Context &context,
|
||||||
|
const QString &title = QString(),
|
||||||
|
const QKeySequence &keySequence = QKeySequence(),
|
||||||
|
const QIcon &icon = QIcon(),
|
||||||
|
const QString &toolTip = {});
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ActionHandlerPrivate *d;
|
ActionHandlerPrivate *d;
|
||||||
|
Reference in New Issue
Block a user