diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-03-22 07:43:24 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-03-23 03:57:27 +0000 |
commit | a655a94f28bb6e4e19486eba8d50db3cc5b823b8 (patch) | |
tree | 55bd7e72f6d45ebe65dbc57d611b0024a6b6f199 /src/Authoring/Studio/Palettes/Slide | |
parent | 90e4f80a8492a50c147aebdfe4ea295860cf7c09 (diff) |
Fix tooltips view menu item
Task-number: QT3DS-1320
Change-Id: If50eb65bcae06eecc52fd9b4ca20fb28016c9a5a
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@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 | 7 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.h | 1 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.qml | 42 |
3 files changed, 28 insertions, 22 deletions
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp index b4577d0b..4016b4d4 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp @@ -131,6 +131,11 @@ void SlideView::showControllerDialog(const QPoint &point) return; } +bool SlideView::toolTipsEnabled() +{ + return CStudioPreferences::ShouldShowTooltips(); +} + void SlideView::showBrowser(QQuickWidget *browser, const QPoint &point) { QSize popupSize = CStudioPreferences::browserPopupSize(); @@ -389,7 +394,7 @@ void SlideView::updateDataInputStatus(bool isViaDispatch) void SlideView::initialize() { CStudioPreferences::setQmlContextProperties(rootContext()); - rootContext()->setContextProperty("_slideView"_L1, this); + rootContext()->setContextProperty("_parentView"_L1, this); rootContext()->setContextProperty("_resDir"_L1, resourceImageUrl()); engine()->addImportPath(qmlImportPath()); diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.h b/src/Authoring/Studio/Palettes/Slide/SlideView.h index ee7e7090..ee93532f 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.h +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.h @@ -75,6 +75,7 @@ public: Q_INVOKABLE void finishSlideRearrange(bool commit); Q_INVOKABLE void showContextMenu(int x, int y, int row); Q_INVOKABLE void showControllerDialog(const QPoint &point); + Q_INVOKABLE bool toolTipsEnabled(); // Presentation Change Listener void OnNewPresentation() override; diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.qml b/src/Authoring/Studio/Palettes/Slide/SlideView.qml index 6d601825..79a8f06a 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.qml +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.qml @@ -35,17 +35,17 @@ Rectangle { id: root - readonly property bool masterSlide: _slideView.showMasterSlide + readonly property bool masterSlide: _parentView.showMasterSlide function handleMouseClicks(mouse) { if (mouse.button === Qt.RightButton) { const coords = slideList.mapToItem(root, mouse.x, mouse.y); - _slideView.showContextMenu(coords.x, coords.y, -1); + _parentView.showContextMenu(coords.x, coords.y, -1); } else { root.focus = true; //Unselect All element when we click outside slider item in listView. //It worked as it in old version. - _slideView.deselectAll(); + _parentView.deselectAll(); mouse.accepted = false } } @@ -80,20 +80,20 @@ Rectangle { id: masterEditButton anchors.horizontalCenter: parent.horizontalCenter - onClicked: _slideView.showMasterSlide = !_slideView.showMasterSlide + onClicked: _parentView.showMasterSlide = !_parentView.showMasterSlide background: Rectangle { color: "transparent" } contentItem: Image { - source: _slideView.showMasterSlide ? _resDir + "Slide-Normal.png" - : _resDir + "Slide-Master-Active.png" + source: _parentView.showMasterSlide ? _resDir + "Slide-Normal.png" + : _resDir + "Slide-Master-Active.png" } } StyledLabel { id: masterEditLabel - text: _slideView.showMasterSlide ? qsTr("Leave Master") : qsTr("Edit Master") + text: _parentView.showMasterSlide ? qsTr("Leave Master") : qsTr("Edit Master") font.pixelSize: _fontSize color: _masterColor verticalAlignment: Text.AlignVCenter @@ -123,7 +123,7 @@ Rectangle { boundsBehavior: Flickable.StopAtBounds clip: true - model: _slideView.currentModel + model: _parentView.currentModel spacing: 10 MouseArea { @@ -159,30 +159,30 @@ Rectangle { onPressed: { dragIndex = model.index; - _slideView.startSlideRearrange(model.index); + _parentView.startSlideRearrange(model.index); if (mouse.x > delegateItem.x && mouse.x < delegateItem.x + delegateItem.width) held = true; } onReleased: { held = false; - _slideView.finishSlideRearrange(true); + _parentView.finishSlideRearrange(true); } onCanceled: { held = false; - _slideView.finishSlideRearrange(false); + _parentView.finishSlideRearrange(false); } onClicked: { - _slideView.deselectAll(); + _parentView.deselectAll(); if (mouse.button === Qt.LeftButton) { root.focus = true; model.selected = true; } if (mouse.button === Qt.RightButton) { const coords = mapToItem(root, mouse.x, mouse.y); - _slideView.showContextMenu(coords.x, coords.y, model.index); + _parentView.showContextMenu(coords.x, coords.y, model.index); } } @@ -262,7 +262,7 @@ Rectangle { onEntered: { var oldIndex = drag.source.dragIndex var newIndex = model.index - _slideView.moveSlide(oldIndex, newIndex) + _parentView.moveSlide(oldIndex, newIndex) drag.source.dragIndex = newIndex } } @@ -299,9 +299,9 @@ Rectangle { width: dataInputImage.sourceSize.width height: dataInputImage.sourceSize.height Layout.leftMargin: 12 - property bool controlled: _slideView.controlled - property string currentController: _slideView.currController - property string toolTip: _slideView.toolTip + property bool controlled: _parentView.controlled + property string currentController: _parentView.currController + property string toolTip: _parentView.toolTip background: Rectangle { color: "transparent" } @@ -311,7 +311,7 @@ Rectangle { hoverEnabled: true acceptedButtons: Qt.LeftButton onClicked: { - _slideView.showControllerDialog(mapToGlobal(mouse.x, mouse.y)); + _parentView.showControllerDialog(mapToGlobal(mouse.x, mouse.y)); } } Image { @@ -327,15 +327,15 @@ Rectangle { } StyledTooltip { id: tooltip - visible: controlButtonArea.containsMouse + enabled: controlButtonArea.containsMouse text: parent.toolTip } } StyledLabel { id: dataInputName - text: _slideView.currController + text: _parentView.currController leftPadding: 10 - color: _slideView.controlled ? _dataInputColor : "transparent" + color: _parentView.controlled ? _dataInputColor : "transparent" } } } |