diff --git a/src/BackProcess/tablet/getmodeldata.cpp b/src/BackProcess/tablet/getmodeldata.cpp index 0f8080f..dee8cc6 100644 --- a/src/BackProcess/tablet/getmodeldata.cpp +++ b/src/BackProcess/tablet/getmodeldata.cpp @@ -105,7 +105,7 @@ bool GetModelData::cmpApp(QStringList &arg_1, QStringList &arg_2) QVector GetModelData::getRecentData() { QVector recentDataVector = QVector(); - enumerator = new Peony::FileEnumerator(this); + enumerator = new Peony::FileEnumerator(); enumerator->setEnumerateDirectory("recent:///"); enumerator->enumerateSync(); @@ -126,6 +126,10 @@ QVector GetModelData::getRecentData() } qSort(recentDataVector.begin(), recentDataVector.end(), cmpApp); + if (enumerator) { + delete enumerator; + enumerator = nullptr; + } return recentDataVector; } diff --git a/src/UserInterface/ListView/klistview.cpp b/src/UserInterface/ListView/klistview.cpp index 64390d9..3e461a5 100644 --- a/src/UserInterface/ListView/klistview.cpp +++ b/src/UserInterface/ListView/klistview.cpp @@ -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) { diff --git a/src/UserInterface/Widget/splitbar_frame.cpp b/src/UserInterface/Widget/splitbar_frame.cpp index 83cfbaa..a9b474e 100644 --- a/src/UserInterface/Widget/splitbar_frame.cpp +++ b/src/UserInterface/Widget/splitbar_frame.cpp @@ -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);