From 130fd22d399624c863bbaad2f72d2213a48e9e13 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 May 2019 19:51:38 +0200 Subject: QWidget/QLineEdit: deprecate get{Contents,Text}Margins() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have contentsMargins() and textMargins() methods since 4.6 which are much more efficient and easier to use. [ChangeLog][QtWidgets][QLineEdit] The getTextMargins() member function has been deprecated in favor of textMargins(). [ChangeLog][QtWidgets][QWidget] The getContentsMargins() member function has been deprecated in favor of contentsMargins(). Change-Id: Ifdb890af6198fc682b94701786c67a5b945a4b4c Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Lars Knoll --- src/widgets/itemviews/qitemeditorfactory.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index 2d49dd4421..8ed2ee5f28 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -570,11 +570,9 @@ void QExpandingLineEdit::changeEvent(QEvent *e) void QExpandingLineEdit::updateMinimumWidth() { - int left, right; - getTextMargins(&left, 0, &right, 0); - int width = left + right + 4 /*horizontalMargin in qlineedit.cpp*/; - getContentsMargins(&left, 0, &right, 0); - width += left + right; + const QMargins tm = textMargins(); + const QMargins cm = contentsMargins(); + const int width = tm.left() + tm.right() + cm.left() + cm.right() + 4 /*horizontalMargin in qlineedit.cpp*/; QStyleOptionFrame opt; initStyleOption(&opt); -- cgit v1.2.3