Skip to content
Snippets Groups Projects
Commit 957e3c5a authored by Konstantin's avatar Konstantin
Browse files

[+] add DapButton

parent e0778b74
No related branches found
No related tags found
1 merge request!6Feature 2798
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
DapButton.qml 0 → 100644
import QtQuick 2.4
DapButtonForm {
}
import QtQuick 2.0
import QtQuick.Controls 2.0
Button {
///@detalis heightButton and widthButton: sets the height and width of the button.
property int heightButton: 36 * pt
property int widthButton: 120 * pt
///@detalis normalImageButton and hoverImageButton: the picture on the button is in normal
///condition and when you hover
property string normalImageButton: "qrc:/res/icons/new-wallet_icon_dark.png"
property string hoverImageButton: "qrc:/res/icons/new-wallet_icon_dark_hover.png"
///@detalis widthImageButton and heightImageButton: image width and height
property int widthImageButton: 28 * pt
property int heightImageButton: 28 * pt
///@detalis indentImageLeftButton: indentation of the image from the left edge
property int indentImageLeftButton: 10 * pt
///@detalis colorBackgroundNormal and colorBackgroundHover: button background color in normal state and on hover
property string colorBackgroundNormal:"#070023"
property string colorBackgroundHover: "#D51F5D"
///@detalis textButton: text button
property string textButton: "New Wallet"
///@detalis colorButtonTextNormal and colorButtonTextHover: button text color in normal state and on hover
property string colorButtonTextNormal: "#FFFFFF"
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
id: dapButton
contentItem: Rectangle {
id: dapBackgroundButton
anchors.fill: parent
color: dapButton.hovered ? colorBackgroundHover : colorBackgroundNormal
implicitWidth: widthButton
implicitHeight: heightButton
///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
}
}
}
...@@ -5,76 +5,80 @@ import QtGraphicalEffects 1.0 ...@@ -5,76 +5,80 @@ import QtGraphicalEffects 1.0
///About property ///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 {
///@sidePaddingActive and @sidePaddingNormal -
ComboBox {
///@detalis normalColorText and hilightColorText: text color in selected state and in normal
property string normalColorText: "#070023" property string normalColorText: "#070023"
property string hilightColorText: "#FFFFFF" property string hilightColorText: "#FFFFFF"
///@detalis normalColorTopText and hilightColorTopText: text color in the main line in normal and active state
property string normalColorTopText:normalColorText property string normalColorTopText:normalColorText
property string hilightColorTopText:normalColorText property string hilightColorTopText:normalColorText
///@detalis normalColor and hilightColor: item color in selected state and in normal
property string normalColor: "#FFFFFF" property string normalColor: "#FFFFFF"
property string hilightColor: "#330F54" property string hilightColor: "#330F54"
///@detalis normalTopColor and hilightTopColor: top string color in selected state and in normal
property string normalTopColor: normalColor property string normalTopColor: normalColor
property string hilightTopColor: normalColor property string hilightTopColor: normalColor
///@detalis fontSizeComboBox: font size for the entire widget (px).
property int fontSizeComboBox: 16*pt property int fontSizeComboBox: 16*pt
///@detalis widthPopupComboBoxActive and widthPopupComboBoxNormal: width of the combo box
/// in the active state and in the normal state
property int widthPopupComboBoxNormal: parent.width property int widthPopupComboBoxNormal: parent.width
property int widthPopupComboBoxActive: widthPopupComboBoxNormal property int widthPopupComboBoxActive: widthPopupComboBoxNormal
///@detalis heightComboBoxNormal and heightComboBoxActive: height of the combo box
/// in the active state and in the normal state
property int heightComboBoxNormal: parent.height property int heightComboBoxNormal: parent.height
property int heightComboBoxActive: heightComboBoxNormal property int heightComboBoxActive: heightComboBoxNormal
///@detalis sidePaddingActive and sidePaddingNormal: sets the indent from the edge of the right and left
/// edges of the parent in the active and normal state
property int sidePaddingNormal:16 * pt property int sidePaddingNormal:16 * pt
property int sidePaddingActive:sidePaddingNormal property int sidePaddingActive:sidePaddingNormal
///@detalis
///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
property int topIndentNormal:12 * pt property int topIndentNormal:12 * pt
property int topIndentActive:topIndentNormal property int topIndentActive:topIndentNormal
property int bottomIndentNormal:14 * pt property int bottomIndentNormal:14 * pt
property int bottomIndentActive:bottomIndentNormal property int bottomIndentActive:bottomIndentNormal
///@detalis paddingTopItemDelegate and paddingBottomItemDelegate: indent above and below from item delegate
property int paddingTopItemDelegate:8 * pt property int paddingTopItemDelegate:8 * pt
property int paddingBottomItemDelegate:paddingTopItemDelegate property int paddingBottomItemDelegate:paddingTopItemDelegate
///@detalis heightListElement: list item height
property int heightListElement: 32 * pt property int heightListElement: 32 * pt
///@detalis intervalListElement: spacing between items in a list
property int intervalListElement: 10 * pt property int intervalListElement: 10 * pt
///@detalis bottomIntervalListElement: spacing from bottom to bottom
property int bottomIntervalListElement:intervalListElement property int bottomIntervalListElement:intervalListElement
///@detalis topEffect: using an effect for the top element
property bool topEffect: true property bool topEffect: true
///@detalis indicatorImageNormal and indicatorImageActive: indicator picture address for active and normal state
property string indicatorImageNormal: "qrc:/res/icons/ic_arrow_drop_down_dark_blue.png" 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 string indicatorImageActive: "qrc:/res/icons/ic_arrow_drop_up_dark_blue.png"
///@detalis indicatorWidth and indicatorHeight: indicator width and height
property int indicatorWidth: 24*pt property int indicatorWidth: 24*pt
property int indicatorHeight: indicatorWidth property int indicatorHeight: indicatorWidth
/// colorTopNormalDropShadow: color of the shadow effect of the combo box when minimized
property string colorTopNormalDropShadow:"#00000000" property string colorTopNormalDropShadow:"#00000000"
///@detalis colorDropShadow: unboxed shadow color in expanded state
property string colorDropShadow:"#40ABABAB" property string colorDropShadow:"#40ABABAB"
id: customComboBox id: customComboBox
...@@ -124,10 +128,7 @@ ComboBox { ...@@ -124,10 +128,7 @@ ComboBox {
if (index == customComboBox.count - 1) return bottomIntervalListElement if (index == customComboBox.count - 1) return bottomIntervalListElement
return intervalListElement return intervalListElement
} }
color: hovered ? hilightColor : normalColor color: hovered ? hilightColor : normalColor
//the list text
} }
highlighted: parent.highlightedIndex === index highlighted: parent.highlightedIndex === index
} }
......
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
}
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>DapComboBox.qml</file> <file>DapComboBox.qml</file>
<file>DapButton.qml</file>
<file>DapButtonForm.ui.qml</file>
</qresource> </qresource>
</RCC> </RCC>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment