I'm encountering an issue where the window and its components in a Qt Designer-designed interface become very small and almost invisible after compiling and running the code. The text on the components also becomes extremely small, making it difficult to read. I'm using Qt version 5.15. I have designed the interface in Qt Designer with various components and layouts. However, when I compile and run the code, the window's size and the size of the components become very small, and it's hard to see the text on the components.
I have attempted the following solutions without success:
Trying to adjust the size properties of the window and components, but it has no effect. Checking the display settings of the operating system to ensure the scaling factor is set correctly. Ensuring there are no direct modifications to the component sizes in the code. I am seeking help to find a solution to this problem. Any assistance would be greatly appreciated!
(Please adjust the code and details as necessary and provide sufficient context in your question for other developers to better understand and answer your issue.)
window1.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Window1</class>
<widget class="QMainWindow" name="Window1">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>300</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>Window1</string>
</property>
<property name="dockNestingEnabled">
<bool>true</bool>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>110</x>
<y>0</y>
<width>141</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:700;">本地信息获取</span></p></body></html></string>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>30</y>
<width>291</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>本地主机名</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="localhostname"/>
</item>
<item>
<widget class="QPushButton" name="flushlocal">
<property name="text">
<string>更新</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>80</x>
<y>230</y>
<width>221</width>
<height>22</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="hostdecoder">
<property name="text">
<string>域名解析器</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="messaging_simulator">
<property name="text">
<string>通信模拟器</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>321</width>
<height>161</height>
</rect>
</property>
<property name="title">
<string>GroupBox</string>
</property>
<widget class="QTextBrowser" name="localips">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>221</width>
<height>131</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_1">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>本机IP</string>
</property>
</widget>
<widget class="QCheckBox" name="chkOnlyIPv4">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>IPv4 only</string>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>