fixed missing deletes in search dialog

This commit is contained in:
csoler 2020-12-23 20:48:03 +01:00
parent a2eced6d4a
commit bb1996725d
2 changed files with 14 additions and 6 deletions

View File

@ -154,8 +154,8 @@ SearchDialog::SearchDialog(QWidget *parent)
// To allow a proper sorting, be careful to pad at right with spaces. This // To allow a proper sorting, be careful to pad at right with spaces. This
// is achieved by using QString("%1").arg(number,15,10). // is achieved by using QString("%1").arg(number,15,10).
// //
ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, new RSHumanReadableSizeDelegate()) ; ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, mSizeColumnDelegate=new RSHumanReadableSizeDelegate()) ;
ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, new RSHumanReadableAgeDelegate()) ; ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, mAgeColumnDelegate=new RSHumanReadableAgeDelegate()) ;
/* make it extended selection */ /* make it extended selection */
ui.searchResultWidget -> setSelectionMode(QAbstractItemView::ExtendedSelection); ui.searchResultWidget -> setSelectionMode(QAbstractItemView::ExtendedSelection);
@ -225,12 +225,17 @@ SearchDialog::~SearchDialog()
// save settings // save settings
processSettings(false); processSettings(false);
if (compareSummaryRole) { if (compareSummaryRole)
delete(compareSummaryRole); delete(compareSummaryRole);
}
if (compareResultRole) { if (compareResultRole)
delete(compareResultRole); delete(compareResultRole);
}
delete mSizeColumnDelegate;
delete mAgeColumnDelegate;
ui.searchResultWidget->setItemDelegateForColumn(SR_SIZE_COL, nullptr);
ui.searchResultWidget->setItemDelegateForColumn(SR_AGE_COL, nullptr);
} }
void SearchDialog::processSettings(bool bLoad) void SearchDialog::processSettings(bool bLoad)

View File

@ -156,6 +156,9 @@ private:
RSTreeWidgetItemCompareRole *compareSummaryRole; RSTreeWidgetItemCompareRole *compareSummaryRole;
RSTreeWidgetItemCompareRole *compareResultRole; RSTreeWidgetItemCompareRole *compareResultRole;
QAbstractItemDelegate *mAgeColumnDelegate;
QAbstractItemDelegate *mSizeColumnDelegate;
/* Color definitions (for standard see qss.default) */ /* Color definitions (for standard see qss.default) */
QColor mTextColorLocal; QColor mTextColorLocal;
QColor mTextColorDownloading; QColor mTextColorDownloading;