support for cancel button

This commit is contained in:
Volker Fischer 2011-04-23 16:00:42 +00:00
parent 398a00ba73
commit 4e593c4baa
2 changed files with 19 additions and 2 deletions

View File

@ -63,6 +63,10 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
// Connections -------------------------------------------------------------
// buttons
QObject::connect ( CancelButton, SIGNAL ( clicked() ),
this, SLOT ( OnCancelButtonClicked() ) );
// line edits
QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ),
this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) );
@ -70,6 +74,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ),
this, SLOT ( OnLineEditServerAddrActivated ( int ) ) );
// timers
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPing() ) );
@ -92,9 +97,10 @@ void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddress )
void CConnectDlg::showEvent ( QShowEvent* )
{
// reset flag (on opening the connect dialg, we always want to request a new
// updated server list per definition)
// reset flags (on opening the connect dialg, we always want to request a
// new updated server list per definition)
bServerListReceived = false;
bCancelPressed = false;
// TEST
@ -233,6 +239,15 @@ void CConnectDlg::OnLineEditServerAddrTextChanged ( const QString )
}
}
void CConnectDlg::OnCancelButtonClicked()
{
// set cancel flag
bCancelPressed = true;
// close dialog
close();
}
void CConnectDlg::OnLineEditServerAddrActivated ( int index )
{
// move activated list item to the top

View File

@ -73,8 +73,10 @@ protected:
QTimer TimerReRequestServList;
CHostAddress CentralServerAddress;
bool bServerListReceived;
bool bCancelPressed;
public slots:
void OnCancelButtonClicked();
void OnLineEditServerAddrTextChanged ( const QString );
void OnLineEditServerAddrActivated ( int index );
void OnTimerPing();