fix for issue with selection change in server list be up/down arrow keys

This commit is contained in:
Volker Fischer 2011-05-01 20:48:38 +00:00
parent 44ff64cc48
commit 99432273c8
2 changed files with 382 additions and 377 deletions

View file

@ -66,8 +66,8 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// list view // list view
QObject::connect ( ListViewServers, QObject::connect ( ListViewServers,
SIGNAL ( itemClicked ( QTreeWidgetItem*, int ) ), SIGNAL ( itemSelectionChanged() ),
this, SLOT ( OnServerListItemClicked ( QTreeWidgetItem*, int ) ) ); this, SLOT ( OnServerListItemSelectionChanged() ) );
QObject::connect ( ListViewServers, QObject::connect ( ListViewServers,
SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ), SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ),
@ -268,16 +268,21 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS ); TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
} }
void CConnectDlg::OnServerListItemClicked ( QTreeWidgetItem* Item, void CConnectDlg::OnServerListItemSelectionChanged()
int )
{ {
// if an item is clicked, copy the server name to the combo box // get current selected item (we are only interested in the first selcted
if ( Item != 0 ) // item)
QList<QTreeWidgetItem*> CurSelListItemList =
ListViewServers->selectedItems();
// if an item is clicked/selected, copy the server name to the combo box
if ( CurSelListItemList.count() > 0 )
{ {
// make sure no signals are send when we change the text // make sure no signals are send when we change the text
LineEditServerAddr->blockSignals ( true ); LineEditServerAddr->blockSignals ( true );
{ {
LineEditServerAddr->setEditText ( Item->text ( 0 ) ); LineEditServerAddr->setEditText (
CurSelListItemList[0]->text ( 0 ) );
} }
LineEditServerAddr->blockSignals ( false ); LineEditServerAddr->blockSignals ( false );
} }

View file

@ -84,7 +84,7 @@ protected:
bool bServerListItemWasChosen; bool bServerListItemWasChosen;
public slots: public slots:
void OnServerListItemClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemSelectionChanged();
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnLineEditServerAddrEditTextChanged ( const QString& ); void OnLineEditServerAddrEditTextChanged ( const QString& );
void OnConnectButtonClicked(); void OnConnectButtonClicked();