#2070 improvements (Patch #2178)
Description
Let me first suggest to split #2070 into two independent parts
- resize window not working. Apply resize on parent widget - and it works: window_qt.cpp Line: 1855
1void CvWindow::setViewportSize(QSize size)
2{
3 QWidget* view = myView->getWidget();
4 int dx = size.width();
5 int dy = size.height();
6 view->parentWidget()->resize(dx-7, dy);
7 myView->setSize(size);
8}
And now a little improvement: insert following function e.g. behind cv::moveWindow() in window.cpp : 1void cv::adjustWindowPos( const string& winname, int xp, int xwp, int yp, int yhp )
2{
3 // Additional function for % setting of windows:
4 // all values in % relative to screen resulution:
5 #ifdef _WIN32
6 int cx,cy;
7 cx = GetSystemMetrics(SM_CXSCREEN);
8 cy = GetSystemMetrics(SM_CYSCREEN);
9 int x = 0.01 * ( xp * cx );
10 int y = 0.01 * ( yp * cy );
11 int neww = 0.01 * (xwp * cx );
12 int newh = 0.01 * (yhp * cy );
13 cvMoveWindow( winname.c_str(), x, y );
14 cvResizeWindow( winname.c_str(),neww, newh );
15 #else
16 cvAdjustWindowPosQt( winname.c_str(), xp, xwp, yp, yhp );
17 #endif
18}
Additionally modify WindowQt.cpp: in case of Linux we do not have GetSystemMetrics so let it do by Qt, but one more include is nesseary:
1#include <QDesktopWidget>
2
3CV_IMPL void cvAdjustWindowPosQt( const char * name, int xp, int xwp, int yp, int yhp )
4{
5 int cx,cy;
6 QDesktopWidget* pDeskWid = QApplication::desktop() ;
7 QRect ScreenGeo = pDeskWid->screenGeometry(); // needs #include <QDesktopWidget>
8 cx = ScreenGeo.width();
9 cy = ScreenGeo.height();
10 int x = 0.01 * ( xp * cx );
11 int y = 0.01 * ( yp * cy );
12 int neww = 0.01 * (xwp * cx );
13 int newh = 0.01 * (yhp * cy );
14 cvMoveWindow( name, x, y );
15 cvResizeWindow( name, neww, newh );
16}
- icons not visible (only Linux): It was possible to reproduce this bug for me using Ubuntu (it works well with Windows XP + Windows 7)
1 vect_QActions[0] = new QAction(QIcon(":/left-icon"), "Panning left (CTRL+arrowLEFT)", this);
I just avoided to use QActions and the QIcon inside using QButton and other controls...
To avoid this bug I wrote some code to read the whole configuration of a button bar from a *.cfg
In this way you have a free order of several contol types ( all QT, so only QT New function in the moment)
I could contibute it, but some changes necessary in the window_QT.cpp code of:
//--------------------Google Code 2010 -- Yannick Verdie--------------------//
Is it welcome ?
Related issues
related to Bug #2070: No toolbar icon on CV_GUI_EXPANDED, resizeWindow not work... | Open | 2012-06-20 |
Associated revisions
Merge pull request #2178 from Nerei:viz_backport
History
Updated by Marina Kolpakova over 12 years ago
- Description changed from Let me first suggest to split #2070 into two independent parts 1. resize win... to Let me first suggest to split #2070 into two independent parts # resize wind... More
Updated by Andrey Kamaev over 12 years ago
Hello Harald,
Your patch is welcomed!
It will be ideal if you can form a pull request to out GitHub mirror: https://github.com/Itseez/opencv
Updated by Andrey Kamaev over 12 years ago
- Category changed from highgui-images to highgui-gui
Updated by Harald Schmidt over 12 years ago
Updated by Vadim Pisarevsky over 12 years ago
- Target version deleted (
2.4.3) - Assignee deleted (
Vadim Pisarevsky)
Updated by Kirill Kornyakov over 12 years ago
- Target version set to Next Hackathon
Updated by Kirill Kornyakov about 12 years ago
Harald, should we close this ticket? And for #2303 and #2304 it would be great if you could mention corresponding pull requests (like this https://github.com/Itseez/opencv/pull/333).
- Affected version set to branch 'master' (2.4.9)
- Assignee set to Harald Schmidt
Updated by Andrey Pavlenko over 11 years ago
- Status changed from Open to Cancelled
- Start date deleted (
2012-07-17) - Target version deleted (
Next Hackathon)