diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-02 22:52:27 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-05 10:14:25 -0800 |
commit | b3253304a59b85c76f8a70f20ada4139e715a5b3 (patch) | |
tree | 8e21ae9d46d9d6ed1f651b7b6008512ae1fd622d /desktop-widgets/tableview.cpp | |
parent | 147a36647ce6148ef2eccbe393faa658d0fe6834 (diff) | |
download | subsurface-b3253304a59b85c76f8a70f20ada4139e715a5b3.tar.gz |
Desktop: don't connect to remove() slot of model from TableModel
When connecting a model to the TableModel class, it would connect
clicking on an item to the remove() slot of the model.
This breaks the program flow implied by the undo code:
Ui --> Undo-Command --> Model --> UI
Moreover, the naming of the remove() slot is illogical, because
clicks can also have different effects, as for example in the
cylinder-table.
Therefore, move the connect() call from TableModel to the
callers. In the case of TabDiveSite, move the remove() function
from the model to the TabWidget, where it makes more sense.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tableview.cpp')
-rw-r--r-- | desktop-widgets/tableview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/desktop-widgets/tableview.cpp b/desktop-widgets/tableview.cpp index 560f98a43..13f7a9d03 100644 --- a/desktop-widgets/tableview.cpp +++ b/desktop-widgets/tableview.cpp @@ -10,6 +10,8 @@ TableView::TableView(QWidget *parent) : QGroupBox(parent) ui.setupUi(this); ui.tableView->setItemDelegate(new DiveListDelegate(this)); + connect(ui.tableView, &QTableView::clicked, this, &TableView::itemClicked); + QFontMetrics fm(defaultModelFont()); int text_ht = fm.height(); @@ -93,7 +95,6 @@ void TableView::setBtnToolTip(const QString &tooltip) void TableView::setModel(QAbstractItemModel *model) { ui.tableView->setModel(model); - connect(ui.tableView, SIGNAL(clicked(QModelIndex)), model, SLOT(remove(QModelIndex))); QSettings s; s.beginGroup(objectName()); |