diff --git a/interface/resources/images/NoPictureProvided.svg b/interface/resources/images/NoPictureProvided.svg new file mode 100644 index 0000000000..003b499bbc --- /dev/null +++ b/interface/resources/images/NoPictureProvided.svg @@ -0,0 +1,3 @@ + + +2015-06-22 17:35ZCanvas 1No infoNo Picture Provided diff --git a/interface/resources/images/header_sep.svg b/interface/resources/images/header_sep.svg new file mode 100644 index 0000000000..ae1434860c --- /dev/null +++ b/interface/resources/images/header_sep.svg @@ -0,0 +1,3 @@ + + +2015-06-22 17:35ZCanvas 1No info diff --git a/interface/resources/images/tooltip_container.svg b/interface/resources/images/tooltip_container.svg new file mode 100644 index 0000000000..2c89bbbd7d --- /dev/null +++ b/interface/resources/images/tooltip_container.svg @@ -0,0 +1,3 @@ + + +2015-06-22 17:35ZCanvas 1Info diff --git a/interface/resources/qml/Tooltip.qml b/interface/resources/qml/Tooltip.qml index c836030ba1..169e5fe211 100644 --- a/interface/resources/qml/Tooltip.qml +++ b/interface/resources/qml/Tooltip.qml @@ -1,31 +1,76 @@ import Hifi 1.0 as Hifi -import QtQuick 2.3 as Original +import QtQuick 2.4 +import QtQuick.Layouts 1.1 import "controls" import "styles" Hifi.Tooltip { id: root HifiConstants { id: hifi } - // FIXME adjust position based on the edges of the screen - x: (lastMousePosition.x > surfaceSize.width/2) ? lastMousePosition.x - 140 : lastMousePosition.x + 20 - //y: lastMousePosition.y + 5 - y: (lastMousePosition.y > surfaceSize.height/2) ? lastMousePosition.y - 70 : lastMousePosition.y + 5 - implicitWidth: border.implicitWidth - implicitHeight: border.implicitHeight + x: lastMousePosition.x + offsetX + y: lastMousePosition.y + offsetY + property int offsetX: 0 + property int offsetY: 0 + width: border.width + height: border.height - Border { + Component.onCompleted: { + offsetX = (lastMousePosition.x > surfaceSize.width/2) ? -root.width : 0 + offsetY = (lastMousePosition.y > surfaceSize.height/2) ? -root.height : 0 + } + + Rectangle { id: border - anchors.fill: parent - implicitWidth: text.implicitWidth - implicitHeight: Math.max(text.implicitHeight, 64) + color: "#7f000000" + width: 322 + height: col.height + hifi.layout.spacing * 2 - Text { - id: text - anchors.fill: parent - anchors.margins: 16 - font.pixelSize: hifi.fonts.pixelSize / 2 - text: root.text - wrapMode: Original.Text.WordWrap + Column { + id: col + x: hifi.layout.spacing + y: hifi.layout.spacing + anchors.left: parent.left + anchors.leftMargin: hifi.layout.spacing + anchors.right: parent.right + anchors.rightMargin: hifi.layout.spacing + spacing: 5 + + Text { + id: textPlace + color: "white" + font.underline: true + anchors.left: parent.left + anchors.right: parent.right + font.pixelSize: hifi.fonts.pixelSize / 2 + text: root.text + wrapMode: Text.WrapAnywhere + + /* Uncomment for debugging to see the extent of the + Rectangle { + anchors.fill: parent + color: "#7fff00ff" + } + */ + } + + Image { + id: tooltipPic + source: "../images/NoPictureProvided.svg" + anchors.left: parent.left + anchors.right: parent.right + verticalAlignment: Image.AlignVCenter + } + + Text { + id: textDescription + color: "white" + width: border.implicitWidth + anchors.left: parent.left + anchors.right: parent.right + font.pixelSize: hifi.fonts.pixelSize / 2 + text: root.text + wrapMode: Text.WrapAnywhere + } } } -} +} \ No newline at end of file diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index fe580eb137..0ea6080165 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -43,6 +43,7 @@ #include "RenderableLineEntityItem.h" #include "RenderablePolyVoxEntityItem.h" #include "EntitiesRendererLogging.h" +#include "AddressManager.h" EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState, AbstractScriptingServicesInterface* scriptingServices) : @@ -836,6 +837,14 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int device RayToEntityIntersectionResult rayPickResult = findRayIntersectionWorker(ray, Octree::Lock, precisionPicking); if (rayPickResult.intersects) { //qCDebug(entitiesrenderer) << "mousePressEvent over entity:" << rayPickResult.entityID; + + QString urlString = rayPickResult.properties.getHref(); + QUrl url = QUrl(urlString, QUrl::StrictMode); + if (url.isValid() && !url.isEmpty()){ + DependencyManager::get()->handleLookupString(urlString); + + } + emit mousePressOnEntity(rayPickResult, event, deviceID); QScriptValueList entityScriptArgs = createMouseEventArgs(rayPickResult.entityID, event, deviceID);