mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Ref T146, avoid double clicks for "connect button" using disableButtonBriefly
This commit is contained in:
committed by
Mathew Sutcliffe
parent
b6ca59eda8
commit
adfd341cbc
@@ -55,6 +55,7 @@ namespace BlackGui
|
||||
|
||||
// non info areas
|
||||
connect(ui->pb_Connect, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||
connect(ui->pb_Connect, &QPushButton::pressed, this, &CMainKeypadAreaComponent::disableButtonBriefly);
|
||||
connect(ui->pb_CockpitIdent, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||
connect(ui->pb_Opacity050, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||
connect(ui->pb_Opacity100, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||
@@ -251,6 +252,10 @@ namespace BlackGui
|
||||
|
||||
void CMainKeypadAreaComponent::disableButtonBriefly()
|
||||
{
|
||||
QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
|
||||
if (!pb) { return; }
|
||||
pb->setEnabled(false);
|
||||
QTimer::singleShot(750, [pb] { pb->setEnabled(true); });
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -98,6 +98,9 @@ namespace BlackGui
|
||||
//! Info area buttons
|
||||
void unsetInfoAreaButtons();
|
||||
|
||||
//! Disable button for some (short) time to avoid double click
|
||||
void disableButtonBriefly();
|
||||
|
||||
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
||||
BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user