aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-18 14:40:10 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-18 14:40:10 +0200
commitd94231bc05f56252416857725ae8a4398436f12a (patch)
tree93502218c7ddbe4051dbca1e6579f7b321693d1c /qtmips_gui
parentee34605308d5e946700fbc5840f8cd0a302c0019 (diff)
downloadqtmips-d94231bc05f56252416857725ae8a4398436f12a.tar.gz
qtmips-d94231bc05f56252416857725ae8a4398436f12a.tar.bz2
qtmips-d94231bc05f56252416857725ae8a4398436f12a.zip
Parent models created by views to ensure their deletion.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/memorydock.cpp2
-rw-r--r--qtmips_gui/messagesdock.cpp2
-rw-r--r--qtmips_gui/messagesmodel.cpp4
-rw-r--r--qtmips_gui/messagesmodel.h1
-rw-r--r--qtmips_gui/programdock.cpp2
5 files changed, 8 insertions, 3 deletions
diff --git a/qtmips_gui/memorydock.cpp b/qtmips_gui/memorydock.cpp
index 2c170e9..e3c55b6 100644
--- a/qtmips_gui/memorydock.cpp
+++ b/qtmips_gui/memorydock.cpp
@@ -62,7 +62,7 @@ MemoryDock::MemoryDock(QWidget *parent, QSettings *settings) : Super(parent) {
QTableView *memory_content = new MemoryTableView(0, settings);
// memory_content->setSizePolicy();
- MemoryModel *memory_model = new MemoryModel(0);
+ MemoryModel *memory_model = new MemoryModel(this);
memory_content->setModel(memory_model);
memory_content->verticalHeader()->hide();
//memory_content->setHorizontalHeader(memory_model->);
diff --git a/qtmips_gui/messagesdock.cpp b/qtmips_gui/messagesdock.cpp
index d897e3f..fa35f1a 100644
--- a/qtmips_gui/messagesdock.cpp
+++ b/qtmips_gui/messagesdock.cpp
@@ -59,7 +59,7 @@ MessagesDock::MessagesDock(QWidget *parent, QSettings *settings) : Super(parent)
QWidget *content = new QWidget();
QListView *messages_content = new MessagesView(0, settings);
- MessagesModel *messages_model = new MessagesModel(0);
+ MessagesModel *messages_model = new MessagesModel(this);
messages_content->setModel(messages_model);
QVBoxLayout *layout = new QVBoxLayout;
diff --git a/qtmips_gui/messagesmodel.cpp b/qtmips_gui/messagesmodel.cpp
index f179b2d..df9bef8 100644
--- a/qtmips_gui/messagesmodel.cpp
+++ b/qtmips_gui/messagesmodel.cpp
@@ -62,6 +62,10 @@ MessagesModel::MessagesModel(QObject *parent) : Super(parent) {
}
+MessagesModel::~MessagesModel() {
+ clear_messages();
+}
+
int MessagesModel::rowCount(const QModelIndex & /*parent*/) const {
return messages.count();
}
diff --git a/qtmips_gui/messagesmodel.h b/qtmips_gui/messagesmodel.h
index d9c35e5..16c65e2 100644
--- a/qtmips_gui/messagesmodel.h
+++ b/qtmips_gui/messagesmodel.h
@@ -51,6 +51,7 @@ class MessagesModel : public QAbstractListModel
using Super = QAbstractListModel;
public:
MessagesModel(QObject *parent);
+ ~MessagesModel();
int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp
index a561c00..f2f9ebc 100644
--- a/qtmips_gui/programdock.cpp
+++ b/qtmips_gui/programdock.cpp
@@ -72,7 +72,7 @@ ProgramDock::ProgramDock(QWidget *parent, QSettings *settings) : Super(parent) {
QTableView *program_content = new ProgramTableView(0, settings);
// program_content->setSizePolicy();
- ProgramModel *program_model = new ProgramModel(0);
+ ProgramModel *program_model = new ProgramModel(this);
program_content->setModel(program_model);
program_content->verticalHeader()->hide();
//program_content->setHorizontalHeader(program_model->);