try fixing problems with high dpi screens, font size for video in pixels

This commit is contained in:
Martin Kaistra 2017-05-23 21:24:58 +02:00
parent 487743104f
commit 025a110005
3 changed files with 108 additions and 10 deletions

View File

@ -60,7 +60,7 @@ class Core():
self._image1 = QtGui.QImage(self._image) self._image1 = QtGui.QImage(self._image)
painter = QPainter(self._image1) painter = QPainter(self._image1)
font = titleFont font = titleFont
font.setPointSizeF(fontSize) font.setPixelSize(fontSize)
painter.setFont(font) painter.setFont(font)
painter.setPen(QColor(255, 255, 255)) painter.setPen(QColor(255, 255, 255))

View File

@ -278,6 +278,13 @@ else:
if __name__ == "__main__": if __name__ == "__main__":
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
window = uic.loadUi("main.ui") window = uic.loadUi("main.ui")
# window.adjustSize()
desc = QtGui.QDesktopWidget()
dpi = desc.physicalDpiX()
topMargin = 0 if (dpi == 96) else int(10 * (dpi / 96))
window.resize(window.width() * (dpi / 96), window.height() * (dpi / 96))
window.verticalLayout_2.setContentsMargins(0, topMargin, 0, 0)
main = Main(window) main = Main(window)

109
main.ui
View File

@ -7,18 +7,42 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>635</width> <width>635</width>
<height>610</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>635</width>
<height>600</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox_settings"> <widget class="QGroupBox" name="groupBox_settings">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -28,7 +52,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>200</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
@ -41,6 +65,12 @@
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QPushButton" name="pushButton_selectInput"> <widget class="QPushButton" name="pushButton_selectInput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -49,7 +79,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>16777215</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -60,6 +90,12 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label_input"> <widget class="QLabel" name="label_input">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
</property> </property>
@ -74,6 +110,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QPushButton" name="pushButton_selectOutput"> <widget class="QPushButton" name="pushButton_selectOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -82,7 +124,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>16777215</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -93,6 +135,12 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label_output"> <widget class="QLabel" name="label_output">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
</property> </property>
@ -107,6 +155,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QPushButton" name="pushButton_selectBackground"> <widget class="QPushButton" name="pushButton_selectBackground">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -115,7 +169,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>16777215</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -126,6 +180,12 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label_background"> <widget class="QLabel" name="label_background">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
</property> </property>
@ -315,6 +375,12 @@
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_preview"> <widget class="QGroupBox" name="groupBox_preview">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -368,10 +434,16 @@
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_create"> <widget class="QGroupBox" name="groupBox_create">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>100</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
@ -385,16 +457,22 @@
<property name="value"> <property name="value">
<number>24</number> <number>24</number>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textVisible"> <property name="textVisible">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="alignment">
<enum>Qt::AlignCenter</enum>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_createVideo"> <widget class="QPushButton" name="pushButton_createVideo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>PushButton</string> <string>PushButton</string>
</property> </property>
@ -405,6 +483,19 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>