Start integrating QT GUI (GoC 2010)

This commit is contained in:
Yannick Verdie 2010-06-07 08:29:10 +00:00
parent 8a7b4760ac
commit c6872100db
4 changed files with 119 additions and 21 deletions

View File

@ -492,6 +492,36 @@ if(BUILD_NEW_PYTHON_SUPPORT)
endif()
#YV
############################### QT ################################
set(HAVE_QT 0)
set(HAVE_QT_OPENGL 0)
set(AUTOSWITCH_QT 0)#uses to disable QT
find_package(Qt4)# QUIET)
if (QT4_FOUND AND AUTOSWITCH_QT)
set(WITH_QT ON CACHE BOOL "Build with QT Backend support")
set(HAVE_QT 1)
add_definitions(-DHAVE_QT=1)
if(UNIX)
if (APPLE)
set(WITH_CARBON 0)
message(STATUS "QT detected, so Carbon and Cocoa disabled")
else()
set(HAVE_GTK 0)
set(HAVE_GTHREAD 0)
message(STATUS "QT detected, so GTK and GThread disabled")
endif()
endif()
#if (QT_QTOPENGL_FOUND)
# set(WITH_QT_OPENGL ON CACHE BOOL "add OpenGL extention to QT")
# set(HAVE_QT_OPENGL 1)
# add_definitions(-DOPENCV_GL=1)
#endif()
endif()
############################### TBB ################################
if (WITH_TBB)
@ -1105,16 +1135,27 @@ message(STATUS " Linker flags (Release): ${CMAKE_SHARED_LINKER_FLAGS} ${CM
message(STATUS " Linker flags (Debug): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
endif()
#YV
if(UNIX AND NOT APPLE)
message(STATUS "")
message(STATUS " GUI: ")
if (HAVE_QT)
message(STATUS " QT 4.x: ${HAVE_QT}")
message(STATUS " QT OpenGL support: ${HAVE_QT_OPENGL}")
else()
message(STATUS " GTK+ 2.x: ${HAVE_GTK}")
message(STATUS " GThread: ${HAVE_GTHREAD}")
endif()
message(STATUS "")
endif()
if(APPLE)
message(STATUS "")
if (HAVE_QT)
message(STATUS " GUI: ")
message(STATUS " QT 4.x: ${HAVE_QT}")
message(STATUS " QT OpenGL support: ${HAVE_QT_OPENGL}")
else()
if(WITH_CARBON)
message(STATUS " GUI Back-end: Carbon")
else()
@ -1122,6 +1163,7 @@ message(STATUS " GUI Back-end: Cocoa")
endif()
message(STATUS "")
endif()
endif()
message(STATUS " Image I/O: ")
if(NOT WITH_JPEG OR JPEG_FOUND)

View File

@ -65,18 +65,48 @@ foreach(h ${lib_hdr_names})
list(APPEND highgui_ext_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/include/opencv2/highgui/${h}")
endforeach()
#YV
if(WIN32)
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp src/cap_vfw.cpp src/cap_cmu.cpp src/cap_w32.cpp src/cap_dshow.cpp)
if (HAVE_QT)
#SET(QT_USE_QTXML 1)
INCLUDE(${QT_USE_FILE})
SET(_MOC_HEADERS src/window_QT.h)
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
else()
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
endif()
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_w32.cpp src/cap_dshow.cpp)
if(HAVE_MIL)
set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
endif()
endif()
if(UNIX)
if (HAVE_QT)
#SET(QT_USE_QTXML 1)
INCLUDE(${QT_USE_FILE})
SET(_MOC_HEADERS src/window_QT.h)
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
else()
if(HAVE_GTK)
set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
endif()
endif()
if(HAVE_XINE)
set(highgui_srcs ${highgui_srcs} src/cap_xine.cpp)
endif()
@ -145,11 +175,24 @@ if(UNIX)
endforeach()
endif()
#YV
if(APPLE)
add_definitions(-DHAVE_QUICKTIME=1)
if(NOT OPENCV_BUILD_3RDPARTY_LIBS)
add_definitions(-DHAVE_IMAGEIO=1)
endif()
if (HAVE_QT)
#SET(QT_USE_QTXML 1)
INCLUDE(${QT_USE_FILE})
SET(_MOC_HEADERS src/window_QT.h)
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES})
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES})
else()
if(WITH_CARBON)
add_definitions(-DHAVE_CARBON=1)
set(highgui_srcs ${highgui_srcs} src/window_carbon.cpp)
@ -157,6 +200,8 @@ if(APPLE)
add_definitions(-DHAVE_COCOA=1)
set(highgui_srcs ${highgui_srcs} src/window_cocoa.mm)
endif()
endif()
if(WITH_QUICKTIME)
set(highgui_srcs ${highgui_srcs} src/cap_qt.cpp)
else()

View File

@ -200,6 +200,17 @@ CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst, int flags CV_DEFAULT(0
/* wait for key event infinitely (delay<=0) or for "delay" milliseconds */
CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
//YV
#if defined (HAVE_QT)
//class CvWindow;
//class ViewPort;
struct CvTrackbar;
CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char *argv[]);
CVAPI(void) cvStopLoop();
CVAPI(void) cvInformation(const char* name, const char* text, int delay);
CvTrackbar* icvFindTrackbarByName( const char* name_trackbar, const char* name_window );
#endif
/****************************************************************************************\
* Working with Video Files and Cameras *

View File

@ -171,7 +171,7 @@ int startWindowThread()
#elif defined (HAVE_GTK) // see window_gtk.cpp
#elif defined (HAVE_COCOA) // see window_carbon.cpp
#elif defined (HAVE_CARBON)
#elif defined (HAVE_QT) //YV see window_QT.cpp
#else