diff mbox series

[v4l-utils,v1,05/11] qv4l2: fix Qt6 compile (QHBoxLayout/QVBoxLayout has no member setMargin)

Message ID 20230415201056.31080-5-ps.report@gmx.net
State New
Headers show
Series [v4l-utils,v1,01/11] qv4l2: remove leagcy alsa_stream.h include (ENABLE_ALSA protected) | expand

Commit Message

Peter Seiderer April 15, 2023, 8:10 p.m. UTC
Fixes:

  ../qv4l2/general-tab.cpp:434:22: error: ‘class QHBoxLayout’ has no member named ‘setMargin’
    434 |                 box->setMargin(0);
        |                      ^~~~~~~~~

  ../qv4l2/capture-win.cpp:130:23: error: ‘class QVBoxLayout’ has no member named ‘setMargin’
    130 |         m_vboxLayout->setMargin(0);
        |                       ^~~~~~~~~

  ../qv4l2/ctrl-tab.cpp:255:22: error: ‘class QHBoxLayout’ has no member named ‘setMargin’
    255 |         m_boxLayout->setMargin(0);
        |                      ^~~~~~~~~

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 utils/qv4l2/capture-win.cpp | 4 ++++
 utils/qv4l2/ctrl-tab.cpp    | 4 ++++
 utils/qv4l2/general-tab.cpp | 5 ++++-
 3 files changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp
index 1e3986ad..ef33a91b 100644
--- a/utils/qv4l2/capture-win.cpp
+++ b/utils/qv4l2/capture-win.cpp
@@ -127,7 +127,11 @@  void CaptureWin::buildWindow(QWidget *videoSurface)
 	int l, t, r, b;
 	m_vboxLayout = new QVBoxLayout(this);
 	m_vboxLayout->getContentsMargins(&l, &t, &r, &b);
+#if QT_VERSION < 0x060000
 	m_vboxLayout->setMargin(0);
+#else
+	m_vboxLayout->setContentsMargins(0, 0, 0, 0);
+#endif
 	m_vboxLayout->addWidget(videoSurface, 1000, Qt::AlignCenter);
 
 	setContextMenuPolicy(Qt::CustomContextMenu);
diff --git a/utils/qv4l2/ctrl-tab.cpp b/utils/qv4l2/ctrl-tab.cpp
index 67f55546..cfdecdeb 100644
--- a/utils/qv4l2/ctrl-tab.cpp
+++ b/utils/qv4l2/ctrl-tab.cpp
@@ -252,7 +252,11 @@  void ApplicationWindow::addCtrl(QGridLayout *grid, const v4l2_query_ext_ctrl &qe
 	struct v4l2_querymenu qmenu;
 	QWidget *wContainer = new QWidget();
 	QHBoxLayout *m_boxLayout = new QHBoxLayout(wContainer);
+#if QT_VERSION < 0x060000
 	m_boxLayout->setMargin(0);
+#else
+	m_boxLayout->setContentsMargins(0, 0, 0, 0);
+#endif
 	__u64 dif;
 
 	switch (qec.type) {
diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp
index b83ccb67..105c5cde 100644
--- a/utils/qv4l2/general-tab.cpp
+++ b/utils/qv4l2/general-tab.cpp
@@ -430,8 +430,11 @@  void GeneralTab::inputSection(v4l2_input vin)
 		QLabel *l = new QLabel("Refresh Tuner Status", parentWidget());
 		QWidget *w = new QWidget(parentWidget());
 		QHBoxLayout *box = new QHBoxLayout(w);
-
+#if QT_VERSION < 0x060000
 		box->setMargin(0);
+#else
+		box->setContentsMargins(0, 0, 0, 0);
+#endif
 		m_detectSubchans = new QToolButton(w);
 		m_detectSubchans->setIcon(QIcon(":/enterbutt.png"));
 		m_subchannels = new QLabel("", w);