Skip to content

Commit

Permalink
Make size of text box in 'Settings' window fixed
Browse files Browse the repository at this point in the history
This fixes the window resizing with long descriptions for options, which causes problems with Gamescope and as a result Steam Deck, as well as when maximizing the Settings window on normal desktops
  • Loading branch information
tomboylover93 committed Jan 8, 2025
1 parent 2fb410b commit 0c78d0c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
16 changes: 0 additions & 16 deletions src/qt_gui/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,22 +510,6 @@ bool SettingsDialog::eventFilter(QObject* obj, QEvent* event) {
} else {
ui->descriptionText->setText(defaultTextEdit);
}

// if the text exceeds the size of the box, it will increase the size
QRect currentGeometry = this->geometry();
int newWidth = currentGeometry.width();

int documentHeight = ui->descriptionText->document()->size().height();
int visibleHeight = ui->descriptionText->viewport()->height();
if (documentHeight > visibleHeight) {
ui->descriptionText->setMaximumSize(16777215, 110);
this->setGeometry(currentGeometry.x(), currentGeometry.y(), newWidth,
currentGeometry.height() + 40);
} else {
ui->descriptionText->setMaximumSize(16777215, 70);
this->setGeometry(currentGeometry.x(), currentGeometry.y(), newWidth,
initialHeight);
}
return true;
}
}
Expand Down
22 changes: 14 additions & 8 deletions src/qt_gui/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<x>0</x>
<y>0</y>
<width>970</width>
<height>750</height>
<height>820</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -67,8 +67,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>932</width>
<height>593</height>
<width>946</width>
<height>605</height>
</rect>
</property>
<layout class="QVBoxLayout" name="generalTabVLayout" stretch="0">
Expand Down Expand Up @@ -638,7 +638,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>585</height>
<height>595</height>
</rect>
</property>
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0">
Expand Down Expand Up @@ -922,7 +922,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>585</height>
<height>595</height>
</rect>
</property>
<layout class="QVBoxLayout" name="graphicsTabVLayout" stretch="0,0">
Expand Down Expand Up @@ -1176,7 +1176,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>585</height>
<height>595</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pathsTabLayout" stretch="0">
Expand Down Expand Up @@ -1233,7 +1233,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>585</height>
<height>595</height>
</rect>
</property>
<layout class="QVBoxLayout" name="debugTabVLayout" stretch="0,1">
Expand Down Expand Up @@ -1404,10 +1404,16 @@
</item>
<item>
<widget class="QTextEdit" name="descriptionText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
<height>120</height>
</size>
</property>
<property name="readOnly">
Expand Down

0 comments on commit 0c78d0c

Please sign in to comment.