forked from qt-creator/qt-creator
TextEditor: Chop of multi line proposal item texts
Change-Id: I57e8b02bffc06a84dbee86e220956baea5ff80a3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -89,14 +89,19 @@ QVariant ModelAdapter::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid() || index.row() >= m_completionModel->size())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return m_completionModel->text(index.row());
|
||||
else if (role == Qt::DecorationRole)
|
||||
if (role == Qt::DisplayRole) {
|
||||
const QString text = m_completionModel->text(index.row());
|
||||
const int lineBreakPos = text.indexOf('\n');
|
||||
if (lineBreakPos < 0)
|
||||
return text;
|
||||
return QString(text.leftRef(lineBreakPos) + QLatin1String(" (...)"));
|
||||
} else if (role == Qt::DecorationRole) {
|
||||
return m_completionModel->icon(index.row());
|
||||
else if (role == Qt::WhatsThisRole)
|
||||
} else if (role == Qt::WhatsThisRole) {
|
||||
return m_completionModel->detail(index.row());
|
||||
else if (role == Qt::UserRole)
|
||||
} else if (role == Qt::UserRole) {
|
||||
return m_completionModel->proposalItem(index.row())->requiresFixIts();
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
Reference in New Issue
Block a user