Commit 74f13467 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlOutline: Only show first line of annotation

Fix the artifacts when the annotations contain a multi-line string.

Task-number: QTCREATORBUG-2889
Reviewed-by: erikv
parent fb46c319
......@@ -36,13 +36,21 @@ void QmlJSOutlineItemDelegate::paint(QPainter *painter, const QStyleOptionViewIt
painter->fillRect(opt.rect, option.palette.highlight());
const QString typeString =;
const QString annotationString =;
QString annotationString =;
QStyle *style = QApplication::style();
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, 0);
if (!annotationString.isEmpty()) {
int newlinePos = annotationString.indexOf(QLatin1Char('\n'));
if (newlinePos != -1) {
// print first line with '...' at end
const QChar ellipsisChar(0x2026);
annotationString = annotationString.left(newlinePos) + ellipsisChar;
QPalette::ColorRole textColorRole = QPalette::Text;
if (option.state & QStyle::State_Selected) {
textColorRole = QPalette::HighlightedText;
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