Send events when items are selected from keyboard in wxListBox
Handle selection rather than clicks in wxListBox in wxQt to allow keyboard interactions to generate events. Closes https://github.com/wxWidgets/wxWidgets/pull/1526
This commit is contained in:
committed by
Vadim Zeitlin
parent
1214676988
commit
631ce0e380
@@ -19,7 +19,7 @@ public:
|
||||
wxQtListWidget( wxWindow *parent, wxListBox *handler );
|
||||
|
||||
private:
|
||||
void clicked( const QModelIndex &index );
|
||||
void OnCurrentItemChange(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void doubleClicked( const QModelIndex &index );
|
||||
void itemChanged(QListWidgetItem *item);
|
||||
};
|
||||
@@ -27,16 +27,22 @@ private:
|
||||
wxQtListWidget::wxQtListWidget( wxWindow *parent, wxListBox *handler )
|
||||
: wxQtEventSignalHandler< QListWidget, wxListBox >( parent, handler )
|
||||
{
|
||||
connect(this, &QListWidget::clicked, this, &wxQtListWidget::clicked);
|
||||
connect(this, &QListWidget::currentItemChanged, this, &wxQtListWidget::OnCurrentItemChange);
|
||||
connect(this, &QListWidget::doubleClicked, this, &wxQtListWidget::doubleClicked);
|
||||
connect(this, &QListWidget::itemChanged, this, &wxQtListWidget::itemChanged);
|
||||
}
|
||||
|
||||
void wxQtListWidget::clicked(const QModelIndex &index )
|
||||
void wxQtListWidget::OnCurrentItemChange(QListWidgetItem *current, QListWidgetItem *)
|
||||
{
|
||||
if ( !current )
|
||||
return;
|
||||
|
||||
wxListBox *handler = GetHandler();
|
||||
if ( handler )
|
||||
{
|
||||
const QModelIndex &index = indexFromItem(current);
|
||||
handler->QtSendEvent(wxEVT_LISTBOX, index.row(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void wxQtListWidget::doubleClicked( const QModelIndex &index )
|
||||
|
Reference in New Issue
Block a user