Frage

I have two tableViews, in one I load album names, in the other I want to load tracks from selected album.

Problem is simple: I can't use signals such as activated, mouse clicked, etc. I want to change stuff in the tracks tableView simply by the highlighting row in the album names tableView.

Summary: emit signal when user changes row and find out on which row he is now.

War es hilfreich?

Lösung

See the Handling selection of items section in the Qt Model/Views documentation.

In essence, what you need to use is your QTableView's selection model which has signals for when the selection changes in the table. You access the view's selection model via it's selectionModel() member function.

Andere Tipps

Ok,so i have solved this problem like this:

First, you must obtain QItemSelectionModel !after! the table was filled:

QItemSelectionModel *select = ui->tableView->selectionModel();

Then connect SIGNAL "selectionChanged" with you own SLOT function:

connect(select, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(change_table()));

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top