Make sure all generated pixmaps are show at the proper pixel ratio

This commit is contained in:
Jonathan Springer 2015-11-29 17:48:10 -05:00
parent c37b033ba0
commit 05a653e670
5 changed files with 11 additions and 2 deletions

View File

@ -341,6 +341,7 @@ def main(args=None):
application = OpenLP(qt_args)
application.setOrganizationName('OpenLP')
application.setOrganizationDomain('openlp.org')
application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
if args and args.portable:
application.setApplicationName('OpenLPPortable')
Settings.setDefaultFormat(Settings.IniFormat)

View File

@ -131,10 +131,14 @@ class ListPreviewWidget(QtWidgets.QTableWidget, RegistryProperties):
else:
label.setScaledContents(True)
if self.service_item.is_command():
label.setPixmap(QtGui.QPixmap(frame['image']))
pixmap = QtGui.QPixmap(frame['image'])
pixmap.setDevicePixelRatio(label.devicePixelRatio())
label.setPixmap(pixmap)
else:
image = self.image_manager.get_image(frame['path'], ImageSource.ImagePlugin)
label.setPixmap(QtGui.QPixmap.fromImage(image))
pixmap = QtGui.QPixmap.fromImage(image)
pixmap.setDevicePixelRatio(label.devicePixelRatio())
label.setPixmap(pixmap)
self.setCellWidget(frame_number, 0, label)
slide_height = width // self.screen_ratio
row += 1

View File

@ -1129,6 +1129,7 @@ class SlideController(DisplayController, RegistryProperties):
QtCore.QTimer.singleShot(2.5, self.grab_maindisplay)
else:
self.slide_image = self.display.preview()
self.slide_image.setDevicePixelRatio(self.main_window.devicePixelRatio())
self.slide_preview.setPixmap(self.slide_image)
self.slide_count += 1
@ -1139,6 +1140,7 @@ class SlideController(DisplayController, RegistryProperties):
win_id = QtWidgets.QApplication.desktop().winId()
rect = self.screens.current['size']
win_image = QtGui.QScreen.grabWindow(win_id, rect.x(), rect.y(), rect.width(), rect.height())
win_image.setDevicePixelRatio(self.slide_preview.devicePixelRatio())
self.slide_preview.setPixmap(win_image)
self.slide_image = win_image

View File

@ -193,6 +193,7 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties):
if self.page(page_id) == self.preview_page:
self.update_theme()
frame = self.theme_manager.generate_image(self.theme)
frame.setDevicePixelRatio(self.devicePixelRatio())
self.preview_box_label.setPixmap(frame)
self.display_aspect_ratio = float(frame.width()) / frame.height()
self.resizeEvent()

View File

@ -43,6 +43,7 @@ class ThemeLayoutForm(QtWidgets.QDialog, Ui_ThemeLayoutDialog):
Run the Dialog with correct heading.
"""
pixmap = image.scaledToHeight(400, QtCore.Qt.SmoothTransformation)
pixmap.setDevicePixelRatio(self.theme_display_label.devicePixelRatio())
self.theme_display_label.setPixmap(pixmap)
display_aspect_ratio = float(image.width()) / image.height()
self.theme_display_label.setFixedSize(400, 400 / display_aspect_ratio)