- removed the setting for HDPI from Preferences and QSettings: QT6 does it automatically now

This commit is contained in:
Marius Stanciu
2021-08-28 22:42:44 +03:00
committed by Marius Stanciu
parent 4afc706e20
commit 30802901c7
4 changed files with 7 additions and 54 deletions

View File

@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
================================================= =================================================
28.08.2021
- removed the setting for HDPI from Preferences and QSettings: QT6 does it automatically now
26.08.2021 26.08.2021
- updated the Italian translation by Massimiliano Golfetto - updated the Italian translation by Massimiliano Golfetto

View File

@@ -104,32 +104,6 @@ if __name__ == '__main__':
debug_trace() debug_trace()
VisPyPatches.apply_patches() VisPyPatches.apply_patches()
# apply High DPI support
settings = QSettings("Open Source", "FlatCAM")
if settings.contains("hdpi"):
hdpi_support = settings.value('hdpi', type=int)
else:
hdpi_support = 0
if hdpi_support == 2:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
else:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "0"
# if hdpi_support == 2:
# tst_screen = QtWidgets.QApplication(sys.argv)
# if tst_screen.screens()[0].geometry().width() > 1930 or tst_screen.screens()[1].geometry().width() > 1930:
# QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
# del tst_screen
# else:
# QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False)
# if hdpi_support == 2:
# QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
# else:
# QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, False)
def excepthook(exc_type, exc_value, exc_tb): def excepthook(exc_type, exc_value, exc_tb):
msg = '%s\n' % str(datetime.today()) msg = '%s\n' % str(datetime.today())
if exc_type != KeyboardInterrupt: if exc_type != KeyboardInterrupt:
@@ -151,7 +125,6 @@ if __name__ == '__main__':
sys.excepthook = excepthook sys.excepthook = excepthook
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
# app.setAttribute(Qt.AA_UseHighDpiPixmaps)
# apply style # apply style
settings = QSettings("Open Source", "FlatCAM") settings = QSettings("Open Source", "FlatCAM")

View File

@@ -1617,13 +1617,14 @@ class MainGUI(QtWidgets.QMainWindow):
self.clear_btn.setToolTip( self.clear_btn.setToolTip(
_("Clear the GUI settings for FlatCAM,\n" _("Clear the GUI settings for FlatCAM,\n"
"such as: layout, gui state, style, hdpi support etc.") "such as: layout, gui state, style etc.")
) )
self.pref_tab_bottom_layout_1.addWidget(self.clear_btn) self.pref_tab_bottom_layout_1.addWidget(self.clear_btn)
self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout() self.pref_tab_bottom_layout_2 = QtWidgets.QHBoxLayout()
self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.pref_tab_bottom_layout_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight |
QtCore.Qt.AlignmentFlag.AlignVCenter)
self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2) self.pref_tab_bottom_layout.addLayout(self.pref_tab_bottom_layout_2)
self.pref_apply_button = FCButton() self.pref_apply_button = FCButton()

View File

@@ -104,22 +104,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.style_label, 5, 0) grid0.addWidget(self.style_label, 5, 0)
grid0.addWidget(self.style_combo, 5, 1) grid0.addWidget(self.style_combo, 5, 1)
# Enable High DPI Support
self.hdpi_cb = FCCheckBox('%s' % _('HDPI Support'))
self.hdpi_cb.setToolTip(
_("Enable High DPI support for the application.\n"
"It will be applied at the next app start.")
)
qsettings = QSettings("Open Source", "FlatCAM")
if qsettings.contains("hdpi"):
self.hdpi_cb.set_value(qsettings.value('hdpi', type=int))
else:
self.hdpi_cb.set_value(False)
self.hdpi_cb.stateChanged.connect(self.handle_hdpi)
grid0.addWidget(self.hdpi_cb, 6, 0, 1, 3)
# Enable Hover box # Enable Hover box
self.hover_cb = FCCheckBox('%s' % _('Hover Shape')) self.hover_cb = FCCheckBox('%s' % _('Hover Shape'))
self.hover_cb.setToolTip( self.hover_cb.setToolTip(
@@ -334,15 +318,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
# This will write the setting to the platform specific storage. # This will write the setting to the platform specific storage.
del qsettings del qsettings
@staticmethod
def handle_hdpi(state):
# set current HDPI
qsettings = QSettings("Open Source", "FlatCAM")
qsettings.setValue('hdpi', state)
# This will write the setting to the platform specific storage.
del qsettings
# Setting selection colors (left - right) handlers # Setting selection colors (left - right) handlers
def on_sf_color_entry(self): def on_sf_color_entry(self):
self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9] self.app.defaults['global_sel_fill'] = self.app.defaults['global_sel_fill'][7:9]