PyQt5 对话框小部件在使用 pyuic 运行时看起来很毛刺



所以我正在PyQt5中制作一个应用程序,它有一个对话框。但是当使用 pyuic 运行时,对话框看起来非常小故障。

这是正在发生的事情的视频: https://youtu.be/3oJ7EMiJxO0如您所见,对话框使用"预览"功能显示正常,但是当我使用 python 和 pyuic 运行它时,标签和下拉列表出现故障。该按钮似乎工作正常...

我正在运行带有GNOME 3和Python 2.7的Fedora 23工作站。

这是我的 .ui 文件的内容...

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <author>David Teresi</author>
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="enabled">
   <bool>true</bool>
  </property>
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>258</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>backflip Settings</string>
  </property>
  <property name="autoFillBackground">
   <bool>false</bool>
  </property>
  <property name="sizeGripEnabled">
   <bool>false</bool>
  </property>
  <widget class="QDialogButtonBox" name="buttonBox">
   <property name="geometry">
    <rect>
     <x>-90</x>
     <y>260</y>
     <width>341</width>
     <height>32</height>
    </rect>
   </property>
   <property name="orientation">
    <enum>Qt::Horizontal</enum>
   </property>
   <property name="standardButtons">
    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
   </property>
  </widget>
  <widget class="QGroupBox" name="groupBox">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>0</y>
     <width>241</width>
     <height>261</height>
    </rect>
   </property>
   <property name="title">
    <string>backflip Settings</string>
   </property>
   <widget class="QWidget" name="layoutWidget">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>60</y>
      <width>155</width>
      <height>22</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout_2">
     <item>
      <widget class="QLabel" name="UpdateEveryLabel">
       <property name="text">
        <string>Update every</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QComboBox" name="UpdateEverySelect">
       <property name="contextMenuPolicy">
        <enum>Qt::DefaultContextMenu</enum>
       </property>
       <item>
        <property name="text">
         <string>Day</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Week</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Hour</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Minute</string>
        </property>
       </item>
      </widget>
     </item>
    </layout>
   </widget>
   <widget class="QPushButton" name="RefreshButton">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>230</y>
      <width>75</width>
      <height>23</height>
     </rect>
    </property>
    <property name="text">
     <string>Refresh</string>
    </property>
   </widget>
   <widget class="QWidget" name="">
    <property name="geometry">
     <rect>
      <x>10</x>
      <y>20</y>
      <width>109</width>
      <height>22</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="QLabel" name="ThemeLabel">
       <property name="text">
        <string>Theme</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QComboBox" name="ThemeSelect">
       <property name="contextMenuPolicy">
        <enum>Qt::DefaultContextMenu</enum>
       </property>
       <item>
        <property name="text">
         <string>None</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Buildings</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Food</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Nature</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>Technology</string>
        </property>
       </item>
       <item>
        <property name="text">
         <string>People</string>
        </property>
       </item>
      </widget>
     </item>
    </layout>
   </widget>
  </widget>
 </widget>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>Dialog</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>248</x>
     <y>254</y>
    </hint>
    <hint type="destinationlabel">
     <x>157</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>Dialog</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>316</x>
     <y>260</y>
    </hint>
    <hint type="destinationlabel">
     <x>286</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>

有人可以帮助我吗?

我可以从您的设计器文件中看到,您的QDialogQGroupBox都没有分配布局。 他们应该使用QVBoxLayout的。 您可能还需要添加一些垂直垫片。

最新更新