Merge pull request #4849 from CookiePLMonster/qt-buttons-fix

Fixed behaviour of some buttons by connecting functors to correct signals
This commit is contained in:
Pengfei Zhu 2019-07-23 07:41:46 +08:00 committed by GitHub
commit 077eacd419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 21 deletions

View File

@ -30,16 +30,16 @@ CheatDialog::CheatDialog(QWidget* parent)
"{:016X}", Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id); "{:016X}", Core::System::GetInstance().Kernel().GetCurrentProcess()->codeset->program_id);
ui->labelTitle->setText(tr("Title ID: %1").arg(QString::fromStdString(game_id))); ui->labelTitle->setText(tr("Title ID: %1").arg(QString::fromStdString(game_id)));
connect(ui->buttonClose, &QPushButton::released, this, &CheatDialog::OnCancel); connect(ui->buttonClose, &QPushButton::clicked, this, &CheatDialog::OnCancel);
connect(ui->buttonAddCheat, &QPushButton::released, this, &CheatDialog::OnAddCheat); connect(ui->buttonAddCheat, &QPushButton::clicked, this, &CheatDialog::OnAddCheat);
connect(ui->tableCheats, &QTableWidget::cellClicked, this, &CheatDialog::OnRowSelected); connect(ui->tableCheats, &QTableWidget::cellClicked, this, &CheatDialog::OnRowSelected);
connect(ui->lineName, &QLineEdit::textEdited, this, &CheatDialog::OnTextEdited); connect(ui->lineName, &QLineEdit::textEdited, this, &CheatDialog::OnTextEdited);
connect(ui->textNotes, &QPlainTextEdit::textChanged, this, &CheatDialog::OnTextEdited); connect(ui->textNotes, &QPlainTextEdit::textChanged, this, &CheatDialog::OnTextEdited);
connect(ui->textCode, &QPlainTextEdit::textChanged, this, &CheatDialog::OnTextEdited); connect(ui->textCode, &QPlainTextEdit::textChanged, this, &CheatDialog::OnTextEdited);
connect(ui->buttonSave, &QPushButton::released, connect(ui->buttonSave, &QPushButton::clicked,
[this] { SaveCheat(ui->tableCheats->currentRow()); }); [this] { SaveCheat(ui->tableCheats->currentRow()); });
connect(ui->buttonDelete, &QPushButton::released, this, &CheatDialog::OnDeleteCheat); connect(ui->buttonDelete, &QPushButton::clicked, this, &CheatDialog::OnDeleteCheat);
LoadCheats(); LoadCheats();
} }

View File

@ -19,7 +19,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
ui->setupUi(this); ui->setupUi(this);
SetConfiguration(); SetConfiguration();
connect(ui->open_log_button, &QPushButton::pressed, []() { connect(ui->open_log_button, &QPushButton::clicked, []() {
QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir)); QString path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::LogDir));
QDesktopServices::openUrl(QUrl::fromLocalFile(path)); QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}); });

View File

@ -136,7 +136,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
if (!button_map[button_id]) if (!button_map[button_id])
continue; continue;
button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu); button_map[button_id]->setContextMenuPolicy(Qt::CustomContextMenu);
connect(button_map[button_id], &QPushButton::released, [=]() { connect(button_map[button_id], &QPushButton::clicked, [=]() {
HandleClick(button_map[button_id], HandleClick(button_map[button_id],
[=](const Common::ParamPackage& params) { [=](const Common::ParamPackage& params) {
buttons_param[button_id] = params; buttons_param[button_id] = params;
@ -173,7 +173,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
continue; continue;
analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy( analog_map_buttons[analog_id][sub_button_id]->setContextMenuPolicy(
Qt::CustomContextMenu); Qt::CustomContextMenu);
connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::released, [=]() { connect(analog_map_buttons[analog_id][sub_button_id], &QPushButton::clicked, [=]() {
HandleClick(analog_map_buttons[analog_id][sub_button_id], HandleClick(analog_map_buttons[analog_id][sub_button_id],
[=](const Common::ParamPackage& params) { [=](const Common::ParamPackage& params) {
SetAnalogButton(params, analogs_param[analog_id], SetAnalogButton(params, analogs_param[analog_id],
@ -206,7 +206,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
menu_location)); menu_location));
}); });
} }
connect(analog_map_stick[analog_id], &QPushButton::released, [=]() { connect(analog_map_stick[analog_id], &QPushButton::clicked, [=]() {
QMessageBox::information(this, tr("Information"), QMessageBox::information(this, tr("Information"),
tr("After pressing OK, first move your joystick horizontally, " tr("After pressing OK, first move your joystick horizontally, "
"and then vertically.")); "and then vertically."));
@ -220,18 +220,19 @@ ConfigureInput::ConfigureInput(QWidget* parent)
}); });
} }
connect(ui->buttonMotionTouch, &QPushButton::released, [this] { connect(ui->buttonMotionTouch, &QPushButton::clicked, [this] {
QDialog* motion_touch_dialog = new ConfigureMotionTouch(this); QDialog* motion_touch_dialog = new ConfigureMotionTouch(this);
return motion_touch_dialog->exec(); return motion_touch_dialog->exec();
}); });
ui->buttonDelete->setEnabled(ui->profile->count() > 1); ui->buttonDelete->setEnabled(ui->profile->count() > 1);
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); connect(ui->buttonClearAll, &QPushButton::clicked, this, &ConfigureInput::ClearAll);
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { RestoreDefaults(); }); connect(ui->buttonRestoreDefaults, &QPushButton::clicked, this,
connect(ui->buttonNew, &QPushButton::released, [this] { NewProfile(); }); &ConfigureInput::RestoreDefaults);
connect(ui->buttonDelete, &QPushButton::released, [this] { DeleteProfile(); }); connect(ui->buttonNew, &QPushButton::clicked, this, &ConfigureInput::NewProfile);
connect(ui->buttonRename, &QPushButton::released, [this] { RenameProfile(); }); connect(ui->buttonDelete, &QPushButton::clicked, this, &ConfigureInput::DeleteProfile);
connect(ui->buttonRename, &QPushButton::clicked, this, &ConfigureInput::RenameProfile);
connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int i) { [this](int i) {

View File

@ -189,9 +189,9 @@ ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::C
// Connect all the widgets to the appropriate events // Connect all the widgets to the appropriate events
connect(ui->player_view, &QTreeView::customContextMenuRequested, this, connect(ui->player_view, &QTreeView::customContextMenuRequested, this,
&ChatRoom::PopupContextMenu); &ChatRoom::PopupContextMenu);
connect(ui->chat_message, &QLineEdit::returnPressed, ui->send_message, &QPushButton::pressed); connect(ui->chat_message, &QLineEdit::returnPressed, this, &ChatRoom::OnSendChat);
connect(ui->chat_message, &QLineEdit::textChanged, this, &::ChatRoom::OnChatTextChanged); connect(ui->chat_message, &QLineEdit::textChanged, this, &ChatRoom::OnChatTextChanged);
connect(ui->send_message, &QPushButton::pressed, this, &ChatRoom::OnSendChat); connect(ui->send_message, &QPushButton::clicked, this, &ChatRoom::OnSendChat);
} }
ChatRoom::~ChatRoom() = default; ChatRoom::~ChatRoom() = default;

View File

@ -40,7 +40,7 @@ ClientRoomWindow::ClientRoomWindow(QWidget* parent)
// TODO (jroweboy) network was not initialized? // TODO (jroweboy) network was not initialized?
} }
connect(ui->disconnect, &QPushButton::pressed, [this] { Disconnect(); }); connect(ui->disconnect, &QPushButton::clicked, this, &ClientRoomWindow::Disconnect);
ui->disconnect->setDefault(false); ui->disconnect->setDefault(false);
ui->disconnect->setAutoDefault(false); ui->disconnect->setAutoDefault(false);
connect(ui->moderation, &QPushButton::clicked, [this] { connect(ui->moderation, &QPushButton::clicked, [this] {

View File

@ -45,7 +45,7 @@ DirectConnectWindow::DirectConnectWindow(QWidget* parent)
// TODO(jroweboy): Show or hide the connection options based on the current value of the combo // TODO(jroweboy): Show or hide the connection options based on the current value of the combo
// box. Add this back in when the traversal server support is added. // box. Add this back in when the traversal server support is added.
connect(ui->connect, &QPushButton::pressed, this, &DirectConnectWindow::Connect); connect(ui->connect, &QPushButton::clicked, this, &DirectConnectWindow::Connect);
} }
DirectConnectWindow::~DirectConnectWindow() = default; DirectConnectWindow::~DirectConnectWindow() = default;

View File

@ -49,7 +49,7 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
ui->game_list->setModel(proxy); ui->game_list->setModel(proxy);
// Connect all the widgets to the appropriate events // Connect all the widgets to the appropriate events
connect(ui->host, &QPushButton::pressed, this, &HostRoomWindow::Host); connect(ui->host, &QPushButton::clicked, this, &HostRoomWindow::Host);
// Restore the settings: // Restore the settings:
ui->username->setText(UISettings::values.room_nickname); ui->username->setText(UISettings::values.room_nickname);

View File

@ -63,7 +63,7 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
} }
// UI Buttons // UI Buttons
connect(ui->refresh_list, &QPushButton::pressed, this, &Lobby::RefreshLobby); connect(ui->refresh_list, &QPushButton::clicked, this, &Lobby::RefreshLobby);
connect(ui->games_owned, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterOwned); connect(ui->games_owned, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterOwned);
connect(ui->hide_full, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterFull); connect(ui->hide_full, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterFull);
connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch); connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch);