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 <bwint...@cisco.com>
---
 utils/qv4l2/capture-win.cpp | 14 ++++++++++----
 utils/qv4l2/capture-win.h   |  2 ++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp
index 2d57909..e583900 100644
--- a/utils/qv4l2/capture-win.cpp
+++ b/utils/qv4l2/capture-win.cpp
@@ -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();
diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h
index ca60244..6b72e00 100644
--- a/utils/qv4l2/capture-win.h
+++ b/utils/qv4l2/capture-win.h
@@ -78,6 +78,8 @@ public:
 protected:
        void closeEvent(QCloseEvent *event);
        void buildWindow(QWidget *videoSurface);
+       QSize getMargins();
+
 
        /**
         * @brief A label that can is used to display capture information.
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to