mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +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
|
// non info areas
|
||||||
connect(ui->pb_Connect, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
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_CockpitIdent, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||||
connect(ui->pb_Opacity050, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
connect(ui->pb_Opacity050, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||||
connect(ui->pb_Opacity100, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
connect(ui->pb_Opacity100, &QPushButton::pressed, this, &CMainKeypadAreaComponent::buttonSelected);
|
||||||
@@ -251,6 +252,10 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CMainKeypadAreaComponent::disableButtonBriefly()
|
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
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ namespace BlackGui
|
|||||||
//! Info area buttons
|
//! Info area buttons
|
||||||
void unsetInfoAreaButtons();
|
void unsetInfoAreaButtons();
|
||||||
|
|
||||||
|
//! Disable button for some (short) time to avoid double click
|
||||||
|
void disableButtonBriefly();
|
||||||
|
|
||||||
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
||||||
BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") };
|
BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") };
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user