1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

highgui: add property WND_PROP_VISIBLE

checks whether the window exists and is visible. On QT closing a window
merley hides it, so the common hack for checking whether a window exists

exists = cv2.getWindowProperty(.., 0) >= 0

does not work.
This commit is contained in:
Pavel Rojtberg
2016-10-27 16:22:42 +02:00
parent 8333ea41e2
commit 358ec04413
6 changed files with 37 additions and 1 deletions
+24
View File
@@ -138,6 +138,20 @@ double cvGetRatioWindow_QT(const char* name)
return result;
}
double cvGetPropVisible_QT(const char* name) {
if (!guiMainThread)
CV_Error( CV_StsNullPtr, "NULL guiReceiver (please create a window)" );
double result = 0;
QMetaObject::invokeMethod(guiMainThread,
"getWindowVisible",
autoBlockingConnection(),
Q_RETURN_ARG(double, result),
Q_ARG(QString, QString(name)));
return result;
}
void cvSetRatioWindow_QT(const char* name,double prop_value)
{
@@ -903,6 +917,16 @@ double GuiReceiver::getPropWindow(QString name)
return (double) w->getPropWindow();
}
double GuiReceiver::getWindowVisible(QString name)
{
QPointer<CvWindow> w = icvFindWindowByName(name);
if (!w)
return 0;
return (double) w->isVisible();
}
void GuiReceiver::setPropWindow(QString name, double arg2)
{