修复部分UI内存泄漏;

This commit is contained in:
jixiaoxu 2023-02-22 11:05:58 +08:00
parent f34b82e5b6
commit a10dff25c6
3 changed files with 9 additions and 5 deletions

View File

@ -105,7 +105,7 @@ bool GetModelData::cmpApp(QStringList &arg_1, QStringList &arg_2)
QVector<QStringList> GetModelData::getRecentData()
{
QVector<QStringList> recentDataVector = QVector<QStringList>();
enumerator = new Peony::FileEnumerator(this);
enumerator = new Peony::FileEnumerator();
enumerator->setEnumerateDirectory("recent:///");
enumerator->enumerateSync();
@ -126,6 +126,10 @@ QVector<QStringList> GetModelData::getRecentData()
}
qSort(recentDataVector.begin(), recentDataVector.end(), cmpApp);
if (enumerator) {
delete enumerator;
enumerator = nullptr;
}
return recentDataVector;
}

View File

@ -25,6 +25,7 @@
KListView::KListView(QWidget *parent):
QListView(parent)
{
m_listmodel = new QStandardItemModel(this);
}
KListView::~KListView()
@ -42,7 +43,6 @@ KListView::~KListView()
void KListView::addData(QStringList data)
{
m_listmodel = new QStandardItemModel(this);
this->setModel(m_listmodel);
Q_FOREACH(QString desktopfp, data) {

View File

@ -23,8 +23,8 @@ SplitBarFrame::SplitBarFrame(QWidget *parent, QString category, int width, int h
m_width(width),
m_height(height),
m_module(module),
m_textLabel(new QLabel),
m_line(new QFrame)
m_textLabel(new QLabel(this)),
m_line(new QFrame(this))
{
initAppBtn();
}
@ -40,7 +40,7 @@ void SplitBarFrame::initAppBtn()
//按钮透明
this->setFocusPolicy(Qt::NoFocus);
this->setAttribute(Qt::WA_TranslucentBackground);
QHBoxLayout *layout = new QHBoxLayout;
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(15, 0, 0, 0);
layout->setSpacing(6);
m_textLabel->setAutoFillBackground(false);