Skip to content

UI: Replace deprecated QLayout->setMargin with setContentsMargin#3811

Merged
jp9000 merged 1 commit into
obsproject:masterfrom
RytoEX:layout-margins
Jan 19, 2021
Merged

UI: Replace deprecated QLayout->setMargin with setContentsMargin#3811
jp9000 merged 1 commit into
obsproject:masterfrom
RytoEX:layout-margins

Conversation

@RytoEX

@RytoEX RytoEX commented Dec 1, 2020

Copy link
Copy Markdown
Member

Description

UI: Replace deprecated QLayout->setMargin with setContentsMargin

Motivation and Context

QLayout->setMargin has been deprecated since Qt 5.13 (though marked obsolete since at least Qt 4.8) and removed in Qt6. It was replaced by QLayout->setContentsMargins, which is available in all versions of Qt5. Building against Qt 5.13+ can produce compiler warnings when using QLayout->setMargin, and warnings are bad.

https://doc.qt.io/archives/qt-4.8/qlayout-obsolete.html
https://doc.qt.io/qt-5/qlayout-obsolete.html
qt/qtbase@d6d33f0
https://github.com/qt/qtbase/blame/5.15.2/src/widgets/kernel/qlayout.h

How Has This Been Tested?

I compiled and ran OBS using Qt 5.15.2 on Windows 10 Home 64-bit 2004 (Build 19041.630) with and without these changes and compared UI elements that had used the old function. Everything looked fine to me. Furthermore, you can see from the Qt commit above that setMargin(int margin) is just an alias for setContentsMargins(margin, margin, margin, margin).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@RytoEX RytoEX added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Non-breaking change which makes code smaller or more readable labels Dec 1, 2020
@RytoEX
RytoEX force-pushed the layout-margins branch 2 times, most recently from 62aedc1 to 13bcf47 Compare December 2, 2020 14:43
QLayout->setMargin has been deprecated since Qt 5.13 (though marked
obsolete since at least Qt 4.8) and removed in Qt6. It was replaced by
QLayout->setContentsMargins, which is available in all versions of Qt5.
Building against Qt 5.13+ can produce compiler warnings when using
QLayout->setMargin, and warnings are bad.

https://doc.qt.io/archives/qt-4.8/qlayout-obsolete.html
https://doc.qt.io/qt-5/qlayout-obsolete.html
qt/qtbase@d6d33f0
https://github.com/qt/qtbase/blame/5.15.2/src/widgets/kernel/qlayout.h
@jp9000
jp9000 merged commit 54207a0 into obsproject:master Jan 19, 2021
@RytoEX
RytoEX deleted the layout-margins branch March 17, 2021 20:22
@RytoEX RytoEX added this to the OBS Studio 27.0 milestone Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Non-breaking change which makes code smaller or more readable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants