Skip to content

Commit

Permalink
Merge pull request #885 from matty0ung/usability
Browse files Browse the repository at this point in the history
Fix non-visible drop-downs next to resize bar, plus small tidy-ups
  • Loading branch information
matty0ung authored Nov 18, 2024
2 parents 01f08fb + 01176ee commit 045d706
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 97 deletions.
1 change: 1 addition & 0 deletions CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Bug fixes and minor enhancements.
### Bug Fixes
* Crash on Windows when opening Print and Print Preview dialog [873](https://github.com/Brewtarget/brewtarget/issues/873)
* Crash when you click Yes or No in the pop-up about downloading the latest version [878](https://github.com/Brewtarget/brewtarget/issues/878)
* Drop down menu for Style and Equipment are so narrow, cannot see contents [879](https://github.com/Brewtarget/brewtarget/issues/879)

### Release Timestamp
Sun, 17 Nov 2024 04:00:11 +0100
Expand Down
10 changes: 6 additions & 4 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,15 +1186,16 @@ void MainWindow::setupCSS() {
this->pimpl->highSS = QString("QLineEdit:read-only { color: #D00000; background: %1 }").arg(wPalette.name());
this->pimpl->boldSS = QString("QLineEdit:read-only { font: bold 10pt; color: #000000; background: %1 }").arg(wPalette.name());

// The bold style sheet doesn't change, so set it here once.
lineEdit_boilSg->setStyleSheet(this->pimpl->boldSS);
/// // The bold style sheet doesn't change, so set it here once.
/// lineEdit_boilSg->setStyleSheet(this->pimpl->boldSS);

// Disabled fields should change color, but not become unreadable. Mucking
// with the css seems the most reasonable way to do that.
QString tabDisabled = QString("QWidget:disabled { color: #000000; background: #F0F0F0 }");
tab_recipe->setStyleSheet(tabDisabled);
tabWidget_ingredients->setStyleSheet(tabDisabled);

return;
}

// Configures the range widgets for the bubbles
Expand Down Expand Up @@ -1830,7 +1831,6 @@ void MainWindow::lockRecipe(int state) {
qWidget_styleBox->setEnabled(enabled);
qWidget_equipmentBox->setEnabled(enabled);
lineEdit_batchSize->setEnabled(enabled);
lineEdit_boilSize->setEnabled(enabled);
lineEdit_efficiency->setEnabled(enabled);

// locked recipes cannot be deleted
Expand Down Expand Up @@ -1904,10 +1904,13 @@ void MainWindow::showChanges(QMetaProperty* prop) {
this->lineEdit_boilSize ->setQuantity(boilSize);
this->lineEdit_efficiency->setQuantity(this->pimpl->m_recipeObs->efficiency_pct());
this->lineEdit_boilTime ->setQuantity(this->pimpl->m_recipeObs->boil()->boilTime_mins());
this->lineEdit_boilSg ->setQuantity(this->pimpl->m_recipeObs->boilGrav());
this->lineEdit_name ->setCursorPosition(0);
this->lineEdit_batchSize ->setCursorPosition(0);
this->lineEdit_boilSize ->setCursorPosition(0);
this->lineEdit_efficiency->setCursorPosition(0);
this->lineEdit_boilTime ->setCursorPosition(0);
this->lineEdit_boilSg ->setCursorPosition(0);
/*
lineEdit_calcBatchSize->setText(this->pimpl->m_recipeObs);
lineEdit_calcBoilSize->setText(this->pimpl->m_recipeObs);
Expand All @@ -1929,7 +1932,6 @@ void MainWindow::showChanges(QMetaProperty* prop) {
else
lineEdit_calcBoilSize->setStyleSheet(this->pimpl->highSS);
*/
this->lineEdit_boilSg->setQuantity(this->pimpl->m_recipeObs->boilGrav());

auto style = this->pimpl->m_recipeObs->style();
if (style) {
Expand Down
161 changes: 68 additions & 93 deletions ui/mainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -367,49 +367,37 @@
</item>
<item row="2" column="1" colspan="2">
<widget class="QWidget" name="qWidget_styleBox" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<layout class="QVBoxLayout" name="styleSubLayout">
<item>
<widget class="StyleButton" name="styleButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>360</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="CustomComboBox" name="styleComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<property name="minimumSize">
<size>
<width>30</width>
<height>16777215</height>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">combobox-popup: 0;</string>
</property>
<property name="maxVisibleItems">
<number>15</number>
</property>
Expand All @@ -430,53 +418,47 @@
</item>
<item row="3" column="1" colspan="2">
<widget class="QWidget" name="qWidget_equipmentBox" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>1</number>
</property>
<layout class="QVBoxLayout" name="equipmentSubLayout">
<item>
<widget class="EquipmentButton" name="equipmentButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="CustomComboBox" name="equipmentComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<property name="minimumSize">
<size>
<width>30</width>
<height>16777215</height>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="maxVisibleItems">
<number>15</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="SmartLabel" name="label_targetBatchSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
Expand All @@ -499,67 +481,57 @@
</widget>
</item>
<item row="5" column="0">
<widget class="SmartLabel" name="label_targetBoilSize">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<widget class="QLabel" name="label_efficiency">
<property name="text">
<string>Tar&amp;get Boil Size</string>
<string>&amp;Efficiency (%)</string>
</property>
<property name="buddy">
<cstring>lineEdit_boilSize</cstring>
<cstring>lineEdit_efficiency</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="SmartLineEdit" name="lineEdit_boilSize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>false</bool>
<widget class="SmartLineEdit" name="lineEdit_efficiency">
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="frame">
<bool>false</bool>
<property name="toolTip">
<string>The extraction efficiency you expect</string>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_boilSizeExplanation">
<item row="6" column="0">
<widget class="SmartLabel" name="label_targetBoilSize">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="text">
<string>(See Boil tab below)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_efficiency">
<property name="text">
<string>&amp;Efficiency (%)</string>
<string>Tar&amp;get Boil Size</string>
</property>
<property name="buddy">
<cstring>lineEdit_efficiency</cstring>
<cstring>lineEdit_boilSize</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="SmartLineEdit" name="lineEdit_efficiency">
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<widget class="SmartLineEdit" name="lineEdit_boilSize">
<property name="toolTip">
<string>The extraction efficiency you expect</string>
<string>See Boil tab below</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<property name="enabled">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
Expand All @@ -571,14 +543,17 @@
<property name="text">
<string>Boil Time</string>
</property>
<property name="buddy">
<cstring>lineEdit_boilTime</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="SmartLineEdit" name="lineEdit_boilTime">
<property name="enabled">
<bool>false</bool>
<property name="toolTip">
<string>See Boil tab below</string>
</property>
<property name="mouseTracking">
<property name="enabled">
<bool>false</bool>
</property>
<property name="acceptDrops">
Expand All @@ -592,16 +567,6 @@
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_boilTimeExplanation">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="text">
<string>(See Boil tab below)</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="SmartLabel" name="label_boilSg">
<property name="contextMenuPolicy">
Expand All @@ -620,9 +585,6 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
Expand Down Expand Up @@ -667,6 +629,19 @@
</property>
</widget>
</item>
<item row="10" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
Expand Down

0 comments on commit 045d706

Please sign in to comment.