Skip to content
Snippets Groups Projects
Commit 2a36b5f6 authored by Konstantin's avatar Konstantin
Browse files

[+] add dapcombobox.ui and new comments

parent 957e3c5a
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.
......@@ -2,42 +2,36 @@ import QtQuick 2.0
import QtQuick.Controls 2.0
Button {
///@detalis heightButton and widthButton: sets the height and width of the button.
///@detalis heightButton button height
property int heightButton: 36 * pt
///@detalis widthButton button width
property int widthButton: 120 * pt
///@detalis normalImageButton and hoverImageButton: the picture on the button is in normal
///condition and when you hover
///@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 and heightImageButton: image width and height
///@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 and colorBackgroundHover: button background color in normal state and on hover
///@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 and colorButtonTextHover: button text color in normal state and on hover
///@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
......
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QtQuick 2.4
DapComboBoxForm {
///About property
///@sidePaddingActive and @sidePaddingNormal -
ComboBox {
///@detalis normalColorText and hilightColorText: text color in selected state and in normal
property string normalColorText: "#070023"
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 hilightColorTopText:normalColorText
///@detalis normalColor and hilightColor: item color in selected state and in normal
property string normalColor: "#FFFFFF"
property string hilightColor: "#330F54"
///@detalis normalTopColor and hilightTopColor: top string color in selected state and in normal
property string normalTopColor: normalColor
property string hilightTopColor: normalColor
///@detalis fontSizeComboBox: font size for the entire widget (px).
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 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 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 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 topIndentActive:topIndentNormal
property int bottomIndentNormal:14 * pt
property int bottomIndentActive:bottomIndentNormal
///@detalis paddingTopItemDelegate and paddingBottomItemDelegate: indent above and below from item delegate
property int paddingTopItemDelegate:8 * pt
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 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 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 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"
id: customComboBox
width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal
height: popup.visible ? heightComboBoxActive : heightComboBoxNormal
anchors.verticalCenter: parent.verticalCenter
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.
height:{
if(index != currentIndex)
{
if(index == customComboBox.count - 2)
{
if(index+1 == currentIndex) return heightListElement + bottomIntervalListElement
else return heightListElement + intervalListElement
}
if (index == customComboBox.count - 1) return heightListElement + bottomIntervalListElement
return heightListElement + intervalListElement
}
else return 0
}
///Text item
contentItem: Text {
id:textDelegateComboBox
anchors.fill: parent
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font.family: fontRobotoRegular.name
font.pixelSize: fontSizeComboBox
text: {if(index != currentIndex) return modelData;}
color: hovered ? hilightColorText : normalColorText
}
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background: Rectangle {
anchors.fill: parent
anchors.bottomMargin: {
if(index == customComboBox.count - 2)
{
if(index+1 == currentIndex) return bottomIntervalListElement
else return intervalListElement
}
if (index == customComboBox.count - 1) return bottomIntervalListElement
return intervalListElement
}
color: hovered ? hilightColor : normalColor
}
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
}
}
import QtQuick 2.0
import QtQuick.Controls 2.0
ItemDelegate {
width: parent.width
///Adjusting the height of the line, taking into account that the second element from the end may be the last.
height:{
if(index != currentIndex)
{
if(index == customComboBox.count - 2)
{
if(index+1 == currentIndex) return heightListElement + bottomIntervalListElement
else return heightListElement + intervalListElement
}
if (index == customComboBox.count - 1) return heightListElement + bottomIntervalListElement
return heightListElement + intervalListElement
}
else return 0
}
///Text item
contentItem: Text {
id:textDelegateComboBox
anchors.fill: parent
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font.family: fontRobotoRegular.name
font.pixelSize: fontSizeComboBox
text: {if(index != currentIndex) return modelData;}
color: hovered ? hilightColorText : normalColorText
}
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background: Rectangle {
anchors.fill: parent
anchors.bottomMargin: {
if(index == customComboBox.count - 2)
{
if(index+1 == currentIndex) return bottomIntervalListElement
else return intervalListElement
}
if (index == customComboBox.count - 1) return bottomIntervalListElement
return intervalListElement
}
color: hovered ? hilightColor : normalColor
}
highlighted: parent.highlightedIndex === index
}
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 (px).
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 combo box in the active state
property int widthPopupComboBoxActive: widthPopupComboBoxNormal
///@detalis heightComboBoxNormal height of the combo box in the normal state
property int heightComboBoxNormal: parent.height
///@detalis heightComboBoxActive height of the combo box 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"
id: customComboBox
width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal
height: popup.visible ? heightComboBoxActive : heightComboBoxNormal
anchors.verticalCenter: parent.verticalCenter
delegate:DapComboBoxDelegate{}
//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
}
}
<RCC>
<qresource prefix="/">
<file>DapComboBox.qml</file>
<file>DapButton.qml</file>
<file>DapButtonForm.ui.qml</file>
<file>DapComboBox.qml</file>
<file>DapComboBoxForm.ui.qml</file>
<file>DapComboBoxDelegate.qml</file>
</qresource>
</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