Embedded OpenCV Window with Qt Support in MFC
Hello, want to embedded an opencv window with qt support in my mfc application. If i use the non supported .dll in my app everything works fine but need to zoom and shift the image. Because of this, i want to embedded the window with qt support, but when I use the .dll compiled with qt sup. a new window pop up and the picture box in my MFC Dialog ist empty. This is my code to display the Image. In case of the qt sup. the value of hWnd1 is negativ.
cv::namedWindow("Histogram", 1);
HWND hWnd1 = (HWND) cvGetWindowHandle("Histogram");
HWND hParent1 = ::GetParent(hWnd1);
::SetParent(hWnd1, GetDlgItem(IDC_HISTOGRAM)->m_hWnd);
::ShowWindow(hParent1, SW_HIDE);
cv::imshow("Histogram", hist_init);
Regards
What is the control type of the IDC_HISTOGRAM item?
picture control
I just had a look into the cvGetWindowHandle funktion in window_qt.cpp and the return value is pointer of a QWindow. But how can I embedded a QWindow into a MFC Dialog.
Then it is strange to me. A full code will be easier to pinpoint the bug, if any.
That's the full code to display the Image in a Picture box. Without QT Support it works fine, but with Qt Support a new image window popped up.
Please consider that, when Qt support enabled,
cvGetWindowHandle
returns an handle to Qt window while your control is embedded in a MFC window. So you are mapping the content of yourcv::window
over a MFC control while thecv::window
is Qt and will open with blank content... I'm surprised about it's work without some exception