From c59793b33fbf8f0e2eb142addd1c6bb6f5c4e73a Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 2 Feb 2014 19:59:22 +0200 Subject: [PATCH] Correctly restore 'name' column width when loading magnet links in the 'Add new torrent dialog'. Closes #1334. --- src/addnewtorrentdialog.cpp | 6 +++--- src/addnewtorrentdialog.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/addnewtorrentdialog.cpp b/src/addnewtorrentdialog.cpp index 3580f882c..520bc9682 100644 --- a/src/addnewtorrentdialog.cpp +++ b/src/addnewtorrentdialog.cpp @@ -104,9 +104,7 @@ void AddNewTorrentDialog::loadState() { QIniSettings settings; settings.beginGroup(QString::fromUtf8("AddNewTorrentDialog")); - QByteArray state = settings.value("treeHeaderState").toByteArray(); - if (!state.isEmpty()) - ui->content_tree->header()->restoreState(state); + m_headerState = settings.value("treeHeaderState").toByteArray(); int width = settings.value("width", -1).toInt(); if (width >= 0) { QRect geo = geometry(); @@ -659,6 +657,8 @@ void AddNewTorrentDialog::setupTreeview() { // List files in torrent m_contentModel->model()->setupModelData(*m_torrentInfo); + if (!m_headerState.isEmpty()) + ui->content_tree->header()->restoreState(m_headerState); // Expand root folder ui->content_tree->setExpanded(m_contentModel->index(0, 0), true); diff --git a/src/addnewtorrentdialog.h b/src/addnewtorrentdialog.h index 96580b846..1e1bfb2ae 100644 --- a/src/addnewtorrentdialog.h +++ b/src/addnewtorrentdialog.h @@ -99,6 +99,7 @@ private: QStringList m_filesPath; bool m_hasRenamedFile; QShortcut *editHotkey; + QByteArray m_headerState; }; #endif // ADDNEWTORRENTDIALOG_H