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

fix QT version checking macros #81

Closed
wants to merge 5 commits into from

Conversation

stharward
Copy link

#if (QT_VERSION < 0x051500)

is very different from

#if (QT_VERSION < QT_VERSION_CHECK(5,15,0))

because 0x051500 != ((5<<15) + (15<<8) + (0)), which is how Qt calculates QT_VERSION. See qglobal.h.

This correction uncovered a bug in src/QxDao/QxSqlRelationLinked.cpp, where some template arguments were missing.

Also corrected the version checks for QLinkedList. This class was deprecated in 5.15.0, and QxOrm was checking against 6.0.0

 #if (QT_VERSION < 0x051500)

is very different from

 #if (QT_VERSION < QT_VERSION_CHECK(5,15,0))

because 0x051500 != ((5<<15) + (15<<8) + (0)), which is how Qt
calculates QT_VERSION.  See qglobal.h.

This correction uncovered a bug in src/QxDao/QxSqlRelationLinked.cpp,
where some template arguments were missing.

Also corrected the version checks for QLinkedList. This class was
deprecated in 5.15.0, and QxOrm was checking against 6.0.0
@QxOrm
Copy link
Owner

QxOrm commented Dec 8, 2022

Hello,

Thx you are right : 0x051500 doesn't mean 5.15 Qt version because this is not an hexa value.
But I read also that it can have some issue with QT_VERSION_CHECK macro and the moc.

All checks in QxOrm library should be OK until 5.9 Qt version (because hexa value equals to decimal value).
So I would prefer to not use the QT_VERSION_CHECK macro and convert every check after 5.9 version to the hexa value.

@stharward
Copy link
Author

But I read also that it can have some issue with QT_VERSION_CHECK macro and the moc.

That was a problem with the Qt4 MOC, but hasn't been a problem since Qt5. QT_VERSION_CHECK is the canonical way to do the check. It will function even if Qt changes the internal format of the version specifier.

@QxOrm
Copy link
Owner

QxOrm commented Dec 9, 2022

I have some customers who are still using Qt4 : this is why I would prefer to change some version checks to hexa value.

- QLinkedList class was deprecated in qt-5.15
- QHash::unite() was deprecated in qt-5.15
- QRegion::rects() was deprecated in qt-5.11
@stharward
Copy link
Author

I have some customers who are still using Qt4 : this is why I would prefer to change some version checks to hexa value.

Updated the branch to use hex values instead of the macro. Few other bug fixes too.

@QxOrm
Copy link
Owner

QxOrm commented Dec 12, 2022

Updated the branch to use hex values instead of the macro

Thank you very much, I will take a look on that when I will have some time :)

This was referenced Mar 2, 2023
QxOrm added a commit that referenced this pull request May 31, 2023
- Fix all checks with QT_VERSION (using macro QT_VERSION_CHECK), should fix checks from Qt 5.10 to Qt 5.15 (GitHub issue #81)
- Fix a compilation issue of QxRestApi and QxHttpTransaction modules with Qt QStringBuilder option enabled (GitHub issues #50, #83)
@QxOrm
Copy link
Owner

QxOrm commented May 31, 2023

Done in the latest commit.
Finally, I used QT_VERSION_CHECK, and for Qt4 I redefine this macro : I have tested it and this is working fine, thx !

@QxOrm QxOrm closed this May 31, 2023
QxOrm added a commit that referenced this pull request Jun 5, 2023
- Fix compilation issue with Qt 6.2+ (due to Qt JIRA : https://bugreports.qt.io/browse/QTBUG-92910), more details in GitHub issue #54
- Support QSqlQuery::execBatch() method to improve performance inserting/updating/deleting a list of C++ instances in database (new optional parameter 'bUseExecBatch' available for functions : qx::dao::insert, qx::dao::update, qx::dao::delete_by_id)
- New method in qx::QxSqlQuery class named setFctOnBeforeSqlPrepare() to define a custom callback function to modify SQL query before preparing in database
- New callbacks functions available in qx::IxDataMember interface to customize SQL generated per data member (see an example in ./test/qxBlogCompositeKey/src/blog.cpp file)
- Fix an issue in qx::QxSqlRelationLinked::hierarchyResolveOutput() which could call getIdFromQuery() for nothing, which could generate some warnings in Qt SQL driver (for example : QPSQLResult::data: column XX out of range)
- Fix a compilation issue of QxRestApi and QxHttpTransaction modules with Qt QStringBuilder option enabled (GitHub issues #50, #83)
- Improve SQL DISTINCT to support relationships (unit test available in qxBlog sample project)
- New feature to fetch relationships only in LEFT OUTER/INNER JOIN and WHERE clauses (so no columns in SELECT part) : use {NULL} syntax to define no relation columns in SELECT part (unit test available in qxBlog sample project)
- Fix a crash which could occur using qx::QxSession and multi-threaded environment
- Add a new parameter caseSensitive (default value : false) to the method qx::QxSqlQuery::getSqlResultAt()
- Fix an issue with JSON REST API (QxRestApi module) and MongoDB database (more details in GitHub issue #70)
- Improve qx::QxClassX::registerAllClasses() : init all validator instances (can fix some issues in a multi-thread environment)
- New settings available in the qx::QxSqlDatabase singleton class (setSqlDelimiterForTableNameAlias() and setSqlDelimiterForColumnNameAlias()) to add delimiters to SQL aliases (more details in GitHub issue #57)
- Fix linking error which could occur with Qt6 and MSVC2019 (should fix GitHub issues #98, #91, #89, #90, #62, #65)
- Fix all checks with QT_VERSION (using macro QT_VERSION_CHECK), should fix checks from Qt 5.10 to Qt 5.15 (GitHub issue #81)
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.

2 participants