diff --git a/qml/libdap-qt-ui-qml.qrc b/qml/libdap-qt-ui-qml.qrc index 226528d9d60878f1253e5ecf4ba575633c8a4215..3943b0a331372020f72cd39e2e88801b78f16644 100644 --- a/qml/libdap-qt-ui-qml.qrc +++ b/qml/libdap-qt-ui-qml.qrc @@ -48,5 +48,6 @@ <file>widgets/DapCustomComboBox.qml</file> <file>widgets/DapCustomToolTip.qml</file> <file>widgets/DapBigText.qml</file> + <file>widgets/DapToolTipInfo.qml</file> </qresource> </RCC> diff --git a/qml/widgets/DapCopyButton.qml b/qml/widgets/DapCopyButton.qml index 6699c122158a82527de60344dd33e7f811f3855a..ac429d660f6a379782b993e950cb109a50d628d1 100644 --- a/qml/widgets/DapCopyButton.qml +++ b/qml/widgets/DapCopyButton.qml @@ -38,6 +38,7 @@ Item { print("DapCopyButton onClicked") dapMainWindow.infoItem.showInfo( + 0,0, dapMainWindow.width*0.5, 8, popupText, diff --git a/qml/widgets/DapCustomToolTip.qml b/qml/widgets/DapCustomToolTip.qml index 62b51a5e39244b43f2435668b67b5839c0a132e1..ecfe091e5876d395143dea7c387596fbbf090a83 100644 --- a/qml/widgets/DapCustomToolTip.qml +++ b/qml/widgets/DapCustomToolTip.qml @@ -7,6 +7,7 @@ ToolTip { id: root signal updatePos() + property alias bottomRect: bottomRect property font textFont: mainFont.dapFont.medium12 property string textColor: currTheme.textColor property string contentText diff --git a/qml/widgets/DapPopupInfo.qml b/qml/widgets/DapPopupInfo.qml index d22e493c572ac7f402d411570b49b9659cb9647f..ef286345a719de1dbd535d51d58d9b73d62c05f4 100644 --- a/qml/widgets/DapPopupInfo.qml +++ b/qml/widgets/DapPopupInfo.qml @@ -110,7 +110,7 @@ Item { { anchors.fill: rectItem anchors.leftMargin: 16 -// anchors.rightMargin: 16 + anchors.rightMargin: 16 spacing: 10 DapImageLoader @@ -134,11 +134,18 @@ Item { } } - function showInfo(x_pos, y_pos, text, image) + function showInfo(width, height, x_pos, y_pos, text, image) { + if(width) + { + rectItem.width = width + stopX = dapMainWindow.width - (popup.width + 24) + } + if(height) + rectItem.height = height + showTimer.stop() hideTimer.stop() - opacityAnim.stop() showAnim.start() diff --git a/qml/widgets/DapTextField.qml b/qml/widgets/DapTextField.qml index e929017d6fe7b5ac0dcf6b358ac45a3ac521245b..ebe15d54a921af4835662c56602de65ba4bf3933 100644 --- a/qml/widgets/DapTextField.qml +++ b/qml/widgets/DapTextField.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.4 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 @@ -8,6 +8,7 @@ TextField { property int bottomLineSpacing: 8 property string bottomLineColor: borderColor property int bottomLineLeftRightMargins: 0 + property alias bottomLine: bottomLine property int borderWidth:0 property int borderRadius:0 @@ -19,6 +20,13 @@ TextField { property string placeholderColor: currTheme.placeHolderTextColor property string textColor: currTheme.textColor + property bool indicatorVisible: false + property string indicatorSourceEnabled: "" + property string indicatorSourceDisabled: "" + property string indicatorSourceEnabledHover: "" + property string indicatorSourceDisabledHover: "" + property alias indicator: indicator + style: TextFieldStyle { @@ -38,8 +46,58 @@ TextField { } } + + Image{ + id: indicator + + property bool isActive: false + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + visible: indicatorVisible + source: indicatorSourceDisabled + mipmap: true + + MouseArea{ + anchors.fill: parent + hoverEnabled: true + onEntered: { + if(indicator.isActive) + indicator.source = indicatorSourceEnabledHover + else + indicator.source = indicatorSourceDisabledHover + } + + onExited: { + if(indicator.isActive) + indicator.source = indicatorSourceEnabled + else + indicator.source = indicatorSourceDisabled + } + onClicked: { + indicator.isActive = !indicator.isActive + + if(containsMouse){ + if(indicator.isActive) + indicator.source = indicatorSourceEnabledHover + else + indicator.source = indicatorSourceDisabledHover + } + else + { + if(indicator.isActive) + indicator.source = indicatorSourceEnabled + else + indicator.source = indicatorSourceDisabled + } + } + } + } + //bottom line Rectangle { + id: bottomLine visible: bottomLineVisible anchors.top: parent.bottom diff --git a/qml/widgets/DapToolTipInfo.qml b/qml/widgets/DapToolTipInfo.qml new file mode 100644 index 0000000000000000000000000000000000000000..7a80edd52d22e91afa287c53c9c5d287d577da4b --- /dev/null +++ b/qml/widgets/DapToolTipInfo.qml @@ -0,0 +1,85 @@ +import QtQuick 2.4 +import QtQml 2.12 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 + +Image { + property string indicatorSrcNormal: "qrc:/Resources/BlackTheme/icons/other/ic_infoGray.svg" + property string indicatorSrcHover: "qrc:/Resources/BlackTheme/icons/other/ic_infoGray.svg" + property string contentText: "" + property alias toolTip: toolTip + property alias text: text + property font textFont: mainFont.dapFont.medium12 + + signal clicked() + + + mipmap: true + + source: area.containsMouse ? indicatorSrcHover : indicatorSrcNormal + + MouseArea{ + id: area + anchors.fill: parent + hoverEnabled: true + onClicked: parent.clicked() + } + + ToolTip{ + id: toolTip + visible: area.containsMouse + width: 213 + y: -(height + 10) + x: 0 + + contentItem: + Item{ + anchors.fill: parent + anchors.margins: 8 + Text + { + id: text + anchors.fill: parent + color: currTheme.textColor + text: contentText + font: textFont + horizontalAlignment: Qt.AlignHCenter + wrapMode: Text.WordWrap + verticalAlignment: Qt.AlignVCenter + } + } + + background:Item{ + Rectangle + { + id: backgroundToolTip + anchors.fill: parent + radius: 4 + color: currTheme.backgroundMainScreen + } + DropShadow { + anchors.fill: backgroundToolTip + source: backgroundToolTip + color: currTheme.reflection + horizontalOffset: -1 + verticalOffset: -1 + radius: 0 + samples: 0 + opacity: 1 + fast: true + cached: true + } + DropShadow { + anchors.fill: backgroundToolTip + source: backgroundToolTip + color: currTheme.shadowColor + horizontalOffset: 2 + verticalOffset: 2 + radius: 10 + samples: 20 + opacity: 1 + } + } + } +}