qt: Fix settings on mac and linux

This commit is contained in:
cold-brewed
2024-07-13 09:30:36 -04:00
parent c728f6cbf5
commit eeb8af91f5
4 changed files with 252 additions and 215 deletions

View File

@@ -50,6 +50,7 @@ public:
SettingsModel(QObject *parent) SettingsModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {
fontHeight = QApplication::fontMetrics().height();
} }
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
@@ -82,6 +83,7 @@ private:
"other_removable_devices", "other_removable_devices",
"other_peripherals", "other_peripherals",
}; };
int fontHeight;
}; };
QVariant QVariant
@@ -94,6 +96,8 @@ SettingsModel::data(const QModelIndex &index, int role) const
return tr(pages.at(index.row()).toUtf8().data()); return tr(pages.at(index.row()).toUtf8().data());
case Qt::DecorationRole: case Qt::DecorationRole:
return QIcon(QString("%1/%2.ico").arg(ProgSettings::getIconSetPath(), page_icons[index.row()])); return QIcon(QString("%1/%2.ico").arg(ProgSettings::getIconSetPath(), page_icons[index.row()]));
case Qt::SizeHintRole:
return QSize(-1, fontHeight * 2);
default: default:
return {}; return {};
} }
@@ -182,9 +186,6 @@ Settings::Settings(QWidget *parent)
[this](const QModelIndex &current, const QModelIndex &previous) { [this](const QModelIndex &current, const QModelIndex &previous) {
ui->stackedWidget->setCurrentIndex(current.row()); }); ui->stackedWidget->setCurrentIndex(current.row()); });
ui->listView->resizeColumnsToContents();
ui->listView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
ui->listView->setCurrentIndex(model->index(0, 0)); ui->listView->setCurrentIndex(model->index(0, 0));
Settings::settings = this; Settings::settings = this;

View File

