Home › Forum › SOFA › Using SOFA › QSqlTable and QSqlDatabase created in QT are not accessible in sofa
Tagged: 64_bits, Qt, scene file, SOFA, SOFA_1706, Windows_10
- This topic has 3 replies, 2 voices, and was last updated 5 years, 10 months ago by Damien Marchal.
-
AuthorPosts
-
21 January 2019 at 11:28 #12802rubab123Blocked
Hello every one, I have created a QSqlTableModel based application in Qt creator. It fetches results from sqlite database and shows in tableview.
When i ccopied its header, cpp and ui files and updated cmake.
Now in sofa, every include<> is underlined and nothing related to this is available in sofa. What should i do now?
I really need to access that Qt application which created Table of sqlite data in sofa.
Suggestion will highly be appreciated.
Thanks.21 January 2019 at 21:01 #12852Damien MarchalBlockedHi rubab,
I don’t think there is any problem in using QSql with sofa as long as the cmake & dependencies there is not problem with the cmake.
When you say “i copied its headers, cpp, ui,” …can you give more details on where you copied all that, how exactely you are updating cmake and which CMakeLists.txt you are updating.
To help you we probably also need to know if you are doing and in-tree build (so you put your application in the sofa for compilation) or an out-tree one (it means you are doing an external application that you want to use sofa as a library)
Damien.22 January 2019 at 07:28 #12855rubab123Blocked@Damien Marchal Thank you so much for responding. I am basically working in sofa and compiling it in Visual studio. I have some values saved in sqlite database. Then I have created a qt application using Qt creator and saved that data from sqlite to QTableView, which gives me a table containing sqlite data.
Now i want to use that table in sofa (my plugin component) so that it displays table, for this some one told me to put your header ,source and ui files (from Qt application) into the cmake of plugins, which I did same. I built cmake and opened project in VS, now that qt files are inaccessible like ui->setup (ui not found) errors like tableview not defined etc, I hope you understand my problem.
Here I share my cmake with you:cmake_minimum_required(VERSION 2.8.12)
project(EvaluationMetrixx)set(HEADER_FILES
initMyPlugin.h
InjectorPositioningMetrics.h
InjectorHandlingMetrics.h
ObjectHandlingMetrics.h
SphereHandlingMetrics.h
ICSISimulationMetrics.h
mainwindow.h)
set(SOURCE_FILES
initMyPlugin.cpp
InjectorPositioningMetrics.cpp
InjectorHandlingMetrics.cpp
ObjectHandlingMetrics.cpp
SphereHandlingMetrics.cpp
ICSISimulationMetrics.cpp
mainwindow.cpp)
set(UI_FILES
mainwindow.ui
)set(MOC_FILES
moc_mainwindow.cpp
)
find_package(Qt5 COMPONENTS Core REQUIRED)
if(Qt5Core_FOUND)
message(“Simedix: Using Qt5”)
set(QT5_NO_LINK_QTMAIN 1)find_package(Qt5 COMPONENTS Gui OpenGL Network Core Multimedia REQUIRED)
set(EXT_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS})
#target_include_directories(${EXT_QT_INCLUDES})set(EXT_QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_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()find_package(SofaFramework REQUIRED)
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${UI_FILES})
target_link_libraries(${PROJECT_NAME} SofaCore SofaMisc SofaMiscCollision SofaMiscEngine SofaMiscFem SofaMiscForceField SofaMiscMapping SofaMiscSolver SofaMiscTopology SofaGuiCommon)
target_link_libraries(${PROJECT_NAME} ${EXT_QT_LIBRARIES})set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS “-DSOFA_BUILD_EVALUATIONMETRIXX”)
install(TARGETS EvaluationMetrixx
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)22 January 2019 at 22:17 #12864Damien MarchalBlockedHi rubab,
I have never done these thing myself but I think I understand what you want to do.
There is different options that depend on what you precisely want to do.
Let me explain:
1) If the table view you want to display should be integrated as a widget into the existing runSofa application. Then what you want to do is very similar to what can be found in the “image” plugin. In this plugin there is some sofa component as well as customized UI elements in the “image_gui” directory that show up when clicking on the sofa components.2) If the able view you want to display is in a separated windows and you want it to be displayed in the existing runSofa gui…This should be done in a similar way to the ‘image_gui’ part (the cmake) except that I don’t think there is a way in the existing runSofa gui to display the new window. So this may require some hacking to the runSofa application to had some “extra-menu”.
Hope this helps,
Damien -
AuthorPosts
- You must be logged in to reply to this topic.