diff options
author | Janne Kangas <janne.kangas@qt.io> | 2018-06-25 13:46:40 +0300 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2018-07-25 09:11:24 +0000 |
commit | 2f2112ffb74787ef3cbc905588075aaa1eb624d9 (patch) | |
tree | 39fb0995573914eb661cd69a9236a9cfb253cdc0 /src/Authoring/Studio/Palettes/Slide | |
parent | 49266118cbedae8060c689550a46a1d7bb9fdcd9 (diff) |
Improve slide data input control visualization
Adds indicator to slide panel that shows the controlling data input name.
Change-Id: I148facafc4d02e764d44a543c2152796d008522d
Task-id: QT3DS-1668
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Slide')
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.cpp | 14 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.h | 5 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.qml | 43 |
3 files changed, 62 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp index cd56029e..01e1338c 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp @@ -50,6 +50,7 @@ #include <QtQml/qqmlcontext.h> #include <QtQml/qqmlengine.h> #include <QtWidgets/qdesktopwidget.h> +#include <QtWidgets/qdockwidget.h> SlideView::SlideView(QWidget *parent) : QQuickWidget(parent) , m_MasterSlideModel(new SlideModel(1, this)) @@ -136,6 +137,13 @@ QSize SlideView::sizeHint() const return {150, 500}; } +QSize SlideView::minimumSizeHint() const +{ + // prevent datainput control indicator from overlapping + // with slide name too much when panel is minimised + return {80, 0}; +} + void SlideView::deselectAll() { g_StudioApp.GetCore()->GetDoc()->DeselectAllItems(); @@ -329,6 +337,12 @@ void SlideView::onDataInputChange(int handle, int instance, const QString &dataI Q_EMIT controlledChanged(); } +void SlideView::onDockLocationChange(Qt::DockWidgetArea area) +{ + m_dockArea = area; + Q_EMIT dockAreaChanged(); +} + // Set the state of slide control based on scene or component // controlledproperty void SlideView::updateDataInputStatus() diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.h b/src/Authoring/Studio/Palettes/Slide/SlideView.h index e5f04eb5..e95ac314 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.h +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.h @@ -55,6 +55,7 @@ class SlideView : public QQuickWidget, Q_PROPERTY(bool controlled MEMBER m_controlled NOTIFY controlledChanged) Q_PROPERTY(QString currController MEMBER m_currentController NOTIFY controlledChanged) Q_PROPERTY(QString toolTip MEMBER m_toolTip NOTIFY controlledChanged) + Q_PROPERTY(Qt::DockWidgetArea dockArea MEMBER m_dockArea NOTIFY dockAreaChanged) public: SlideView(QWidget *parent = nullptr); ~SlideView(); @@ -63,7 +64,9 @@ public: void setShowMasterSlide(bool show); QAbstractItemModel *currentModel() { return m_CurrentModel; } QSize sizeHint() const override; + QSize minimumSizeHint() const override; void onDataInputChange(int handle, int instance, const QString &dataInputName); + void onDockLocationChange(Qt::DockWidgetArea area); Q_INVOKABLE void deselectAll(); Q_INVOKABLE void addNewSlide(int row); @@ -91,6 +94,7 @@ Q_SIGNALS: void currentModelChanged(); void showMasterSlideChanged(); void controlledChanged(); + void dockAreaChanged(); protected: void mousePressEvent(QMouseEvent *event) override; @@ -135,6 +139,7 @@ private: bool m_controlled = false; // Are slides in this slide set controlled by datainput? QString m_currentController; QString m_toolTip; + Qt::DockWidgetArea m_dockArea; }; #endif // SLIDEVIEW_H diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.qml b/src/Authoring/Studio/Palettes/Slide/SlideView.qml index 3efc6027..32393ffa 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.qml +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.qml @@ -50,6 +50,11 @@ Rectangle { } } + Connections { + target: _parentView + onDockAreaChanged: diIndicator.reAnchor(); + } + color: _backgroundColor Column { @@ -117,6 +122,8 @@ Rectangle { - separator.height - separator2.height - parent.spacing * 2 - 14 - slideControlButton.height - slideControlButton.spacing * 2 + // DockWidgetArea is enum; value 0x2 denotes right edge + property int area: _parentView.dockArea height: listItemHeight > 0 ? listItemHeight : 0 anchors.horizontalCenter: parent.horizontalCenter @@ -126,6 +133,42 @@ Rectangle { model: _parentView.currentModel spacing: 10 + Rectangle { + id: diIndicator + height: slideList.listItemHeight + width: dataInputImage2.height + + function reAnchor() { + // reset anchors before setting new value + anchors.right = undefined + anchors.left = undefined + // default position for indicator is right edge + // except when slide panel is attached to window right side + if (parent.area === 2) + anchors.left = parent.left + else + anchors.right = parent.right + } + + color: _parentView.controlled ? _dataInputColor : "transparent" + Row { + rotation: 90 + anchors.centerIn: parent + Image { + id: dataInputImage2 + fillMode: Image.Pad + visible: _parentView.controlled + source: _resDir + "Objects-DataInput-White.png" + + } + StyledLabel { + text: _parentView.currController + anchors.margins: 16 + color: "#ffffff" + } + } + } + MouseArea { // mouse handling for the area not covered by the delegates propagateComposedEvents: true |