Port frameworks away from QRegExp
Open, Needs TriagePublic

Description

QRegExp is supposed to only exist in Qt6 in a Qt5Support lib, good enough for apps initially, but not for frameworks, most importantly not as part of exported API.

vkrause created this task.Nov 27 2019, 6:10 PM

It's still used a lot.

It's used in non-deprecated public API in:

  • ktextwidgets: kfind, kreplace
  • kcoreaddons: kstringhandler
  • ktexteditor: kateregexp, vimode
  • kio: kcoredirlister
ahmadsamir moved this task from Backlog to In Progress on the KF6 board.Dec 22 2019, 2:28 PM

Frameworks that use QRegExp but are probably going to be deprecated (based on the KF6 workboard):
kemoticons
khtml
kinit
kross
kwallet

Frameworks that still use QRegExp:
kactivities-stats
kdelibs4support - does this one need to be ported or not?
knewstuff - kmoretools
ktexteditor
plasma-framework - pluginloader

And of course apps in various places, extragear, kdeedu, plasma-workspace ... etc. Are apps included in the scope of this task?

dfaure added a subscriber: dfaure.Apr 11 2020, 5:58 PM

You can skip kemoticons, khtml, kinit, kross, and kdelibs4support.
I don't see any work happening on replacing kwallet so honestly at this point I don't see it going away, the board item might be wishful thinking.

The task title is "port *frameworks* away from QRegExp" so the apps are not in scope. But of course that doesn't mean it's not useful to do so :-)

ahmadsamir added a comment.EditedApr 20 2020, 5:34 PM

Status report:
It seems that porting plasma-framework is a bit problematic see D28978, it's only one place where QRegExp is used so not a problem.

What remains:
kactivities-stats
ktexteditor

KTextEditor: porting the search interface to QRegularExression:
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/7

some parts still in ktexteditor still use QRegExp.

KTextEditor: porting the search interface to QRegularExression:
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/7

some parts still in ktexteditor still use QRegExp.

OK, that's been merged o/. Some parts remain in ktexteditor, I'll hopefully get to them soon.

However, the vimode is a black box for me, I don't use it and it has many quirks; and while it has an extensive collection of unit tests, I don't want to attempt porting it unless someone who actually uses it volunteers to test (I'll make sure all vimode unit tests still pass).

kactivities-stats, is it still used/needed?

ahmadsamir added subscribers: KTextEditor, Plasma.EditedNov 20 2020, 6:56 PM

KWallet was ported.

kactivities-stats https://invent.kde.org/frameworks/kactivities-stats/-/merge_requests/9

KTextEditor only has the vimode-related code still not ported to QRE.

plasma-framework: src/declarativeimports/core/datamodel , I don't know how to port this one, keep the QRegExp stuff and add new methods for QRE, or replace QRegExp with QRE? and how to handle DataModel::setKeyRoleFilter()?

There is also some usage in KTextWidgets left

There is also some usage in KTextWidgets left

I'll look into it (at first glance I forgot to wrap some #include <QRegExp> in deprecation wrappers).

OK, only kreplacedialog.cpp is still using QRegExp in a _k_slotOk(), I must have missed it the first time around; looking at the code now, it doesn't seem to be used by anything, I commented it out completely and it still compiled just fine. I'll create an MR.

alex added a subscriber: alex.Jan 3 2021, 9:03 PM

KNewStuff is QRegExp free :)

In T12279#247457, @alex wrote:

KNewStuff is QRegExp free :)

That was implied by not being included in my "what remains" posts :)

So, what remains now is the vimode parts in KTextEditors.

KTexEditor vimode was ported by @jbatrina:
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/62
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/67

and the remaining usage of QRegExp in KTextEditor has been ported:
https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/85

So KTextEditor is now all ported.

Remains plasma-framework:

plasma-framework: src/declarativeimports/core/datamodel , I don't know how to port this one, keep the QRegExp stuff and add new methods for QRE, or replace QRegExp with QRE? and how to handle DataModel::setKeyRoleFilter()?

I asked on Plasma on IRC (luckily the plasma team were having their weekly meeting, so I got an answer quickly :)). According to @davidedmundson the plasma-framework/src/declarativeimports/core/datamodel* will be dropped in KF6 (along with DataEngines in plasma in general), so no need to port it to QRegularExpression.

ahmadsamir moved this task from In Progress to Done on the KF6 board.Feb 15 2021, 12:26 PM