Don't scroll the settings window when opening it

This commit is contained in:
Guillaume Meunier
2024-11-03 14:24:05 +01:00
parent 792feecbe9
commit 4c6e10dc57
+6 -5
View File
@@ -135,11 +135,6 @@ settings::settings(wivrn_server * server_interface) :
connect(ui->combo_select_game, &QComboBox::currentIndexChanged, this, &settings::on_selected_game_changed);
connect(ui->button_game_browse, &QPushButton::clicked, this, &settings::on_browse_game);
// Use a queued connection so that the slot is called after the widgets have been laid out
connect(ui->radio_manual_encoder, &QRadioButton::toggled, this, [&](bool value) {
if (value)
ui->scrollArea->ensureWidgetVisible(ui->layout_encoder_config); }, Qt::QueuedConnection);
connect(ui->partitionner, &rectangle_partitionner::selected_index_change, this, &settings::selected_rectangle_changed);
connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_selected_encoder_changed);
@@ -154,6 +149,12 @@ settings::settings(wivrn_server * server_interface) :
fill_steam_games_list();
load_settings();
// Use a queued connection so that the slot is called after the widgets have been laid out
// Set up the signal connection after loading to avoid scrolling when opening the window
connect(ui->radio_manual_encoder, &QRadioButton::toggled, this, [&](bool value) {
if (value)
ui->scrollArea->ensureWidgetVisible(ui->layout_encoder_config); }, Qt::QueuedConnection);
auto encoders = dynamic_cast<QStandardItemModel *>(ui->encoder->model());
#if !WIVRN_USE_NVENC
encoders->item(1)->setEnabled(false);