Skip to content

Conversation

@mitchcurtis
Copy link
Contributor

The PatternSyntax enum had to be removed as QRegularExpression only
supports Perl-compatible regular expressions.

As QVariant's comparison operators were removed, a simplified
comparison is now done as a starting point, but should probably
be extended to support more types.

Fixes #84
Fixes #86

var modelValue = testModel.get(i, sorter.roleName);
verify(modelValue === sorter.expectedValues[i],
"Expected testModel value " + sorter.expectedValues[i] + ", actual: " + modelValue);
let actualValues = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This results in clearer error messages:

FAIL!  : SortFilterProxyModel::RoleSorterTests::test_roleSorters(mixedCaseStringRole) Compared values are not the same
   Actual   (): [A,C,D,b,e]
   Expected (): [A,b,C,D,e]
   Loc: [/Users/mitch/dev/SortFilterProxyModel/tests/tst_rolesorter.qml(67)]

for (var i = 0; i < testModel.count; i++) {
actualValues.push(testModel.get(i, sorter.roleName));
}
compare(actualValues, sorter.expectedValues);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is one failing test that I don't know how to fix:

FAIL!  : SortFilterProxyModel::StringSorterTests::test_stringSorters(doNotIgnorePunctuation) Compared values are not the same
   Actual   (): [a-a,aa,b-b,b-c,b.c,bc]
   Expected (): [aa,a-a,b.c,b-b,bc,b-c]
   Loc: [/Users/mitch/dev/SortFilterProxyModel/tests/tst_stringsorter.qml(82)]

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah this test is finnicky, it depends on ICU. I think it passes on Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I blacklisted it on macOS.

@oKcerG
Copy link
Owner

oKcerG commented May 14, 2022

About the QVariant compare, does it work for bools ? Could you add QDate/QTime/QDateTime support ?

@mitchcurtis
Copy link
Contributor Author

About the QVariant compare, does it work for bools ? Could you add QDate/QTime/QDateTime support ?

Not currently, but I can make it. Not sure what it should do though... so I just made false < true.

The PatternSyntax enum had to be removed as QRegularExpression only
supports Perl-compatible regular expressions.

As QVariant's comparison operators were removed, a simplified
comparison is now done as a starting point, but should probably
be extended to support more types.

Fixes oKcerG#84
Fixes oKcerG#86
mitchcurtis and others added 4 commits July 9, 2022 15:44
cmake: fix c++17 build requirement for msvc
I was getting the following error:

/usr/bin/ld: isle/3rdparty/SortFilterProxyModel/CMakeFiles/SortFilterProxyModel.dir/SortFilterProxyModel_autogen/mocs_compilation.cpp.o: relocation R_X86_64_PC32 against symbol `__asan_option_detect_stack_use_after_return' can not be used when making a shared object; recompile with -fPIC

And:

/home/mitch/dev/bgv/isle/3rdparty/SortFilterProxyModel/qqmlsortfilterproxymodel.cpp:1: error: In included file: "You must build your code with position independent code if Qt was configured with -reduce-relocations. "         "Compile your code with -fPIC (and not with -fPIE)."

Initially I fixed this with:

    set(CMAKE_POSITION_INDEPENDENT_CODE ON)

but was told the proper solution is to add the missing
target_link_libraries.
@olafmandel
Copy link

Have an additional commit in MenloSystems:qt6 that allows compiling against Qt5 and Qt6 from the same codebase.

@olafmandel
Copy link

About the QVariant compare, does it work for bools ? Could you add QDate/QTime/QDateTime support ?

Which implementation is preferable: qqsfpm::compareVariants() from utils/utils.* or qqsfpm::lessThan() from #81 ?

@JoachimColine
Copy link

Why not use built-in variant comparison? https://doc.qt.io/qt-6/qvariant.html#compare

@mitchcurtis
Copy link
Contributor Author

Qt added support for SortFilterProxyModel in 6.10: https://doc-snapshots.qt.io/qt6-dev/qml-qtqml-models-sortfilterproxymodel.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to build with Qt6 Qt6 removed QRegExp

5 participants