mirror of
https://github.com/opencv/opencv.git
synced 2025-06-08 01:53:19 +08:00
Merge pull request #20183 from xhawk18:3.4
* improve compatibility for qt 6. * cmake(highgui): rework Qt dependency support * cmake(highgui): workaround Qt5Config.cmake "components" bug Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
parent
48c985e775
commit
24f43e7ae9
@ -1232,12 +1232,17 @@ status("")
|
|||||||
status(" GUI: ")
|
status(" GUI: ")
|
||||||
|
|
||||||
if(WITH_QT OR HAVE_QT)
|
if(WITH_QT OR HAVE_QT)
|
||||||
if(HAVE_QT5)
|
if(HAVE_QT)
|
||||||
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
|
|
||||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
|
|
||||||
elseif(HAVE_QT)
|
|
||||||
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
|
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
|
||||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
|
if(HAVE_QT_OPENGL)
|
||||||
|
if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
|
||||||
|
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
|
||||||
|
else()
|
||||||
|
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
status(" QT OpenGL support:" "NO")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
status(" QT:" "NO")
|
status(" QT:" "NO")
|
||||||
endif()
|
endif()
|
||||||
|
@ -26,31 +26,14 @@ if(VTK_VERSION VERSION_LESS "5.8.0")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Different Qt versions can't be linked together
|
# Different Qt versions can't be linked together
|
||||||
if(HAVE_QT5 AND VTK_VERSION VERSION_LESS "6.0.0")
|
if((HAVE_QT AND VTK_USE_QT)
|
||||||
if(VTK_USE_QT)
|
AND NOT DEFINED FORCE_VTK # deprecated
|
||||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
AND NOT DEFINED OPENCV_FORCE_VTK
|
||||||
endif()
|
)
|
||||||
endif()
|
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt, and VTK ver.${VTK_VERSION} with Qt")
|
||||||
|
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DOPENCV_FORCE_VTK=TRUE' flag in CMake")
|
||||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
|
||||||
if(HAVE_QT5 AND VTK_VERSION VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
|
||||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
|
||||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Different Qt versions can't be linked together
|
|
||||||
if(HAVE_QT AND VTK_VERSION VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
|
||||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
|
||||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
|
||||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(HAVE_VTK ON)
|
set(HAVE_VTK ON)
|
||||||
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
||||||
|
@ -11,25 +11,50 @@ if(WITH_WIN32UI)
|
|||||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=user32;gdi32")
|
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=user32;gdi32")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# --- QT4 ---
|
macro(ocv_find_package_Qt4)
|
||||||
ocv_clear_vars(HAVE_QT HAVE_QT5)
|
find_package(Qt4 COMPONENTS QtCore QtGui QtTest ${ARGN})
|
||||||
if(WITH_QT)
|
if(QT4_FOUND)
|
||||||
if(NOT WITH_QT EQUAL 4)
|
set(QT_FOUND 1)
|
||||||
find_package(Qt5 COMPONENTS Core Gui Widgets Test Concurrent REQUIRED NO_MODULE)
|
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
||||||
if(Qt5_FOUND)
|
|
||||||
set(HAVE_QT5 ON)
|
|
||||||
set(HAVE_QT ON)
|
|
||||||
find_package(Qt5 COMPONENTS OpenGL QUIET)
|
|
||||||
if(Qt5OpenGL_FOUND)
|
|
||||||
set(QT_QTOPENGL_FOUND ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
if(NOT HAVE_QT)
|
macro(ocv_find_package_Qt OCV_QT_VER)
|
||||||
find_package(Qt4 REQUIRED QtCore QtGui QtTest)
|
find_package(Qt${OCV_QT_VER} COMPONENTS Core Gui Widgets Test Concurrent ${ARGN} NO_MODULE)
|
||||||
if(QT4_FOUND)
|
if(Qt${OCV_QT_VER}_FOUND)
|
||||||
set(HAVE_QT TRUE)
|
set(QT_FOUND 1)
|
||||||
|
set(QT_VERSION "${Qt${OCV_QT_VER}_VERSION}")
|
||||||
|
set(QT_VERSION_MAJOR "${Qt${OCV_QT_VER}_VERSION_MAJOR}")
|
||||||
|
set(QT_VERSION_MINOR "${Qt${OCV_QT_VER}_VERSION_MINOR}")
|
||||||
|
set(QT_VERSION_PATCH "${Qt${OCV_QT_VER}_VERSION_PATCH}")
|
||||||
|
set(QT_VERSION_TWEAK "${Qt${OCV_QT_VER}_VERSION_TWEAK}")
|
||||||
|
set(QT_VERSION_COUNT "${Qt${OCV_QT_VER}_VERSION_COUNT}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# --- QT4 ---
|
||||||
|
if(WITH_QT)
|
||||||
|
if(NOT WITH_QT GREATER 0)
|
||||||
|
# BUG: Qt5Config.cmake script can't handle components properly: find_package(QT NAMES Qt6 Qt5 REQUIRED NO_MODULE COMPONENTS Core Gui Widgets Test Concurrent)
|
||||||
|
ocv_find_package_Qt(6 QUIET)
|
||||||
|
if(NOT QT_FOUND)
|
||||||
|
ocv_find_package_Qt(5 QUIET)
|
||||||
|
endif()
|
||||||
|
if(NOT QT_FOUND)
|
||||||
|
ocv_find_package_Qt4(QUIET)
|
||||||
|
endif()
|
||||||
|
elseif(WITH_QT EQUAL 4)
|
||||||
|
ocv_find_package_Qt4(REQUIRED)
|
||||||
|
else() # WITH_QT=<major version>
|
||||||
|
ocv_find_package_Qt("${WITH_QT}" REQUIRED)
|
||||||
|
endif()
|
||||||
|
if(QT_FOUND)
|
||||||
|
set(HAVE_QT ON)
|
||||||
|
if(QT_VERSION_MAJOR GREATER 4)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL QUIET)
|
||||||
|
if(Qt${QT_VERSION_MAJOR}OpenGL_FOUND)
|
||||||
|
set(QT_QTOPENGL_FOUND ON) # HAVE_QT_OPENGL is defined below
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -41,46 +41,55 @@ file(GLOB highgui_ext_hdrs
|
|||||||
# Removing WinRT API headers by default
|
# Removing WinRT API headers by default
|
||||||
list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/highgui_winrt.hpp")
|
list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/highgui_winrt.hpp")
|
||||||
|
|
||||||
if(HAVE_QT5)
|
if(HAVE_QT)
|
||||||
# "Automoc" doesn't work properly with opencv_world build, use QT5_WRAP_CPP() directly
|
if(QT_VERSION_MAJOR GREATER 4)
|
||||||
#set(CMAKE_AUTOMOC ON)
|
# "Automoc" doesn't work properly with opencv_world build, use QT<ver>_WRAP_CPP() directly
|
||||||
|
#set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
QT5_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
QT6_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||||
list(APPEND highgui_srcs
|
QT6_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
|
elseif(QT_VERSION_MAJOR EQUAL 5)
|
||||||
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
|
QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||||
${_MOC_OUTFILES}
|
QT5_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||||
${_RCC_OUTFILES})
|
else()
|
||||||
|
message(FATAL_ERROR "Unsuported QT version: ${QT_VERSION_MAJOR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(dt5_dep Core Gui Widgets Test Concurrent)
|
list(APPEND highgui_srcs
|
||||||
add_definitions(${Qt5${dt5_dep}_DEFINITIONS})
|
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
|
||||||
include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS})
|
${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
|
||||||
list(APPEND HIGHGUI_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES})
|
${_MOC_OUTFILES}
|
||||||
endforeach()
|
${_RCC_OUTFILES})
|
||||||
|
|
||||||
if(HAVE_QT_OPENGL)
|
set(qt_deps Core Gui Widgets Test Concurrent)
|
||||||
add_definitions(${Qt5OpenGL_DEFINITIONS})
|
if(HAVE_QT_OPENGL)
|
||||||
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
|
list(APPEND qt_deps OpenGL)
|
||||||
list(APPEND HIGHGUI_LIBRARIES ${Qt5OpenGL_LIBRARIES})
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
elseif(HAVE_QT)
|
foreach(dt_dep ${qt_deps})
|
||||||
if (HAVE_QT_OPENGL)
|
add_definitions(${Qt${QT_VERSION_MAJOR}${dt_dep}_DEFINITIONS})
|
||||||
set(QT_USE_QTOPENGL TRUE)
|
include_directories(${Qt${QT_VERSION_MAJOR}${dt_dep}_INCLUDE_DIRS})
|
||||||
endif()
|
list(APPEND HIGHGUI_LIBRARIES ${Qt${QT_VERSION_MAJOR}${dt_dep}_LIBRARIES})
|
||||||
include(${QT_USE_FILE})
|
endforeach()
|
||||||
|
else()
|
||||||
|
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
||||||
|
if (HAVE_QT_OPENGL)
|
||||||
|
set(QT_USE_QTOPENGL TRUE)
|
||||||
|
endif()
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
QT4_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
QT4_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
|
||||||
QT4_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
QT4_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
|
||||||
|
|
||||||
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES})
|
list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES})
|
||||||
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
|
list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
|
||||||
ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag "")
|
ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag "")
|
||||||
if(${_have_flag})
|
if(${_have_flag})
|
||||||
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
|
set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(WINRT)
|
elseif(WINRT)
|
||||||
if(NOT WINRT_8_0)
|
if(NOT WINRT_8_0)
|
||||||
|
@ -64,6 +64,38 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
|
#define Qt_MiddleButton Qt::MiddleButton
|
||||||
|
inline Qt::Orientation wheelEventOrientation(QWheelEvent *we) {
|
||||||
|
if (std::abs(we->angleDelta().x()) < std::abs(we->angleDelta().y()))
|
||||||
|
return Qt::Vertical;
|
||||||
|
else
|
||||||
|
return Qt::Horizontal;
|
||||||
|
}
|
||||||
|
inline int wheelEventDelta(QWheelEvent *we) {
|
||||||
|
if(wheelEventOrientation(we) == Qt::Vertical)
|
||||||
|
return we->angleDelta().y();
|
||||||
|
else
|
||||||
|
return we->angleDelta().x();
|
||||||
|
}
|
||||||
|
inline QPoint wheelEventPos(QWheelEvent *we) {
|
||||||
|
return we->position().toPoint();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define Qt_MiddleButton Qt::MidButton
|
||||||
|
inline Qt::Orientation wheelEventOrientation(QWheelEvent *we) {
|
||||||
|
return we->orientation();
|
||||||
|
}
|
||||||
|
inline int wheelEventDelta(QWheelEvent *we) {
|
||||||
|
return we->delta();
|
||||||
|
}
|
||||||
|
inline QPoint wheelEventPos(QWheelEvent *we) {
|
||||||
|
return we->pos();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//Static and global first
|
//Static and global first
|
||||||
static GuiReceiver *guiMainThread = NULL;
|
static GuiReceiver *guiMainThread = NULL;
|
||||||
static int parameterSystemC = 1;
|
static int parameterSystemC = 1;
|
||||||
@ -1579,7 +1611,9 @@ CvWinProperties::CvWinProperties(QString name_paraWindow, QObject* /*parent*/)
|
|||||||
myLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
myLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
||||||
myLayout->setContentsMargins(0, 0, 0, 0);
|
myLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
myLayout->setSpacing(0);
|
myLayout->setSpacing(0);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
myLayout->setMargin(0);
|
myLayout->setMargin(0);
|
||||||
|
#endif
|
||||||
myLayout->setSizeConstraint(QLayout::SetFixedSize);
|
myLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
setLayout(myLayout);
|
setLayout(myLayout);
|
||||||
|
|
||||||
@ -1957,7 +1991,9 @@ void CvWindow::createBarLayout()
|
|||||||
myBarLayout->setObjectName(QString::fromUtf8("barLayout"));
|
myBarLayout->setObjectName(QString::fromUtf8("barLayout"));
|
||||||
myBarLayout->setContentsMargins(0, 0, 0, 0);
|
myBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
myBarLayout->setSpacing(0);
|
myBarLayout->setSpacing(0);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
myBarLayout->setMargin(0);
|
myBarLayout->setMargin(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1967,7 +2003,9 @@ void CvWindow::createGlobalLayout()
|
|||||||
myGlobalLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
myGlobalLayout->setObjectName(QString::fromUtf8("boxLayout"));
|
||||||
myGlobalLayout->setContentsMargins(0, 0, 0, 0);
|
myGlobalLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
myGlobalLayout->setSpacing(0);
|
myGlobalLayout->setSpacing(0);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
myGlobalLayout->setMargin(0);
|
myGlobalLayout->setMargin(0);
|
||||||
|
#endif
|
||||||
setMinimumSize(1, 1);
|
setMinimumSize(1, 1);
|
||||||
|
|
||||||
if (param_flags == CV_WINDOW_AUTOSIZE)
|
if (param_flags == CV_WINDOW_AUTOSIZE)
|
||||||
@ -2205,7 +2243,7 @@ void CvWindow::icvLoadControlPanel()
|
|||||||
}
|
}
|
||||||
if (t->type == type_CvButtonbar)
|
if (t->type == type_CvButtonbar)
|
||||||
{
|
{
|
||||||
int subsize = settings.beginReadArray(QString("buttonbar")+i);
|
int subsize = settings.beginReadArray(QString("buttonbar%1").arg(i));
|
||||||
|
|
||||||
if ( subsize == ((CvButtonbar*)t)->layout()->count() )
|
if ( subsize == ((CvButtonbar*)t)->layout()->count() )
|
||||||
icvLoadButtonbar((CvButtonbar*)t,&settings);
|
icvLoadButtonbar((CvButtonbar*)t,&settings);
|
||||||
@ -2236,7 +2274,7 @@ void CvWindow::icvSaveControlPanel()
|
|||||||
}
|
}
|
||||||
if (t->type == type_CvButtonbar)
|
if (t->type == type_CvButtonbar)
|
||||||
{
|
{
|
||||||
settings.beginWriteArray(QString("buttonbar")+i);
|
settings.beginWriteArray(QString("buttonbar%1").arg(i));
|
||||||
icvSaveButtonbar((CvButtonbar*)t,&settings);
|
icvSaveButtonbar((CvButtonbar*)t,&settings);
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
}
|
}
|
||||||
@ -2396,14 +2434,14 @@ void OCVViewPort::icvmouseHandler(QMouseEvent* evnt, type_mouse_event category,
|
|||||||
flags |= CV_EVENT_FLAG_LBUTTON;
|
flags |= CV_EVENT_FLAG_LBUTTON;
|
||||||
if(buttons & Qt::RightButton)
|
if(buttons & Qt::RightButton)
|
||||||
flags |= CV_EVENT_FLAG_RBUTTON;
|
flags |= CV_EVENT_FLAG_RBUTTON;
|
||||||
if(buttons & Qt::MidButton)
|
if(buttons & Qt_MiddleButton)
|
||||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||||
|
|
||||||
if (cv_event == -1) {
|
if (cv_event == -1) {
|
||||||
if (category == mouse_wheel) {
|
if (category == mouse_wheel) {
|
||||||
QWheelEvent *we = (QWheelEvent *) evnt;
|
QWheelEvent *we = (QWheelEvent *) evnt;
|
||||||
cv_event = ((we->orientation() == Qt::Vertical) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL);
|
cv_event = ((wheelEventOrientation(we) == Qt::Vertical) ? CV_EVENT_MOUSEWHEEL : CV_EVENT_MOUSEHWHEEL);
|
||||||
flags |= (we->delta() & 0xffff)<<16;
|
flags |= (wheelEventDelta(we) & 0xffff)<<16;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch(evnt->button())
|
switch(evnt->button())
|
||||||
@ -2416,7 +2454,7 @@ void OCVViewPort::icvmouseHandler(QMouseEvent* evnt, type_mouse_event category,
|
|||||||
cv_event = tableMouseButtons[category][1];
|
cv_event = tableMouseButtons[category][1];
|
||||||
flags |= CV_EVENT_FLAG_RBUTTON;
|
flags |= CV_EVENT_FLAG_RBUTTON;
|
||||||
break;
|
break;
|
||||||
case Qt::MidButton:
|
case Qt_MiddleButton:
|
||||||
cv_event = tableMouseButtons[category][2];
|
cv_event = tableMouseButtons[category][2];
|
||||||
flags |= CV_EVENT_FLAG_MBUTTON;
|
flags |= CV_EVENT_FLAG_MBUTTON;
|
||||||
break;
|
break;
|
||||||
@ -2772,7 +2810,7 @@ void DefaultViewPort::wheelEvent(QWheelEvent* evnt)
|
|||||||
{
|
{
|
||||||
icvmouseEvent((QMouseEvent *)evnt, mouse_wheel);
|
icvmouseEvent((QMouseEvent *)evnt, mouse_wheel);
|
||||||
|
|
||||||
scaleView(evnt->delta() / 240.0, evnt->pos());
|
scaleView(wheelEventDelta(evnt) / 240.0, wheelEventPos(evnt));
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
|
|
||||||
QWidget::wheelEvent(evnt);
|
QWidget::wheelEvent(evnt);
|
||||||
|
Loading…
Reference in New Issue
Block a user