QML Observer: Print correct id in crumble path and elide text

This commit is contained in:
Lasse Holmstedt
2010-08-03 10:35:04 +02:00
parent 3e9193021c
commit 514ec10ca5
2 changed files with 9 additions and 3 deletions

View File

@@ -179,12 +179,15 @@ QString AbstractFormEditorTool::titleForItem(QGraphicsItem *item)
if (!objectStringId.isEmpty()) {
constructedName = objectStringId + " (" + className + ")";
} else {
if (!gfxObject->objectName().isEmpty())
if (!gfxObject->objectName().isEmpty()) {
constructedName = gfxObject->objectName() + " (" + className + ")";
} else {
constructedName = className;
}
}
}
return className;
return constructedName;
}

View File

@@ -126,7 +126,10 @@ void CrumblePathButton::paintEvent(QPaintEvent *)
}
}
p.setPen(StyleHelper::panelTextColor());
p.drawText(QRectF(m_textPos.x(), 4, geom.width(), geom.height()), text());
QFontMetrics fm(p.font());
QString textToDraw = fm.elidedText(text(), Qt::ElideRight, geom.width() - m_textPos.x());
p.drawText(QRectF(m_textPos.x(), 4, geom.width(), geom.height()), textToDraw);
}
void CrumblePathButton::tintImages()