qv4l2: create function getMargins
authorBård Eirik Winther <bwinther@cisco.com>
Thu, 8 Aug 2013 11:31:23 +0000 (11:31 +0000)
committerHans Verkuil <hans.verkuil@cisco.com>
Thu, 8 Aug 2013 12:46:35 +0000 (14:46 +0200)
Created a function to get the total margins (window frame) in pixels
outside the actual video frame beeing displayed.

Signed-off-by: Bård Eirik Winther <bwinther@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/capture-win.cpp
utils/qv4l2/capture-win.h

index 2d57909..8722066 100644 (file)
@@ -54,16 +54,22 @@ void CaptureWin::buildWindow(QWidget *videoSurface)
        vbox->setSpacing(b);
 }
 
+QSize CaptureWin::getMargins()
+{
+       int l, t, r, b;
+       layout()->getContentsMargins(&l, &t, &r, &b);
+       return QSize(l + r, t + b + m_information.minimumSizeHint().height() + layout()->spacing());
+}
+
 void CaptureWin::setMinimumSize(int minw, int minh)
 {
        QDesktopWidget *screen = QApplication::desktop();
        QRect resolution = screen->screenGeometry();
        QSize maxSize = maximumSize();
 
-       int l, t, r, b;
-       layout()->getContentsMargins(&l, &t, &r, &b);
-       minw += l + r;
-       minh += t + b + m_information.minimumSizeHint().height() + layout()->spacing();
+       QSize margins = getMargins();
+       minw += margins.width();
+       minh += margins.height();
 
        if (minw > resolution.width())
                minw = resolution.width();
index ca60244..f662bd3 100644 (file)
@@ -78,6 +78,7 @@ public:
 protected:
        void closeEvent(QCloseEvent *event);
        void buildWindow(QWidget *videoSurface);
+       QSize getMargins();
 
        /**
         * @brief A label that can is used to display capture information.