src/eric7/EricWidgets/EricMainWindow.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
14 14
15 class EricMainWindow(QMainWindow): 15 class EricMainWindow(QMainWindow):
16 """ 16 """
17 Class implementing a main window with styling support. 17 Class implementing a main window with styling support.
18 """ 18 """
19
19 def __init__(self, parent=None): 20 def __init__(self, parent=None):
20 """ 21 """
21 Constructor 22 Constructor
22 23
23 @param parent reference to the parent widget 24 @param parent reference to the parent widget
24 @type QWidget 25 @type QWidget
25 """ 26 """
26 super().__init__(parent) 27 super().__init__(parent)
27 28
28 self.defaultStyleName = QApplication.style().objectName() 29 self.defaultStyleName = QApplication.style().objectName()
29 30
30 def setStyle(self, styleName, styleSheetFile): 31 def setStyle(self, styleName, styleSheetFile):
31 """ 32 """
32 Public method to set the style of the interface. 33 Public method to set the style of the interface.
33 34
34 @param styleName name of the style to set 35 @param styleName name of the style to set
35 @type str 36 @type str
36 @param styleSheetFile name of a style sheet file to read to overwrite 37 @param styleSheetFile name of a style sheet file to read to overwrite
37 defaults of the given style 38 defaults of the given style
38 @type str 39 @type str
44 style = QStyleFactory.create(styleName) 45 style = QStyleFactory.create(styleName)
45 if style is None: 46 if style is None:
46 style = QStyleFactory.create(self.defaultStyleName) 47 style = QStyleFactory.create(self.defaultStyleName)
47 if style is not None: 48 if style is not None:
48 QApplication.setStyle(style) 49 QApplication.setStyle(style)
49 50
50 # step 2: set a style sheet 51 # step 2: set a style sheet
51 ericApp().setStyleSheetFile(styleSheetFile) 52 ericApp().setStyleSheetFile(styleSheetFile)

eric ide

mercurial