From f0627af8528c0c25ba5d7d80083c106ab1195dce Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 26 Feb 2023 12:17:35 +0100 Subject: QListView: Reset style after using a temporary proxy Amends 0242be90606b377864c6fd02d5a8e0afaf635acf, and removes unwanted side effect of having a modified style behavior for later functions. Change-Id: If3dff0d7ab9e6c6c10e7a92d0a3eaff98fa1457f Reviewed-by: Axel Spoerl (cherry picked from commit f75b29fbbde79d66ee539162441a007a90035b96) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index c85ed7e35b..a154baad46 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -3056,6 +3056,11 @@ void tst_QListView::spacingWithWordWrap() } }; + QStyle *oldStyle = QApplication::style(); + oldStyle->setParent(nullptr); + const auto resetStyle = qScopeGuard([oldStyle]{ + QApplication::setStyle(oldStyle); + }); QApplication::setStyle(new MyStyle(scrollBarOverlap)); const int listViewResizeCount = 200; -- cgit v1.2.1