QmlDesigner: Clean up 3D Toolbar

* Item orders for 3D toolbar is modified
* ParticleSeeker is available as an action, and also an Edit3DAction

Task-number: QDS-9082
Change-Id: I210feaa416934c3e287a1a177720db69138ffab3
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Ali Kianian
2023-02-20 15:47:46 +02:00
parent b0ae85096e
commit 3d02d08612
19 changed files with 251 additions and 90 deletions

View File

@@ -8,7 +8,7 @@
namespace QmlDesigner {
AbstractAction::AbstractAction(const QString &description)
: m_defaultAction(new DefaultAction(description))
: m_pureAction(new DefaultAction(description))
{
const Utils::Icon defaultIcon({
{":/utils/images/select.png", Utils::Theme::QmlDesigner_FormEditorForegroundColor}}, Utils::Icon::MenuTintedStyle);
@@ -16,14 +16,14 @@ AbstractAction::AbstractAction(const QString &description)
action()->setIcon(defaultIcon.icon());
}
AbstractAction::AbstractAction(DefaultAction *action)
: m_defaultAction(action)
AbstractAction::AbstractAction(PureActionInterface *action)
: m_pureAction(action)
{
}
QAction *AbstractAction::action() const
{
return m_defaultAction.data();
return m_pureAction->action();
}
void AbstractAction::currentContextChanged(const SelectionContext &selectionContext)
@@ -34,12 +34,13 @@ void AbstractAction::currentContextChanged(const SelectionContext &selectionCont
void AbstractAction::updateContext()
{
m_defaultAction->setSelectionContext(m_selectionContext);
m_pureAction->setSelectionContext(m_selectionContext);
if (m_selectionContext.isValid()) {
m_defaultAction->setEnabled(isEnabled(m_selectionContext));
m_defaultAction->setVisible(isVisible(m_selectionContext));
if (m_defaultAction->isCheckable())
m_defaultAction->setChecked(isChecked(m_selectionContext));
QAction *action = m_pureAction->action();
action->setEnabled(isEnabled(m_selectionContext));
action->setVisible(isVisible(m_selectionContext));
if (action->isCheckable())
action->setChecked(isChecked(m_selectionContext));
}
}
@@ -50,12 +51,12 @@ bool AbstractAction::isChecked(const SelectionContext &) const
void AbstractAction::setCheckable(bool checkable)
{
m_defaultAction->setCheckable(checkable);
action()->setCheckable(checkable);
}
DefaultAction *AbstractAction::defaultAction() const
PureActionInterface *AbstractAction::pureAction() const
{
return m_defaultAction.data();
return m_pureAction.data();
}
SelectionContext AbstractAction::selectionContext() const
@@ -65,6 +66,7 @@ SelectionContext AbstractAction::selectionContext() const
DefaultAction::DefaultAction(const QString &description)
: QAction(description, nullptr)
, PureActionInterface(this)
{
connect(this, &QAction::triggered, this, &DefaultAction::actionTriggered);
}
@@ -74,4 +76,15 @@ void DefaultAction::setSelectionContext(const SelectionContext &selectionContext
m_selectionContext = selectionContext;
}
PureActionInterface::PureActionInterface(QAction *action)
: m_action(action)
{
}
QAction *PureActionInterface::action()
{
return m_action;
}
} // namespace QmlDesigner

View File

@@ -10,7 +10,18 @@
namespace QmlDesigner {
class QMLDESIGNERCOMPONENTS_EXPORT DefaultAction : public QAction
class QMLDESIGNERCOMPONENTS_EXPORT PureActionInterface
{
public:
explicit PureActionInterface(QAction *action);
virtual void setSelectionContext(const SelectionContext &selectionContext) = 0;
QAction *action();
private:
QAction *m_action = nullptr;
};
class QMLDESIGNERCOMPONENTS_EXPORT DefaultAction : public QAction, public PureActionInterface
{
Q_OBJECT
@@ -19,7 +30,7 @@ public:
// virtual function instead of slot
virtual void actionTriggered([[maybe_unused]] bool enable) {}
void setSelectionContext(const SelectionContext &selectionContext);
virtual void setSelectionContext(const SelectionContext &selectionContext) override;
protected:
SelectionContext m_selectionContext;
@@ -29,10 +40,10 @@ class QMLDESIGNERCOMPONENTS_EXPORT AbstractAction : public ActionInterface
{
public:
AbstractAction(const QString &description = QString());
AbstractAction(DefaultAction *action);
AbstractAction(PureActionInterface *action);
QAction *action() const override final;
DefaultAction *defaultAction() const;
PureActionInterface *pureAction() const;
void currentContextChanged(const SelectionContext &selectionContext) override;
@@ -46,7 +57,7 @@ protected:
SelectionContext selectionContext() const;
private:
QScopedPointer<DefaultAction> m_defaultAction;
QScopedPointer<PureActionInterface> m_pureAction;
SelectionContext m_selectionContext;
};

View File

@@ -311,17 +311,17 @@ public:
void updateContext() override
{
defaultAction()->setSelectionContext(selectionContext());
pureAction()->setSelectionContext(selectionContext());
if (selectionContext().isValid()) {
defaultAction()->setEnabled(isEnabled(selectionContext()));
defaultAction()->setVisible(isVisible(selectionContext()));
action()->setEnabled(isEnabled(selectionContext()));
action()->setVisible(isVisible(selectionContext()));
defaultAction()->setCheckable(true);
action()->setCheckable(true);
QmlItemNode itemNode = QmlItemNode(selectionContext().currentSingleSelectedNode());
if (itemNode.isValid())
defaultAction()->setChecked(itemNode.instanceValue("visible").toBool());
action()->setChecked(itemNode.instanceValue("visible").toBool());
else
defaultAction()->setEnabled(false);
action()->setEnabled(false);
}
}
};
@@ -337,12 +337,12 @@ public:
{}
void updateContext() override
{
defaultAction()->setSelectionContext(selectionContext());
pureAction()->setSelectionContext(selectionContext());
if (selectionContext().isValid()) {
defaultAction()->setEnabled(isEnabled(selectionContext()));
defaultAction()->setVisible(isVisible(selectionContext()));
action()->setEnabled(isEnabled(selectionContext()));
action()->setVisible(isVisible(selectionContext()));
defaultAction()->setCheckable(true);
action()->setCheckable(true);
QmlItemNode itemNode = QmlItemNode(selectionContext().currentSingleSelectedNode());
if (itemNode.isValid()) {
bool flag = false;
@@ -350,9 +350,9 @@ public:
|| itemNode.propertyAffectedByCurrentState(m_propertyName)) {
flag = itemNode.modelValue(m_propertyName).toBool();
}
defaultAction()->setChecked(flag);
action()->setChecked(flag);
} else {
defaultAction()->setEnabled(false);
action()->setEnabled(false);
}
}
}

View File

@@ -182,8 +182,8 @@ public:
, m_priority(priority)
, m_visibility(&SelectionContextFunctors::always)
{
defaultAction()->setSeparator(true);
defaultAction()->setIcon({});
action()->setSeparator(true);
action()->setIcon({});
}
bool isVisible(const SelectionContext &m_selectionState) const override { return m_visibility(m_selectionState); }

View File

@@ -261,7 +261,7 @@ void ViewManager::registerNanotraceActions()
22,
handleShutdownNanotraceAction);
QObject::connect(startNanotraceAction->defaultAction(), &QAction::triggered, [&]() {
QObject::connect(startNanotraceAction->action(), &QAction::triggered, [&]() {
d->nodeInstanceView.startNanotrace();
});
@@ -276,7 +276,7 @@ void ViewManager::registerNanotraceActions()
23,
handleShutdownNanotraceAction);
QObject::connect(shutDownNanotraceAction->defaultAction(), &QAction::triggered, [&]() {
QObject::connect(shutDownNanotraceAction->action(), &QAction::triggered, [&]() {
d->nodeInstanceView.endNanotrace();
});

View File

@@ -6,8 +6,9 @@
#include <viewmanager.h>
#include <nodeinstanceview.h>
#include <qmldesignerplugin.h>
#include <nodemetainfo.h>
#include <qmldesignerplugin.h>
#include "seekerslider.h"
#include <utils/algorithm.h>
@@ -36,6 +37,12 @@ void Edit3DActionTemplate::actionTriggered(bool b)
m_action(m_selectionContext);
}
Edit3DWidgetActionTemplate::Edit3DWidgetActionTemplate(QWidgetAction *widget)
: PureActionInterface(widget)
{
}
Edit3DAction::Edit3DAction(const QByteArray &menuId,
View3DActionType type,
const QString &description,
@@ -47,11 +54,11 @@ Edit3DAction::Edit3DAction(const QByteArray &menuId,
Edit3DView *view,
SelectionContextOperation selectionAction,
const QString &toolTip)
: AbstractAction(new Edit3DActionTemplate(description, selectionAction, view, type))
, m_menuId(menuId)
, m_actionTemplate(qobject_cast<Edit3DActionTemplate *>(defaultAction()))
: Edit3DAction(menuId, type, view, new Edit3DActionTemplate(description,
selectionAction,
view,
type))
{
view->registerEdit3DAction(this);
action()->setShortcut(key);
action()->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action()->setCheckable(checkable);
@@ -74,6 +81,17 @@ Edit3DAction::Edit3DAction(const QByteArray &menuId,
}
}
Edit3DAction::Edit3DAction(const QByteArray &menuId,
View3DActionType type,
Edit3DView *view,
PureActionInterface *pureInt)
: AbstractAction(pureInt)
, m_menuId(menuId)
, m_actionType(type)
{
view->registerEdit3DAction(this);
}
QByteArray Edit3DAction::category() const
{
return QByteArray();
@@ -81,7 +99,7 @@ QByteArray Edit3DAction::category() const
View3DActionType Edit3DAction::actionType() const
{
return m_actionTemplate->m_type;
return m_actionType;
}
bool Edit3DAction::isVisible([[maybe_unused]] const SelectionContext &selectionContext) const
@@ -114,5 +132,31 @@ bool Edit3DCameraAction::isEnabled(const SelectionContext &selectionContext) con
[](const ModelNode &node) { return node.metaInfo().isQtQuick3DCamera(); });
}
Edit3DParticleSeekerAction::Edit3DParticleSeekerAction(const QByteArray &menuId,
View3DActionType type,
Edit3DView *view)
: Edit3DAction(menuId,
type,
view,
new Edit3DWidgetActionTemplate(
new SeekerSliderAction(nullptr)))
{
m_seeker = qobject_cast<SeekerSliderAction *>(action());
}
SeekerSliderAction *Edit3DParticleSeekerAction::seekerAction()
{
return m_seeker;
}
bool Edit3DParticleSeekerAction::isVisible(const SelectionContext &) const
{
return m_seeker->isVisible();
}
bool Edit3DParticleSeekerAction::isEnabled(const SelectionContext &) const
{
return m_seeker->isEnabled();
}
}

View File

@@ -5,12 +5,15 @@
#include <abstractaction.h>
#include <QAction>
#include <QWidgetAction>
#include <QIcon>
class QWidgetAction;
namespace QmlDesigner {
using SelectionContextOperation = std::function<void(const SelectionContext &)>;
class Edit3DView;
class SeekerSliderAction;
class Edit3DActionTemplate : public DefaultAction
{
@@ -29,6 +32,15 @@ public:
View3DActionType m_type;
};
class Edit3DWidgetActionTemplate : public PureActionInterface
{
Q_DISABLE_COPY(Edit3DWidgetActionTemplate)
public:
explicit Edit3DWidgetActionTemplate(QWidgetAction *widget);
virtual void setSelectionContext(const SelectionContext &) {}
};
class Edit3DAction : public AbstractAction
{
public:
@@ -44,6 +56,11 @@ public:
SelectionContextOperation selectionAction = nullptr,
const QString &toolTip = {});
Edit3DAction(const QByteArray &menuId,
View3DActionType type,
Edit3DView *view,
PureActionInterface *pureInt);
QByteArray category() const override;
int priority() const override
@@ -69,7 +86,7 @@ protected:
private:
QByteArray m_menuId;
Edit3DActionTemplate *m_actionTemplate = nullptr;
View3DActionType m_actionType;
};
class Edit3DCameraAction : public Edit3DAction
@@ -90,4 +107,21 @@ protected:
bool isEnabled(const SelectionContext &selectionContext) const override;
};
class Edit3DParticleSeekerAction : public Edit3DAction
{
public:
Edit3DParticleSeekerAction(const QByteArray &menuId,
View3DActionType type,
Edit3DView *view);
SeekerSliderAction *seekerAction();
protected:
bool isVisible(const SelectionContext &) const override;
bool isEnabled(const SelectionContext &) const override;
private:
SeekerSliderAction *m_seeker = nullptr;
};
} // namespace QmlDesigner

View File

@@ -346,11 +346,6 @@ QSize Edit3DView::canvasSize() const
return {};
}
void Edit3DView::setSeeker(SeekerSlider *slider)
{
m_seeker = slider;
}
Edit3DAction *Edit3DView::createSelectBackgroundColorAction(QAction *syncBackgroundColorAction)
{
QString description = QCoreApplication::translate("SelectBackgroundColorAction",
@@ -468,6 +463,25 @@ Edit3DAction *Edit3DView::createSyncBackgroundColorAction()
tooltip);
}
Edit3DAction *Edit3DView::createSeekerSliderAction()
{
Edit3DParticleSeekerAction *seekerAction = new Edit3DParticleSeekerAction(
QmlDesigner::Constants::EDIT3D_PARTICLES_SEEKER,
View3DActionType::ParticlesSeek,
this);
seekerAction->action()->setEnabled(false);
seekerAction->action()->setToolTip(QLatin1String("Seek particle system time when paused."));
connect(seekerAction->seekerAction(),
&SeekerSliderAction::valueChanged,
this, [=] (int value) {
this->emitView3DAction(View3DActionType::ParticlesSeek, value);
});
return seekerAction;
}
void Edit3DView::createEdit3DActions()
{
m_selectionModeAction = new Edit3DAction(
@@ -661,8 +675,8 @@ void Edit3DView::createEdit3DActions()
m_particlesRestartAction->action()->setEnabled(particlemode);
if (particlemode)
m_particlesPlayAction->action()->setChecked(true);
if (m_seeker)
m_seeker->setEnabled(false);
if (m_seekerAction)
m_seekerAction->action()->setEnabled(false);
resetPuppet();
};
@@ -670,15 +684,15 @@ void Edit3DView::createEdit3DActions()
particlemode = !particlemode;
m_particlesPlayAction->action()->setEnabled(particlemode);
m_particlesRestartAction->action()->setEnabled(particlemode);
if (m_seeker)
m_seeker->setEnabled(false);
if (m_seekerAction)
m_seekerAction->action()->setEnabled(false);
QmlDesignerPlugin::settings().insert("particleMode", particlemode);
resetPuppet();
};
SelectionContextOperation particlesPlayTrigger = [this](const SelectionContext &) {
if (m_seeker)
m_seeker->setEnabled(!m_particlesPlayAction->action()->isChecked());
if (m_seekerAction)
m_seekerAction->action()->setEnabled(!m_particlesPlayAction->action()->isChecked());
};
m_particleViewModeAction = new Edit3DAction(
@@ -786,6 +800,8 @@ void Edit3DView::createEdit3DActions()
this,
backgroundColorActionsTrigger);
m_seekerAction = createSeekerSliderAction();
m_leftActions << m_selectionModeAction;
m_leftActions << nullptr; // Null indicates separator
m_leftActions << nullptr; // Second null after separator indicates an exclusive group
@@ -810,6 +826,8 @@ void Edit3DView::createEdit3DActions()
m_rightActions << m_particlesPlayAction;
m_rightActions << m_particlesRestartAction;
m_rightActions << nullptr;
m_rightActions << m_seekerAction;
m_rightActions << nullptr;
m_rightActions << m_resetAction;
m_visibilityToggleActions << m_showGridAction;

