[LyX/master] Fix Qt deprecation warn for getContentsMargins()
Scott Kostyshak
skostysh at lyx.org
Fri Mar 6 14:37:25 UTC 2020
commit 1c78b563ff47cafbd2c1622342ca3c639e4738ca
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Fri Mar 6 09:07:31 2020 -0500
Fix Qt deprecation warn for getContentsMargins()
Fixes the following warning:
error: ‘void QWidget::getContentsMargins(int*, int*, int*, int*) const’ is deprecated: use contentsMargins() [-Werror=deprecated-declarations]
The new code also has advantages in that 'l' can be set to const and
it is more readable because it is clear that only 'l' is used.
QWidget::getContentsMargins() was deprecated in 5.14.0 [1]. and
QWidget::contentsMargins() is available since 4.6 [2].
[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.14.0/?h=v5.14.0
[2] https://doc.qt.io/archives/qt-4.8/qlayout.html#contentsMargins
---
src/frontends/qt/GuiView.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 6890c16..c7a1bd9 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4604,8 +4604,8 @@ bool GuiView::lfunUiToggle(string const & ui_component)
menuBar()->setVisible(!menuBar()->isVisible());
} else
if (ui_component == "frame") {
- int l, t, r, b;
- getContentsMargins(&l, &t, &r, &b);
+ int const l = contentsMargins().left();
+
//are the frames in default state?
d.current_work_area_->setFrameStyle(QFrame::NoFrame);
if (l == 0) {
More information about the lyx-cvs
mailing list