質問

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.

役に立ちましたか?

解決

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.

他のヒント

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()));

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top