Moving the opencv window on top Qt(c++) dialogs/widgets
-
Hello Everyone,
I am new to Qt. I am developing a Qt(c++) and opencv application on Ubuntu 14.
My application has three Qt diaglog windows.The 2nd dialog opens by pressing the pushbutton on the first dialog. The 3rd dialog opens by pressing the pushbutton on the 2nd dialog.
In the 3rd dialog on the press of a push button i do some image processing operations using opencv and display the results using opencv function namedWindow. This is shown in image1 .
The problem is that i am not able to move opencv windows("source" and "centers") on top of the 3 qt dialogs. This is shown in image2. I,e i want to bring the opencv windows to foreground.
How do i move the opencv windows on top of all the qt dialogs(bring it to foreground) and have complete access to the opencv window to perform operations like clicking on pixels, rectangular selection , thresholding using scroll bar(basically mouse call back) on the opencv window.
Please help me out with this problem
Thanks
-
Hi
How are you showing the dialogs?
Dialogs are pr default modal, meaning they block other windows from interaction while open.
if you use exec() it will block.
if you use show(), they will not. ( make sure to new the dialog or it runs out of scope)
Maybe you rather have at Qt:tool window if design is to have the dialog open while
using the mainwindow?You might also considering docks
http://doc.qt.io/qt-5/qtwidgets-mainwindows-dockwidgets-example.html
which can both float as windows and be in the sides. -
Thanks for the reply.
I am using the show() option (by newing the dialog). But still i am not able to get the two image windows to the foreground. The two image windows("source" and "center") are from opencv (cv::namedWindow) .
Will i face any problem if i use qt for developing GUI and opencv for image processing operations? (I read on the internet that qt and opencv run on different threads. Is this true?)
-
@demonferrari
Hi
Can you try with
http://doc.qt.io/qt-5/qwidget.html#raise
since you are using show() it sounds ok.Hmm are you saying those are openCV windows?
-
@demonferrari
ok, are those made with Qt or native windows ?
It seems to be native windows and as such, they know nothing
about Qt widgetstack/order.
They do talk about Qt at their site.Normally people use the output in Qt windows/widgets
https://stackoverflow.com/questions/14729417/open-webcamera-with-opencv-and-show-it-with-qlabel-white-window/14729778#14729778You might be able to wrap the CV window in
http://doc.qt.io/qt-5/qwindow.html#details
so they become part of the Qt system.Update:
Are CV windows actually Qt powered ? -
@demonferrari
Ok, should just work then.
Are you giving them a parent ?
Did raise have any effect ? -
@demonferrari
ok, hard to tell whats up with those.
maybe look in the CV source to see what flags are used to create them.
Also if you are giving the QDialog parents (like dialog where u open second),
they might stay over those etc.Sorry, i cant provide more direct tips.- I dont know CV windows.
-
@demonferrari
well at least check out what flags are used to create them.