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

[Mon / Qt Apps] Fixed filter-function #1591

Merged
merged 2 commits into from
May 15, 2024
Merged

Conversation

FlorianReimold
Copy link
Member

Description

The MultiColumnSortFilterProxyModel now supports QRegexp and QRegularExpression depending on the Qt Version

Related issues

The MultiColumnSortFilterProxyModel now supports QRegexp and QRegularExpression depending on the Qt Version
@FlorianReimold FlorianReimold added the cherry-pick-to-support/v5.13 Cherry pick these changes to support/v5.13 label May 14, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

if (!filter_regexp.isEmpty())
{
// Use QRegExp
for (int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: replace loop by 'std::any_of()' [readability-use-anyofallof]

    for (int column : filter_columns_)
    ^

if (!filter_regexp.isEmpty())
{
// Use QRegExp
for (int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'column' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
for (int column : filter_columns_)
for (int const column : filter_columns_)

// Use QRegExp
for (int column : filter_columns_)
{
QModelIndex index = sourceModel()->index(source_row, column, source_parent);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'index' of type 'QModelIndex' can be declared 'const' [misc-const-correctness]

Suggested change
QModelIndex index = sourceModel()->index(source_row, column, source_parent);
QModelIndex const index = sourceModel()->index(source_row, column, source_parent);

QModelIndex index = sourceModel()->index(source_row, column, source_parent);
if (index.isValid())
{
QString data = sourceModel()->data(index, filterRole()).toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'data' of type 'QString' can be declared 'const' [misc-const-correctness]

Suggested change
QString data = sourceModel()->data(index, filterRole()).toString();
QString const data = sourceModel()->data(index, filterRole()).toString();

// Use QRegularExpression, as QRegExp is empty
QRegularExpression const filter_regularexpression = filterRegularExpression();

for (int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: replace loop by 'std::any_of()' [readability-use-anyofallof]

    for (int column : filter_columns_)
    ^

// Use QRegularExpression, as QRegExp is empty
QRegularExpression const filter_regularexpression = filterRegularExpression();

for (int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'column' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
for (int column : filter_columns_)
for (int const column : filter_columns_)


for (int column : filter_columns_)
{
QModelIndex index = sourceModel()->index(source_row, column, source_parent);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'index' of type 'QModelIndex' can be declared 'const' [misc-const-correctness]

Suggested change
QModelIndex index = sourceModel()->index(source_row, column, source_parent);
QModelIndex const index = sourceModel()->index(source_row, column, source_parent);

QModelIndex index = sourceModel()->index(source_row, column, source_parent);
if (index.isValid())
{
QString data = sourceModel()->data(index, filterRole()).toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'data' of type 'QString' can be declared 'const' [misc-const-correctness]

Suggested change
QString data = sourceModel()->data(index, filterRole()).toString();
QString const data = sourceModel()->data(index, filterRole()).toString();

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

if (!filter_regexp.isEmpty())
{
// Use QRegExp
for (const int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: replace loop by 'std::any_of()' [readability-use-anyofallof]

    for (const int column : filter_columns_)
    ^

// Use QRegularExpression, as QRegExp is empty
QRegularExpression const filter_regularexpression = filterRegularExpression();

for (const int column : filter_columns_)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: replace loop by 'std::any_of()' [readability-use-anyofallof]

    for (const int column : filter_columns_)
    ^

@FlorianReimold FlorianReimold marked this pull request as ready for review May 15, 2024 04:51
@FlorianReimold
Copy link
Member Author

Tested with Qt 5.9 / 5.15 / 6.6.1

@FlorianReimold FlorianReimold merged commit 3e99f97 into master May 15, 2024
16 of 18 checks passed
eclipse-ecal-bot pushed a commit that referenced this pull request May 15, 2024
The MultiColumnSortFilterProxyModel now supports QRegexp and QRegularExpression depending on the Qt Version
FlorianReimold added a commit that referenced this pull request May 15, 2024
The MultiColumnSortFilterProxyModel now supports QRegexp and QRegularExpression depending on the Qt Version
@KerstinKeller KerstinKeller deleted the hotfix/mon_gui_filter branch October 2, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-support/v5.13 Cherry pick these changes to support/v5.13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants