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