From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Tue, 17 Dec 2024 08:41:58 +0100
Subject: qt: use QLayout::setContentsMargins() instead of
 QLayout::setMargin()

Similar to ed986711c159499b873157d4e5d4a53026d94719.

It's deprecated in Qt 5.15 [^1], since 5.13 [^2], and removed in Qt 6.

[^1] https://doc.qt.io/qt-5/qlayout-obsolete.html#setMargin
[^2] https://github.com/qt/qtbase/commit/d6d33f0b80dd85043c71f71a3ed5485d6014e6c4
---
 modules/gui/qt/components/controller.cpp             | 16 ++++++++--------
 modules/gui/qt/components/controller_widget.cpp      |  2 +-
 modules/gui/qt/components/playlist/playlist.cpp      |  2 +-
 modules/gui/qt/components/playlist/standardpanel.cpp |  2 +-
 modules/gui/qt/components/playlist/views.cpp         |  2 +-
 modules/gui/qt/dialogs/external.cpp                  |  2 +-
 modules/gui/qt/dialogs/preferences.cpp               |  2 +-
 modules/gui/qt/dialogs/toolbar.cpp                   |  6 +++---
 modules/gui/qt/main_interface.cpp                    |  4 ++--
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp
index 3adfe67..0006a74 100644
--- a/modules/gui/qt/components/controller.cpp
+++ b/modules/gui/qt/components/controller.cpp
@@ -536,12 +536,12 @@ QFrame *AbstractController::discFrame()
     QFrame *discFrame = new QFrame( this );
 
     QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
-    discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
+    discLayout->setSpacing( 0 ); discLayout->setContentsMargins( 0, 0, 0, 0 );
 
 
     QFrame *chapFrame = new QFrame( discFrame );
     QHBoxLayout *chapLayout = new QHBoxLayout( chapFrame );
-    chapLayout->setSpacing( 0 ); chapLayout->setMargin( 0 );
+    chapLayout->setSpacing( 0 ); chapLayout->setContentsMargins( 0, 0, 0, 0 );
 
     QToolButton *prevSectionButton = new QToolButton( chapFrame );
     setupButton( prevSectionButton );
@@ -560,7 +560,7 @@ QFrame *AbstractController::discFrame()
 
     QFrame *menuFrame = new QFrame( discFrame );
     QHBoxLayout *menuLayout = new QHBoxLayout( menuFrame );
-    menuLayout->setSpacing( 0 ); menuLayout->setMargin( 0 );
+    menuLayout->setSpacing( 0 ); menuLayout->setContentsMargins( 0, 0, 0, 0 );
 
     QToolButton *menuButton = new QToolButton( menuFrame );
     setupButton( menuButton );
@@ -594,7 +594,7 @@ QFrame *AbstractController::telexFrame()
      **/
     QFrame *telexFrame = new QFrame( this );
     QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
-    telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
+    telexLayout->setSpacing( 0 ); telexLayout->setContentsMargins( 0, 0, 0, 0 );
     CONNECT( THEMIM->getIM(), teletextPossible( bool ),
              telexFrame, setVisible( bool ) );
 
@@ -720,14 +720,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
     controlLayout->setContentsMargins( 3, 1, 0, 1 );
     controlLayout->setSpacing( 0 );
     QHBoxLayout *controlLayout1 = new QHBoxLayout;
-    controlLayout1->setSpacing( 0 ); controlLayout1->setMargin( 0 );
+    controlLayout1->setSpacing( 0 ); controlLayout1->setContentsMargins( 0, 0, 0, 0 );
 
     QString line1 = getSettings()->value( "MainWindow/MainToolbar1", MAIN_TB1_DEFAULT )
                                         .toString();
     parseAndCreate( line1, controlLayout1 );
 
     QHBoxLayout *controlLayout2 = new QHBoxLayout;