View File

@@ -25,7 +25,6 @@ namespace QmlDesigner {
class Edit3DWidget;
class Edit3DAction;
class Edit3DCameraAction;
class SeekerSlider;
class QMLDESIGNERCOMPONENTS_EXPORT Edit3DView : public AbstractView
{
@@ -58,7 +57,6 @@ public:
QVector<Edit3DAction *> visibilityToggleActions() const;
QVector<Edit3DAction *> backgroundColorActions() const;
Edit3DAction *edit3DAction(View3DActionType type) const;
void setSeeker(SeekerSlider *slider);
void addQuick3DImport();
void startContextMenu(const QPoint &pos);
@@ -91,6 +89,7 @@ private:
Edit3DAction *createGridColorSelectionAction();
Edit3DAction *createResetColorAction(QAction *syncBackgroundColorAction);
Edit3DAction *createSyncBackgroundColorAction();
Edit3DAction *createSeekerSliderAction();
QPointer<Edit3DWidget> m_edit3DWidget;
QVector<Edit3DAction *> m_leftActions;
@@ -120,7 +119,7 @@ private:
Edit3DAction *m_particlesRestartAction = nullptr;
Edit3DAction *m_visibilityTogglesAction = nullptr;
Edit3DAction *m_backgrondColorMenuAction = nullptr;
SeekerSlider *m_seeker = nullptr;
Edit3DAction *m_seekerAction = nullptr;
int particlemode;
ModelCache<QImage> m_canvasCache;
ModelNode m_droppedModelNode;

View File

@@ -83,11 +83,8 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view)
fillLayout->setSpacing(0);
setLayout(fillLayout);
SeekerSlider *seeker = new SeekerSlider(this);
seeker->setEnabled(false);
// Initialize toolbar
m_toolBox = new ToolBox(seeker, this);
m_toolBox = new ToolBox(this);
fillLayout->addWidget(m_toolBox.data());
// Iterate through view actions. A null action indicates a separator and a second null action
@@ -164,13 +161,6 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view)
createContextMenu();
view->setSeeker(seeker);
seeker->setToolTip(QLatin1String("Seek particle system time when paused."));
QObject::connect(seeker, &SeekerSlider::valueChanged, [view](int value) {
view->emitView3DAction(View3DActionType::ParticlesSeek, value);
});
// Onboarding label contains instructions for new users how to get 3D content into the project
m_onboardingLabel = new QLabel(this);
QString labelText =

View File

@@ -51,7 +51,7 @@ void EventListPluginView::registerActions()
&SelectionContextFunctors::always,
&SelectionContextFunctors::always));
auto eventListAction = new EventListAction();
connect(eventListAction->defaultAction(), &QAction::triggered, [this]() {
connect(eventListAction->action(), &QAction::triggered, [this]() {
if (!m_eventListDialog)
m_eventListDialog = new EventListDialog(Core::ICore::dialogParent());
@@ -62,7 +62,7 @@ void EventListPluginView::registerActions()
designerActionManager.addDesignerAction(eventListAction);
auto assignEventAction = new AssignEventEditorAction();
connect(assignEventAction->defaultAction(), &QAction::triggered, [this]() {
connect(assignEventAction->action(), &QAction::triggered, [this]() {
if (!m_assigner)
m_assigner = new AssignEventDialog(Core::ICore::dialogParent());
if (!m_eventListDialog)
@@ -78,7 +78,7 @@ void EventListPluginView::registerActions()
auto *connectSignalAction = new ConnectSignalAction();
connect(connectSignalAction->defaultAction(), &QAction::triggered, [this, connectSignalAction]() {
connect(connectSignalAction->action(), &QAction::triggered, [this, connectSignalAction]() {
if (!m_signalConnector)
m_signalConnector = new ConnectSignalDialog(Core::ICore::dialogParent());

View File

@@ -128,7 +128,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
addAction(m_rootHeightAction.data());
upperActions.append(m_rootHeightAction.data());
m_toolBox = new ToolBox(nullptr, this);
m_toolBox = new ToolBox(this);
fillLayout->addWidget(m_toolBox.data());
m_toolBox->setLeftSideActions(upperActions);

View File

@@ -67,4 +67,41 @@ void SeekerSlider::mouseReleaseEvent(QMouseEvent *event)
QSlider::mouseReleaseEvent(event);
}
SeekerSliderAction::SeekerSliderAction(QObject *parent)
: QWidgetAction(parent)
, m_defaultSlider(new SeekerSlider())
{
setDefaultWidget(m_defaultSlider);
QObject::connect(m_defaultSlider, &QSlider::valueChanged, this, &SeekerSliderAction::valueChanged);
}
SeekerSliderAction::~SeekerSliderAction()
{
m_defaultSlider->deleteLater();
}
SeekerSlider *SeekerSliderAction::defaultSlider() const
{
return m_defaultSlider;
}
int SeekerSliderAction::value()
{
return m_defaultSlider->value();
}
QWidget *SeekerSliderAction::createWidget(QWidget *parent)
{
SeekerSlider *slider = new SeekerSlider(parent);
QObject::connect(m_defaultSlider, &SeekerSlider::valueChanged, slider, &SeekerSlider::setValue);
QObject::connect(slider, &SeekerSlider::valueChanged, m_defaultSlider, &SeekerSlider::setValue);
QObject::connect(m_defaultSlider, &QSlider::rangeChanged, slider, &QSlider::setRange);
slider->setValue(m_defaultSlider->value());
slider->setMaxValue(m_defaultSlider->maxValue());
return slider;
}
} // namespace QmlDesigner

View File

@@ -3,6 +3,7 @@
#pragma once
#include <QSlider>
#include <QWidgetAction>
namespace QmlDesigner {
class SeekerSlider : public QSlider
@@ -28,4 +29,27 @@ private:
bool m_moving = false;
};
class SeekerSlider;
class SeekerSliderAction : public QWidgetAction
{
Q_OBJECT
public:
explicit SeekerSliderAction(QObject *parent);
virtual ~SeekerSliderAction();
SeekerSlider *defaultSlider() const;
int value();
signals:
void valueChanged(int);
protected:
virtual QWidget *createWidget(QWidget *parent) override;
private:
using QWidgetAction::setDefaultWidget;
SeekerSlider *m_defaultSlider = nullptr;
};
} // namespace QmlDesigner

View File

@@ -13,11 +13,10 @@
namespace QmlDesigner {
ToolBox::ToolBox(SeekerSlider *seeker, QWidget *parentWidget)
: Utils::StyledBar(parentWidget),
m_leftToolBar(new QToolBar(QLatin1String("LeftSidebar"), this)),
m_rightToolBar(new QToolBar(QLatin1String("RightSidebar"), this)),
m_seeker(seeker)
ToolBox::ToolBox(QWidget *parentWidget)
: Utils::StyledBar(parentWidget)
, m_leftToolBar(new QToolBar(QLatin1String("LeftSidebar"), this))
, m_rightToolBar(new QToolBar(QLatin1String("RightSidebar"), this))
{
setProperty("panelwidget", false);
m_leftToolBar->setFloatable(true);
@@ -30,7 +29,6 @@ ToolBox::ToolBox(SeekerSlider *seeker, QWidget *parentWidget)
setFixedHeight(Theme::toolbarSize());
auto stretchToolbar = new QToolBar(this);
m_leftToolBar->setProperty("panelwidget", false);
m_leftToolBar->setProperty("panelwidget_singlerow", false);
@@ -39,17 +37,16 @@ ToolBox::ToolBox(SeekerSlider *seeker, QWidget *parentWidget)
m_rightToolBar->setProperty("panelwidget", false);
m_rightToolBar->setProperty("panelwidget_singlerow", false);
m_rightToolBar->setFixedHeight(Theme::toolbarSize());
m_rightToolBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
auto stretchToolbar = new QToolBar(this);
stretchToolbar->setProperty("panelwidget", false);
stretchToolbar->setProperty("panelwidget_singlerow", false);
stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_rightToolBar->setOrientation(Qt::Horizontal);
horizontalLayout->addWidget(m_leftToolBar);
horizontalLayout->addWidget(stretchToolbar);
if (m_seeker)
horizontalLayout->addWidget(m_seeker);
horizontalLayout->addWidget(m_rightToolBar);
}
@@ -82,9 +79,4 @@ QList<QAction*> ToolBox::actions() const
return m_leftToolBar->actions() + m_rightToolBar->actions();
}
SeekerSlider *ToolBox::seeker() const
{
return m_seeker;
}
} // namespace QmlDesigner

View File

@@ -16,18 +16,16 @@ namespace QmlDesigner {
class ToolBox : public Utils::StyledBar
{
public:
ToolBox(SeekerSlider *seeker, QWidget *parentWidget);
explicit ToolBox(QWidget *parentWidget);
void setLeftSideActions(const QList<QAction*> &actions);
void setRightSideActions(const QList<QAction*> &actions);
void addLeftSideAction(QAction *action);
void addRightSideAction(QAction *action);
QList<QAction*> actions() const;
SeekerSlider *seeker() const;
private:
QToolBar *m_leftToolBar;
QToolBar *m_rightToolBar;
SeekerSlider *m_seeker;
};
} // namespace QmlDesigner

View File

@@ -56,6 +56,7 @@ const char EDIT3D_EDIT_SHOW_PARTICLE_EMITTER[] = "QmlDesigner.Editor3D.TogglePar
const char EDIT3D_RESET_VIEW[] = "QmlDesigner.Editor3D.ResetView";
const char EDIT3D_PARTICLE_MODE[] = "QmlDesigner.Editor3D.ParticleViewModeToggle";
const char EDIT3D_PARTICLES_PLAY[] = "QmlDesigner.Editor3D.ParticlesPlay";
const char EDIT3D_PARTICLES_SEEKER[] = "QmlDesigner.Editor3D.ParticlesSeeker";
const char EDIT3D_PARTICLES_RESTART[] = "QmlDesigner.Editor3D.ParticlesRestart";
const char EDIT3D_VISIBILITY_TOGGLES[] = "QmlDesigner.Editor3D.VisibilityToggles";
const char EDIT3D_BACKGROUND_COLOR_ACTIONS[] = "QmlDesigner.Editor3D.BackgroundColorActions";

View File

@@ -70,9 +70,9 @@ QmlPreviewAction::QmlPreviewAction() : ModelNodeAction(livePreviewId,
&SelectionContextFunctors::always)
{
if (!QmlPreviewWidgetPlugin::getPreviewPlugin())
defaultAction()->setVisible(false);
action()->setVisible(false);
defaultAction()->setCheckable(true);
action()->setCheckable(true);
}
void QmlPreviewAction::updateContext()
@@ -80,7 +80,7 @@ void QmlPreviewAction::updateContext()
if (selectionContext().view()->isAttached())
QmlPreviewWidgetPlugin::setQmlFile();
defaultAction()->setSelectionContext(selectionContext());
pureAction()->setSelectionContext(selectionContext());
}
ActionInterface::Type QmlPreviewAction::type() const

View File

@@ -59,7 +59,7 @@ QmlPreviewWidgetPlugin::QmlPreviewWidgetPlugin()
auto separator = new SeparatorDesignerAction(ComponentCoreConstants::qmlPreviewCategory, 0);
designerActionManager.addDesignerAction(separator);
m_previewToggleAction = previewAction->defaultAction();
m_previewToggleAction = previewAction->action();
if (s_previewPlugin) {
auto fpsAction = new FpsAction;