Skip to content
Snippets Groups Projects
Commit c6657362 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

New way of notification of ComponentEditor when item changed

parent 2ece99e2
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
// ************************************************************************** //
#include "GroupItem.h"
#include <QDebug>
const QString GroupItem::T_ITEMS = "Item tag";
......@@ -23,6 +24,17 @@ GroupItem::GroupItem()
{
registerTag(T_ITEMS);
setDefaultTag(T_ITEMS);
mapper()->setOnChildPropertyChange(
[this](SessionItem* item, const QString &name)
{
qDebug() << "QQQQ" << item->itemLabel() << name;
group()->setCurrentLabel(item->itemLabel());
// qDebug() << "emmiting..." << modelType();
// emitDataChanged();
// qDebug() << "...emmited";
});
}
void GroupItem::setGroup(GroupProperty_t group)
......
......@@ -101,7 +101,13 @@ void GroupProperty::setCurrentLabel(const QString &label)
{
if(type() == FIXED) {
m_type_label_map[m_current_type] = label;
if(m_groupItem) {
m_groupItem->emitDataChanged();
}
// if(m_groupItem) m_groupItem->getItem(getGroupName())->emitValueChanged();
// if(m_groupItem) {
// qDebug() << "!!!" << m_groupItem
// }
}
}
......
......@@ -103,6 +103,10 @@ void ComponentEditor::onDataChanged(const QModelIndex &topLeft,
qDebug() << " ComponentEditor::onDataChanged" << m_d->m_presentationType
<< roles << item->modelType() << item->displayName();
if(m_d->m_changedItems.contains(item)) return;
qDebug() << " ComponentEditor::onDataChanged 1.2 processing";
if (QtVariantProperty *property = m_d->getPropertyForItem(item)) {
// updating editor's property appearance (tooltips, limits)
if (roles.contains(Qt::UserRole)) {
......@@ -135,6 +139,7 @@ void ComponentEditor::onRowsInserted(const QModelIndex &parent, int first,
SessionItem *item = model->itemForIndex(parent);
Q_ASSERT(item);
if(m_d->m_changedItems.contains(item)) return;
if (QtVariantProperty *property = m_d->getPropertyForItem(item)) {
updateEditor(item, property);
......@@ -148,9 +153,13 @@ void ComponentEditor::onQtPropertyChanged(QtProperty *property,
qDebug() << "ComponentEditor::onQtPropertyChanged" << property << value;
if (SessionItem *item = m_d->getItemForProperty(property)) {
Q_ASSERT(item);
disconnectModel(item->model());
qDebug() << "Disconnecting";
// disconnectModel(item->model());
m_d->m_changedItems.append(item);
item->setValue(value);
connectModel(item->model());
// connectModel(item->model());
m_d->m_changedItems.removeAll(item);
qDebug() << "Connected";
}
}
......
......@@ -75,8 +75,8 @@ public:
QMap<SessionItem *, ComponentEditorFlags::InsertMode> m_item_to_insert_mode;
ComponentEditorFlags::PresentationType m_presentationType;
QList<SessionItem *> m_changedItems;
std::unique_ptr<WheelEventEater> m_wheel_event_filter;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment