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

Feature/qt6 compatibility #1315

Merged
merged 22 commits into from
Feb 13, 2024
Merged

Feature/qt6 compatibility #1315

merged 22 commits into from
Feb 13, 2024

Conversation

FlorianReimold
Copy link
Member

@FlorianReimold FlorianReimold commented Jan 19, 2024

Description

Made eCAL Compatible with Qt6

  • Compiles with both Qt5 and Qt6
  • CMake option is now HAS_QT, but the legacy HAS_QT5 option is still supported
  • Min Supported Qt Version: 5.9 (that's the version Ubuntu 18.04 ships with)
  • Max Supported Qt Version: 6.6.1 (probably higher, but that's the latest I tested with)
  • Official Windows installer now ships with Qt6
  • Qt6 dropped the QWinExtras that enabled the Thumbnail Taskbar buttons of eCAL Play and eCAL Rec on Windows. Therefore, those buttons had to be removed.
  • Fixed the mon include regexp from the ecal.ini, so it doesn't need to be "fixed" in C++ code anymore (Added ^ and $ to match entire string)
  • Solved Qt Related warnigns
  • Updated QWT submodule to the latest development version.

Related issues

Cherry-pick to

  • none

; filter_incl = Topics whitelist as regular expression (will be monitored only)
; filter_log_con = info, warning, error, fatal Log messages logged to console (all, info, warning, error, fatal, debug1, debug2, debug3, debug4)
; filter_log_file = Log messages to logged into file system
; filter_log_udp = info, warning, error, fatal Log messages logged via udp network
; --------------------------------------------------
[monitoring]
timeout = 5000
filter_excl = __.*
filter_excl = ^__.*$
Copy link
Member Author

Choose a reason for hiding this comment

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

@rex-schilasky Please leave a comment whether you think that this change can have bad side-effects

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

app/mon/mon_gui/src/ecalmon.cpp Outdated Show resolved Hide resolved
@@ -224,7 +226,19 @@ void GroupTreeModel::removeItemFromGroups(QAbstractTreeItem* item, bool remove_e

if (item_to_remove->parentItem() == root())
{
group_map_.remove(group_map_.key((GroupTreeItem*)item_to_remove));
auto it = std::find_if(std::begin(group_map_), std::end(group_map_),
[item_to_remove](auto& p) { return p.second == (GroupTreeItem*)item_to_remove; });
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast]

Suggested change
[item_to_remove](auto& p) { return p.second == (GroupTreeItem*)item_to_remove; });
[item_to_remove](auto& p) { return p.second == dynamic_cast<GroupTreeItem*>(item_to_remove); });

app/play/play_gui/src/q_ecal_play.cpp Outdated Show resolved Hide resolved
app/rec/rec_gui/src/ecalrec_gui.cpp Outdated Show resolved Hide resolved
app/sys/sys_gui/src/ecalsys_gui.cpp Outdated Show resolved Hide resolved
lib/CustomQt/src/QListMenuToolButton.cpp Outdated Show resolved Hide resolved
lib/CustomQt/src/QMulticolumnSortFilterProxyModel.cpp Outdated Show resolved Hide resolved
FlorianReimold and others added 2 commits January 19, 2024 10:18
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -217,9 +229,64 @@ target_include_directories(${PROJECT_NAME} PRIVATE src)
target_include_directories(${PROJECT_NAME} PRIVATE $<TARGET_PROPERTY:eCAL::core,INCLUDE_DIRECTORIES>)


if(WIN32)
if ((WIN32 OR APPLE) AND (${QT_VERSION_MAJOR} GREATER_EQUAL 6))
Copy link
Contributor

Choose a reason for hiding this comment

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

We have this (or similar) code in many places. Could you please make cmake macros / functions for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are just 3 commands (qt_generate_deploy_app_script, add_custom_command, install). The rest are comments to explain what is going on. Do you think that it is worth to make a script for that, discover the script file, include the script and then call it?
I feel like that would cause more code and be more difficult to understand, because you would have to go to that script to see what is going on. And one would have to implement some kind of argument parsing, if you intend to keep it flexible. It would also cause additional coupling of all eCAL Qt Application to some custom script that is stored somewhere. I was excited to remove custom deploy scripts for Qt6, so I am not sure if encapsulating 3 commands justify creating one, again.

Copy link
Contributor

Choose a reason for hiding this comment

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

But you have the same code in at least 4 places (mon_gui, play_gui, rec_gui, sys_gui, ...)
It's like arguing that you're not creating another header file and not using functions, because it's too complicated.

It's 60 lines of code, being (as far as I can see), exactly identical in at least mon_gui, play_gui, rec_gui.
If you want to keep it with the apps, put it in the app subdirectory, or define the macro in app/CMakeLists.txt.
But duplicated code is duplicated code and should be put in a function (or cmake macro, because that is in the end text replacement, and does not introduce new scopes which you may not want).

Copy link
Contributor

Choose a reason for hiding this comment

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

You could also make it part of ecal_add_app_qt, if it's something to be done for all ecal qt apps.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm ok, so your intention is to put the legacy Qt5 install(CODE ... in that script as well? I agree that that script could go in its own file, but the scope of this PR was to just add Qt6. Also the Qt5 script wasn't written by me and I honestly was afraid to touch it, so I just added the new commands for Qt6.

It's like arguing that you're not creating another header file and not using functions, because it's too complicated.

I didn't write it would be too complicated and (for Qt6) the CMakeLists.txt does use functions. But yea, it kind of is similar to copying code from one to the next header file versus creating a separate project for it that you then have to reference to. It's always a tradeoff between coupling and code duplication.
I felt like Qt6 already encapsulated everything very well and those official qt functions are probably better understandable than a custom one. Thus I didn't want to hide those 3 calls with the downside of more coupling.

You could also make it part of ecal_add_app_qt, if it's something to be done for all ecal qt apps.

Sure, could be a solution for the apps, as those are coupled to those functions anyways. It would get rid of the flexbility, but maybe we are ok with a preconfigured variant of the scripts.
We would also maybe need a preconfigured variant for samples, monitor plugins and libraries.

@FlorianReimold FlorianReimold marked this pull request as ready for review January 19, 2024 13:41
@FlorianReimold FlorianReimold added this to the eCAL 5.13 milestone Feb 6, 2024
Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

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

From my point we can merge it, but we need to schedule a general CMake cleanup issue at some point in the future.

@FlorianReimold FlorianReimold merged commit 72afa10 into master Feb 13, 2024
13 of 14 checks passed
@FlorianReimold FlorianReimold deleted the feature/qt6_compatibility branch March 1, 2024 11:11
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.

Qt6 compatiblity
2 participants