Skip to content
Snippets Groups Projects
Commit 049c20a0 authored by andrey.daragan's avatar andrey.daragan
Browse files

Merge branch 'features-2603' into 'develop'

Features 2603

See merge request !14
parents dd57503b c2501485
No related branches found
No related tags found
1 merge request!14Features 2603
...@@ -12,9 +12,9 @@ Button ...@@ -12,9 +12,9 @@ Button
///@detalis hoverImageButton The image on the Button is in the mouseover state. ///@detalis hoverImageButton The image on the Button is in the mouseover state.
property string hoverImageButton property string hoverImageButton
///@detalis widthImageButton Image width. ///@detalis widthImageButton Image width.
property int widthImageButton property int widthImageButton: 0 * pt
///@detalis heightImageButton Image height. ///@detalis heightImageButton Image height.
property int heightImageButton property int heightImageButton: 0 * pt
///@detalis indentImageLeftButton: Indentation of the image from the left edge. ///@detalis indentImageLeftButton: Indentation of the image from the left edge.
property int indentImageLeftButton property int indentImageLeftButton
///@detalis colorBackgroundNormal Button background color in normal state. ///@detalis colorBackgroundNormal Button background color in normal state.
...@@ -31,8 +31,6 @@ Button ...@@ -31,8 +31,6 @@ Button
property int indentTextRight property int indentTextRight
///@detalis fontButton Font setting. ///@detalis fontButton Font setting.
property alias fontButton:buttonText.font property alias fontButton:buttonText.font
///@detalis existenceImage Indicates the presence of an image.
property bool existenceImage: true
///@detalis horizontalAligmentText Horizontal alignment. ///@detalis horizontalAligmentText Horizontal alignment.
property alias horizontalAligmentText:buttonText.horizontalAlignment property alias horizontalAligmentText:buttonText.horizontalAlignment
///@detalis colorBackgroundButton This property overrides the background color. ///@detalis colorBackgroundButton This property overrides the background color.
...@@ -72,12 +70,12 @@ Button ...@@ -72,12 +70,12 @@ Button
Image Image
{ {
id: iconNewWallet id: iconNewWallet
anchors.verticalCenter: if(existenceImage)parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: if(existenceImage)parent.left anchors.left: parent.left
anchors.leftMargin:if(existenceImage) indentImageLeftButton anchors.leftMargin: indentImageLeftButton
source: if(existenceImage) dapButton.hovered ? hoverImageButton : normalImageButton source: dapButton.hovered ? hoverImageButton : normalImageButton
width: if(existenceImage)widthImageButton width: widthImageButton
height:if(existenceImage) heightImageButton height: heightImageButton
} }
} }
} }
import QtQuick 2.0 import QtQuick 2.4
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
DapComboBoxForm DapComboBoxForm
{ {
id:dapComboBox delegate:
ItemDelegate
{
width: parent.width
delegate:ItemDelegate //Adjusting the height of the line, taking into account that the second element from the end may be the last
{ height:
{
width: parent.width if(index != currentIndex)
{
if(index == (count - 2))
{
if(index+1 == currentIndex)
return heightListElement + bottomIntervalListElement
else
return heightListElement + intervalListElement
}
if (index == count - 1)
return heightListElement + bottomIntervalListElement
return heightListElement + intervalListElement
}
else return 0
}
//Adjusting the height of the line, taking into account that the second element from the end may be the last //Text item
height:{ contentItem:
if(index != currentIndex) Text
{
if(index == (count - 2))
{ {
if(index+1 == currentIndex) return heightListElement + bottomIntervalListElement id:textDelegateComboBox
else return heightListElement + intervalListElement anchors.fill: parent
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
anchors.rightMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font: fontComboBox
//Calculates various properties of a given string of text for a particular font
TextMetrics
{
id: tm
font: fontComboBox
elide: Text.ElideRight
text: modelData
elideWidth:
{
if(index != currentIndex)
return widthPopupComboBoxActive - 2*sidePaddingActive;
else
return widthPopupComboBoxNormal - indicatorWidth - indicatorLeftInterval;
}
}
FontMetrics
{
id: fm
font: fontComboBox
}
text:
{
if(index != currentIndex)
{
if(tm.elidedText.length < tm.text.length)
return tm.elidedText.substring(0, tm.elidedText.length-1) +
((fm.tightBoundingRect(tm.elidedText.substring(0, tm.elidedText.length-1)).width +
fm.tightBoundingRect(tm.text.charAt(tm.elidedText.length-1) + '..').width) < tm.elideWidth ?
(tm.text.charAt(tm.elidedText.length-1) + '..')
: '..');
return tm.elidedText.replace('', '..');
}
else
{
if(tm.elidedText.length < tm.text.length)
mainLineText = tm.elidedText.substring(0, tm.elidedText.length-1) +
((fm.tightBoundingRect(tm.elidedText.substring(0, tm.elidedText.length-1)).width +
fm.tightBoundingRect(tm.text.charAt(tm.elidedText.length-1) + '..').width) < tm.elideWidth ?
(tm.text.charAt(tm.elidedText.length-1) + '..')
: '..');
else
mainLineText = tm.elidedText.replace('', '..');
return "";
}
}
color: hovered ? hilightColorText : normalColorText
} }
if (index == 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:dapComboBox.font
text: if(index != currentIndex)
return modelData;
else return ""
color: hovered ? hilightColorText : normalColorText
}
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse //Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background: Rectangle { background:
anchors.fill: parent Rectangle
anchors.bottomMargin: {
if(index == count - 2)
{ {
if(index+1 == currentIndex) return bottomIntervalListElement anchors.fill: parent
else return intervalListElement anchors.bottomMargin: {
if(index == count - 2)
{
if(index+1 == currentIndex)
return bottomIntervalListElement
else
return intervalListElement
}
if (index == count - 1)
return bottomIntervalListElement
return intervalListElement
}
color: hovered ? hilightColor : normalColor
} }
if (index == count - 1) return bottomIntervalListElement highlighted: parent.highlightedIndex === index
return intervalListElement
}
color: hovered ? hilightColor : normalColor
} }
highlighted: parent.highlightedIndex === index
}
} }
...@@ -5,6 +5,8 @@ import QtGraphicalEffects 1.0 ...@@ -5,6 +5,8 @@ import QtGraphicalEffects 1.0
ComboBox ComboBox
{ {
id: dapComboBox
///@detalis normalColorText Text color in normal state. ///@detalis normalColorText Text color in normal state.
property string normalColorText property string normalColorText
///@detalis hilightColorText Text color in selected state. ///@detalis hilightColorText Text color in selected state.
...@@ -33,18 +35,8 @@ ComboBox ...@@ -33,18 +35,8 @@ ComboBox
property int sidePaddingNormal property int sidePaddingNormal
///@detalis sidePaddingActive Sets the indent from the edge of the right and left edges of the parent in the active state. ///@detalis sidePaddingActive Sets the indent from the edge of the right and left edges of the parent in the active state.
property int sidePaddingActive property int sidePaddingActive
///@detalis topIndentNormal Sets the indent from the edge of the upper of the parent in the normal state.
property int topIndentNormal
///@detalis topIndentActive Sets the indent from the edge of the upper of the parent in the active state.
property int topIndentActive
///@detalis bottomIndentNormal Sets the indent from the edge of the lower of the parent in the normal state.
property int bottomIndentNormal
///@detalis bottomIndentActive Sets the indent from the edge of the lower of the parent in the active state.
property int bottomIndentActive
///@detalis paddingTopItemDelegate Indent above from item delegate. ///@detalis paddingTopItemDelegate Indent above from item delegate.
property int paddingTopItemDelegate property int paddingTopItemDelegate
///@detalis paddingBottomItemDelegate Indent below from item delegate.
property int paddingBottomItemDelegate
///@detalis heightListElement List item height. ///@detalis heightListElement List item height.
property int heightListElement property int heightListElement
///@detalis intervalListElement Spacing between items in a list. ///@detalis intervalListElement Spacing between items in a list.
...@@ -61,14 +53,17 @@ ComboBox ...@@ -61,14 +53,17 @@ ComboBox
property int indicatorWidth property int indicatorWidth
///@detalis indicatorHeight Indicator height. ///@detalis indicatorHeight Indicator height.
property int indicatorHeight property int indicatorHeight
///@detalis indicatorLeftInterval Space between indicator border and text border.
property int indicatorLeftInterval
/// colorTopNormalDropShadow Color of the shadow effect of the combo box when minimized. /// colorTopNormalDropShadow Color of the shadow effect of the combo box when minimized.
property string colorTopNormalDropShadow property string colorTopNormalDropShadow
///@detalis colorDropShadow Unboxed shadow color in expanded state. ///@detalis colorDropShadow Unboxed shadow color in expanded state.
property string colorDropShadow property string colorDropShadow
///@detalis fontComboBox Font setting combobox. ///@detalis fontComboBox Font setting combobox.
property alias fontComboBox:customComboBox.font property alias fontComboBox: dapComboBox.font
///@detalis mainLineText Text without unneccesary part.
property string mainLineText
id: customComboBox
width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal
height: popup.visible ? heightComboBoxActive : heightComboBoxNormal height: popup.visible ? heightComboBoxActive : heightComboBoxNormal
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -94,6 +89,7 @@ ComboBox ...@@ -94,6 +89,7 @@ ComboBox
radius: 2 * pt radius: 2 * pt
height: parent.height height: parent.height
} }
//Main line text settings //Main line text settings
contentItem: contentItem:
Text Text
...@@ -101,7 +97,7 @@ ComboBox ...@@ -101,7 +97,7 @@ ComboBox
id:textTopComboBox id:textTopComboBox
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
text: parent.displayText text: mainLineText
font: parent.font font: parent.font
color: popup.visible ? hilightColorTopText : normalColorTopText color: popup.visible ? hilightColorTopText : normalColorTopText
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
...@@ -112,21 +108,21 @@ ComboBox ...@@ -112,21 +108,21 @@ ComboBox
Popup Popup
{ {
y: parent.height - 1 y: parent.height - 1
width: parent.width + 1 width: parent.width
padding: 1 padding: 0
contentItem: contentItem:
ListView ListView
{ {
clip: true clip: true
implicitHeight: contentHeight implicitHeight: contentHeight
model: customComboBox.popup.visible ? customComboBox.delegateModel : null model: dapComboBox.popup.visible ? dapComboBox.delegateModel : null
ScrollIndicator.vertical: ScrollIndicator {} ScrollIndicator.vertical: ScrollIndicator {}
} }
background: background:
Rectangle Rectangle
{ {
width: customComboBox.background.width width: dapComboBox.background.width
color: normalColor color: normalColor
Rectangle Rectangle
{ {
...@@ -159,7 +155,7 @@ ComboBox ...@@ -159,7 +155,7 @@ ComboBox
13 * pt 13 * pt
else 0 else 0
color: if (topEffect) color: if (topEffect)
customComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow dapComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow
else "#00000000" else "#000000"
} }
} }
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