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 -------------------------------------------------------------
// list view
QObject::connect ( ListViewServers,
SIGNAL ( itemClicked ( QTreeWidgetItem*, int ) ),
this, SLOT ( OnServerListItemClicked ( QTreeWidgetItem*, int ) ) );
SIGNAL ( itemSelectionChanged() ),
this, SLOT ( OnServerListItemSelectionChanged() ) );
QObject::connect ( ListViewServers,
SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ),
@ -268,16 +268,21 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
}
void CConnectDlg::OnServerListItemClicked ( QTreeWidgetItem* Item,
int )
void CConnectDlg::OnServerListItemSelectionChanged()
{
// if an item is clicked, copy the server name to the combo box
if ( Item != 0 )
// get current selected item (we are only interested in the first selcted
// 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
LineEditServerAddr->blockSignals ( true );
{
LineEditServerAddr->setEditText ( Item->text ( 0 ) );
LineEditServerAddr->setEditText (
CurSelListItemList[0]->text ( 0 ) );
}
LineEditServerAddr->blockSignals ( false );
}

View file

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