Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
System Settings
Commits
dd7ca23d
Commit
dd7ca23d
authored
Apr 23, 2022
by
Volker Krause
Browse files
Port from QRegExp to QRegularExpression
parent
66a830a6
Pipeline
#168305
passed with stage
in 1 minute and 16 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
app/main.cpp
View file @
dd7ca23d
...
...
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
return
-
1
;
}
const
QStringList
args
=
parser
.
value
(
QStringLiteral
(
"args"
)).
split
(
QReg
Exp
(
QStringLiteral
(
" +"
)),
Qt
::
SkipEmptyParts
);
const
QStringList
args
=
parser
.
value
(
QStringLiteral
(
"args"
)).
split
(
QReg
ularExpression
(
QStringLiteral
(
" +"
)),
Qt
::
SkipEmptyParts
);
QString
startupModule
;
if
(
parser
.
positionalArguments
().
count
()
==
1
)
{
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
parser
.
parse
(
arguments
);
const
QStringList
args
=
parser
.
value
(
QStringLiteral
(
"args"
)).
split
(
QReg
Exp
(
QStringLiteral
(
" +"
)),
Qt
::
SkipEmptyParts
);
const
QStringList
args
=
parser
.
value
(
QStringLiteral
(
"args"
)).
split
(
QReg
ularExpression
(
QStringLiteral
(
" +"
)),
Qt
::
SkipEmptyParts
);
QString
startupModule
;
if
(
parser
.
positionalArguments
().
count
()
==
1
)
{
...
...
core/MenuProxyModel.cpp
View file @
dd7ca23d
...
...
@@ -111,7 +111,11 @@ Qt::ItemFlags MenuProxyModel::flags(const QModelIndex &index) const
}
QString
matchText
=
index
.
data
(
MenuModel
::
UserFilterRole
).
toString
();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QRegExp
pattern
=
KCategorizedSortFilterProxyModel
::
filterRegExp
();
#else
QRegularExpression
pattern
=
KCategorizedSortFilterProxyModel
::
filterRegularExpression
();
#endif
if
(
!
matchText
.
contains
(
pattern
))
{
return
Qt
::
NoItemFlags
;
...
...
@@ -120,6 +124,7 @@ Qt::ItemFlags MenuProxyModel::flags(const QModelIndex &index) const
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void
MenuProxyModel
::
setFilterRegExp
(
const
QString
&
pattern
)
{
if
(
pattern
==
filterRegExp
())
{
...
...
@@ -142,3 +147,27 @@ void MenuProxyModel::setFilterRegExp(const QRegExp ®Exp)
KCategorizedSortFilterProxyModel
::
setFilterRegExp
(
regExp
);
Q_EMIT
layoutChanged
();
}
#else
void
MenuProxyModel
::
setFilterRegularExpression
(
const
QString
&
pattern
)
{
if
(
pattern
==
filterRegularExpression
())
{
return
;
}
Q_EMIT
layoutAboutToBeChanged
();
KCategorizedSortFilterProxyModel
::
setFilterRegularExpression
(
pattern
);
Q_EMIT
layoutChanged
();
Q_EMIT
filterRegularExpressionChanged
();
}
QString
MenuProxyModel
::
filterRegularExpression
()
const
{
return
KCategorizedSortFilterProxyModel
::
filterRegularExpression
().
pattern
();
}
void
MenuProxyModel
::
setFilterRegularExpression
(
const
QRegularExpression
&
regExp
)
{
Q_EMIT
layoutAboutToBeChanged
();
KCategorizedSortFilterProxyModel
::
setFilterRegularExpression
(
regExp
);
Q_EMIT
layoutChanged
();
}
#endif
core/MenuProxyModel.h
View file @
dd7ca23d
...
...
@@ -28,7 +28,11 @@ class SYSTEMSETTINGSVIEW_EXPORT MenuProxyModel : public KCategorizedSortFilterPr
{
Q_OBJECT
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Q_PROPERTY
(
QString
filterRegExp
READ
filterRegExp
WRITE
setFilterRegExp
NOTIFY
filterRegExpChanged
)
#else
Q_PROPERTY
(
QString
filterRegExp
READ
filterRegularExpression
WRITE
setFilterRegularExpression
NOTIFY
filterRegularExpressionChanged
)
#endif
public:
/**
...
...
@@ -79,6 +83,7 @@ public:
*/
Qt
::
ItemFlags
flags
(
const
QModelIndex
&
index
)
const
override
;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/**
* Please see Qt QAbstractItemModel documentation for more details.\n
* Reimplemented for internal reasons.
...
...
@@ -92,6 +97,21 @@ public:
void
setFilterRegExp
(
const
QString
&
pattern
);
QString
filterRegExp
()
const
;
#else
/**
* Please see Qt QAbstractItemModel documentation for more details.\n
* Reimplemented for internal reasons.
*/
void
setFilterRegularExpression
(
const
QRegularExpression
&
regExp
);
/**
* Please see Qt QAbstractItemModel documentation for more details.\n
* Reimplemented for internal reasons.
*/
void
setFilterRegularExpression
(
const
QString
&
pattern
);
QString
filterRegularExpression
()
const
;
#endif
/**
* makes the filter highlight matching entries instead of hiding them
...
...
@@ -104,7 +124,11 @@ public:
bool
filterHighlightsEntries
()
const
;
Q_SIGNALS:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void
filterRegExpChanged
();
#else
void
filterRegularExpressionChanged
();
#endif
private:
bool
m_filterHighlightsEntries
:
1
;
...
...
icons/IconMode.cpp
View file @
dd7ca23d
...
...
@@ -116,7 +116,11 @@ void IconMode::initEvent()
void
IconMode
::
searchChanged
(
const
QString
&
text
)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
d
->
proxyModel
->
setFilterRegExp
(
text
);
#else
d
->
proxyModel
->
setFilterRegularExpression
(
text
);
#endif
if
(
d
->
categoryView
)
{
QAbstractItemModel
*
model
=
d
->
categoryView
->
model
();
const
int
column
=
d
->
categoryView
->
modelColumn
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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