Commit 23560f8a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some qt6 compile errors

parent 7a629dda
Pipeline #198744 passed with stage
in 3 minutes and 5 seconds
......@@ -26,7 +26,7 @@ include(CheckLibraryExists) #FindCurses seems to need that on the CI
include(ECMPoQmTools)
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Xml Svg Test Qml Quick PrintSupport)
if (QT_MAJOR_VERSION STREQUAL "6")
find_package(Qt6Core5Compat)
find_package(Qt6 REQUIRED NO_MODULE COMPONENTS Core5Compat OpenGLWidgets)
endif()
set(ANALITZA_INCLUDE_INSTALL_DIR "${KDE_INSTALL_INCLUDEDIR}/Analitza5")
......
......@@ -96,12 +96,22 @@ QStringList dependencies(const Object* o, const QStringList& scope)
Object* ul=c->ulimit(), *dl=c->dlimit(), *domain=c->domain();
//uplimit and downlimit are in the parent scope
if(ul) ret += dependencies(ul, scope).toSet();
if(dl) ret += dependencies(dl, scope).toSet();
if(domain) ret += dependencies(domain, scope).toSet();
if(ul) {
const auto &dep = dependencies(ul, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
if(dl) {
const auto &dep = dependencies(dl, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
if(domain) {
const auto &dep = dependencies(domain, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
if(c->firstOperator()==Operator::function) {
ret += dependencies(c->m_params[0], scope).toSet();
const auto &dep = dependencies(c->m_params[0], scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
QStringList newScope=scope+c->bvarStrings();
......
......@@ -1356,7 +1356,9 @@ Object* Analyzer::simpApply(Apply* c)
//if bvars is empty, we are dealing with an invalid sum()
Object* function = *c->firstValue();
if(!bvars.isEmpty() && !domain && !hasTheVar(bvars.toSet(), function)) {
const auto barsSet = QSet<QString>(bvars.begin(), bvars.end());
if(!bvars.isEmpty() && !domain && !hasTheVar(barsSet, function)) {
Apply *cDiff=new Apply;
cDiff->appendBranch(new Operator(Operator::minus));
cDiff->appendBranch(uplimit ->copy());
......
......@@ -775,7 +775,7 @@ QVariant ExpressionTypeChecker::visit(const Container* c)
case Container::lambda: {
QSet<QString> aux=m_lambdascope;
QStringList bvars=c->bvarStrings();
m_lambdascope+=bvars.toSet();
m_lambdascope+=QSet<QString>(bvars.begin(), bvars.end());
c->m_params.constLast()->accept(this);
m_lambdascope=aux;
......
set(testLibs Qt::Core Qt::Xml Qt::Test Analitza)
if (QT_MAJOR_VERSION STREQUAL "6")
set (testLibs ${testLibs} Qt6::Core5Compat)
endif()
ecm_add_tests(
analitzatest.cpp
......
......@@ -2,6 +2,9 @@ add_subdirectory(tests)
add_library(AnalitzaGui operatorsmodel.cpp algebrahighlighter.cpp variablesmodel.cpp)
target_link_libraries(AnalitzaGui Qt::Core Qt::Gui Analitza)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(AnalitzaGui Qt6::Core5Compat)
endif()
set_target_properties(AnalitzaGui PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
......
......@@ -17,7 +17,6 @@
*************************************************************************************/
#include "variablesmodel.h"
#include <analitza/variables.h>
#include <analitza/expression.h>
#include <analitza/value.h>
#include <analitza/analitzautils.h>
......
......@@ -22,10 +22,10 @@
#include <QAbstractTableModel>
#include <QSharedPointer>
#include "analitzaguiexport.h"
#include <analitza/variables.h>
namespace Analitza
{
class Variables;
class Expression;
/**
......
......@@ -66,6 +66,10 @@ PRIVATE
Qt::PrintSupport # this pulls widgets
)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(AnalitzaPlot PRIVATE Qt6::OpenGL)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Android)
target_link_libraries(AnalitzaPlot PRIVATE GLESv2)
elseif(WIN32)
......
......@@ -6,9 +6,15 @@ target_link_libraries(plotsdictionarydemo AnalitzaWidgets)
add_executable(plots3ddemo plots3ddemo.cpp)
target_link_libraries(plots3ddemo AnalitzaWidgets)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(plots3ddemo Qt6::OpenGLWidgets)
endif()
add_executable(export3dplotdemo export3dplotdemo.cpp)
target_link_libraries(export3dplotdemo AnalitzaWidgets)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(export3dplotdemo Qt6::OpenGLWidgets)
endif()
find_library(SNDFILE sndfile)
if (SNDFILE_FOUND)
......
......@@ -512,8 +512,12 @@ bool Plotter3DES::save(const QUrl& url)
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(path);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
printer.setPaperSize(px.size(), QPrinter::DevicePixel);
printer.setPageMargins(0,0,0,0, QPrinter::DevicePixel);
#else
#pragma "port printer.setPaperSize";
#endif
printer.setPageMargins(QMarginsF(0,0,0,0));
QPainter painter;
painter.begin(&printer);
painter.drawImage(QPoint(0,0), px);
......
......@@ -15,6 +15,11 @@ target_link_libraries(AnalitzaWidgets PUBLIC Qt::Widgets Analitza AnalitzaPlot A
PRIVATE Qt::Svg
)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(AnalitzaWidgets PRIVATE Qt6::OpenGLWidgets)
endif()
set_target_properties(AnalitzaWidgets PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
generate_export_header(AnalitzaWidgets)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment