From d86cb62dc06aa392db93ddbda6fbd74042cd877b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 9 Nov 2009 11:54:47 +0000 Subject: [PATCH] - Clearing of fiels list in properties was a bit too efficient (it removed header too) --- src/PropListDelegate.h | 3 +++ src/propertieswidget.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PropListDelegate.h b/src/PropListDelegate.h index d77bbb5fe..9a167c7d5 100644 --- a/src/PropListDelegate.h +++ b/src/PropListDelegate.h @@ -113,6 +113,7 @@ class PropListDelegate: public QItemDelegate { } QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex & index) const { + qDebug("CreateEditor called"); if(index.column() != PRIORITY) return 0; QComboBox* editor = new QComboBox(parent); editor->setFocusPolicy(Qt::StrongFocus); @@ -124,6 +125,7 @@ class PropListDelegate: public QItemDelegate { } void setEditorData(QWidget *editor, const QModelIndex &index) const { + qDebug("setEditorData called"); unsigned short val = index.model()->data(index, Qt::DisplayRole).toInt(); QComboBox *combobox = static_cast(editor); qDebug("Set Editor data: Prio is %d", val); @@ -213,6 +215,7 @@ class PropListDelegate: public QItemDelegate { } void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const { + qDebug("UpdateEditor Geometry called"); editor->setGeometry(option.rect); } diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index 2261b848b..cd0534b88 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -161,7 +161,7 @@ void PropertiesWidget::clear() { dlTotal->clear(); shareRatio->clear(); listWebSeeds->clear(); - PropListModel->clear(); + PropListModel->removeRows(0, PropListModel->rowCount()); setEnabled(false); } @@ -207,7 +207,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { std::vector files_priority = loadFilesPriorities(); // List files in torrent arborescence *arb = new arborescence(h.get_torrent_info(), fp, files_priority); - PropListModel->clear(); + PropListModel->removeRows(0, PropListModel->rowCount()); addFilesToTree(arb->getRoot(), PropListModel->invisibleRootItem()); // Increase first column width //filesList->resizeColumnToContents(0); // does not work