Skip to content
Snippets Groups Projects
Commit 69c900e0 authored by tatiana.novikova's avatar tatiana.novikova
Browse files

[*] Update calculating and deleting the unnecessary part of text at comboBox

[-] Delete unused property
parent acf63490
No related branches found
No related tags found
1 merge request!14Features 2603
...@@ -44,16 +44,35 @@ DapComboBoxForm ...@@ -44,16 +44,35 @@ DapComboBoxForm
if(index != currentIndex) if(index != currentIndex)
return widthPopupComboBoxActive - 2*sidePaddingActive; return widthPopupComboBoxActive - 2*sidePaddingActive;
else else
return widthPopupComboBoxNormal - indicatorWidth ; return widthPopupComboBoxNormal - indicatorWidth - indicatorLeftInterval;
} }
} }
FontMetrics
{
id: fm
font: dapComboBox.font
}
text: text:
{ {
if(index != currentIndex) if(index != currentIndex)
{
console.log(fm.tightBoundingRect("le").width);
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('', '..'); return tm.elidedText.replace('', '..');
}
else else
{ {
mainLineText = tm.elidedText.replace('', '..'); 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 ""; return "";
} }
} }
......
...@@ -33,18 +33,8 @@ ComboBox ...@@ -33,18 +33,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,6 +51,8 @@ ComboBox ...@@ -61,6 +51,8 @@ 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.
......
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