Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
79697896
Commit
79697896
authored
Feb 05, 2022
by
Waqar Ahmed
Committed by
Christoph Cullmann
Feb 05, 2022
Browse files
Don't depend on proxy model
parent
6b4a7293
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/search/htmldelegate.cpp
View file @
79697896
...
...
@@ -6,7 +6,6 @@
#include "htmldelegate.h"
#include "MatchModel.h"
#include "MatchProxyModel.h"
#include <KLocalizedString>
#include <KSyntaxHighlighting/Theme>
...
...
@@ -138,6 +137,11 @@ void SPHtmlDelegate::paintMatchItem(QPainter *p, const QStyleOptionViewItem &opt
p
->
restore
();
}
static
bool
isMatchItem
(
const
QModelIndex
&
index
)
{
return
index
.
parent
().
isValid
()
&&
index
.
parent
().
parent
().
isValid
();
}
void
SPHtmlDelegate
::
paint
(
QPainter
*
painter
,
const
QStyleOptionViewItem
&
option
,
const
QModelIndex
&
index
)
const
{
QStyleOptionViewItem
options
=
option
;
...
...
@@ -147,13 +151,9 @@ void SPHtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option
options
.
text
=
QString
();
options
.
widget
->
style
()
->
drawControl
(
QStyle
::
CE_ItemViewItem
,
&
options
,
painter
,
options
.
widget
);
Q_ASSERT
(
index
.
model
()
&&
qstrcmp
(
index
.
model
()
->
metaObject
()
->
className
(),
"MatchProxyModel"
));
const
auto
model
=
static_cast
<
const
MatchProxyModel
*>
(
index
.
model
());
if
(
model
->
isMatchItem
(
index
))
{
if
(
isMatchItem
(
index
))
{
const
auto
item
=
index
.
data
(
MatchModel
::
MatchItem
).
value
<
KateSearchMatch
>
();
paintMatchItem
(
painter
,
options
,
item
);
}
else
{
QTextDocument
doc
;
doc
.
setDefaultFont
(
m_font
);
...
...
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