diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-04-01 16:21:03 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-04-01 16:37:09 +0300 |
commit | d96f2732be3264c019d8523932ff35f714053152 (patch) | |
tree | 3df17aee56322e3933c987423a7aa5912aa05a23 /src/Authoring/Studio/Palettes | |
parent | 9b6a24c9f71553f78dc511e68f5aab8b5960e6fa (diff) | |
parent | 69caaf1facb4d81910153bf47f6fd71849d95ca7 (diff) |
Merge branch '2.3'
Change-Id: If005b2e6e32c3616152e3049dbfa934fb28005da
Diffstat (limited to 'src/Authoring/Studio/Palettes')
-rw-r--r-- | src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp | 96 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp | 3 |
2 files changed, 52 insertions, 47 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp index d7d233a5..ae6fec47 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp @@ -1000,54 +1000,56 @@ void TimelineGraphicsScene::updateHoverStatus(const QPointF &scenePos) RowTree *rowTree = item->type() == TimelineItem::TypeRowTree ? static_cast<RowTree *>(item) : static_cast<RowTreeLabelItem *>(item)->parentRow(); - int left = rowTree->clipX(); - int right = (int)rowTree->treeWidth() - TimelineConstants::TREE_ICONS_W; - variantsAreaHovered = scenePos.x() > left && scenePos.x() < right; - if (variantsAreaHovered && rowTree != m_variantsRowTree) { - CDoc *doc = g_StudioApp.GetCore()->GetDoc(); - const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem(); - const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); - auto property = bridge->GetLayer().m_variants; - - using namespace qt3dsdm; - SValue sValue; - if (propertySystem->GetInstancePropertyValue(rowTree->instance(), property, - sValue)) { - QString propVal = get<TDataStrPtr>(sValue)->toQString(); - if (!propVal.isEmpty()) { - // parse propVal into variantsHash (group => tags) - const QStringList tagPairs = propVal.split(QLatin1Char(',')); - QHash<QString, QStringList> variantsHash; - QStringList variantsHashKeys; // maintain traverse order - for (auto &tagPair : tagPairs) { - const QStringList pair = tagPair.split(QLatin1Char(':')); - variantsHash[pair[0]].append(pair[1]); - if (!variantsHashKeys.contains(pair[0])) - variantsHashKeys.append(pair[0]); - } - - // parse variantsHash into tooltipStr - const auto variantsDef - = g_StudioApp.GetCore()->getProjectFile().variantsDef(); - QString templ = QStringLiteral("<font color='%1'>%2</font>"); - QString tooltipStr("<table>"); - for (auto &g : qAsConst(variantsHashKeys)) { - tooltipStr.append("<tr><td>"); - tooltipStr.append(templ.arg(variantsDef[g].m_color).arg(g + ": ")); - tooltipStr.append("</td><td>"); - for (auto &t : qAsConst(variantsHash[g])) - tooltipStr.append(t + ", "); - tooltipStr.chop(2); - tooltipStr.append("</td></tr>"); + if (!rowTree->isProperty()) { + int left = rowTree->clipX(); + int right = (int)rowTree->treeWidth() - TimelineConstants::TREE_ICONS_W; + variantsAreaHovered = scenePos.x() > left && scenePos.x() < right; + if (variantsAreaHovered && rowTree != m_variantsRowTree) { + CDoc *doc = g_StudioApp.GetCore()->GetDoc(); + const auto propertySystem = doc->GetStudioSystem()->GetPropertySystem(); + const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); + auto property = bridge->GetLayer().m_variants; + + using namespace qt3dsdm; + SValue sValue; + if (propertySystem->GetInstancePropertyValue(rowTree->instance(), property, + sValue)) { + QString propVal = get<TDataStrPtr>(sValue)->toQString(); + if (!propVal.isEmpty()) { + // parse propVal into variantsHash (group => tags) + const QStringList tagPairs = propVal.split(QLatin1Char(',')); + QHash<QString, QStringList> variantsHash; + QStringList variantsHashKeys; // maintain traverse order + for (auto &tagPair : tagPairs) { + const QStringList pair = tagPair.split(QLatin1Char(':')); + variantsHash[pair[0]].append(pair[1]); + if (!variantsHashKeys.contains(pair[0])) + variantsHashKeys.append(pair[0]); + } + + // parse variantsHash into tooltipStr + const auto variantsDef + = g_StudioApp.GetCore()->getProjectFile().variantsDef(); + QString templ = QStringLiteral("<font color='%1'>%2</font>"); + QString tooltipStr("<table>"); + for (auto &g : qAsConst(variantsHashKeys)) { + tooltipStr.append("<tr><td>"); + tooltipStr.append(templ.arg(variantsDef[g].m_color).arg(g + ": ")); + tooltipStr.append("</td><td>"); + for (auto &t : qAsConst(variantsHash[g])) + tooltipStr.append(t + ", "); + tooltipStr.chop(2); + tooltipStr.append("</td></tr>"); + } + tooltipStr.append("</table>"); + m_variantsToolTip->setText(tooltipStr); + m_variantsToolTip->adjustSize(); + m_variantsToolTip->move(m_widgetTimeline->mapToGlobal( + {right, (int)rowTree->y()})); + m_variantsToolTip->raise(); + m_variantsToolTip->show(); + m_variantsRowTree = rowTree; } - tooltipStr.append("</table>"); - m_variantsToolTip->setText(tooltipStr); - m_variantsToolTip->adjustSize(); - m_variantsToolTip->move(m_widgetTimeline->mapToGlobal( - {right, (int)rowTree->y()})); - m_variantsToolTip->raise(); - m_variantsToolTip->show(); - m_variantsRowTree = rowTree; } } } diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp index 27335168..b953c836 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp @@ -96,6 +96,9 @@ ITimelineItemBinding *RowTree::getBinding() const // object instance handle int RowTree::instance() const { + if (m_isProperty || !m_binding) + return 0; + return static_cast<Qt3DSDMTimelineItemBinding *>(m_binding)->GetInstance(); } |