Skip to content

Commit 953f289

Browse files
authored
Merge pull request #69 from RoboDK/qt6-compat
feat: add support for Qt 6 (PR #69)
2 parents f3b501d + 6564221 commit 953f289

13 files changed

Lines changed: 1681 additions & 710 deletions

File tree

Plugin-OPC-UA/PluginOPCUA.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ INCLUDEPATH += ../robodk_interface
136136
# ------------------------
137137
# Flag to compile Open62541 source for any platform
138138
win32-msvc {
139+
DEFINES += _CRT_SECURE_NO_WARNINGS
139140
QMAKE_CXXFLAGS_WARN_ON += -wd4100
140141
QMAKE_CFLAGS_WARN_ON += -wd4100
141142
QMAKE_CFLAGS += -std:clatest

Plugin-OPC-UA/opcua_server.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
#include <QTimer>
2121

2222

23-
#ifdef _MSC_VER
24-
#define _CRT_SECURE_NO_WARNINGS //disable fopen deprecation warning in msvs
25-
#endif
26-
27-
2823
//----------------------------
2924
#include <QDebug>
3025
#include <QString>

Plugin-OPC-UA/pluginopcua.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <QDesktopServices>
1818
#include <QSettings>
1919
#include <QDateTime>
20+
#include <QIODevice>
2021

2122

2223
// only for Sleep()

PluginAppLoader/apploader.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QTimer>
2525
#include <QSysInfo>
2626
#include <QBuffer>
27+
#include <QActionGroup>
2728

2829
// Function to check and sort priority of apps
2930
struct CheckPriority {
@@ -779,8 +780,8 @@ void AppLoader::AppsSearch(bool install_requirements){
779780
}
780781

781782
// Sort actions for the menu and the toolbar
782-
qSort(menuActions.begin(), menuActions.end(), CheckPriority());
783-
qSort(toolbarActions.begin(), toolbarActions.end(), CheckPriority());
783+
std::sort(menuActions.begin(), menuActions.end(), CheckPriority());
784+
std::sort(toolbarActions.begin(), toolbarActions.end(), CheckPriority());
784785

785786
// Add menu actions to the menu
786787
for (int i=0; i<menuActions.length(); i++){
@@ -795,17 +796,17 @@ void AppLoader::AppsSearch(bool install_requirements){
795796

796797
// Sort all actions
797798
if (ListActions.length() > 1){
798-
qSort(ListActions.begin(), ListActions.end(), CheckPriority());
799+
std::sort(ListActions.begin(), ListActions.end(), CheckPriority());
799800
}
800801

801802
// Sort menus
802803
if (ListMenus.length() > 1){
803-
qSort(ListMenus.begin(), ListMenus.end(), CheckPriority());
804+
std::sort(ListMenus.begin(), ListMenus.end(), CheckPriority());
804805
}
805806

806807
// Sort toolbars
807808
if (ListToolbars.length() > 1){
808-
qSort(ListToolbars.begin(), ListToolbars.end(), CheckPriority());
809+
std::sort(ListToolbars.begin(), ListToolbars.end(), CheckPriority());
809810
}
810811

811812
// Append Apps directories to RoboDK's PYTHONPATH
@@ -1012,8 +1013,7 @@ void AppLoader::onRunScript(){
10121013
if (action->isCheckable()){
10131014
if (action->isChecked()){
10141015
// make sure we uncheck the action if the process ends or stops
1015-
connect(proc, static_cast<void(QProcess::*)(int)>(&QProcess::finished), proc, [action]() {
1016-
1016+
connect(proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), proc, [action]() {
10171017
QActionGroup *grp = action->actionGroup();
10181018
if (grp != nullptr && grp->checkedAction() == action){
10191019
emit grp->triggered(action); // important to reset the group lastaction static variable

PluginAppLoader/installerdialog.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <QSettings>
1111
#include <QComboBox>
1212
#include <QDebug>
13+
#include <QString>
14+
1315

1416

1517
InstallerDialog::InstallerDialog(AppLoader* apploader, QWidget* parent) :
@@ -83,7 +85,7 @@ bool InstallerDialog::processPackage(const QString& package){
8385

8486
QString name = unzipper.entryName();
8587
int slash = name.indexOf('/');
86-
if (slash < 0 || name.midRef(slash).compare(QString("/AppConfig.ini")) != 0)
88+
if (slash < 0 || name.mid(slash).compare(QString("/AppConfig.ini")) != 0)
8789
continue;
8890

8991
name.truncate(slash);
@@ -308,7 +310,7 @@ void InstallerDialog::on_buttonBox_accepted(){
308310
if (!name.startsWith(entity.name + "/"))
309311
continue;
310312

311-
QFileInfo fileInfo = folder.absoluteFilePath(name);
313+
QFileInfo fileInfo(folder.absoluteFilePath(name));
312314
folder.mkpath(fileInfo.absolutePath());
313315
unzipper.entryExtract(fileInfo.absoluteFilePath());
314316
}

PluginBallbarTracker/PluginBallbarTracker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ void PluginBallbarTracker::update_ballbar_pose(){
329329
double rho = 90.0 - qRadiansToDegrees(qAcos(pillar_2_tool_vec.z() / std::max(1e-6, r)));
330330

331331
// Theta θ
332-
double theta = 180 - qRadiansToDegrees(qAcos(pillar_2_tool_vec.x() / std::max(1e-6, qSqrt(pillar_2_tool_vec.x() * pillar_2_tool_vec.x() + pillar_2_tool_vec.y() * pillar_2_tool_vec.y()))));
332+
double xy_length = qSqrt(pillar_2_tool_vec.x() * pillar_2_tool_vec.x() + pillar_2_tool_vec.y() * pillar_2_tool_vec.y());
333+
double theta = 180 - qRadiansToDegrees(qAcos(pillar_2_tool_vec.x() / std::max(1e-6, xy_length)));
333334
if (pillar_2_tool_vec.y() > 0){
334335
theta = -theta;
335336
}

PluginExample/pluginexample.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void PluginExample::callback_information(){
316316

317317
// Perform some timing tests using the RoboDK API
318318
RDK->ShowMessage("Starting timing tests", false);
319-
QString text_message_html("<strong>Plugin Timing Tests Summary on " + QDateTime::currentDateTime().toString(Qt::SystemLocaleLongDate) + ":</strong><br>");
319+
QString text_message_html("<strong>Plugin Timing Tests Summary on " + QDateTime::currentDateTime().toString() + ":</strong><br>");
320320

321321
int ntests=10000;
322322
//Item robot = RDK->getItem("", IItem::ITEM_TYPE_ROBOT);

PluginOpenGL-Shaders/PluginChip8Opengl.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ QT += opengl
3636
QT += gui
3737
QT += concurrent
3838

39+
greaterThan(QT_MAJOR_VERSION, 5) {
40+
QT += openglwidgets
41+
}
3942

4043

4144
#-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

0 commit comments

Comments
 (0)