1. added border-hover-interaction
2. updated textarea-focus-interaction
This commit is contained in:
parent
8b08a5bee0
commit
ee99565b63
1 changed files with 75 additions and 47 deletions
|
@ -9,12 +9,23 @@ Rectangle {
|
||||||
property alias textArea: textArea
|
property alias textArea: textArea
|
||||||
property alias textAreaText: textArea.text
|
property alias textAreaText: textArea.text
|
||||||
|
|
||||||
|
property string borderHoveredColor: "#494B50"
|
||||||
|
property string borderNormalColor: "#2C2D30"
|
||||||
|
property string borderFocusedColor: "#d7d8db"
|
||||||
|
|
||||||
height: 148
|
height: 148
|
||||||
color: "#1C1D21"
|
color: "#1C1D21"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: "#2C2D30"
|
border.color: getBorderColor(borderNormalColor)
|
||||||
radius: 16
|
radius: 16
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: parentMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
onClicked: textArea.forceActiveFocus()
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
interactive: false
|
interactive: false
|
||||||
|
@ -55,14 +66,20 @@ Rectangle {
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
id: textAreaMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
fl.interactive = true
|
fl.interactive = true
|
||||||
contextMenu.open()
|
contextMenu.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
root.border.color = getBorderColor(borderNormalColor)
|
||||||
|
}
|
||||||
|
|
||||||
ContextMenuType {
|
ContextMenuType {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
textObj: textArea
|
textObj: textArea
|
||||||
|
@ -70,10 +87,21 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo make whole background clickable, with code below we lose ability to select text by mouse
|
onPressed: {
|
||||||
// MouseArea {
|
root.border.color = getBorderColor(borderFocusedColor)
|
||||||
// anchors.fill: parent
|
}
|
||||||
// cursorShape: Qt.IBeamCursor
|
|
||||||
// onClicked: textArea.forceActiveFocus()
|
onExited: {
|
||||||
// }
|
root.border.color = getBorderColor(borderNormalColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
root.border.color = getBorderColor(borderHoveredColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getBorderColor(noneFocusedColor) {
|
||||||
|
return textArea.focus ? root.borderFocusedColor : noneFocusedColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue