diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp index 3d7d88c7c..ccab5fde3 100644 --- a/src/blackgui/components/mainkeypadareacomponent.cpp +++ b/src/blackgui/components/mainkeypadareacomponent.cpp @@ -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(QObject::sender()); + if (!pb) { return; } + pb->setEnabled(false); + QTimer::singleShot(750, [pb] { pb->setEnabled(true); }); } } // namespace } // namespace diff --git a/src/blackgui/components/mainkeypadareacomponent.h b/src/blackgui/components/mainkeypadareacomponent.h index bda8c8ac7..9e0899b2a 100644 --- a/src/blackgui/components/mainkeypadareacomponent.h +++ b/src/blackgui/components/mainkeypadareacomponent.h @@ -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; BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") }; };