Skip to content
Snippets Groups Projects

Features 2603

Closed tatiana.novikova requested to merge features-2603 into develop
2 files
+ 32
7
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 26
4
import QtQuick 2.0
import QtQuick 2.7
import QtQuick.Controls 2.0
DapComboBoxForm
{
id:dapComboBox
//temporary variable for the calculating unnecessary part of text
property int stringSize
delegate:ItemDelegate
{
@@ -31,9 +34,28 @@ DapComboBoxForm
anchors.topMargin: paddingTopItemDelegate
anchors.leftMargin: popup.visible ? sidePaddingActive : sidePaddingNormal
font:dapComboBox.font
text: if(index != currentIndex)
return modelData;
else return ""
//Calculates various properties of a given string of text for a particular font
TextMetrics
{
id: tm
font: dapComboBox.font
elide: Text.ElideRight
elideWidth: parent.width - (popup.visible ? sidePaddingActive : sidePaddingNormal) * 2 - 8*pt
text: modelData
}
text:
{
if(index != currentIndex)
return modelData;
else
{
stringSize = tm.elidedText.length;
if(stringSize < modelData.length)
mainLineText = tm.elidedText.substring(0, stringSize-3) + '..';
else mainLineText = modelData;
return "";
}
}
color: hovered ? hilightColorText : normalColorText
}
Loading