0

How can I make a QListView emit a custom SIGNAL called onListViewItemSelectionChanged whenever its item selection has been changed either by clicking or by using the up and down arrow keys, so that I could assign a custom SLOT called changeLineEditText to handle the SIGNAL?

ymoreau
  • 3,402
  • 1
  • 22
  • 60
Bhaddiya Tanchangya
  • 331
  • 1
  • 5
  • 12

1 Answers1

0

You can take selectionModel of the list view and connect your slot to its currentChanged signal :

connect(listView->selectionModel(),SIGNAL(​currentChanged(const QModelIndex &,const QModelIndex &)),
        this,SLOT(changeLineEditText(const QModelIndex &,const QModelIndex &)));

Here the first argument is the current selected index and the second one is the previous index.

Nejat
  • 31,784
  • 12
  • 106
  • 138