@@ -36,25 +36,31 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QTableView" name="listView"> <widget class="QListView" name="listView">
<property name="editTriggers"> <property name="sizePolicy">
<set>QAbstractItemView::NoEditTriggers</set> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="selectionMode"> <property name="minimumSize">
<enum>QAbstractItemView::SingleSelection</enum> <size>
<width>200</width>
<height>0</height>
</size>
</property> </property>
<property name="selectionBehavior"> <property name="maximumSize">
<enum>QAbstractItemView::SelectRows</enum> <size>
<width>200</width>
<height>16777215</height>
</size>
</property> </property>
<property name="showGrid"> <property name="viewMode">
<bool>false</bool> <enum>QListView::ListMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property> </property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget> </widget>
</item> </item>
<item> <item>

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>544</width> <width>544</width>
<height>617</height> <height>363</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -35,6 +35,18 @@
</item> </item>
<item> <item>
<widget class="QTableView" name="tableViewFloppy"> <widget class="QTableView" name="tableViewFloppy">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
@@ -53,49 +65,38 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QWidget" name="floppyControls" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout">
<widget class="QLabel" name="label_2"> <item>
<property name="text"> <widget class="QLabel" name="label_2">
<string>Type:</string> <property name="text">
</property> <string>Type:</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QComboBox" name="comboBoxFloppyType"> <item>
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxFloppyType">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QCheckBox" name="checkBoxTurboTimings"> <item>
<property name="text"> <widget class="QCheckBox" name="checkBoxTurboTimings">
<string>Turbo timings</string> <property name="text">
</property> <string>Turbo timings</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QCheckBox" name="checkBoxCheckBPB"> <item>
<property name="text"> <widget class="QCheckBox" name="checkBoxCheckBPB">
<string>Check BPB</string> <property name="text">
</property> <string>Check BPB</string>
</widget> </property>
</item> </widget>
</layout> </item>
</item> </layout>
<item> </widget>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
@@ -106,6 +107,18 @@
</item> </item>
<item> <item>
<widget class="QTableView" name="tableViewCDROM"> <widget class="QTableView" name="tableViewCDROM">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
@@ -124,64 +137,66 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <widget class="QWidget" name="cdControls" native="true">
<item row="0" column="0"> <layout class="QGridLayout" name="gridLayout">
<widget class="QLabel" name="label_3"> <item row="0" column="0">
<property name="text"> <widget class="QLabel" name="label_3">
<string>Bus:</string> <property name="text">
</property> <string>Bus:</string>
</widget> </property>
</item> </widget>
<item row="0" column="2"> </item>
<widget class="QLabel" name="label_7"> <item row="0" column="2">
<property name="text"> <widget class="QLabel" name="label_7">
<string>Channel:</string> <property name="text">
</property> <string>Channel:</string>
</widget> </property>
</item> </widget>
<item row="1" column="0"> </item>
<widget class="QLabel" name="label_4"> <item row="1" column="0">
<property name="text"> <widget class="QLabel" name="label_4">
<string>Speed:</string> <property name="text">
</property> <string>Speed:</string>
</widget> </property>
</item> </widget>
<item row="2" column="0"> </item>
<widget class="QLabel" name="label_5"> <item row="2" column="0">
<property name="text"> <widget class="QLabel" name="label_5">
<string>Type:</string> <property name="text">
</property> <string>Type:</string>
</widget> </property>
</item> </widget>
<item row="0" column="1"> </item>
<widget class="QComboBox" name="comboBoxBus"> <item row="0" column="1">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxBus">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item row="0" column="3"> </item>
<widget class="QComboBox" name="comboBoxChannel"> <item row="0" column="3">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxChannel">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item row="1" column="1"> </item>
<widget class="QComboBox" name="comboBoxSpeed"> <item row="1" column="1">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxSpeed">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item row="2" column="1" colspan="3"> </item>
<widget class="QComboBox" name="comboBoxCDROMType"> <item row="2" column="1" colspan="3">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxCDROMType">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
</layout> </item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>418</width> <width>418</width>
<height>433</height> <height>368</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -35,6 +35,18 @@
</item> </item>
<item> <item>
<widget class="QTableView" name="tableViewMO"> <widget class="QTableView" name="tableViewMO">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
@@ -53,63 +65,52 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <widget class="QWidget" name="moControls" native="true">
<item row="0" column="0"> <layout class="QGridLayout" name="gridLayout">
<widget class="QLabel" name="label_2"> <item row="0" column="0">
<property name="text"> <widget class="QLabel" name="label_2">
<string>Bus:</string> <property name="text">
</property> <string>Bus:</string>
</widget> </property>
</item> </widget>
<item row="0" column="2"> </item>
<widget class="QLabel" name="label_7"> <item row="0" column="2">
<property name="text"> <widget class="QLabel" name="label_7">
<string>Channel:</string> <property name="text">
</property> <string>Channel:</string>
</widget> </property>
</item> </widget>
<item row="0" column="1"> </item>
<widget class="QComboBox" name="comboBoxMOBus"> <item row="0" column="1">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxMOBus">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item row="0" column="3"> </item>
<widget class="QComboBox" name="comboBoxMOChannel"> <item row="0" column="3">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxMOChannel">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item row="1" column="0"> </item>
<widget class="QLabel" name="label_4"> <item row="1" column="0">
<property name="text"> <widget class="QLabel" name="label_4">
<string>Type:</string> <property name="text">
</property> <string>Type:</string>
</widget> </property>
</item> </widget>
<item row="1" column="1" colspan="3"> </item>
<widget class="QComboBox" name="comboBoxMOType"> <item row="1" column="1" colspan="3">
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxMOType">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
</layout> </item>
</item> </layout>
<item> </widget>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
@@ -120,6 +121,18 @@
</item> </item>
<item> <item>
<widget class="QTableView" name="tableViewZIP"> <widget class="QTableView" name="tableViewZIP">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::NoEditTriggers</set>
</property> </property>
@@ -138,43 +151,45 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QWidget" name="zipControls" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout">
<widget class="QLabel" name="label_3"> <item>
<property name="text"> <widget class="QLabel" name="label_3">
<string>Bus:</string> <property name="text">
</property> <string>Bus:</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QComboBox" name="comboBoxZIPBus"> <item>
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxZIPBus">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QLabel" name="label_5"> <item>
<property name="text"> <widget class="QLabel" name="label_5">
<string>Channel:</string> <property name="text">
</property> <string>Channel:</string>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QComboBox" name="comboBoxZIPChannel"> <item>
<property name="maxVisibleItems"> <widget class="QComboBox" name="comboBoxZIPChannel">
<number>30</number> <property name="maxVisibleItems">
</property> <number>30</number>
</widget> </property>
</item> </widget>
<item> </item>
<widget class="QCheckBox" name="checkBoxZIP250"> <item>
<property name="text"> <widget class="QCheckBox" name="checkBoxZIP250">
<string>ZIP 250</string> <property name="text">
</property> <string>ZIP 250</string>
</widget> </property>
</item> </widget>
</layout> </item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>