diff --git a/DapButton.qml b/DapButton.qml new file mode 100644 index 0000000000000000000000000000000000000000..a0ef3882f19736783d2d68cdcd2879408b23b013 --- /dev/null +++ b/DapButton.qml @@ -0,0 +1,4 @@ +import QtQuick 2.4 + +DapButtonForm { +} diff --git a/DapButtonForm.ui.qml b/DapButtonForm.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..4428f923247e540696a09d0b532be6dd9b136db5 --- /dev/null +++ b/DapButtonForm.ui.qml @@ -0,0 +1,81 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.0 + +Button { + ///@detalis heightButton Button height. + property int heightButton: 36 * pt + ///@detalis widthButton Button width. + property int widthButton: 120 * pt + ///@detalis normalImageButton The picture on the Button is in normal state. + property string normalImageButton: "qrc:/res/icons/new-wallet_icon_dark.png" + ///@detalis hoverImageButton The image on the Button is in the mouseover state. + property string hoverImageButton: "qrc:/res/icons/new-wallet_icon_dark_hover.png" + ///@detalis widthImageButton Image width. + property int widthImageButton: 28 * pt + ///@detalis heightImageButton Image height. + property int heightImageButton: 28 * pt + ///@detalis indentImageLeftButton: Indentation of the image from the left edge. + property int indentImageLeftButton: 10 * pt + ///@detalis colorBackgroundNormal Button background color in normal state. + property string colorBackgroundNormal:"#070023" + ///@detalis colorBackgroundHover Button background color in hover state. + property string colorBackgroundHover: "#D51F5D" + ///@detalis textButton Text button. + property string textButton: "New Wallet" + ///@detalis colorButtonTextNormal Button text color in normal state. + property string colorButtonTextNormal: "#FFFFFF" + ///@detalis colorButtonTextHover Button text color in hover state. + property string colorButtonTextHover: "#FFFFFF" + ///@detalis indentTextRight: Indentation of the text from the right edge. + property int indentTextRight: 20 * pt + ///@detalis fontSizeButton Font size. + property int fontSizeButton: 14 * pt + ///@detalis existenceImage Indicates the presence of an image. + property bool existenceImage:true + ///@detalis horizontalAligmentText Horizontal alignment. + property alias horizontalAligmentText:templateText.horizontalAlignment + ///@detalis colorBackgroundButton This property overrides the background color. + property alias colorBackgroundButton: dapBackgroundButton.color + ///@detalis colorTextButton This property overrides the color of the text. + property alias colorTextButton: templateText.color + ///@detalis borderColorButton Sets the color of the border. + property string borderColorButton: "#000000" + ///@detalis borderWidthButton Sets the width of the border. + property int borderWidthButton: 0 + + id: dapButton + + contentItem: Rectangle { + id: dapBackgroundButton + anchors.fill: parent + color: dapButton.hovered ? colorBackgroundHover : colorBackgroundNormal + implicitWidth: widthButton + implicitHeight: heightButton + border.color: borderColorButton + border.width: borderWidthButton + ///button text + Text { + id: templateText + anchors.fill: parent + verticalAlignment: Qt.AlignVCenter + horizontalAlignment: Qt.AlignRight + anchors.rightMargin: indentTextRight + font.pixelSize: fontSizeButton + font.family: "Roboto" + font.weight: Font.Normal + color: dapButton.hovered ? colorButtonTextHover : colorButtonTextNormal + text: qsTr(textButton) + } + + ///button picture + Image { + id: iconNewWallet + anchors.verticalCenter: if(existenceImage)parent.verticalCenter + anchors.left: if(existenceImage)parent.left + anchors.leftMargin:if(existenceImage) indentImageLeftButton + source: if(existenceImage) dapButton.hovered ? hoverImageButton : normalImageButton + width: if(existenceImage)widthImageButton + height:if(existenceImage) heightImageButton + } + } +} diff --git a/DapComboBox.qml b/DapComboBox.qml index 27e6e79ca8cfec3164c1902ee3f8256b4cf21844..82ef89dc4c60bab74edcc999746192b5b5936342 100644 --- a/DapComboBox.qml +++ b/DapComboBox.qml @@ -1,91 +1,13 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 +import QtQuick 2.0 +import QtQuick.Controls 2.0 - -///About property -///@hilightColor - color of the selected item -///@normalColor - color of item -///@normalColorText and @hilightColorText - normal and selected text color -///@normalColorTopText and @hilightColorTopText - text color in the main line in normal and active state -///@fontSizeComboBox - font size for the entire widget (px). -///@widthPopupComboBoxActive and @widthPopupComboBoxNormal - width of the combo box -/// in the active state and in the normal state -///@heightComboBoxNormal and @heightComboBoxActive - height of the combo box -/// in the active state and in the normal state -///@sidePaddingActive and @sidePaddingNormal - padding width of the combo box in the active state -/// and in the normal state -///@sidePaddingActive and @sidePaddingNormal - sets the indent from the edge of the right and left -/// edges of the parent in the active and normal state -///@topIndentActive and @topIndentNormal -///@bottomIndentActive and @bottomIndentNormal -/// - sets the indent from the edge of the upper and lower edges of the parent in the active and normal state -///@indicatorImageNormal and @indicatorImageActive - indicator picture address for active and normal state -///@indicatorWidth and @indicatorHeight - indicator width and height -///@heightListElement - List item height -///@intervalListElement - spacing between items in a list -///@bottomIntervalListElement - spacing from bottom to bottom -///@topEffect - Using an effect for the top element -///@colorTopNormalDropShadow - Color of the shadow effect of the combo box when minimized -///@colorDropShadow - Unboxed shadow color in expanded state -///@paddingTopItemDelegate - indent above and below from item delegate - -ComboBox { - - property string normalColorText: "#070023" - property string hilightColorText: "#FFFFFF" - - property string normalColorTopText:normalColorText - property string hilightColorTopText:normalColorText - - property string normalColor: "#FFFFFF" - property string hilightColor: "#330F54" - property string normalTopColor: normalColor - property string hilightTopColor: normalColor - - property int fontSizeComboBox: 16*pt - - property int widthPopupComboBoxNormal: parent.width - property int widthPopupComboBoxActive: widthPopupComboBoxNormal - - property int heightComboBoxNormal: parent.height - property int heightComboBoxActive: heightComboBoxNormal - - property int sidePaddingNormal:16 * pt - property int sidePaddingActive:sidePaddingNormal - - property int topIndentNormal:12 * pt - property int topIndentActive:topIndentNormal - - property int bottomIndentNormal:14 * pt - property int bottomIndentActive:bottomIndentNormal - - property int paddingTopItemDelegate:8 * pt - property int paddingBottomItemDelegate:paddingTopItemDelegate - - property int heightListElement: 32 * pt - property int intervalListElement: 10 * pt - property int bottomIntervalListElement:intervalListElement - property bool topEffect: true - - property string indicatorImageNormal: "qrc:/res/icons/ic_arrow_drop_down_dark_blue.png" - property string indicatorImageActive: "qrc:/res/icons/ic_arrow_drop_up_dark_blue.png" - property int indicatorWidth: 24*pt - property int indicatorHeight: indicatorWidth - - property string colorTopNormalDropShadow:"#00000000" - property string colorDropShadow:"#40ABABAB" - - id: customComboBox - width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal - height: popup.visible ? heightComboBoxActive : heightComboBoxNormal - anchors.verticalCenter: parent.verticalCenter - - delegate:ItemDelegate { +DapComboBoxForm +{ + delegate:ItemDelegate + { width: parent.width - ///Adjusting the height of the line, taking into account that the second element from the end may be the last. + //Adjusting the height of the line, taking into account that the second element from the end may be the last height:{ if(index != currentIndex) { @@ -99,7 +21,7 @@ ComboBox { } else return 0 } - ///Text item + //Text item contentItem: Text { id:textDelegateComboBox anchors.fill: parent @@ -116,87 +38,16 @@ ComboBox { background: Rectangle { anchors.fill: parent anchors.bottomMargin: { - if(index == customComboBox.count - 2) + if(index == countComboBox - 2) { if(index+1 == currentIndex) return bottomIntervalListElement else return intervalListElement } - if (index == customComboBox.count - 1) return bottomIntervalListElement + if (index == countComboBox - 1) return bottomIntervalListElement return intervalListElement } - color: hovered ? hilightColor : normalColor - //the list text - } highlighted: parent.highlightedIndex === index } - - //Icon icon near the text (arrow) - indicator: Image { - source: parent.popup.visible ? indicatorImageActive : indicatorImageNormal - width: indicatorWidth - height: indicatorHeight - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: popup.visible ? sidePaddingActive : sidePaddingNormal - } - - ///Defining the background for the main line - background: Rectangle { - anchors.fill: parent - color: parent.popup.visible ? hilightTopColor : normalTopColor - radius: 2 * pt - height: parent.height - - } - ///Main line text settings - contentItem: Text { - anchors.fill: parent - anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal - text: parent.displayText - font.family: fontRobotoRegular.name - font.pixelSize: fontSizeComboBox - color: popup.visible ? hilightColorTopText : normalColorTopText - verticalAlignment: Text.AlignVCenter - } - - ///Customize drop-down list with shadow effect - popup: Popup { - y: parent.height - 1 - width: parent.width + 1 - padding: 1 - contentItem: ListView { - clip: true - implicitHeight: contentHeight - model: customComboBox.popup.visible ? customComboBox.delegateModel : null - ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle { - width: customComboBox.background.width - color: parent.color - Rectangle { - id: contentCorner - anchors.fill: parent - } - - DropShadow { - anchors.fill: parent - source: contentCorner - verticalOffset: 9 * pt - samples: 13 * pt - color: colorDropShadow - } - } - } - - ///Shadow effect for the top element. - DropShadow { - anchors.fill: if(topEffect) parent - source: if(topEffect) background - verticalOffset: if(topEffect) 9 * pt - samples: if(topEffect) 13 * pt - color: if(topEffect) customComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow - } } diff --git a/DapComboBoxDelegate.qml b/DapComboBoxDelegate.qml new file mode 100644 index 0000000000000000000000000000000000000000..55db1e52970e9696bf893f6693352bbb4655b0d5 --- /dev/null +++ b/DapComboBoxDelegate.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.5 + +ItemDelegate { + property string delegateContentText: "" + width: parent.width + height:{ + if(index == currentIndex) return 0 + else return 42*pt + } + contentItem: Text { + id:textDelegateComboBox + anchors.fill: parent + anchors.topMargin: 8 * pt + anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal + verticalAlignment: Qt.AlignTop + font.family: fontRobotoRegular.name + font.pixelSize: fontSizeComboBox + text: {if(index != currentIndex) return delegateContentText;} + color: hovered ? hilightColorText : normalColorText + } + + background: Rectangle { + anchors.fill: parent + anchors.bottomMargin: 10 * pt + color: hovered ? hilightColor : normalColor + } + + highlighted: parent.highlightedIndex === index + +} diff --git a/DapComboBoxForm.ui.qml b/DapComboBoxForm.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..7a219d8a9c40ae3be7fe8a5b44d72fe8a9cc1b33 --- /dev/null +++ b/DapComboBoxForm.ui.qml @@ -0,0 +1,149 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.2 +import QtQuick.Controls.Styles 1.4 +import QtGraphicalEffects 1.0 + +ComboBox { + ///@detalis normalColorText Text color in normal state. + property string normalColorText: "#070023" + ///@detalis hilightColorText Text color in selected state. + property string hilightColorText: "#FFFFFF" + ///@detalis normalColorTopText Text color in the main line in normal state. + property string normalColorTopText: normalColorText + ///@detalis hilightColorTopText Text color in the main line in active state. + property string hilightColorTopText: normalColorText + ///@detalis normalColor Item color in normal state. + property string normalColor: "#FFFFFF" + ///@detalis hilightColor Item color in selected state. + property string hilightColor: "#330F54" + ///@detalis normalTopColor Top string color in normal state. + property string normalTopColor: normalColor + ///@detalis hilightTopColor Top string color in selected state. + property string hilightTopColor: normalColor + ///@detalis fontSizeComboBox Font size for the entire widget. + property int fontSizeComboBox: 16 * pt + ///@detalis widthPopupComboBoxNormal Width of the combo box in the normal state. + property int widthPopupComboBoxNormal: parent.width + ///@detalis widthPopupComboBoxActive Width of the ComboBox in the active state. + property int widthPopupComboBoxActive: widthPopupComboBoxNormal + ///@detalis heightComboBoxNormal Height of the ComboBox in the normal state. + property int heightComboBoxNormal: parent.height + ///@detalis heightComboBoxActive Height of the ComboBox in the active state. + property int heightComboBoxActive: heightComboBoxNormal + ///@detalis sidePaddingNormal: Sets the indent from the edge of the right and left edges of the parent in the normal state. + property int sidePaddingNormal: 16 * pt + ///@detalis sidePaddingActive Sets the indent from the edge of the right and left edges of the parent in the active state. + property int sidePaddingActive: sidePaddingNormal + ///@detalis topIndentNormal Sets the indent from the edge of the upper of the parent in the normal state. + property int topIndentNormal: 12 * pt + ///@detalis topIndentActive Sets the indent from the edge of the upper of the parent in the active state. + property int topIndentActive: topIndentNormal + ///@detalis bottomIndentNormal Sets the indent from the edge of the lower of the parent in the normal state. + property int bottomIndentNormal: 14 * pt + ///@detalis bottomIndentActive Sets the indent from the edge of the lower of the parent in the active state. + property int bottomIndentActive: bottomIndentNormal + ///@detalis paddingTopItemDelegate Indent above from item delegate. + property int paddingTopItemDelegate: 8 * pt + ///@detalis paddingBottomItemDelegate Indent below from item delegate. + property int paddingBottomItemDelegate: paddingTopItemDelegate + ///@detalis heightListElement List item height. + property int heightListElement: 32 * pt + ///@detalis intervalListElement Spacing between items in a list. + property int intervalListElement: 10 * pt + ///@detalis bottomIntervalListElement Spacing from bottom to bottom. + property int bottomIntervalListElement: intervalListElement + ///@detalis topEffect Using an effect for the top element. + property bool topEffect: true + ///@detalis indicatorImageNormal Indicator picture address for normal state. + property string indicatorImageNormal: "qrc:/res/icons/ic_arrow_drop_down_dark_blue.png" + ///@detalis indicatorImageActive Indicator picture address for active state. + property string indicatorImageActive: "qrc:/res/icons/ic_arrow_drop_up_dark_blue.png" + ///@detalis indicatorWidth Indicator width. + property int indicatorWidth: 24 * pt + ///@detalis indicatorHeight Indicator height. + property int indicatorHeight: indicatorWidth + /// colorTopNormalDropShadow Color of the shadow effect of the combo box when minimized. + property string colorTopNormalDropShadow: "#00000000" + ///@detalis colorDropShadow Unboxed shadow color in expanded state. + property string colorDropShadow: "#40ABABAB" + ///@detalis countComboBox this variable indicates the number of lines in the list for + ///the delegate in the file DapComboBox.qml. + property int countComboBox: customComboBox.count + + id: customComboBox + width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal + height: popup.visible ? heightComboBoxActive : heightComboBoxNormal + anchors.verticalCenter: parent.verticalCenter + + //Icon icon near the text (arrow) + indicator: Image { + source: parent.popup.visible ? indicatorImageActive : indicatorImageNormal + width: indicatorWidth + height: indicatorHeight + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: popup.visible ? sidePaddingActive : sidePaddingNormal + } + + //Defining the background for the main line + background: Rectangle { + anchors.fill: parent + color: parent.popup.visible ? hilightTopColor : normalTopColor + radius: 2 * pt + height: parent.height + } + //Main line text settings + contentItem: Text { + anchors.fill: parent + anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal + text: parent.displayText + font.family: fontRobotoRegular.name + font.pixelSize: fontSizeComboBox + color: popup.visible ? hilightColorTopText : normalColorTopText + verticalAlignment: Text.AlignVCenter + } + + //Customize drop-down list with shadow effect + popup: Popup { + y: parent.height - 1 + width: parent.width + 1 + padding: 1 + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: customComboBox.popup.visible ? customComboBox.delegateModel : null + ScrollIndicator.vertical: ScrollIndicator {} + } + + background: Rectangle { + width: customComboBox.background.width + color: parent.color + Rectangle { + id: contentCorner + anchors.fill: parent + } + + DropShadow { + anchors.fill: parent + source: contentCorner + verticalOffset: 9 * pt + samples: 13 * pt + color: colorDropShadow + } + } + } + + //Shadow effect for the top element. + DropShadow { + anchors.fill: if (topEffect) + parent + source: if (topEffect) + background + verticalOffset: if (topEffect) + 9 * pt + samples: if (topEffect) + 13 * pt + color: if (topEffect) + customComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow + } +} diff --git a/libdap-qt-ui-qml.qrc b/libdap-qt-ui-qml.qrc index 109fd9444fc157db31172cf399d99ed2d6edff85..f5e14a7f6fd0b5499301edd41c3fb84ff23ba9c9 100644 --- a/libdap-qt-ui-qml.qrc +++ b/libdap-qt-ui-qml.qrc @@ -1,5 +1,7 @@ <RCC> <qresource prefix="/"> + <file>DapButton.qml</file> + <file>DapButtonForm.ui.qml</file> <file>DapComboBox.qml</file> <file>DapScreen.qml</file> <file>DapScreenForm.ui.qml</file> @@ -9,5 +11,6 @@ <file>DapRightPanelForm.ui.qml</file> <file>DapTab.qml</file> <file>DapTabForm.ui.qml</file> + <file>DapComboBoxForm.ui.qml</file> </qresource> </RCC>