Q_ARG(double, prop_value));
}
+void cv::setWindowTitle(const String& winname, const String& title)
+{
+ if (!guiMainThread)
+ CV_Error(Error::StsNullPtr, "NULL guiReceiver (please create a window)");
+
+ QMetaObject::invokeMethod(guiMainThread,
+ "setWindowTitle",
+ autoBlockingConnection(),
+ Q_ARG(QString, QString(winname.c_str())),
+ Q_ARG(QString, QString(title.c_str())));
+}
+
void cvSetModeWindow_QT(const char* name, double prop_value)
{
if (temp->type == type_CvWindow)
{
CvWindow* w = (CvWindow*) temp;
- if (w->windowTitle() == name)
+ if (w->objectName() == name)
{
window = w;
break;
if (!QApplication::instance())
{
new QApplication(*c, v);
+ setlocale(LC_NUMERIC,"C");
qDebug() << "init done";
if( !window_handle )
CV_Error( CV_StsNullPtr, "NULL window handler" );
- return ((CvWindow*)window_handle)->windowTitle().toLatin1().data();
+ return ((CvWindow*)window_handle)->objectName().toLatin1().data();
}
}
+CV_IMPL void cvSetTrackbarMax(const char* name_bar, const char* window_name, int maxval)
+{
+ if (maxval >= 0)
+ {
+ QPointer<CvTrackbar> t = icvFindTrackBarByName(name_bar, window_name);
+ if (t)
+ {
+ t->slider->setMaximum(maxval);
+ }
+ }
+}
+
+
/* assign callback for mouse events */
CV_IMPL void cvSetMouseCallback(const char* window_name, CvMouseCallback on_mouse, void* param)
{
w->setPropWindow(flags);
}
+void GuiReceiver::setWindowTitle(QString name, QString title)
+{
+ QPointer<CvWindow> w = icvFindWindowByName(name);
+
+ if (!w)
+ {
+ cvNamedWindow(name.toLatin1().data());
+ w = icvFindWindowByName(name);
+ }
+
+ if (!w)
+ return;
+
+ w->setWindowTitle(title);
+}
+
double GuiReceiver::isFullScreen(QString name)
{
//no value pos was saved so we let Qt move the window in the middle of its parent (event ignored).
//then hide will save the last position and thus, we want to retreive it (event accepted).
QPoint mypos(-1, -1);
- QSettings settings("OpenCV2", windowTitle());
+ QSettings settings("OpenCV2", objectName());
mypos = settings.value("pos", mypos).toPoint();
if (mypos.x() >= 0)
void CvWinProperties::hideEvent(QHideEvent* evnt)
{
- QSettings settings("OpenCV2", windowTitle());
+ QSettings settings("OpenCV2", objectName());
settings.setValue("pos", pos()); //there is an offset of 6 pixels (so the window's position is wrong -- why ?)
evnt->accept();
}
CvWinProperties::~CvWinProperties()
{
//clear the setting pos
- QSettings settings("OpenCV2", windowTitle());
+ QSettings settings("OpenCV2", objectName());
settings.remove("pos");
}
//setAttribute(Qt::WA_DeleteOnClose); //in other case, does not release memory
setContentsMargins(0, 0, 0, 0);
setWindowTitle(name);
- setObjectName(name);
+ setObjectName(name);
- setFocus( Qt::PopupFocusReason ); //#1695 arrow keys are not received without the explicit focus
+ setFocus( Qt::PopupFocusReason ); //#1695 arrow keys are not received without the explicit focus
resize(400, 300);
setMinimumSize(1, 1);
}
}
-
void CvWindow::toggleFullScreen(int flags)
{
if (isFullScreen() && flags == CV_WINDOW_NORMAL)