UI: Replace deprecated QLayout->setMargin with setContentsMargin#3811
Merged
Conversation
WizardCM
approved these changes
Dec 1, 2020
RytoEX
force-pushed
the
layout-margins
branch
2 times, most recently
from
December 2, 2020 14:43
62aedc1 to
13bcf47
Compare
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
RytoEX
force-pushed
the
layout-margins
branch
from
December 2, 2020 19:29
13bcf47 to
85d319b
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forsetContentsMargins(margin, margin, margin, margin).Types of changes
Checklist: