Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace QRegExp with QRegularExpression #585

Closed
wants to merge 2 commits into from

Conversation

prusnak
Copy link
Contributor

@prusnak prusnak commented Apr 15, 2022

Fixes #578

Only made sure the code builds, not sure how to test.

@hebasto
Copy link
Member

hebasto commented Apr 15, 2022

Concept ACK.

As a preparation to Qt 6, I think this PR will benefit by incorporating of bitcoin/bitcoin@f6adcad and bitcoin/bitcoin@b649103 in any reasonable way.

@hebasto hebasto changed the title qt: replace QRegExp with QRegularExpression Replace QRegExp with QRegularExpression Apr 15, 2022
@hebasto hebasto added Refactoring Qt 6 Transition to Qt 6 labels Apr 15, 2022
@prusnak
Copy link
Contributor Author

prusnak commented Apr 15, 2022

As a preparation to Qt 6, I think this PR will benefit by incorporating of bitcoin/bitcoin@f6adcad and bitcoin/bitcoin@b649103 in any reasonable way.

@prusnak
Copy link
Contributor Author

prusnak commented Apr 15, 2022

It seems the CI is failing because it does not recognize filterRegularExpression and indeed it was introduced in Qt 5.12 while we still do support Qt 5.11.

I updated the second commit of the PR to use QT_VERSION check - see 54980a7

@hebasto
Copy link
Member

hebasto commented Apr 21, 2022

Does it make sense to extract the "Extract first suffix from filter pattern..." functionality into a testable utility function?

@hebasto
Copy link
Member

hebasto commented Apr 23, 2022

not sure how to test.

Here is a branch with tests for the AddressBookPage class -- https://github.com/hebasto/gui/commits/220423-test-ab

And test fails for the 54980a7 commit.

UPDATE: mind looking at #591, #592 and #593?

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 24, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #593 (Getting ready to Qt 6 (8/n). Use QRegularExpression in AddressBookSortFilterProxyModel class by hebasto)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

hebasto added a commit that referenced this pull request May 9, 2022
1506913 qt, test: Add tests for `tableView` in `AddressBookPage` dialog (Hennadii Stepanov)
edae3ab qt: No need to force Qt::QueuedConnection for NotifyAddressBookChanged (Hennadii Stepanov)

Pull request description:

  This PR is a prerequisite for more thorough testing of filtering in the `AddressBookPage` class in context of #578 and #585.

  Required for #592.

ACKs for top commit:
  promag:
    Code review ACK 1506913.

Tree-SHA512: 86986d47606cbd54d813436c7afb21894e2200b6d3042a7aa0b5e84821c765bd68b14ad38a445069891ab33f2d7bcd4933b8373e14e9afb0c91f1a6ddf4da740
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 9, 2022
…ssBookPage` dialog

1506913 qt, test: Add tests for `tableView` in `AddressBookPage` dialog (Hennadii Stepanov)
edae3ab qt: No need to force Qt::QueuedConnection for NotifyAddressBookChanged (Hennadii Stepanov)

Pull request description:

  This PR is a prerequisite for more thorough testing of filtering in the `AddressBookPage` class in context of bitcoin-core/gui#578 and bitcoin-core/gui#585.

  Required for bitcoin-core/gui#592.

ACKs for top commit:
  promag:
    Code review ACK 1506913.

Tree-SHA512: 86986d47606cbd54d813436c7afb21894e2200b6d3042a7aa0b5e84821c765bd68b14ad38a445069891ab33f2d7bcd4933b8373e14e9afb0c91f1a6ddf4da740
@@ -44,8 +44,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
/// HTML-format the license message from the core
QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
// Make URLs clickable
QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
uri.setMinimal(true); // use non-greedy matching
QRegularExpression uri("<(.*)>", QRegularExpression::InvertedGreedinessOption); // use non-greedy matching
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment seems unneeded here because QRegularExpression::InvertedGreedinessOption is pretty self-explained.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in db71143

@prusnak prusnak force-pushed the qregexp-obsolete branch from 54980a7 to 7b896dc Compare May 23, 2022 16:33
@@ -46,12 +47,19 @@ class AddressBookSortFilterProxyModel final : public QSortFilterProxyModel

auto address = model->index(row, AddressTableModel::Address, parent);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slight preference for flipping this around where we're checking if less than qt6, i think this makes the code cleaner and inline with how we've done some other qt6 preparation changes, but not a blocker

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current implementation allows to test without Qt 6.

hebasto added a commit that referenced this pull request May 24, 2022
…`AddressBookSortFilterProxyModel` class

e280087 qt: Use `QRegularExpression` in `AddressBookSortFilterProxyModel` class (Hennadii Stepanov)
5c5d8f2 qt, test: Add tests for searching in `AddressBookPage` dialog (Hennadii Stepanov)

Pull request description:

  This is a step in [migration](bitcoin/bitcoin#24798) to Qt 6.

  Related:
  - #578
  - #585

  No behavior change. To ensure this, tests have been added.

ACKs for top commit:
  hebasto:
    > tACK [e280087](e280087) on Ubuntu 21.10 Qt 5.15.2
  promag:
    Tested ACK e280087 with Qt6 on macOS 12 M1.
  w0xlt:
    tACK e280087 on Ubuntu 21.10 Qt 5.15.2
  jarolrod:
    Tested ACK e280087 on M1 mac, x86 mac, x86 Linux with Qt5 and separately with Qt6

Tree-SHA512: 664baacc1504deb2f7fa651ea4a44f3942f5c9058befe4d2ce292beed032d4b1697710cfd10c0909602d8a4a6eeb680414e4a1f56d2038478c1ae2f34965d74f
@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@prusnak
Copy link
Contributor Author

prusnak commented May 24, 2022

I won't be able to work on this PR in the following days/weeks. Feel free to push into my branch (maintainers are allowed) or take over the PR completely if needed.

@jarolrod
Copy link
Member

Picked up in #606

@prusnak prusnak deleted the qregexp-obsolete branch May 25, 2022 08:02
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 28, 2022
…rExpression` in `AddressBookSortFilterProxyModel` class

e280087 qt: Use `QRegularExpression` in `AddressBookSortFilterProxyModel` class (Hennadii Stepanov)
5c5d8f2 qt, test: Add tests for searching in `AddressBookPage` dialog (Hennadii Stepanov)

Pull request description:

  This is a step in [migration](bitcoin#24798) to Qt 6.

  Related:
  - bitcoin-core/gui#578
  - bitcoin-core/gui#585

  No behavior change. To ensure this, tests have been added.

ACKs for top commit:
  hebasto:
    > tACK [e280087](bitcoin-core/gui@e280087) on Ubuntu 21.10 Qt 5.15.2
  promag:
    Tested ACK e280087 with Qt6 on macOS 12 M1.
  w0xlt:
    tACK bitcoin-core/gui@e280087 on Ubuntu 21.10 Qt 5.15.2
  jarolrod:
    Tested ACK bitcoin-core/gui@e280087 on M1 mac, x86 mac, x86 Linux with Qt5 and separately with Qt6

Tree-SHA512: 664baacc1504deb2f7fa651ea4a44f3942f5c9058befe4d2ce292beed032d4b1697710cfd10c0909602d8a4a6eeb680414e4a1f56d2038478c1ae2f34965d74f
@bitcoin-core bitcoin-core locked and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace QRegExp with QRegularExpression
4 participants