mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 02:03:57 +02:00
Word wrap implementation
This commit is contained in:
parent
6b14a64c8c
commit
8ea01b45ae
1 changed files with 57 additions and 48 deletions
|
@ -1,5 +1,5 @@
|
|||
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"
|
||||
|
@ -7,59 +7,68 @@ import "styles"
|
|||
Hifi.Tooltip {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
x: (lastMousePosition.x > surfaceSize.width/2) ? lastMousePosition.x - root.width : lastMousePosition.x
|
||||
y: (lastMousePosition.y > surfaceSize.height/2) ? lastMousePosition.y - root.height : lastMousePosition.y
|
||||
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: tooltipBackground.implicitWidth
|
||||
//implicitHeight: Math.max(text.implicitHeight, 64)
|
||||
implicitHeight: tooltipBackground.implicitHeight*/
|
||||
color: "#7f000000"
|
||||
width: 322
|
||||
height: col.height + hifi.layout.spacing * 2
|
||||
|
||||
Original.Rectangle {
|
||||
id: border
|
||||
color: "#7f000000"
|
||||
implicitWidth: 322
|
||||
implicitHeight: col.height + hifi.layout.spacing * 2
|
||||
|
||||
ColumnLayout {
|
||||
id: col
|
||||
spacing: 5
|
||||
|
||||
Text {
|
||||
id: textPlace
|
||||
color: "#ffffff"
|
||||
implicitWidth: 322
|
||||
//anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
font.pixelSize: hifi.fonts.pixelSize * 1.5
|
||||
text: root.text
|
||||
wrapMode: Original.Text.WrapAnywhere
|
||||
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"
|
||||
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"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
Original.Image {
|
||||
id: tooltipPic
|
||||
source: "../images/NoPictureProvided.svg"
|
||||
//anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
}
|
||||
|
||||
Text {
|
||||
id: textDescription
|
||||
color: "#ffffff"
|
||||
implicitWidth: 322
|
||||
//anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
font.pixelSize: hifi.fonts.pixelSize
|
||||
text: root.text
|
||||
wrapMode: Original.Text.WrapAnywhere
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue