Remove obsolete code related to Qt5

* Remove bundling of openssl1.1
* Remove obsolete compile flags
* Remove use of obsolete RimCommandObject
* Use QColor::isValidColorName
QColor::isValidColor is deprecated in Qt 6.6, QColor::isValidColorName was introduced in 6.4

* Make sure debug DLLs are copied when required
* Remove Qt5 from AppFwk
* Remove obsolete copy of Qt  DLLs
This commit is contained in:
Magne Sjaastad
2024-10-07 10:16:48 +02:00
committed by GitHub
parent c75990551a
commit ca4a7b9000
40 changed files with 198 additions and 1194 deletions

View File

@@ -197,13 +197,6 @@ if(MSVC)
set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005")
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
# The following warning is generated over 800 times from a qwt header only
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
# local function has been removed
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505")
endif()
message(STATUS "BUILD_FLAGS_FOR_MSVC ${BUILD_FLAGS_FOR_MSVC}") message(STATUS "BUILD_FLAGS_FOR_MSVC ${BUILD_FLAGS_FOR_MSVC}")
set_target_properties( set_target_properties(
ResInsight PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS_FOR_MSVC} ResInsight PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS_FOR_MSVC}
@@ -444,8 +437,8 @@ if(RESINSIGHT_PRIVATE_INSTALL)
add_custom_command( add_custom_command(
TARGET ResInsight TARGET ResInsight
POST_BUILD POST_BUILD
COMMAND ${WINDEPLOYQT_EXECUTABLE} $<TARGET_FILE:ResInsight> --release COMMAND ${WINDEPLOYQT_EXECUTABLE} $<TARGET_FILE:ResInsight>
--no-translations "$<IF:$<CONFIG:Debug>,--debug,--release>" --no-translations
COMMENT COMMENT
"Running windeployqt to deploy Qt dependencies to the build folder, required by install()" "Running windeployqt to deploy Qt dependencies to the build folder, required by install()"
) )

View File

@@ -48,7 +48,6 @@
#include "Rim2dIntersectionViewCollection.h" #include "Rim2dIntersectionViewCollection.h"
#include "RimCellFilterCollection.h" #include "RimCellFilterCollection.h"
#include "RimCommandObject.h"
#include "RimCommandRouter.h" #include "RimCommandRouter.h"
#include "RimCompletionTemplateCollection.h" #include "RimCompletionTemplateCollection.h"
#include "RimEclipseCaseCollection.h" #include "RimEclipseCaseCollection.h"
@@ -789,18 +788,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
// Default behavior for scripts is to use current active view for data read/write // Default behavior for scripts is to use current active view for data read/write
onProjectOpened(); onProjectOpened();
// Loop over command objects and execute them
for ( size_t i = 0; i < m_project->commandObjects.size(); i++ )
{
m_commandQueue.push_back( m_project->commandObjects[i] );
}
// Lock the command queue
m_commandQueueLock.lock();
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
// Recalculate the results from grid property calculations. // Recalculate the results from grid property calculations.
// Has to be done late since the results are filtered by view cell visibility // Has to be done late since the results are filtered by view cell visibility
for ( auto gridCalculation : m_project->gridCalculationCollection()->sortedGridCalculations() ) for ( auto gridCalculation : m_project->gridCalculationCollection()->sortedGridCalculations() )
@@ -883,7 +870,6 @@ void RiaApplication::closeProject()
onProjectBeingClosed(); onProjectBeingClosed();
m_project->close(); m_project->close();
m_commandQueue.clear();
RiaWellNameComparer::clearCache(); RiaWellNameComparer::clearCache();
@@ -1383,81 +1369,6 @@ void RiaApplication::executeCommandFile( const QString& commandFile )
RicfCommandFileExecutor::instance()->executeCommands( in ); RicfCommandFileExecutor::instance()->executeCommands( in );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::addCommandObject( RimCommandObject* commandObject )
{
m_commandQueue.push_back( commandObject );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::executeCommandObjects()
{
{
auto currentCommandQueue = m_commandQueue;
for ( auto command : currentCommandQueue )
{
if ( !command->isAsyncronous() )
{
command->redo();
m_commandQueue.remove( command );
}
}
}
if ( !m_commandQueue.empty() )
{
auto it = m_commandQueue.begin();
if ( it->notNull() )
{
RimCommandObject* first = *it;
first->redo();
}
m_commandQueue.pop_front();
}
else
{
// Unlock the command queue lock when the command queue is empty
// Required to lock the mutex before unlocking to avoid undefined behavior
m_commandQueueLock.tryLock();
m_commandQueueLock.unlock();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
{
auto start = std::chrono::system_clock::now();
const double timeoutThreshold = 5.0;
// Wait until all command objects have completed
bool mutexLockedSuccessfully = m_commandQueueLock.tryLock();
while ( !mutexLockedSuccessfully )
{
invokeProcessEvents();
mutexLockedSuccessfully = m_commandQueueLock.tryLock();
std::chrono::duration<double> elapsed_seconds = std::chrono::system_clock::now() - start;
if ( timeoutThreshold < elapsed_seconds.count() )
{
// This can happen if the octave plugins fails to execute during regression testing.
RiaLogging::warning(
QString( "Timeout waiting for command objects to complete, timeout set to %1 seconds." ).arg( timeoutThreshold ) );
break;
}
}
m_commandQueueLock.unlock();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -49,7 +49,6 @@ class RiaSocketServer;
class RigEclipseCaseData; class RigEclipseCaseData;
class RimCommandObject;
class RimCommandRouter; class RimCommandRouter;
class RimEclipseCase; class RimEclipseCase;
class RimEclipseView; class RimEclipseView;
@@ -180,9 +179,6 @@ public:
QVariant cacheDataObject( const QString& key ) const; QVariant cacheDataObject( const QString& key ) const;
void executeCommandFile( const QString& commandFile ); void executeCommandFile( const QString& commandFile );
void addCommandObject( RimCommandObject* commandObject );
void executeCommandObjects();
void waitUntilCommandObjectsHasBeenProcessed();
const QString startDir() const; const QString startDir() const;
void setStartDir( const QString& startDir ); void setStartDir( const QString& startDir );
@@ -253,9 +249,6 @@ protected:
QString m_commandLineHelpText; QString m_commandLineHelpText;
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
std::list<caf::PdmPointer<RimCommandObject>> m_commandQueue;
QMutex m_commandQueueLock;
bool m_runningWorkerProcess; bool m_runningWorkerProcess;
private: private:

View File

@@ -50,7 +50,6 @@
#include "RimAnnotationCollection.h" #include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h" #include "RimAnnotationInViewCollection.h"
#include "RimAnnotationTextAppearance.h" #include "RimAnnotationTextAppearance.h"
#include "RimCommandObject.h"
#include "RimEclipseCaseCollection.h" #include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimFlowPlotCollection.h" #include "RimFlowPlotCollection.h"
@@ -1574,9 +1573,6 @@ void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitS
} }
m_workerProcess = nullptr; m_workerProcess = nullptr;
// Always make sure the command objects are executed before any return statement
executeCommandObjects();
// Either the work process crashed or was aborted by the user // Either the work process crashed or was aborted by the user
if ( exitStatus == QProcess::CrashExit ) if ( exitStatus == QProcess::CrashExit )
{ {

View File

@@ -43,7 +43,6 @@ class RiaSocketServer;
class RigEclipseCaseData; class RigEclipseCaseData;
class RimCommandObject;
class RimEclipseCase; class RimEclipseCase;
class RimEclipseView; class RimEclipseView;
class RimGridView; class RimGridView;

View File

@@ -240,9 +240,6 @@ void RiaRegressionTestRunner::runRegressionTest()
app->loadProject( testCaseFolder.filePath( projectFileName ), RiaApplication::ProjectLoadAction::PLA_NONE, projectModifier.p() ); app->loadProject( testCaseFolder.filePath( projectFileName ), RiaApplication::ProjectLoadAction::PLA_NONE, projectModifier.p() );
// Wait until all command objects have completed
app->waitUntilCommandObjectsHasBeenProcessed();
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName ); QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName );
if ( regressionTestConfig.exportSnapshots3dViews ) if ( regressionTestConfig.exportSnapshots3dViews )
{ {

View File

@@ -277,13 +277,6 @@ if(MSVC)
message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}") message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}")
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
# The following warning is generated over 800 times from a qwt header only
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
# local function has been removed
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505")
endif()
if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38)
# https://github.com/OPM/ResInsight/issues/10844 # https://github.com/OPM/ResInsight/issues/10844
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996")

View File

@@ -123,13 +123,6 @@ if(MSVC)
set(BUILD_FLAGS_FOR_MSVC "/W3 /wd4190 /wd4100 /wd4127") set(BUILD_FLAGS_FOR_MSVC "/W3 /wd4190 /wd4100 /wd4127")
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
# The following warning is generated over 800 times from a qwt header only
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
# local function has been removed
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505")
endif()
if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38)
# https://github.com/OPM/ResInsight/issues/10844 # https://github.com/OPM/ResInsight/issues/10844
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996")

View File

@@ -88,7 +88,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
// extract last word which may contain formation color // extract last word which may contain formation color
QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last(); QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last();
if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line
// extract words containing formation number(s) // extract words containing formation number(s)
QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) ); QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) );
@@ -110,7 +110,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
startK = tmp < endK ? tmp : endK; startK = tmp < endK ? tmp : endK;
endK = tmp > endK ? tmp : endK; endK = tmp > endK ? tmp : endK;
if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
{ {
cvf::Color3f formationColor; cvf::Color3f formationColor;
@@ -133,7 +133,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
continue; continue;
} }
if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
{ {
cvf::Color3f formationColor; cvf::Color3f formationColor;

View File

@@ -30,7 +30,6 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h
${CMAKE_CURRENT_LIST_DIR}/RimMimeData.h ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.h
${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.h
${CMAKE_CURRENT_LIST_DIR}/RimTools.h ${CMAKE_CURRENT_LIST_DIR}/RimTools.h
${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.h
${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.h
@@ -168,7 +167,6 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp
${CMAKE_CURRENT_LIST_DIR}/RimMimeData.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.cpp
${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.cpp
${CMAKE_CURRENT_LIST_DIR}/RimTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.cpp

View File

@@ -1,318 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimCommandObject.h"
#include "RiaApplication.h"
#include "RimCalcScript.h"
#include "RimEclipseStatisticsCase.h"
#include "RimProject.h"
#include "cafPdmObjectGroup.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTextEditor.h"
#include "cafPdmValueField.h"
#include <QFile>
CAF_PDM_SOURCE_INIT( RimCommandObject, "RimCommandObject" );
CAF_PDM_SOURCE_INIT( RimCommandExecuteScript, "RimCommandExecuteScript" );
CAF_PDM_SOURCE_INIT( RimCommandIssueFieldChanged, "RimCommandIssueFieldChanged" );
//------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandObject::RimCommandObject()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandObject::~RimCommandObject()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandExecuteScript::RimCommandExecuteScript()
{
CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" );
CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text" );
scriptText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled " );
CAF_PDM_InitField( &execute, "Execute", true, "Execute" );
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &execute );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandExecuteScript::~RimCommandExecuteScript()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandExecuteScript::redo()
{
if ( !isEnabled ) return;
RiaApplication* app = RiaApplication::instance();
QString octavePath = app->octavePath();
if ( !octavePath.isEmpty() )
{
QStringList arguments = app->octaveArguments();
arguments.append( "--eval" );
arguments << scriptText();
RiaApplication::instance()->launchProcess( octavePath, arguments, app->octaveProcessEnvironment() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandExecuteScript::undo()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandExecuteScript::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
if ( myAttr )
{
myAttr->showSaveButton = true;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCommandExecuteScript::userDescriptionField()
{
return &name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandExecuteScript::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( &execute == changedField )
{
RiaApplication* app = RiaApplication::instance();
app->addCommandObject( this );
app->executeCommandObjects();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimCommandExecuteScript::isAsyncronous()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandFactory::createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector<RimCommandObject*>* commandObjects )
{
for ( size_t i = 0; i < selectedObjects.objects.size(); i++ )
{
caf::PdmObjectHandle* pdmObject = selectedObjects.objects[i];
if ( dynamic_cast<RimCalcScript*>( pdmObject ) )
{
RimCalcScript* calcScript = dynamic_cast<RimCalcScript*>( pdmObject );
QFile file( calcScript->absoluteFileName );
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
QTextStream in( &file );
QByteArray byteArray = file.readAll();
QString scriptText( byteArray );
RimCommandExecuteScript* command = new RimCommandExecuteScript;
command->scriptText = scriptText;
commandObjects->push_back( command );
}
}
else if ( dynamic_cast<RimEclipseStatisticsCase*>( pdmObject ) )
{
RimEclipseStatisticsCase* statisticsCase = dynamic_cast<RimEclipseStatisticsCase*>( pdmObject );
RimCommandIssueFieldChanged* command = new RimCommandIssueFieldChanged;
command->objectName = statisticsCase->uiName();
command->fieldName = statisticsCase->m_calculateEditCommand.keyword();
command->fieldValueToApply = "true";
commandObjects->push_back( command );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandIssueFieldChanged::RimCommandIssueFieldChanged()
{
CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName" );
CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName" );
CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName" );
CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCommandIssueFieldChanged::~RimCommandIssueFieldChanged()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandIssueFieldChanged::redo()
{
RiaApplication* app = RiaApplication::instance();
PdmObject* project = app->project();
caf::PdmObjectHandle* pdmObject = findObjectByName( project, objectName );
if ( pdmObject )
{
caf::PdmFieldHandle* fieldHandle = findFieldByKeyword( pdmObject, fieldName );
if ( fieldHandle && fieldHandle->uiCapability() )
{
caf::PdmValueField* valueField = dynamic_cast<caf::PdmValueField*>( fieldHandle );
CVF_ASSERT( valueField );
QVariant oldValue = valueField->toQVariant();
QVariant newValue( fieldValueToApply );
valueField->setFromQVariant( newValue );
caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability();
uiFieldHandle->notifyFieldChanged( oldValue, newValue );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandIssueFieldChanged::undo()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCommandIssueFieldChanged::userDescriptionField()
{
return &commandName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCommandIssueFieldChanged::childObjects( caf::PdmObject* pdmObject, std::vector<caf::PdmObjectHandle*>& children )
{
if ( !pdmObject ) return;
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
size_t fIdx;
for ( fIdx = 0; fIdx < fields.size(); ++fIdx )
{
if ( fields[fIdx] )
{
auto other = fields[fIdx]->children();
children.insert( children.end(), other.begin(), other.end() );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimCommandIssueFieldChanged::findObjectByName( caf::PdmObjectHandle* pdmObject, const QString& name )
{
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
caf::PdmUiObjectHandle* uiObjectHandle = uiObj( pdmObject );
if ( uiObjectHandle && uiObjectHandle->uiName() == name )
{
return pdmObject;
}
for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ )
{
if ( fields[fIdx] )
{
std::vector<caf::PdmObjectHandle*> children = fields[fIdx]->children();
for ( size_t cIdx = 0; cIdx < children.size(); cIdx++ )
{
PdmObjectHandle* candidateObj = findObjectByName( children[cIdx], name );
if ( candidateObj )
{
return candidateObj;
}
}
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimCommandIssueFieldChanged::findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& keywordName )
{
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ )
{
if ( fields[fIdx] && fields[fIdx]->keyword() == keywordName )
{
return fields[fIdx];
}
}
return nullptr;
}

View File

@@ -1,108 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmObjectGroup.h"
#include "cvfObject.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimCommandObject : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimCommandObject();
~RimCommandObject() override;
virtual bool isAsyncronous() { return false; };
virtual void redo(){};
virtual void undo(){};
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimCommandExecuteScript : public RimCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RimCommandExecuteScript();
~RimCommandExecuteScript() override;
caf::PdmField<QString> name;
caf::PdmField<bool> isEnabled;
caf::PdmField<bool> execute;
caf::PdmField<QString> scriptText;
void redo() override;
void undo() override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
caf::PdmFieldHandle* userDescriptionField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
bool isAsyncronous() override;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimCommandIssueFieldChanged : public RimCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RimCommandIssueFieldChanged();
~RimCommandIssueFieldChanged() override;
caf::PdmField<QString> commandName;
caf::PdmField<QString> objectName;
caf::PdmField<QString> fieldName;
caf::PdmField<QString> fieldValueToApply;
void redo() override;
void undo() override;
caf::PdmFieldHandle* userDescriptionField() override;
private:
void childObjects( caf::PdmObject* pdmObject, std::vector<caf::PdmObjectHandle*>& children );
caf::PdmObjectHandle* findObjectByName( caf::PdmObjectHandle* root, const QString& name );
caf::PdmFieldHandle* findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& fieldName );
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimCommandFactory
{
public:
static void createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector<RimCommandObject*>* commandObjects );
};

View File

@@ -45,7 +45,6 @@
#include "RimCase.h" #include "RimCase.h"
#include "RimCaseCollection.h" #include "RimCaseCollection.h"
#include "RimColorLegendCollection.h" #include "RimColorLegendCollection.h"
#include "RimCommandObject.h"
#include "RimCompletionTemplateCollection.h" #include "RimCompletionTemplateCollection.h"
#include "RimContextCommandBuilder.h" #include "RimContextCommandBuilder.h"
#include "RimCorrelationPlotCollection.h" #include "RimCorrelationPlotCollection.h"
@@ -172,8 +171,6 @@ RimProject::RimProject()
CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" ); CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" );
gridCalculationCollection = new RimGridCalculationCollection; gridCalculationCollection = new RimGridCalculationCollection;
CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" );
CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" );
CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" ); CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" );
@@ -267,8 +264,6 @@ void RimProject::close()
casesObsolete.deleteChildren(); casesObsolete.deleteChildren();
caseGroupsObsolete.deleteChildren(); caseGroupsObsolete.deleteChildren();
commandObjects.deleteChildren();
multiSnapshotDefinitions.deleteChildren(); multiSnapshotDefinitions.deleteChildren();
m_dialogData->clearProjectSpecificData(); m_dialogData->clearProjectSpecificData();

View File

@@ -43,8 +43,6 @@ class RimPolylinesAnnotation;
class RimSummaryCalculationCollection; class RimSummaryCalculationCollection;
class RimSummaryCalculation; class RimSummaryCalculation;
class RimCase; class RimCase;
class RimCommandObject;
class RimCommandObject;
class RimDialogData; class RimDialogData;
class RimEclipseCase; class RimEclipseCase;
class RimGeoMechCase; class RimGeoMechCase;
@@ -101,7 +99,6 @@ public:
caf::PdmChildField<RimViewLinkerCollection*> viewLinkerCollection; caf::PdmChildField<RimViewLinkerCollection*> viewLinkerCollection;
caf::PdmChildField<RimSummaryCalculationCollection*> calculationCollection; caf::PdmChildField<RimSummaryCalculationCollection*> calculationCollection;
caf::PdmChildField<RimGridCalculationCollection*> gridCalculationCollection; caf::PdmChildField<RimGridCalculationCollection*> gridCalculationCollection;
caf::PdmChildArrayField<RimCommandObject*> commandObjects;
RimMainPlotCollection* mainPlotCollection() const; RimMainPlotCollection* mainPlotCollection() const;

View File

@@ -32,7 +32,6 @@
#include "Rim2dIntersectionView.h" #include "Rim2dIntersectionView.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimCommandObject.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseContourMapView.h" #include "RimEclipseContourMapView.h"
@@ -358,7 +357,6 @@ void RiuMainWindow::createActions()
m_snapshotAllViewsToFile = new QAction( QIcon( ":/SnapShotSaveViews.svg" ), "Snapshot All Views To File", this ); m_snapshotAllViewsToFile = new QAction( QIcon( ":/SnapShotSaveViews.svg" ), "Snapshot All Views To File", this );
m_createCommandObject = new QAction( "Create Command Object", this );
m_showRegressionTestDialog = new QAction( "Regression Test Dialog", this ); m_showRegressionTestDialog = new QAction( "Regression Test Dialog", this );
m_executePaintEventPerformanceTest = new QAction( "&Paint Event Performance Test", this ); m_executePaintEventPerformanceTest = new QAction( "&Paint Event Performance Test", this );
@@ -370,7 +368,6 @@ void RiuMainWindow::createActions()
connect( m_snapshotAllViewsToFile, SIGNAL( triggered() ), SLOT( slotSnapshotAllViewsToFile() ) ); connect( m_snapshotAllViewsToFile, SIGNAL( triggered() ), SLOT( slotSnapshotAllViewsToFile() ) );
connect( m_createCommandObject, SIGNAL( triggered() ), SLOT( slotCreateCommandObject() ) );
connect( m_showRegressionTestDialog, SIGNAL( triggered() ), SLOT( slotShowRegressionTestDialog() ) ); connect( m_showRegressionTestDialog, SIGNAL( triggered() ), SLOT( slotShowRegressionTestDialog() ) );
connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) ); connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) );
@@ -532,8 +529,6 @@ void RiuMainWindow::createMenus()
testMenu->addAction( m_mockModelCustomizedAction ); testMenu->addAction( m_mockModelCustomizedAction );
testMenu->addAction( m_mockInputModelAction ); testMenu->addAction( m_mockInputModelAction );
testMenu->addSeparator(); testMenu->addSeparator();
testMenu->addAction( m_createCommandObject );
testMenu->addSeparator();
testMenu->addAction( m_showRegressionTestDialog ); testMenu->addAction( m_showRegressionTestDialog );
testMenu->addAction( m_executePaintEventPerformanceTest ); testMenu->addAction( m_executePaintEventPerformanceTest );
testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) ); testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) );
@@ -1928,44 +1923,6 @@ void RiuMainWindow::selectedCases( std::vector<RimCase*>& cases )
caf::SelectionManager::instance()->objectsByType( &cases ); caf::SelectionManager::instance()->objectsByType( &cases );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotCreateCommandObject()
{
RiaApplication* app = RiaApplication::instance();
if ( !app->project() ) return;
caf::PdmUiTreeView* projectTree = dynamic_cast<caf::PdmUiTreeView*>( sender() );
if ( !projectTree ) return;
std::vector<caf::PdmUiItem*> selectedUiItems;
projectTree->selectedUiItems( selectedUiItems );
caf::PdmObjectGroup selectedObjects;
for ( auto* selectedUiItem : selectedUiItems )
{
caf::PdmUiObjectHandle* uiObj = dynamic_cast<caf::PdmUiObjectHandle*>( selectedUiItem );
if ( uiObj )
{
selectedObjects.addObject( uiObj->objectHandle() );
}
}
if ( !selectedObjects.objects.empty() )
{
std::vector<RimCommandObject*> commandObjects;
RimCommandFactory::createCommandObjects( selectedObjects, &commandObjects );
for ( auto* commandObject : commandObjects )
{
app->project()->commandObjects.push_back( commandObject );
}
app->project()->updateConnectedEditors();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -173,7 +173,6 @@ private:
QAction* m_snapshotAllViewsToFile; QAction* m_snapshotAllViewsToFile;
QAction* m_createCommandObject;
QAction* m_showRegressionTestDialog; QAction* m_showRegressionTestDialog;
QAction* m_executePaintEventPerformanceTest; QAction* m_executePaintEventPerformanceTest;
@@ -235,8 +234,6 @@ private slots:
// Debug slots // Debug slots
void slotSnapshotAllViewsToFile(); void slotSnapshotAllViewsToFile();
void slotCreateCommandObject();
void slotShowRegressionTestDialog(); void slotShowRegressionTestDialog();
void slotExecutePaintEventPerformanceTest(); void slotExecutePaintEventPerformanceTest();

View File

@@ -10,11 +10,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk) set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk)
# !!! For now, we force Qt to version 5 message(STATUS "Set CEE_USE_QT6 to ON")
set(CEE_USE_QT5 OFF) set(CEE_USE_QT5 OFF)
message(STATUS "Forcing setting of CEE_USE_QT6 to ON")
set(CEE_USE_QT6 ON) set(CEE_USE_QT6 ON)
message(STATUS "CEE_USE_QT6=${CEE_USE_QT6}")
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
if(POLICY CMP0077) if(POLICY CMP0077)
@@ -1079,36 +1077,6 @@ install(TARGETS extract-projectfile-versions
DESTINATION ${RESINSIGHT_INSTALL_FOLDER} DESTINATION ${RESINSIGHT_INSTALL_FOLDER}
) )
# ##############################################################################
# Add OpenSSL 1.1.1 libraries The OpenSSL libraries are needed for the
# NetworkAuth module in Qt 5 Installed by adding openssl-windows in vcpkg.json
# Required to use fully specified path to the dlls, as it is not trivial to find
# the path. OpenSSL 3 is installed and used by other modules
# ##############################################################################
if(MSVC)
FetchContent_Declare(
openssl_1_1_1
URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/download/2024.05/openssl_1_1_1.zip
)
FetchContent_Populate(openssl_1_1_1)
set(FILE_PATH_LIBCRYPTO_1_1
"${openssl_1_1_1_SOURCE_DIR}/libcrypto-1_1-x64.dll"
)
set(FILE_PATH_LIBOPENSSL_1_1 "${openssl_1_1_1_SOURCE_DIR}/libssl-1_1-x64.dll")
message(STATUS "FILE_PATH_LIBCRYPTO_1_1: ${FILE_PATH_LIBCRYPTO_1_1}")
message(STATUS "FILE_PATH_LIBOPENSSL_1_1: ${FILE_PATH_LIBOPENSSL_1_1}")
install(
FILES ${FILE_PATH_LIBCRYPTO_1_1} ${FILE_PATH_LIBOPENSSL_1_1}
DESTINATION ${RESINSIGHT_INSTALL_FOLDER}
OPTIONAL
)
endif() # MSVC
# ############################################################################## # ##############################################################################
# Visual Studio : Create the ruleset file to be used by Static Code Analysis # Visual Studio : Create the ruleset file to be used by Static Code Analysis
# https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt # https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt

View File

@@ -14,23 +14,13 @@ find_package(OpenGL)
# These headers need to go through Qt's MOC compiler # These headers need to go through Qt's MOC compiler
set(MOC_HEADER_FILES cafMessagePanel.h) set(MOC_HEADER_FILES cafMessagePanel.h)
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets OpenGL
REQUIRED Core Gui Widgets OpenGL )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
add_library( add_library(
${PROJECT_NAME} ${PROJECT_NAME}

View File

@@ -11,23 +11,13 @@ set(MOC_HEADER_FILES cafFrameAnimationControl.h cafAnimationToolBar.h
cafPopupMenuButton.h cafPopupMenuButton.h
) )
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
# NOTE! Resources in this subfolder appends to the variable QRC_FILES in parent # NOTE! Resources in this subfolder appends to the variable QRC_FILES in parent
# scope CMakeList.txt in the application folder (parent scope) must use the # scope CMakeList.txt in the application folder (parent scope) must use the

View File

@@ -10,23 +10,13 @@ endif()
set(MOC_HEADER_FILES cafCmdFeature.h cafCmdFeatureManager.h) set(MOC_HEADER_FILES cafCmdFeature.h cafCmdFeatureManager.h)
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafCmdExecCommandManager.cpp cafCmdExecCommandManager.cpp

View File

@@ -10,23 +10,13 @@ endif()
set(MOC_HEADER_FILES) set(MOC_HEADER_FILES)
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
set(PROJECT_FILES set(PROJECT_FILES
# Default features # Default features

View File

@@ -7,22 +7,13 @@ if(CAF_ENABLE_UNITY_BUILD)
endif() endif()
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafDataLoader.h cafDataLoader.cpp cafDataLoadTask.h cafDataLoadTask.cpp cafDataLoader.h cafDataLoader.cpp cafDataLoadTask.h cafDataLoadTask.cpp

View File

@@ -6,23 +6,12 @@ if(CAF_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true) set(CMAKE_UNITY_BUILD true)
endif() endif()
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})
endif()
add_library( add_library(
${PROJECT_NAME} ${PROJECT_NAME}

View File

@@ -1,20 +1,9 @@
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core
REQUIRED Core )
) set(QT_LIBRARIES Qt6::Core)
set(QT_LIBRARIES Qt6::Core)
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core
)
set(QT_LIBRARIES Qt5::Core)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})
endif()
project(cafPdmCvf_UnitTests) project(cafPdmCvf_UnitTests)
@@ -31,44 +20,8 @@ set(PROJECT_FILES
# add the executable # add the executable
add_executable(${PROJECT_NAME} ${PROJECT_FILES}) add_executable(${PROJECT_NAME} ${PROJECT_FILES})
if(Qt5Core_FOUND)
set(QT_LIBRARIES Qt5::Core)
endif()
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
target_link_libraries( target_link_libraries(
${PROJECT_NAME} cafPdmCore cafPdmXml LibCore cafPdmCvf ${QT_LIBRARIES} ${PROJECT_NAME} cafPdmCore cafPdmXml LibCore cafPdmCvf ${QT_LIBRARIES}
) )
# Copy Qt Dlls
if(Qt5Core_FOUND)
foreach(qtlib ${QT_LIBRARIES})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
# Copy Qt Dlls
else()
# Copy Qt Dlls
if(MSVC)
set(QTLIBLIST QtCore)
foreach(qtlib ${QTLIBLIST})
# Debug
execute_process(
COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll
${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll
)
# Release
execute_process(
COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll
${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll
)
endforeach(qtlib)
endif(MSVC)
endif(Qt5Core_FOUND)

View File

@@ -1,20 +1,11 @@
project(cafPdmScripting_UnitTests) project(cafPdmScripting_UnitTests)
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets
REQUIRED Core Gui Widgets )
) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Xml Gui
)
set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui)
endif()
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
@@ -29,11 +20,7 @@ set(PROJECT_FILES cafPdmScripting_UnitTests.cpp gtest/gtest-all.cpp
cafPdmScriptingBasicTest.cpp cafPdmFieldSerializationTest.cpp cafPdmScriptingBasicTest.cpp cafPdmFieldSerializationTest.cpp
) )
if(CEE_USE_QT6) qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
else()
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
endif(CEE_USE_QT6)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options( target_compile_options(
@@ -47,29 +34,14 @@ target_link_libraries(
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
# Copy Qt Dlls
if(Qt5Core_FOUND)
foreach(qtlib ${QT_LIBRARIES})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
endif(Qt5Core_FOUND)
# Install
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION . BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
endif(CEE_USE_QT6)

View File

@@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true) set(CMAKE_UNITY_BUILD true)
endif() endif()
# Qt find_package(
if(CEE_USE_QT6) Qt6
find_package( COMPONENTS
Qt6 REQUIRED Core Gui Widgets
COMPONENTS )
REQUIRED Core Gui Widgets set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
) qt_standard_project_setup()
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafFactory.h cafFactory.h

View File

@@ -6,22 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true) set(CMAKE_UNITY_BUILD true)
endif() endif()
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core
REQUIRED Core )
) set(QT_LIBRARIES Qt6::Core)
set(QT_LIBRARIES Qt6::Core) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core
)
set(QT_LIBRARIES Qt5::Core)
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafAssert.h cafAssert.h

View File

@@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15)
project(cafPdmCore_UnitTests) project(cafPdmCore_UnitTests)
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Widgets Gui
REQUIRED Core Widgets Gui )
) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui)
endif()
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
@@ -43,11 +34,7 @@ set(PROJECT_FILES
TestObj.h TestObj.h
) )
if(CEE_USE_QT6) qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
else()
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
endif(CEE_USE_QT6)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -59,10 +46,6 @@ endif()
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
if(Qt5Core_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
target_link_libraries( target_link_libraries(
${PROJECT_NAME} PRIVATE cafPdmCore ${QT_LIBRARIES} ${THREAD_LIBRARY} ${PROJECT_NAME} PRIVATE cafPdmCore ${QT_LIBRARIES} ${THREAD_LIBRARY}
) )
@@ -84,10 +67,8 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
endif(CEE_USE_QT6)

View File

@@ -11,24 +11,13 @@ set(MOC_HEADER_FILES cafPdmUiEditorHandle.h cafPdmUiFieldEditorHandle.h
cafPdmUiSelection3dEditorVisualizer.h cafQShortenedLabel.h cafPdmUiSelection3dEditorVisualizer.h cafQShortenedLabel.h
) )
# Qt find_package(
if(CEE_USE_QT6) Qt6
find_package( COMPONENTS
Qt6 REQUIRED Core Gui Widgets
COMPONENTS )
REQUIRED Core Gui Widgets set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
) qt_standard_project_setup()
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets)
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafInternalPdmFieldTypeSpecializations.h cafInternalPdmFieldTypeSpecializations.h

View File

@@ -162,7 +162,7 @@ std::unique_ptr<QIcon> IconProvider::icon( const QSize& size ) const
bool validIcon = false; bool validIcon = false;
if ( !m_backgroundColorStrings.empty() ) if ( !m_backgroundColorStrings.empty() )
{ {
if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColor( m_backgroundColorStrings.front() ) ) if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColorName( m_backgroundColorStrings.front() ) )
{ {
pixmap.fill( QColor( m_backgroundColorStrings.front() ) ); pixmap.fill( QColor( m_backgroundColorStrings.front() ) );
validIcon = true; validIcon = true;
@@ -176,7 +176,7 @@ std::unique_ptr<QIcon> IconProvider::icon( const QSize& size ) const
QLinearGradient gradient( QPointF( 0.0f, 0.0f ), QPoint( size.width(), 0.0f ) ); QLinearGradient gradient( QPointF( 0.0f, 0.0f ), QPoint( size.width(), 0.0f ) );
for ( size_t i = 0; i < m_backgroundColorStrings.size(); ++i ) for ( size_t i = 0; i < m_backgroundColorStrings.size(); ++i )
{ {
if ( !QColor::isValidColor( m_backgroundColorStrings[i] ) ) if ( !QColor::isValidColorName( m_backgroundColorStrings[i] ) )
{ {
validIcon = false; validIcon = false;
break; break;
@@ -303,7 +303,7 @@ bool IconProvider::backgroundColorsAreValid() const
bool validBackgroundColors = true; bool validBackgroundColors = true;
for ( QString colorName : m_backgroundColorStrings ) for ( QString colorName : m_backgroundColorStrings )
{ {
if ( !QColor::isValidColor( colorName ) ) if ( !QColor::isValidColorName( colorName ) )
{ {
validBackgroundColors = false; validBackgroundColors = false;
break; break;

View File

@@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true) set(CMAKE_UNITY_BUILD true)
endif() endif()
# Qt find_package(
if(CEE_USE_QT6) Qt6
find_package( COMPONENTS
Qt6 REQUIRED Core Xml
COMPONENTS )
REQUIRED Core Xml set(QT_LIBRARIES Qt6::Core Qt6::Xml)
) qt_standard_project_setup()
set(QT_LIBRARIES Qt6::Core Qt6::Xml)
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Xml
)
set(QT_LIBRARIES Qt5::Core Qt5::Xml)
endif()
set(PROJECT_FILES set(PROJECT_FILES
cafInternalPdmFieldIoHelper.cpp cafInternalPdmFieldIoHelper.cpp

View File

@@ -2,22 +2,13 @@ cmake_minimum_required(VERSION 3.15)
project(cafPdmXml_UnitTests) project(cafPdmXml_UnitTests)
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Xml
REQUIRED Core Xml )
) set(QT_LIBRARIES Qt6::Core Qt6::Xml)
set(QT_LIBRARIES Qt6::Core Qt6::Xml) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Xml
)
set(QT_LIBRARIES Qt5::Core Qt5::Xml)
endif()
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
@@ -34,11 +25,7 @@ set(PROJECT_FILES
cafPdmPtrArrayTest.cpp cafPdmPtrArrayTest.cpp
) )
if(CEE_USE_QT6) qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
else()
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
endif(CEE_USE_QT6)
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
@@ -46,29 +33,14 @@ target_link_libraries(
${PROJECT_NAME} PRIVATE cafPdmXml ${QT_LIBRARIES} ${THREAD_LIBRARY} ${PROJECT_NAME} PRIVATE cafPdmXml ${QT_LIBRARIES} ${THREAD_LIBRARY}
) )
# Copy Qt Dlls
if(Qt5Core_FOUND)
foreach(qtlib ${QT_LIBRARIES})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
endif(Qt5Core_FOUND)
# Install
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION . BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
endif(CEE_USE_QT6)

View File

@@ -2,22 +2,12 @@ cmake_minimum_required(VERSION 3.15)
project(cafProjectDataModel_UnitTests) project(cafProjectDataModel_UnitTests)
# Qt find_package(
if(CEE_USE_QT6) Qt6
find_package( COMPONENTS
Qt6 REQUIRED Core Widgets
COMPONENTS )
REQUIRED Core Widgets qt_standard_project_setup()
)
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Xml Gui
)
set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui)
endif()
if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
@@ -38,11 +28,7 @@ set(PROJECT_FILES
gtest/gtest-all.cpp gtest/gtest-all.cpp
) )
if(CEE_USE_QT6) qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
else()
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
endif(CEE_USE_QT6)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options( target_compile_options(
@@ -57,27 +43,14 @@ target_link_libraries(
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
# Copy Qt Dlls
foreach(qtlib ${QT_LIBRARIES})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
# Install
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION . BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
endif(CEE_USE_QT6)

View File

@@ -16,24 +16,13 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h CustomObjectEditor.h
set(QRC_FILES ${QRC_FILES} textedit.qrc) set(QRC_FILES ${QRC_FILES} textedit.qrc)
message("QRC_FILES: ${QRC_FILES}") message("QRC_FILES: ${QRC_FILES}")
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets OpenGL Svg
REQUIRED Core Gui Widgets OpenGL Svg )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})
endif()
option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON)
@@ -60,28 +49,11 @@ set(PROJECT_FILES
LineEditAndPushButtons.cpp LineEditAndPushButtons.cpp
) )
if(CEE_USE_QT6) qt_add_executable(
qt_add_executable( ${PROJECT_NAME} ${PROJECT_FILES} ${MOC_SOURCE_FILES} ${QRC_FILES}
${PROJECT_NAME} $<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12. Remove
${PROJECT_FILES} # when we can use target_link_libraries with OBJECT libraries
${MOC_SOURCE_FILES} )
${QRC_FILES}
$<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12.
# Remove
# when we can use target_link_libraries with OBJECT libraries
)
else()
add_executable(
${PROJECT_NAME}
${PROJECT_FILES}
${MOC_SOURCE_FILES}
${QRC_FILES_CPP}
$<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12.
# Remove when we can use
# target_link_libraries with OBJECT
# libraries
)
endif(CEE_USE_QT6)
set(TAP_LINK_LIBRARIES cafUserInterface) set(TAP_LINK_LIBRARIES cafUserInterface)
@@ -122,19 +94,16 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CPACK_GENERATOR TGZ) set(CPACK_GENERATOR TGZ)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
endif() endif()
include(CPack) include(CPack)
endif(CEE_USE_QT6)

View File

@@ -8,23 +8,12 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h)
# Resource file # Resource file
set(QRC_FILES textedit.qrc) set(QRC_FILES textedit.qrc)
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets OpenGL Svg
REQUIRED Core Gui Widgets OpenGL Svg )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg)
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})
endif()
option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON)

View File

@@ -55,23 +55,13 @@ set(MOC_HEADER_FILES
cafPdmUiValueRangeEditor.h cafPdmUiValueRangeEditor.h
) )
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets Svg
REQUIRED Core Gui Widgets Svg )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets Svg
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
set(PROJECT_FILES set(PROJECT_FILES
# field editors # field editors

View File

@@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15)
project(cafUserInterface_UnitTests) project(cafUserInterface_UnitTests)
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets Svg
REQUIRED Core Gui Widgets Svg )
) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp
) )
@@ -26,11 +17,7 @@ set(PROJECT_FILES cafUserInterface_UnitTests.cpp cafPdmUiTreeViewModelTest.cpp
cafPdmUiTreeSelectionQModelTest.cpp gtest/gtest-all.cpp cafPdmUiTreeSelectionQModelTest.cpp gtest/gtest-all.cpp
) )
if(CEE_USE_QT6) qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES})
else()
add_executable(${PROJECT_NAME} ${PROJECT_FILES})
endif(CEE_USE_QT6)
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})
@@ -38,16 +25,6 @@ target_link_libraries(
${PROJECT_NAME} PRIVATE cafUserInterface ${QT_LIBRARIES} ${THREAD_LIBRARY} ${PROJECT_NAME} PRIVATE cafUserInterface ${QT_LIBRARIES} ${THREAD_LIBRARY}
) )
# Copy Qt Dlls
foreach(qtlib ${QT_LIBRARIES})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
# Install # Install
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
@@ -55,10 +32,8 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(CEE_USE_QT6) qt_generate_deploy_app_script(
qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script
TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS
NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS )
) install(SCRIPT ${deploy_script})
install(SCRIPT ${deploy_script})
endif(CEE_USE_QT6)

View File

@@ -11,25 +11,13 @@ endif()
# These headers need to go through Qt's MOC compiler # These headers need to go through Qt's MOC compiler
set(MOC_HEADER_FILES cafViewer.h) set(MOC_HEADER_FILES cafViewer.h)
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets OpenGL
REQUIRED Core Gui Widgets OpenGL )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) qt_standard_project_setup()
qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
set(QT5_OPENGL_FILES cafOpenGLWidget.cpp cafOpenGLWidget.h)
endif()
add_library( add_library(
${PROJECT_NAME} ${PROJECT_NAME}

View File

@@ -10,26 +10,16 @@ endif()
find_package(OpenGL) find_package(OpenGL)
# Qt # Qt
if(CEE_USE_QT6) find_package(
find_package( Qt6
Qt6 COMPONENTS
COMPONENTS REQUIRED Core Gui Widgets OpenGL
REQUIRED Core Gui Widgets OpenGL )
) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) qt_standard_project_setup()
qt_standard_project_setup() set_property(
set_property( SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON
SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON )
)
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui Widgets OpenGL
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif()
add_library( add_library(
${PROJECT_NAME} ${PROJECT_NAME}

View File

@@ -32,7 +32,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG")
endif() endif()
if(CEE_USE_QT6)
find_package( find_package(
Qt6 Qt6
COMPONENTS COMPONENTS
@@ -40,14 +39,6 @@ if(CEE_USE_QT6)
) )
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Widgets) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Widgets)
qt_standard_project_setup() qt_standard_project_setup()
else()
find_package(
Qt5
COMPONENTS
REQUIRED Core Gui OpenGL Widgets
)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets)
endif()
# Libraries # Libraries
add_subdirectory(AppFwk/cafProjectDataModel/cafPdmCore) add_subdirectory(AppFwk/cafProjectDataModel/cafPdmCore)