summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
index 41d67789..1c4fe0f2 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Action/ActionView.cpp
@@ -183,6 +183,11 @@ bool ActionView::event(QEvent *event)
return QQuickWidget::event(event);
}
+void ActionView::setControlView(InspectorControlView *controlView)
+{
+ m_inspectorControlView = controlView;
+}
+
void ActionView::setItem(const qt3dsdm::Qt3DSDMInstanceHandle &handle)
{
if (!m_activeBrowser.isNull() && m_activeBrowser->isVisible()) {
@@ -324,6 +329,11 @@ bool ActionView::isPropertyValueInvalid() const
return m_propertyValueInvalid;
}
+QColor ActionView::showColorDialog(const QColor &color, int instance, int handle)
+{
+ return ActionView::m_inspectorControlView->showColorDialog(color, instance, handle);
+}
+
void ActionView::setCurrentActionIndex(int index)
{
if (index == m_currentActionIndex)
@@ -384,8 +394,17 @@ void ActionView::addAction()
// Query data model bridge to see the applicable events and actions for this instance.
CClientDataModelBridge *theBridge = GetBridge();
- std::wstring theEventName = theBridge->GetDefaultEvent(m_itemHandle);
- std::wstring theHandlerName = theBridge->GetDefaultHandler(m_itemHandle);
+ // For signals, default to onActivate and emitting signal
+ std::wstring preferredEvent = L"";
+ std::wstring preferredHandler = L"";
+ auto info = m_objRefHelper->GetInfo(m_itemHandle);
+ if (info.m_Type == OBJTYPE_SIGNAL) {
+ preferredEvent = L"onActivate";
+ preferredHandler = L"Emit Signal";
+ }
+
+ std::wstring theEventName = theBridge->GetDefaultEvent(m_itemHandle, preferredEvent);
+ std::wstring theHandlerName = theBridge->GetDefaultHandler(m_itemHandle, preferredHandler);
Q3DStudio::SCOPED_DOCUMENT_EDITOR(*GetDoc(), QObject::tr("Add Action"))
->AddAction(GetDoc()->GetActiveSlide(), m_itemHandle, theEventName,
@@ -514,6 +533,22 @@ QObject *ActionView::showEventBrowser(const QPoint &point)
qt3dsdm::TEventHandleList eventList;
bridge->GetEvents(instanceHandle, eventList);
+
+ // Only show time events if the selected object is a signal
+ auto info = m_objRefHelper->GetInfo(m_itemHandle);
+ if (info.m_Type == OBJTYPE_SIGNAL) {
+ qt3dsdm::TEventHandleList filteredEventList;
+ auto thePos = eventList.begin();
+ for (; thePos != eventList.end(); ++thePos) {
+ qt3dsdm::SEventInfo theEvent = bridge->GetEventInfo(*thePos);
+ QString name = QString::fromWCharArray(theEvent.m_Category.wide_str());
+
+ if (name == QString("Time"))
+ filteredEventList.emplace_back(*thePos);
+ }
+ eventList = filteredEventList;
+ }
+
m_eventsModel->setEventList(eventList);
if (!m_eventsBrowser)
@@ -1034,6 +1069,8 @@ void ActionView::updateHandlerArguments()
m_currentPropertyValueHandle = 0;
m_currentPropertyNameHandle = 0;
m_handlerArguments.clear();
+ // Emit empty list, to force update even when arguments amount remain the same
+ Q_EMIT handlerArgumentsChanged();
const auto doc = GetDoc();
if (!doc->isValid() || !m_itemHandle.Valid())
return;
@@ -1059,6 +1096,7 @@ void ActionView::updateHandlerArguments()
argument.m_completeType = argMetaData->m_CompleteType;
m_handlerArguments.append(QVariant::fromValue(argument));
}
+ Q_EMIT handlerArgumentsChanged();
}
}
@@ -1106,6 +1144,8 @@ void ActionView::initialize()
{
CStudioPreferences::setQmlContextProperties(rootContext());
rootContext()->setContextProperty(QStringLiteral("_parentView"), this);
+ rootContext()->setContextProperty(QStringLiteral("_inspectorModel"),
+ m_inspectorControlView->inspectorControlModel());
rootContext()->setContextProperty(QStringLiteral("_resDir"), StudioUtils::resourceImageUrl());
rootContext()->setContextProperty(QStringLiteral("_tabOrderHandler"), tabOrderHandler());
rootContext()->setContextProperty(QStringLiteral("_mouseHelper"), &m_mouseHelper);
@@ -1161,7 +1201,7 @@ int ActionView::slideNameToIndex(const QString &name)
bool ActionView::toolTipsEnabled()
{
- return CStudioPreferences::ShouldShowTooltips();
+ return CStudioPreferences::isTooltipsOn();
}
void ActionView::updateActionStates()