Allow vertical scrolling in input configuration

On screens that are of limited height (like the Steam Deck), certain
buttons of the input configuration are cut off and cannot be accessed.
Now a vertical scrollbar will show up when the minimum height is not
available.
This commit is contained in:
Joshua Goins 2023-05-16 15:24:27 -04:00
parent e3df744955
commit f2c5af2de7
2 changed files with 20 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include <memory>
#include <thread>
#include <QScrollArea>
#include "core/core.h"
#include "core/hid/emulated_controller.h"
@ -112,7 +113,13 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem,
for (std::size_t i = 0; i < player_tabs.size(); ++i) {
player_tabs[i]->setLayout(new QHBoxLayout(player_tabs[i]));
player_tabs[i]->layout()->addWidget(player_controllers[i]);
auto scroll_area = new QScrollArea(player_tabs[i]);
player_tabs[i]->layout()->addWidget(scroll_area);
scroll_area->setWidget(player_controllers[i]);
scroll_area->setWidgetResizable(true);
scroll_area->setFrameShape(QFrame::Shape::NoFrame);
connect(player_controllers[i], &ConfigureInputPlayer::Connected, [&, i](bool is_connected) {
// Ensures that the controllers are always connected in sequential order
if (is_connected) {

View file

@ -10,6 +10,18 @@
<height>487</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>743</height>
</size>
</property>
<property name="windowTitle">
<string>Configure Input</string>
</property>