Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cellframe/libdap-qt-ui-qml
1 result
Show changes
Commits on Source (2)
......@@ -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
}
}
}
import QtQuick 2.0
import QtQuick 2.4
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
}
//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))
//Text item
contentItem:
Text
{
if(index+1 == currentIndex) return heightListElement + bottomIntervalListElement
else return heightListElement + intervalListElement
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
}
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
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.
......@@ -33,18 +35,8 @@ ComboBox
property int sidePaddingNormal
///@detalis sidePaddingActive Sets the indent from the edge of the right and left edges of the parent in the active state.
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.
property int paddingTopItemDelegate
///@detalis paddingBottomItemDelegate Indent below from item delegate.
property int paddingBottomItemDelegate
///@detalis heightListElement List item height.
property int heightListElement
///@detalis intervalListElement Spacing between items in a list.
......@@ -61,14 +53,17 @@ ComboBox
property int indicatorWidth
///@detalis indicatorHeight Indicator height.
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.
property string colorTopNormalDropShadow
///@detalis colorDropShadow Unboxed shadow color in expanded state.
property string colorDropShadow
///@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
height: popup.visible ? heightComboBoxActive : heightComboBoxNormal
anchors.verticalCenter: parent.verticalCenter
......@@ -94,6 +89,7 @@ ComboBox
radius: 2 * pt
height: parent.height
}
//Main line text settings
contentItem:
Text
......@@ -101,7 +97,7 @@ ComboBox
id:textTopComboBox
anchors.fill: parent
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
text: parent.displayText
text: mainLineText
font: parent.font
color: popup.visible ? hilightColorTopText : normalColorTopText
verticalAlignment: Text.AlignVCenter
......@@ -112,21 +108,21 @@ ComboBox
Popup
{
y: parent.height - 1
width: parent.width + 1
padding: 1
width: parent.width
padding: 0
contentItem:
ListView
{
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
{
......@@ -159,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"
}
}