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

Minimal port to qt6 #1558

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

.qmake.stash
.qtc_clangd
*.pro.user
*.pro.user.*
*.pro.user*
moc_*.cpp
qrc_*.cpp
Makefile
Expand Down Expand Up @@ -50,5 +49,5 @@ coverage/
.vscode/

# CMake build
CMakeLists.txt.user
CMakeLists.txt.user*
build*
20 changes: 20 additions & 0 deletions qmlui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ if(WIN32)
)
endif()

if(QT_VERSION_MAJOR GREATER 5)
file(GLOB_RECURSE FILES_TO_ALIAS
"${CMAKE_CURRENT_SOURCE_DIR}/js/*.js"
"${CMAKE_CURRENT_SOURCE_DIR}/qml/*.qml"
"${CMAKE_CURRENT_SOURCE_DIR}/qml/fixturesfunctions/3DView/shaders/*.frag"
"${CMAKE_CURRENT_SOURCE_DIR}/qml/fixturesfunctions/3DView/shaders/*.vert"
)

list(APPEND FILES_TO_ALIAS "${CMAKE_CURRENT_SOURCE_DIR}/qml/qmldir")

foreach(FILE_TO_ALIAS ${FILES_TO_ALIAS})
if(NOT "${FILE_TO_ALIAS}" MATCHES "\\+qt5")
get_filename_component(FILE_NAME ${FILE_TO_ALIAS} NAME)
set_source_files_properties("${FILE_TO_ALIAS}"
PROPERTIES QT_RESOURCE_ALIAS "${FILE_NAME}"
)
endif()
endforeach()
endif()

target_include_directories(${module_name} PRIVATE
../engine/audio/src
../engine/src
Expand Down
19 changes: 16 additions & 3 deletions qmlui/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QPrinter>
#include <QPainter>
#include <QScreen>
#include <QQmlFileSelector>
#include <unistd.h>

#include "app.h"
Expand Down Expand Up @@ -122,6 +123,13 @@ void App::startup()
qmlRegisterUncreatableType<Function>("org.qlcplus.classes", 1, 0, "QLCFunction", "Can't create a Function!");
qmlRegisterType<ModelSelector>("org.qlcplus.classes", 1, 0, "ModelSelector");

qputenv("QT3D_RENDERER", "opengl");

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQmlFileSelector* selector = new QQmlFileSelector(engine());
selector->setExtraSelectors({"qt5"});
#endif

setTitle(APPNAME);
setIcon(QIcon(":/qlcplus.svg"));

Expand Down Expand Up @@ -254,9 +262,14 @@ bool App::is3DSupported() const
int glVersion = (openglContext()->format().majorVersion() * 10) + openglContext()->format().minorVersion();
return glVersion < 33 ? false : true;
#else
// TODO: Qt6

return true;
if (rendererInterface()->isApiRhiBased(graphicsApi())) {
return true;
}
QOpenGLContext * openglContext = static_cast<QOpenGLContext *>(rendererInterface()->getResource(const_cast<App *>(this), QSGRendererInterface::OpenGLContextResource));
if (openglContext && openglContext->isValid() && openglContext->format().majorVersion() * 10 + openglContext->format().minorVersion() >= 33) {
return true;
}
return false;
#endif
}

Expand Down
3 changes: 1 addition & 2 deletions qmlui/inputprofileeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class InputProfileEditor : public QObject
* Initialization
************************************************************************/
public:
InputProfileEditor(QObject *parent = nullptr);
InputProfileEditor(QLCInputProfile *profile, Doc *doc, QObject *parent = nullptr);
explicit InputProfileEditor(QLCInputProfile *profile, Doc *doc, QObject *parent = nullptr);
~InputProfileEditor();

/* Get/Set the profile modified state */
Expand Down
Loading