Skip to content
Snippets Groups Projects

Features 2603

Merged tatiana.novikova requested to merge features-2603 into develop
Files
2
+ 45
4
import QtQuick 2.0
import QtQuick 2.4
import QtQuick.Controls 2.0
import QtQuick.Controls 2.0
DapComboBoxForm
DapComboBoxForm
@@ -30,10 +30,51 @@ DapComboBoxForm
@@ -30,10 +30,51 @@ DapComboBoxForm
anchors.fill: parent
anchors.fill: parent
anchors.topMargin: paddingTopItemDelegate
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
 
anchors.rightMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font:dapComboBox.font
font:dapComboBox.font
text: if(index != currentIndex)
//Calculates various properties of a given string of text for a particular font
return modelData;
TextMetrics
else return ""
{
 
id: tm
 
font: dapComboBox.font
 
elide: Text.ElideRight
 
text: modelData
 
elideWidth:
 
{
 
if(index != currentIndex)
 
return widthPopupComboBoxActive - 2*sidePaddingActive;
 
else
 
return widthPopupComboBoxNormal - indicatorWidth - indicatorLeftInterval;
 
}
 
}
 
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
 
{
 
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
}
}
Loading