--- a/eric6/Tools/UIPreviewer.py Fri Oct 09 17:19:29 2020 +0200 +++ b/eric6/Tools/UIPreviewer.py Sat Oct 10 12:20:51 2020 +0200 @@ -9,7 +9,7 @@ from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt -from PyQt5.QtGui import QCursor, QKeySequence, QImageWriter, QPainter +from PyQt5.QtGui import QKeySequence, QImageWriter, QPainter from PyQt5.QtWidgets import ( QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow, @@ -22,6 +22,7 @@ from E5Gui import E5MessageBox, E5FileDialog from E5Gui.E5MainWindow import E5MainWindow from E5Gui.E5Application import e5App +from E5Gui.E5OverrideCursor import E5OverrideCursor import Preferences import UI.PixmapCache @@ -376,26 +377,25 @@ @param sstyle name of the selected style (string) """ - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - qstyle = QStyleFactory.create(sstyle) - self.mainWidget.setStyle(qstyle) - - lst = self.mainWidget.findChildren(QWidget) - for obj in lst: - try: - obj.setStyle(qstyle) - except AttributeError: - pass - del lst - - self.mainWidget.hide() - self.mainWidget.show() - - self.lastQStyle = qstyle - self.lastStyle = sstyle - Preferences.Prefs.settings.setValue( - 'UIPreviewer/style', self.styleCombo.currentIndex()) - QApplication.restoreOverrideCursor() + with E5OverrideCursor(): + qstyle = QStyleFactory.create(sstyle) + self.mainWidget.setStyle(qstyle) + + lst = self.mainWidget.findChildren(QWidget) + for obj in lst: + try: + obj.setStyle(qstyle) + except AttributeError: + pass + del lst + + self.mainWidget.hide() + self.mainWidget.show() + + self.lastQStyle = qstyle + self.lastStyle = sstyle + Preferences.Prefs.settings.setValue( + 'UIPreviewer/style', self.styleCombo.currentIndex()) def __updateActions(self): """