我最近搬到 Mac OS X 并注意到我的一个应用程序中的对话框看起来有点奇怪......我有几个对话框,它们基本上是一个简单的表单,具有可配置的路径:
标签:<QLineEdit>
<QPushButton (opens file dialog)>
标签: ...
对话框以 QGridLayout 组织,在 Ubuntu 上看起来不错:
在 Mac OS X 上,QPushButtons 行下方有一个很大的空白区域,这让整个事情看起来很奇怪:
我发现这个错误报告显然是默默关闭的: https ://bugreports.qt.io/browse/QTBUG-2699
用户界面代码:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>431</width>
<height>235</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>PDF Export</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/images/images/application-pdf.png</normaloff>:/images/images/application-pdf.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="texPath">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Auszubildender:</string>
</property>
<property name="buddy">
<cstring>traineeName</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="traineeName"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Ausbilder:</string>
</property>
<property name="buddy">
<cstring>instructorName</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="instructorName"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Name der Firma:</string>
</property>
<property name="buddy">
<cstring>companyName</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="companyName"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Datum der Unterschriften:</string>
</property>
<property name="buddy">
<cstring>dateEdit</cstring>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QDateEdit" name="dateEdit">
<property name="displayFormat">
<string>dd.MM.yyyy</string>
</property>
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="browseButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/images/images/document-open.png</normaloff>:/images/images/document-open.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Pfad zum TEX-Template:</string>
</property>
<property name="buddy">
<cstring>texPath</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Abbrechen</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="generateButton">
<property name="text">
<string>PDF generieren...</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/images/images/arrow-right.png</normaloff>:/images/images/arrow-right.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>texPath</tabstop>
<tabstop>browseButton</tabstop>
<tabstop>traineeName</tabstop>
<tabstop>instructorName</tabstop>
<tabstop>companyName</tabstop>
<tabstop>dateEdit</tabstop>
<tabstop>cancelButton</tabstop>
<tabstop>generateButton</tabstop>
</tabstops>
<resources>
<include location="resources.qrc"/>
</resources>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>246</x>
<y>221</y>
</hint>
<hint type="destinationlabel">
<x>133</x>
<y>152</y>
</hint>
</hints>
</connection>
</connections>
</ui>
有没有什么办法解决这一问题?