[PATCHv2 5/9] qv4l2: create function getMargins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp
index 2d57909..8722066 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..f662bd3 100644
--- a/utils/qv4l2/capture-win.h
+++ b/utils/qv4l2/capture-win.h
@@ -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.
-- 
1.8.4.rc1

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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux