Commit b63bb590 authored by Leander Schulten's avatar Leander Schulten
Browse files

Fix CodeCompletion. The wrong role was used (DisplayRole and not ModelDataRole)

parent a7cf3009
Pipeline #173154 passed with stage
in 1 minute and 45 seconds
......@@ -98,8 +98,8 @@ CodeHighlighter::CodeHighlighter(QTextDocument * parent):QSyntaxHighlighter (par
}
bool CodeCompletions::lessThan(const QModelIndex &left, const QModelIndex &right)const{
CodeCompletionEntry* leftData = sourceModel()->data(left).value<CodeCompletionEntry*>();
CodeCompletionEntry* rightData = sourceModel()->data(right).value<CodeCompletionEntry*>();
CodeCompletionEntry* leftData = sourceModel()->data(left, ModelVector<CodeCompletions*>::ModelDataRole).value<CodeCompletionEntry*>();
CodeCompletionEntry* rightData = sourceModel()->data(right, ModelVector<CodeCompletions*>::ModelDataRole).value<CodeCompletionEntry*>();
return leftData->completion < rightData->completion;
}
......@@ -107,7 +107,7 @@ bool CodeCompletions::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
CodeCompletionEntry* data = sourceModel()->data(index).value<CodeCompletionEntry*>();
CodeCompletionEntry* data = sourceModel()->data(index, ModelVector<CodeCompletions*>::ModelDataRole).value<CodeCompletionEntry*>();
if(data) {
return data->completion.contains(this->filterRegExp());
} else {
......
......@@ -408,7 +408,7 @@ Item{
anchors.fill: parent
id: descriptionLabel
wrapMode: "WordWrap"
text: codeCompletionListView.currentItem ? odeCompletionListView.currentModelData.description : "Keine Beschreibung"
text: codeCompletionListView.currentModelData ? codeCompletionListView.currentModelData.description : "Keine Beschreibung"
background: null
}
color: "beige"
......@@ -433,8 +433,9 @@ Item{
clip: true
id: codeCompletionListView
model: codeEditorHelper.codeCompletions
property var currentModelData: currentItem ? currentItem.itemData : null;
delegate: ItemDelegate {
property var modelData: modelData
property var itemData: modelData
text: modelData.completion.replace(/\n*\t*/g,"")
onClicked: codeCompletionListView.clickCurrentItem()
highlighted: ListView.isCurrentItem
......
Supports Markdown
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