don't try to perform assignable setting copying when device view is out

of focus

This fixes a bug where the first assignable setting in the profile would
be copied to selected nodes, even if they were incompatible
This commit is contained in:
Jussi Kuokkanen 2023-10-29 18:39:51 +02:00
parent a099765e4e
commit 1759ecaa51

View File

@ -4,6 +4,7 @@
#include <DragChartView.hpp>
#include <Globals.hpp>
#include <patterns.hpp>
#include <QApplication>
#include <QCheckBox>
#include <QDebug>
#include <QHeaderView>
@ -33,6 +34,15 @@ DeviceTreeView::DeviceTreeView(QWidget *parent) : QTreeView(parent) {
resumeChildren(index);
});
// Semi-hack: don't try to copy assignable settings from indices when loading profile
auto app = static_cast<QApplication *>(QApplication::instance());
connect(app, &QApplication::focusChanged, [=](QWidget *, QWidget *now) {
if (now && !this->geometry().contains(now->geometry())) {
m_editSelection = {};
m_editedIndex = QModelIndex{};
clearSelection();
}
});
m_delegate = new DeviceModelDelegate(this);
setItemDelegate(m_delegate);