I created QTableView as below and want to select the top item as default selection.
proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(d->model);
d->ui->projects->setModel(proxyModel);
d->ui->projects->setSortingEnabled(true);
proxyModel->setFilterCaseSensitivity( Qt::CaseInsensitive );
proxyModel->setFilterKeyColumn(-1);
connect(d->ui->projects->model(),SIGNAL(dataChanged(QModelIndex,QModelIndex)),d,SLOT(selectTopOne()));
connect ( d->ui->search_phrase, SIGNAL( textChanged(QString)),
proxyModel, SLOT( setFilterWildcard(QString)) );
Note that d->ui->projects represents my QTableView. and d->ui->projects is text edit use to grab search string.
I tried to select top item of my table view by calling Slot selectTopOne through the dataChanged signala. But it is not calling for Slot.
And I tried to select row with Qmodelindex (0,0). But it not worked too.
EDIT:
This is How my QTableview appears now.
This is What I need to do. I need to select first row automatically.
According to the Text Edit on top items of QTableview filtered. I want to select top item at that time too.