-    controlLayout2->setSpacing( 0 ); controlLayout2->setMargin( 0 );
+    controlLayout2->setSpacing( 0 ); controlLayout2->setContentsMargins( 0, 0, 0, 0 );
     QString line2 = getSettings()->value( "MainWindow/MainToolbar2", MAIN_TB2_DEFAULT )
                                         .toString();
     parseAndCreate( line2, controlLayout2 );
@@ -760,7 +760,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
 {
     RTL_UNAFFECTED_WIDGET
     controlLayout = new QHBoxLayout( this );
-    controlLayout->setMargin( 0 );
+    controlLayout->setContentsMargins( 0, 0, 0, 0 );
     controlLayout->setSpacing( 0 );
 #ifdef DEBUG_LAYOUT
     setStyleSheet( "background: orange ");
@@ -777,7 +777,7 @@ InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent
 {
     RTL_UNAFFECTED_WIDGET
     controlLayout = new QHBoxLayout( this );
-    controlLayout->setMargin( 0 );
+    controlLayout->setContentsMargins( 0, 0, 0, 0 );
     controlLayout->setSpacing( 0 );
 #ifdef DEBUG_LAYOUT
     setStyleSheet( "background: green ");
diff --git a/modules/gui/qt/components/controller_widget.cpp b/modules/gui/qt/components/controller_widget.cpp
index 45ce421..2cbbbc8 100644
--- a/modules/gui/qt/components/controller_widget.cpp
+++ b/modules/gui/qt/components/controller_widget.cpp
@@ -49,7 +49,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
 {
     /* We need a layout for this widget */
     QHBoxLayout *layout = new QHBoxLayout( this );
-    layout->setSpacing( 0 ); layout->setMargin( 0 );
+    layout->setSpacing( 0 ); layout->setContentsMargins( 0, 0, 0, 0 );
 
     /* We need a Label for the pix */
     volMuteLabel = new QLabel;
diff --git a/modules/gui/qt/components/playlist/playlist.cpp b/modules/gui/qt/components/playlist/playlist.cpp
index d2849a2..5f6a248 100644
--- a/modules/gui/qt/components/playlist/playlist.cpp
+++ b/modules/gui/qt/components/playlist/playlist.cpp
@@ -53,7 +53,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     setContentsMargins( 0, 3, 0, 3 );
 
     QGridLayout *layout = new QGridLayout( this );
-    layout->setMargin( 0 ); layout->setSpacing( 0 );
+    layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 );
 
     /*******************
      * Left            *
diff --git a/modules/gui/qt/components/playlist/standardpanel.cpp b/modules/gui/qt/components/playlist/standardpanel.cpp
index 226914f..326f4f0 100644
--- a/modules/gui/qt/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt/components/playlist/standardpanel.cpp
@@ -89,7 +89,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
                   p_selector( _p_selector )
 {
     viewStack = new QStackedLayout( this );
-    viewStack->setSpacing( 0 ); viewStack->setMargin( 0 );
+    viewStack->setSpacing( 0 ); viewStack->setContentsMargins( 0, 0, 0, 0 );
     setMinimumWidth( 300 );
 
     iconView    = NULL;
diff --git a/modules/gui/qt/components/playlist/views.cpp b/modules/gui/qt/components/playlist/views.cpp
index 70dd29d..2e80e13 100644
--- a/modules/gui/qt/components/playlist/views.cpp
+++ b/modules/gui/qt/components/playlist/views.cpp
@@ -477,7 +477,7 @@ void PlTreeView::keyPressEvent( QKeyEvent *event )
 PicFlowView::PicFlowView( QAbstractItemModel *p_model, QWidget *parent ) : QAbstractItemView( parent )
 {
     QHBoxLayout *layout = new QHBoxLayout( this );
-    layout->setMargin( 0 );
+    layout->setContentsMargins( 0, 0, 0, 0 );
     picFlow = new PictureFlow( this, p_model );
     picFlow->setContextMenuPolicy( Qt::CustomContextMenu );
     connect( picFlow, SIGNAL(customContextMenuRequested( const QPoint & )),
diff --git a/modules/gui/qt/dialogs/external.cpp b/modules/gui/qt/dialogs/external.cpp
index 4c78c61..69929f7 100644
--- a/modules/gui/qt/dialogs/external.cpp
+++ b/modules/gui/qt/dialogs/external.cpp
@@ -190,7 +190,7 @@ void DialogHandler::displayLogin(vlc_dialog_id *p_id, const QString &title,
     dialog->setWindowTitle (title);
     dialog->setWindowRole ("vlc-login");
     dialog->setModal(true);
-    layout->setMargin (2);
+    layout->setContentsMargins( 2, 2, 2, 2 );
 
     /* Username and password fields */
     QWidget *panel = new QWidget (dialog);
diff --git a/modules/gui/qt/dialogs/preferences.cpp b/modules/gui/qt/dialogs/preferences.cpp
index 110c60d..e0b7692 100644
--- a/modules/gui/qt/dialogs/preferences.cpp
+++ b/modules/gui/qt/dialogs/preferences.cpp
@@ -126,7 +126,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
     setLayout( main_layout );
 
     /* Margins */
-    simple_tree_panel->layout()->setMargin( 1 );
+    simple_tree_panel->layout()->setContentsMargins( 1, 1, 1, 1 );
     simple_panels_stack->layout()->setContentsMargins( 6, 0, 0, 3 );
 
     for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
diff --git a/modules/gui/qt/dialogs/toolbar.cpp b/modules/gui/qt/dialogs/toolbar.cpp
index 58a90f7..22e351c 100644
--- a/modules/gui/qt/dialogs/toolbar.cpp
+++ b/modules/gui/qt/dialogs/toolbar.cpp
@@ -497,7 +497,7 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
                 QWidget *discFrame = new QWidget( this );
                 //discFrame->setLineWidth( 1 );
                 QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
-                discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
+                discLayout->setSpacing( 0 ); discLayout->setContentsMargins( 0, 0, 0, 0 );
 
                 QToolButton *prevSectionButton = new QToolButton( discFrame );
                 prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev.svg" ) );
@@ -522,7 +522,7 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
             {
                 QWidget *telexFrame = new QWidget( this );
                 QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
-                telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
+                telexLayout->setSpacing( 0 ); telexLayout->setContentsMargins( 0, 0, 0, 0 );
 
                 QToolButton *telexOn = new QToolButton( telexFrame );
                 telexOn->setIcon( QIcon( ":/toolbar/tv.svg" ) );
@@ -638,7 +638,7 @@ DroppingController::DroppingController( intf_thread_t *_p_intf,
     setAcceptDrops( true );
     controlLayout = new QHBoxLayout( this );
     controlLayout->setSpacing( 5 );
-    controlLayout->setMargin( 0 );
+    controlLayout->setContentsMargins( 0, 0, 0, 0 );
     setFrameShape( QFrame::StyledPanel );
     setFrameShadow( QFrame::Raised );
     setMinimumHeight( 20 );
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 095c765..fc33ec5 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -364,7 +364,7 @@ void MainInterface::createResumePanel( QWidget *w )
     resumePanel = new QWidget( w );
     resumePanel->hide();
     QHBoxLayout *resumePanelLayout = new QHBoxLayout( resumePanel );
-    resumePanelLayout->setSpacing( 0 ); resumePanelLayout->setMargin( 0 );
+    resumePanelLayout->setSpacing( 0 ); resumePanelLayout->setContentsMargins( 0, 0, 0, 0 );
 
     QLabel *continuePixmapLabel = new QLabel();
     continuePixmapLabel->setPixmap( ImageHelper::loadSvgToPixmap( ":/menu/help.svg" , fontMetrics().height(), fontMetrics().height()) );
@@ -458,7 +458,7 @@ void MainInterface::createMainWidget( QSettings *creationSettings )
     setCentralWidget( main );
     mainLayout = new QVBoxLayout( main );
     main->setContentsMargins( 0, 0, 0, 0 );
-    mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
+    mainLayout->setSpacing( 0 ); mainLayout->setContentsMargins( 0, 0, 0, 0 );
 
     createResumePanel( main );
     /* */
