diff options
author | Arno <arno@disconnect.de> | 2017-12-19 07:47:19 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-12-19 07:47:19 +0100 |
commit | 61bca974eeb4f6385b501f9117f4c24b966762e1 (patch) | |
tree | 6b080cda304f509b69d8d46cec3c10a2f7624873 | |
parent | 56a97ec93598f3afdc37e9fece8eb045de5f4a22 (diff) | |
download | ShemovCleaner-61bca974eeb4f6385b501f9117f4c24b966762e1.tar.gz ShemovCleaner-61bca974eeb4f6385b501f9117f4c24b966762e1.tar.bz2 ShemovCleaner-61bca974eeb4f6385b501f9117f4c24b966762e1.zip |
Keep sort order and column when gathering torrent data
This was a bit more complicated than thought. Just calling
writeHeaderData unconditionally doesn't work, because it saves the
headers on startup, when the widget isn't visible yet, so all columns
have the same width. Fix it by checking if we're visible first.
That almost worked. Almost, because after startup some columns had a
different height! Setting uniformRowHeights() to true helped.
-rw-r--r-- | torrentwidget.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp index f93115b..72afb30 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -68,6 +68,7 @@ void TorrentWidget::setupGui(){ mFileView->setSortingEnabled(true); mFileView->setSelectionBehavior(QAbstractItemView::SelectRows); mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection); + mFileView->setUniformRowHeights(true); mModel = new QStandardItemModel; mProxy = new FileSorter; @@ -153,6 +154,9 @@ void TorrentWidget::createActions(){ void TorrentWidget::gatherData(){ rememberSelection(); + if(isVisible()){ + writeHeaderData(); + } QSqlDatabase db = QSqlDatabase::database("shemovdb"); if(!db.isOpen()){ db.open(); |