Skip to content

Commit

Permalink
fix: OptionWidget; Adjust the controller mapping combobox size
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Jun 6, 2024
1 parent cf8055a commit 9eb2d44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/widgets/data/OptionsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,12 @@ void OptionsWidget::setControllerMappingVisible(bool visible)
QGridLayout *OptionsWidget::makeControllerLayout()
{
auto finalLayout = new QGridLayout;
const int fmh = fontMetrics().height();
for (int i = 0; i < 16; i++) {
lblInputs[i]->setAlignment(Qt::AlignRight);
auto comboBox = new QComboBox;
comboBox->setObjectName(_inputNames.at(i));
comboBox->setIconSize(QSize(fontMetrics().height(), fontMetrics().height()));
comboBox->setIconSize(QSize(fmh * 1.5, fmh * 1.5));
comboBox->addItem(QString());
comboBox->addItem(QString());
comboBox->addItem(QString());
Expand All @@ -423,6 +424,7 @@ QGridLayout *OptionsWidget::makeControllerLayout()
comboBox->addItem(QString());
comboBox->addItem(QString());
comboBox->addItem(QString());
comboBox->setFixedWidth(fmh * 3);

connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [comboBox, i, this] {
Q_EMIT inputChanged(i, comboBox->currentIndex());
Expand All @@ -438,7 +440,7 @@ QGridLayout *OptionsWidget::makeControllerLayout()

void OptionsWidget::setInput(int controlAction, int newButton)
{
QComboBox *inputCombo = centerWidget->findChild<QComboBox *>(_actionNames.at(controlAction));
QComboBox *inputCombo = centerWidget->findChild<QComboBox *>()_actionNames.at(controlAction));
if (inputCombo->currentIndex() == newButton)
return;

Expand Down

0 comments on commit 9eb2d44

Please sign in to comment.