From bae383002a9d064f6565caccac43f0f82c2c737a Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 26 Feb 2023 12:17:35 +0100 Subject: [PATCH] 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 c7bd1c934a2..cb6a05c1358 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -3058,6 +3058,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;