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)
painter = QPainter(self._image1)
font = titleFont
font.setPointSizeF(fontSize)
font.setPixelSize(fontSize)
painter.setFont(font)
painter.setPen(QColor(255, 255, 255))

View File

@ -278,6 +278,13 @@ else:
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
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)

109
main.ui
View File

@ -7,18 +7,42 @@
<x>0</x>
<y>0</y>
<width>635</width>
<height>610</height>
<height>600</height>
</rect>
</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">
<string>MainWindow</string>
</property>
<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">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<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">
<size>
<width>0</width>
@ -28,7 +52,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
<height>16777215</height>
</size>
</property>
<property name="title">
@ -41,6 +65,12 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<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">
<size>
<width>200</width>
@ -49,7 +79,7 @@
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
@ -60,6 +90,12 @@
</item>
<item>
<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">
<enum>QFrame::Box</enum>
</property>
@ -74,6 +110,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<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">
<size>
<width>200</width>
@ -82,7 +124,7 @@
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
@ -93,6 +135,12 @@
</item>
<item>
<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">
<enum>QFrame::Box</enum>
</property>
@ -107,6 +155,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<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">
<size>
<width>200</width>
@ -115,7 +169,7 @@
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
@ -126,6 +180,12 @@
</item>
<item>
<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">
<enum>QFrame::Box</enum>
</property>
@ -315,6 +375,12 @@
</item>
<item>
<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">
<size>
<width>0</width>
@ -368,10 +434,16 @@
</item>
<item>
<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">
<size>
<width>16777215</width>
<height>100</height>
<height>16777215</height>
</size>
</property>
<property name="title">
@ -385,16 +457,22 @@
<property name="value">
<number>24</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textVisible">
<bool>true</bool>
</property>
<property name="alignment">
<enum>Qt::AlignCenter</enum>
</property>
</widget>
</item>
<item>
<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">
<string>PushButton</string>
</property>
@ -405,6 +483,19 @@
</layout>
</widget>
</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>
</item>
</layout>