Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
b63bb590
Commit
b63bb590
authored
Aug 18, 2019
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/codeeditorhelper.cpp
View file @
b63bb590
...
...
@@ -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
{
...
...
src/qml/ModuleView.qml
View file @
b63bb590
...
...
@@ -408,7 +408,7 @@ Item{
anchors.fill
:
parent
id
:
descriptionLabel
wrapMode
:
"
WordWrap
"
text
:
codeCompletionListView
.
current
Item
?
odeCompletionListView
.
currentModelData
.
description
:
"
Keine Beschreibung
"
text
:
codeCompletionListView
.
current
ModelData
?
c
odeCompletionListView
.
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
model
Data
:
modelData
property
var
item
Data
:
modelData
text
:
modelData
.
completion
.
replace
(
/
\n
*
\t
*/g
,
""
)
onClicked
:
codeCompletionListView
.
clickCurrentItem
()
highlighted
:
ListView
.
isCurrentItem
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment