forked from qt-creator/qt-creator
QmlDesigner: Fix shortcuts and tooltips for transition editor
Creating the correct tooltip and managing the shortcut is managed by the command. We need a context for the shortcuts. Applying similar fixes to the timeline. Task-number: QDS-6539 Change-Id: If9a92c64508a6d3ff0754522e311ca0ce422dda1 Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
This commit is contained in:
@@ -103,13 +103,12 @@ static QAction *createAction(const Utils::Id &id,
|
||||
const QString &name,
|
||||
const QKeySequence &shortcut)
|
||||
{
|
||||
QString text = QString("%1 (%2)").arg(name).arg(shortcut.toString());
|
||||
|
||||
Core::Context context(TimelineConstants::C_QMLTIMELINE);
|
||||
|
||||
auto *action = new QAction(icon, text);
|
||||
auto *action = new QAction(icon, name);
|
||||
auto *command = Core::ActionManager::registerAction(action, id, context);
|
||||
command->setDefaultKeySequence(shortcut);
|
||||
command->augmentActionWithShortcutToolTip(action);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
@@ -37,10 +37,10 @@ const int transitionEditorPropertyItemUserType = QGraphicsItem::UserType + 7;
|
||||
|
||||
const char C_QMLTRANSITIONS[] = "QmlDesigner::Transitions";
|
||||
|
||||
const char C_SETTINGS[] = "QmlDesigner.SettingsTransitions";
|
||||
const char C_CURVE_PICKER[] = "QmlDesigner.CurvePickerTransitions";
|
||||
const char C_ZOOM_IN[] = "QmlDesigner.ZoomInTransition";
|
||||
const char C_ZOOM_OUT[] = "QmlDesigner.ZoomOutTransitions";
|
||||
const char C_SETTINGS[] = "QmlDesigner.Transitions.Settings";
|
||||
const char C_CURVE_PICKER[] = "QmlDesigner.Transitions.CurvePicker";
|
||||
const char C_ZOOM_IN[] = "QmlDesigner.Transitions.ZoomIn";
|
||||
const char C_ZOOM_OUT[] = "QmlDesigner.Transitions.ZoomOut";
|
||||
|
||||
} // namespace TransitionEditorConstants
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -90,13 +90,13 @@ static QAction *createAction(const Utils::Id &id,
|
||||
const QString &name,
|
||||
const QKeySequence &shortcut)
|
||||
{
|
||||
QString text = QString("%1 (%2)").arg(name).arg(shortcut.toString());
|
||||
|
||||
Core::Context context(TransitionEditorConstants::C_QMLTRANSITIONS);
|
||||
|
||||
auto *action = new QAction(icon, text);
|
||||
auto *action = new QAction(icon, name);
|
||||
auto *command = Core::ActionManager::registerAction(action, id, context);
|
||||
command->setDefaultKeySequence(shortcut);
|
||||
command->augmentActionWithShortcutToolTip(action);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
@@ -319,6 +319,9 @@ TransitionEditorWidget *TransitionEditorView::createWidget()
|
||||
if (!m_transitionEditorWidget)
|
||||
m_transitionEditorWidget = new TransitionEditorWidget(this);
|
||||
|
||||
auto *transitionContext = new TransitionContext(m_transitionEditorWidget);
|
||||
Core::ICore::addContextObject(transitionContext);
|
||||
|
||||
return m_transitionEditorWidget;
|
||||
}
|
||||
|
||||
|
@@ -68,6 +68,19 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
TransitionContext::TransitionContext(QWidget *widget)
|
||||
: IContext(widget)
|
||||
{
|
||||
setWidget(widget);
|
||||
setContext(Core::Context(TransitionEditorConstants::C_QMLTRANSITIONS));
|
||||
}
|
||||
|
||||
void TransitionContext::contextHelp(const Core::IContext::HelpCallback &callback) const
|
||||
{
|
||||
if (auto *widget = qobject_cast<TransitionEditorWidget *>(m_widget))
|
||||
widget->contextHelp(callback);
|
||||
}
|
||||
|
||||
class Eventfilter : public QObject
|
||||
{
|
||||
public:
|
||||
|
@@ -49,6 +49,15 @@ class TransitionEditorToolBar;
|
||||
class TransitionEditorGraphicsScene;
|
||||
class ModelNode;
|
||||
|
||||
class TransitionContext : public Core::IContext
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TransitionContext(QWidget *widget);
|
||||
void contextHelp(const HelpCallback &callback) const override;
|
||||
};
|
||||
|
||||
class TransitionEditorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user