1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #10649 from GregoryMorse:patch-3

* Fix for QT image window rectangle

* Update window_QT.h

* Update window_QT.cpp

* trailing whitespace

* highgui: fix QT getWindowImageRect()
This commit is contained in:
Gregory Morse
2018-01-21 07:26:48 +01:00
committed by Alexander Alekhin
parent c89ae6e537
commit d84c7e5143
3 changed files with 11 additions and 8 deletions
+8 -7
View File
@@ -967,13 +967,7 @@ CvRect GuiReceiver::getWindowRect(QString name)
if (!w)
return cvRect(-1, -1, -1, -1);
QPoint org = w->myView->mapToGlobal(new QPoint(0, 0));
#ifdef HAVE_QT_OPENGL
if (isOpenGl()) {
return cvRect(w->myView->pos().x() + org.x, w->myView->pos().y() + org.y, w->myView->width(), w->myView->height());
} else
#endif
return cvRect(w->myView->viewport()->pos().x() + org.x, w->myView->viewport()->pos().y() + org.y, w->myView->viewport()->width(), w->myView->viewport()->height());
return w->getWindowRect();
}
double GuiReceiver::isFullScreen(QString name)
@@ -1781,6 +1775,13 @@ void CvWindow::setRatio(int flags)
myView->setRatio(flags);
}
CvRect CvWindow::getWindowRect()
{
QWidget* view = myView->getWidget();
QRect local_rc = view->geometry(); // http://doc.qt.io/qt-5/application-windows.html#window-geometry
QPoint global_pos = /*view->*/mapToGlobal(QPoint(local_rc.x(), local_rc.y()));
return cvRect(global_pos.x(), global_pos.y(), local_rc.width(), local_rc.height());
}
int CvWindow::getPropWindow()
{