7 Module implementing the UI Previewer main window. |
7 Module implementing the UI Previewer main window. |
8 """ |
8 """ |
9 |
9 |
10 |
10 |
11 from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt |
11 from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt |
12 from PyQt5.QtGui import QCursor, QKeySequence, QImageWriter, QPainter |
12 from PyQt5.QtGui import QKeySequence, QImageWriter, QPainter |
13 from PyQt5.QtWidgets import ( |
13 from PyQt5.QtWidgets import ( |
14 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, |
14 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, |
15 QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow, |
15 QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow, |
16 QComboBox, QVBoxLayout, QAction, QLabel |
16 QComboBox, QVBoxLayout, QAction, QLabel |
17 ) |
17 ) |
374 """ |
375 """ |
375 Private slot to change the style of the show UI. |
376 Private slot to change the style of the show UI. |
376 |
377 |
377 @param sstyle name of the selected style (string) |
378 @param sstyle name of the selected style (string) |
378 """ |
379 """ |
379 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) |
380 with E5OverrideCursor(): |
380 qstyle = QStyleFactory.create(sstyle) |
381 qstyle = QStyleFactory.create(sstyle) |
381 self.mainWidget.setStyle(qstyle) |
382 self.mainWidget.setStyle(qstyle) |
382 |
383 |
383 lst = self.mainWidget.findChildren(QWidget) |
384 lst = self.mainWidget.findChildren(QWidget) |
384 for obj in lst: |
385 for obj in lst: |
385 try: |
386 try: |
386 obj.setStyle(qstyle) |
387 obj.setStyle(qstyle) |
387 except AttributeError: |
388 except AttributeError: |
388 pass |
389 pass |
389 del lst |
390 del lst |
390 |
391 |
391 self.mainWidget.hide() |
392 self.mainWidget.hide() |
392 self.mainWidget.show() |
393 self.mainWidget.show() |
393 |
394 |
394 self.lastQStyle = qstyle |
395 self.lastQStyle = qstyle |
395 self.lastStyle = sstyle |
396 self.lastStyle = sstyle |
396 Preferences.Prefs.settings.setValue( |
397 Preferences.Prefs.settings.setValue( |
397 'UIPreviewer/style', self.styleCombo.currentIndex()) |
398 'UIPreviewer/style', self.styleCombo.currentIndex()) |
398 QApplication.restoreOverrideCursor() |
|
399 |
399 |
400 def __updateActions(self): |
400 def __updateActions(self): |
401 """ |
401 """ |
402 Private slot to update the actions state. |
402 Private slot to update the actions state. |
403 """ |
403 """ |