From 22d5bcbcb79dea84e7aab4e2032ae3638fbca581 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 16 Sep 2016 11:07:37 +0200 Subject: Always select and set current first row --- torrentwidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'torrentwidget.cpp') diff --git a/torrentwidget.cpp b/torrentwidget.cpp index f7b51df..bb392d0 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -326,6 +326,13 @@ void TorrentWidget::fileSelectionChanged(const QItemSelection &selected, const Q emit selectionCountChanged(msg); } +void TorrentWidget::selectFirst(){ + if(mModel->rowCount() > 0){ + QModelIndex idx = mModel->index(0, 0); + mFileView->selectionModel()->select(idx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); + } +} + void TorrentWidget::readSettings(){ QSettings s; QString dir = s.value("searchdir", QDir::toNativeSeparators(QDir::homePath())).toString(); -- cgit v1.2.3-70-g09d2