Skip to content
Snippets Groups Projects
Commit 9abd54c4 authored by littletux89@gmail.com's avatar littletux89@gmail.com
Browse files

[*] Made design changes and fixed warning.

parent dd34f10c
No related branches found
No related tags found
1 merge request!14Features 2603
This commit is part of merge request !14. Comments created here will be created in the context of that merge request.
......@@ -12,9 +12,9 @@ Button
///@detalis hoverImageButton The image on the Button is in the mouseover state.
property string hoverImageButton
///@detalis widthImageButton Image width.
property int widthImageButton
property int widthImageButton: 0 * pt
///@detalis heightImageButton Image height.
property int heightImageButton
property int heightImageButton: 0 * pt
///@detalis indentImageLeftButton: Indentation of the image from the left edge.
property int indentImageLeftButton
///@detalis colorBackgroundNormal Button background color in normal state.
......@@ -31,8 +31,6 @@ Button
property int indentTextRight
///@detalis fontButton Font setting.
property alias fontButton:buttonText.font
///@detalis existenceImage Indicates the presence of an image.
property bool existenceImage: true
///@detalis horizontalAligmentText Horizontal alignment.
property alias horizontalAligmentText:buttonText.horizontalAlignment
///@detalis colorBackgroundButton This property overrides the background color.
......@@ -72,12 +70,12 @@ Button
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
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: indentImageLeftButton
source: dapButton.hovered ? hoverImageButton : normalImageButton
width: widthImageButton
height: heightImageButton
}
}
}
......@@ -3,96 +3,109 @@ import QtQuick.Controls 2.0
DapComboBoxForm
{
id:dapComboBox
delegate:
ItemDelegate
{
width: parent.width
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 == (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
}
//Text item
contentItem: Text {
id:textDelegateComboBox
anchors.fill: parent
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
anchors.rightMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font:dapComboBox.font
//Calculates various properties of a given string of text for a particular font
TextMetrics
{
id: tm
font: dapComboBox.font
elide: Text.ElideRight
text: modelData
elideWidth:
//Adjusting the height of the line, taking into account that the second element from the end may be the last
height:
{
if(index != currentIndex)
return widthPopupComboBoxActive - 2*sidePaddingActive;
else
return widthPopupComboBoxNormal - indicatorWidth - indicatorLeftInterval;
{
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
}
}
FontMetrics
{
id: fm
font: dapComboBox.font
}
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
//Text item
contentItem:
Text
{
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 "";
id:textDelegateComboBox
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
}
}
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 == count - 2)
//Indent from the bottom edge or the next line that will not stand out when you hover over the mouse
background:
Rectangle
{
if(index+1 == currentIndex) return bottomIntervalListElement
else return intervalListElement
anchors.fill: parent
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
return intervalListElement
}
color: hovered ? hilightColor : normalColor
highlighted: parent.highlightedIndex === index
}
highlighted: parent.highlightedIndex === index
}
}
......@@ -5,6 +5,8 @@ import QtGraphicalEffects 1.0
ComboBox
{
id: dapComboBox
///@detalis normalColorText Text color in normal state.
property string normalColorText
///@detalis hilightColorText Text color in selected state.
......@@ -51,18 +53,17 @@ ComboBox
property int indicatorWidth
///@detalis indicatorHeight Indicator height.
property int indicatorHeight
///@detalis indicatorLeftInterval Space between indicator border and text border
///@detalis indicatorLeftInterval Space between indicator border and text border.
property int indicatorLeftInterval
/// colorTopNormalDropShadow Color of the shadow effect of the combo box when minimized.
property string colorTopNormalDropShadow
///@detalis colorDropShadow Unboxed shadow color in expanded state.
property string colorDropShadow
///@detalis fontComboBox Font setting combobox.
property alias fontComboBox:customComboBox.font
///@detalis mainLineText Text without unneccesary part
property alias fontComboBox: dapComboBox.font
///@detalis mainLineText Text without unneccesary part.
property string mainLineText
id: customComboBox
width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal
height: popup.visible ? heightComboBoxActive : heightComboBoxNormal
anchors.verticalCenter: parent.verticalCenter
......@@ -88,6 +89,7 @@ ComboBox
radius: 2 * pt
height: parent.height
}
//Main line text settings
contentItem:
Text
......@@ -113,14 +115,14 @@ ComboBox
{
clip: true
implicitHeight: contentHeight
model: customComboBox.popup.visible ? customComboBox.delegateModel : null
model: dapComboBox.popup.visible ? dapComboBox.delegateModel : null
ScrollIndicator.vertical: ScrollIndicator {}
}
background:
Rectangle
{
width: customComboBox.background.width
width: dapComboBox.background.width
color: normalColor
Rectangle
{
......@@ -153,7 +155,7 @@ ComboBox
13 * pt
else 0
color: if (topEffect)
customComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow
else "#00000000"
dapComboBox.popup.visible ? colorDropShadow : colorTopNormalDropShadow
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