fix for connect dialog and selected items in the list view when the combo box is changed

This commit is contained in:
Volker Fischer 2011-05-01 20:36:12 +00:00
parent 50cf3e54dc
commit 44ff64cc48
2 changed files with 19 additions and 1 deletions

View file

@ -73,6 +73,11 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ),
this, SLOT ( OnServerListItemDoubleClicked ( QTreeWidgetItem*, int ) ) ); this, SLOT ( OnServerListItemDoubleClicked ( QTreeWidgetItem*, int ) ) );
// combo boxes
QObject::connect ( LineEditServerAddr,
SIGNAL ( editTextChanged ( const QString& ) ),
this, SLOT ( OnLineEditServerAddrEditTextChanged ( const QString& ) ) );
// buttons // buttons
QObject::connect ( CancelButton, SIGNAL ( clicked() ), QObject::connect ( CancelButton, SIGNAL ( clicked() ),
this, SLOT ( close() ) ); this, SLOT ( close() ) );
@ -269,7 +274,12 @@ void CConnectDlg::OnServerListItemClicked ( QTreeWidgetItem* Item,
// if an item is clicked, copy the server name to the combo box // if an item is clicked, copy the server name to the combo box
if ( Item != 0 ) if ( Item != 0 )
{ {
LineEditServerAddr->setEditText ( Item->text ( 0 ) ); // make sure no signals are send when we change the text
LineEditServerAddr->blockSignals ( true );
{
LineEditServerAddr->setEditText ( Item->text ( 0 ) );
}
LineEditServerAddr->blockSignals ( false );
} }
} }
@ -284,6 +294,13 @@ void CConnectDlg::OnServerListItemDoubleClicked ( QTreeWidgetItem* Item,
} }
} }
void CConnectDlg::OnLineEditServerAddrEditTextChanged ( const QString& )
{
// in the server address combo box, a text was changed, remove selection
// in the server list (if any)
ListViewServers->clearSelection();
}
void CConnectDlg::OnConnectButtonClicked() void CConnectDlg::OnConnectButtonClicked()
{ {
// set state OK flag // set state OK flag

View file

@ -86,6 +86,7 @@ protected:
public slots: public slots:
void OnServerListItemClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemClicked ( QTreeWidgetItem* Item, int );
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnLineEditServerAddrEditTextChanged ( const QString& );
void OnConnectButtonClicked(); void OnConnectButtonClicked();
void OnTimerPing(); void OnTimerPing();
void OnTimerReRequestServList(); void OnTimerReRequestServList();