Commit 2e1a68b1 authored by Christiaan Janssen's avatar Christiaan Janssen

QmlDesigner.Navigator: Long text in items' names is elided

parent aec39f55
......@@ -160,17 +160,8 @@ void IdItemDelegate::paint(QPainter *painter,
// Check text length does not exceed available space
int extraSpace=12+pixmap.width();
QFontMetrics metric(painter->fontMetrics());
if (painter->fontMetrics().boundingRect(myString).width() > option.rect.width()-extraSpace)
{
QString origString(myString);
int cutpoint=origString.length()/2;
while (painter->fontMetrics().boundingRect(myString).width() > option.rect.width()-extraSpace)
{
cutpoint--;
myString = origString.left(cutpoint)+QLatin1String("...")+origString.right(cutpoint);
}
}
QFontMetrics fm(option.font);
myString = fm.elidedText(myString,Qt::ElideMiddle,option.rect.width()-extraSpace);
painter->drawText(option.rect.bottomLeft()+QPoint(3+pixmap.width(),-8),myString);
......
......@@ -90,7 +90,7 @@ void NavigatorView::modelAttached(Model *model)
treeWidget()->header()->setResizeMode(0, QHeaderView::Stretch);
treeWidget()->header()->resizeSection(1,26);
treeWidget()->setRootIsDecorated(false);
treeWidget()->setIndentation(40);
treeWidget()->setIndentation(20);
#ifdef _LOCK_ITEMS_
treeWidget()->header()->resizeSection(2,20);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment