- This topic has 2 replies, 2 voices, and was last updated 8 years, 3 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] UseQt in Plugin
Tagged: 64_bits, Linux_ubuntu, SOFA_1512
Hello Guys
in previously version of SOFA , when we needed to use Qt class like Qlist or QTimer , i writed “UseQt()” in cmakefile and #include <QList> , and everything was OK
NOW , i clone new version of SOFA (15.12) and “UseQt()” has an error in cmake and i cannot use Qt class in my component , how can fix this problem ?
I found it , I add this codes to my cmakelist and NOW i can use Qt class in my plugin
find_package(SofaGeneral REQUIRED)
find_package(SofaMisc REQUIRED)
find_package(SofaAdvanced REQUIRED)
find_package(Qt5 COMPONENTS Gui OpenGL Xml REQUIRED)
#startModifed
if(Qt5Core_FOUND)
message(“SofaGUIQt: Using Qt5”)
set(QT5_NO_LINK_QTMAIN 1)
find_package(Qt5 COMPONENTS Gui OpenGL REQUIRED)
set(EXT_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS})
# target_include_directories(${EXT_QT_INCLUDES})
set(EXT_QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5OpenGL_LIBRARIES})
qt5_wrap_cpp(MOC_FILES ${MOC_HEADER_FILES})
set(MOC_FILES_GROUP “Generated”)
qt5_wrap_ui(FORM_FILES ${UI_FILES})
set(FORM_FILES_GROUP “Generated”)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}”)
set(MOC_FILES_GROUP “Generated”)
Cool ! thank you Binesh for sharing your issue and solution !
Best wishes,
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.