문제

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