2020-08-04 20:54:02 -04:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
|
import QtGraphicalEffects 1.15
|
|
|
|
|
|
|
|
|
|
import "../constant"
|
|
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
|
enum BorderColorMode {
|
|
|
|
|
NORMAL,
|
|
|
|
|
RIGHT,
|
|
|
|
|
ERROR
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
property int fieldLayoutWidth: 256
|
|
|
|
|
property int fieldLayoutHeight: 48
|
|
|
|
|
property bool layoutFillwidth: false
|
|
|
|
|
|
|
|
|
|
property int borderColorMode: InfoLineEdit.NORMAL
|
|
|
|
|
property var iconSource: {
|
2020-08-17 22:38:19 -04:00
|
|
|
if (readOnly) {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
switch(borderColorMode){
|
|
|
|
|
case InfoLineEdit.RIGHT:
|
2020-08-17 22:38:19 -04:00
|
|
|
return "qrc:/images/icons/round-check_circle-24px.svg"
|
2020-08-04 20:54:02 -04:00
|
|
|
case InfoLineEdit.NORMAL:
|
|
|
|
|
return ""
|
|
|
|
|
case InfoLineEdit.ERROR:
|
|
|
|
|
return "qrc:/images/icons/round-error-24px.svg"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
property var backgroundColor: JamiTheme.rgb256(240,240,240)
|
|
|
|
|
property var borderColor: {
|
2020-08-17 22:38:19 -04:00
|
|
|
if (!enabled) {
|
|
|
|
|
return "transparent"
|
|
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
switch(borderColorMode){
|
|
|
|
|
case InfoLineEdit.NORMAL:
|
2020-08-17 22:38:19 -04:00
|
|
|
return "#333"
|
2020-08-04 20:54:02 -04:00
|
|
|
case InfoLineEdit.RIGHT:
|
|
|
|
|
return "green"
|
|
|
|
|
case InfoLineEdit.ERROR:
|
|
|
|
|
return "red"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-17 22:38:19 -04:00
|
|
|
signal imageClicked
|
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
readOnly: false
|
|
|
|
|
selectByMouse: true
|
|
|
|
|
font.pointSize: 10
|
|
|
|
|
padding: 16
|
|
|
|
|
font.kerning: true
|
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
|
|
|
|
|
Image {
|
|
|
|
|
source: iconSource
|
|
|
|
|
width: 24
|
|
|
|
|
height: 24
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
|
layer {
|
|
|
|
|
enabled: true
|
|
|
|
|
effect: ColorOverlay {
|
|
|
|
|
id: overlay
|
|
|
|
|
color: borderColor
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-17 22:38:19 -04:00
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
enabled: borderColorMode === InfoLineEdit.RIGHT
|
|
|
|
|
|
|
|
|
|
onReleased: {
|
|
|
|
|
imageClicked()
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
radius: 4
|
2020-08-17 22:38:19 -04:00
|
|
|
border.color: readOnly? "transparent" : borderColor
|
2020-08-04 20:54:02 -04:00
|
|
|
color: readOnly? "transparent" : backgroundColor
|
|
|
|
|
}
|
|
|
|
|
}
|