9 |
9 |
10 from PyQt5.QtCore import Qt, QCoreApplication |
10 from PyQt5.QtCore import Qt, QCoreApplication |
11 from PyQt5.QtGui import QPalette |
11 from PyQt5.QtGui import QPalette |
12 from PyQt5.QtWidgets import QApplication |
12 from PyQt5.QtWidgets import QApplication |
13 |
13 |
14 QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) |
14 QCoreApplication.setAttribute( |
15 QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True) |
15 Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True) |
|
16 QCoreApplication.setAttribute( |
|
17 Qt.ApplicationAttribute.AA_ShareOpenGLContexts, True) |
16 |
18 |
17 |
19 |
18 class E5Application(QApplication): |
20 class E5Application(QApplication): |
19 """ |
21 """ |
20 Eric application class with an object registry. |
22 Eric application class with an object registry. |
27 @type list |
29 @type list |
28 """ |
30 """ |
29 super(E5Application, self).__init__(argv) |
31 super(E5Application, self).__init__(argv) |
30 |
32 |
31 QCoreApplication.setAttribute( |
33 QCoreApplication.setAttribute( |
32 Qt.AA_DontCreateNativeWidgetSiblings, True) |
34 Qt.ApplicationAttribute.AA_DontCreateNativeWidgetSiblings, True) |
33 QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) |
35 QCoreApplication.setAttribute( |
|
36 Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True) |
34 |
37 |
35 self.__objectRegistry = {} |
38 self.__objectRegistry = {} |
36 self.__pluginObjectRegistry = {} |
39 self.__pluginObjectRegistry = {} |
37 |
40 |
38 def registerObject(self, name, objectRef): |
41 def registerObject(self, name, objectRef): |
145 |
148 |
146 @return flag indicating the use of a palette with a dark background |
149 @return flag indicating the use of a palette with a dark background |
147 @rtype bool |
150 @rtype bool |
148 """ |
151 """ |
149 palette = self.palette() |
152 palette = self.palette() |
150 lightness = palette.color(QPalette.Window).lightness() |
153 lightness = palette.color(QPalette.ColorRole.Window).lightness() |
151 return lightness <= 128 |
154 return lightness <= 128 |
152 |
155 |
153 e5App = QCoreApplication.instance |
156 e5App = QCoreApplication.instance |