diff --git a/GUI/coregui/Models/BeamItem.cpp b/GUI/coregui/Models/BeamItem.cpp index 90ff3777ed04c9ee48e49b192fe459b2b17ae2b7..19496a36102d45ca2be47bcfe359db70bb2835de 100644 --- a/GUI/coregui/Models/BeamItem.cpp +++ b/GUI/coregui/Models/BeamItem.cpp @@ -60,32 +60,16 @@ BeamWavelengthItem::BeamWavelengthItem(ParameterizedItem *parent) { setItemName(Constants::BeamWavelengthType); registerGroupProperty(P_DISTRIBUTION, Constants::DistributionExtendedGroup); - setGroupProperty(P_DISTRIBUTION, Constants::DistributionNoneType); + setGroupProperty(P_DISTRIBUTION, Constants::DistributionGateType); registerProperty(P_VALUE, 0.1, PropertyAttribute(AttLimits::lowerLimited(1e-4), 4)); } void BeamWavelengthItem::onPropertyChange(const QString &name) { - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; if(name == P_DISTRIBUTION) { ParameterizedItem *distribution = getSubItems()[P_DISTRIBUTION]; if(distribution) { - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; - qDebug() << "XXXX"; if(distribution->modelType() == Constants::DistributionNoneType) { setPropertyAppearance(P_VALUE, PropertyAttribute::VISIBLE); qDebug() << "XXX setting to visible"; @@ -99,6 +83,18 @@ void BeamWavelengthItem::onPropertyChange(const QString &name) ParameterizedItem::onPropertyChange(name); } +//void BeamWavelengthItem::onPropertyItemChanged(const QString &propertyName) +//{ +// qDebug() << "AAA"; +// qDebug() << "AAA"; +// qDebug() << "AAA"; +// qDebug() << "AAA"; +// qDebug() << "AAA"; +// qDebug() << "AAA"; +// qDebug() << "BeamWavelengthItem::onPropertyItemChanged(const QString &propertyName)" << propertyName; +// ParameterizedItem::onPropertyItemChanged(propertyName); +//} + const QString TestBeamItem::P_INTENSITY = "Intensity [1/s]"; const QString TestBeamItem::P_WAVELENGTH = "Wavelength"; diff --git a/GUI/coregui/Models/BeamItem.h b/GUI/coregui/Models/BeamItem.h index 4f2d15d8a418032d8b55926222e069a9c2daf420..c1c151dd79f73dd4b0ec2fb0500e30cdafc4d70d 100644 --- a/GUI/coregui/Models/BeamItem.h +++ b/GUI/coregui/Models/BeamItem.h @@ -44,6 +44,7 @@ public: explicit BeamWavelengthItem(ParameterizedItem *parent=0); ~BeamWavelengthItem(){} void onPropertyChange(const QString &name); +// void onPropertyItemChanged(const QString &propertyName); }; diff --git a/GUI/coregui/Models/DistributionItem.cpp b/GUI/coregui/Models/DistributionItem.cpp index 3c4f4a365c854010a8f8ef9d4c1e6ea7e021d4c0..b9af44a332b1fd3e915272bb920fa3ff19da8d2d 100644 --- a/GUI/coregui/Models/DistributionItem.cpp +++ b/GUI/coregui/Models/DistributionItem.cpp @@ -15,6 +15,7 @@ #include "DistributionItem.h" #include "ComboProperty.h" +#include <QDebug> const QString DistributionItem::P_NUMBER_OF_SAMPLES = "Number of samples"; DistributionItem::DistributionItem(const QString name, ParameterizedItem *parent) diff --git a/GUI/coregui/Models/LayerItem.cpp b/GUI/coregui/Models/LayerItem.cpp index d6d018de1a48e7f149c1863133b107fa33fa898e..9cefc84ed670e4b212e98e8e3b8681a1045564b8 100644 --- a/GUI/coregui/Models/LayerItem.cpp +++ b/GUI/coregui/Models/LayerItem.cpp @@ -31,5 +31,4 @@ LayerItem::LayerItem(ParameterizedItem *parent) registerGroupProperty(P_ROUGHNESS, Constants::LayerRoughnessGroup); setGroupProperty(P_ROUGHNESS, Constants::LayerZeroRoughnessType); addToValidChildren(Constants::ParticleLayoutType, PortInfo::PORT_0); - } diff --git a/GUI/coregui/Models/ParameterizedItem.cpp b/GUI/coregui/Models/ParameterizedItem.cpp index 58d2b254205c6500e2e141c33a8377014c6b539f..3c285441ca7a4068708d055d58054596fb581000 100644 --- a/GUI/coregui/Models/ParameterizedItem.cpp +++ b/GUI/coregui/Models/ParameterizedItem.cpp @@ -144,8 +144,8 @@ void ParameterizedItem::setItemPort(ParameterizedItem::PortInfo::EPorts nport) } -// to update label of FixedGroupProperty -void ParameterizedItem::onPropertyItemChanged(const QString & propertyName) +//! this slot is called when SubItem change one of its properties +void ParameterizedItem::onSubItemPropertyChanged(const QString & propertyName) { Q_UNUSED(propertyName); ParameterizedItem *propertyItem = qobject_cast<ParameterizedItem *>(sender()); @@ -155,13 +155,13 @@ void ParameterizedItem::onPropertyItemChanged(const QString & propertyName) FancyGroupProperty_t group_property = getRegisteredProperty(it.key()).value<FancyGroupProperty_t>(); group_property->setValueLabel(propertyItem->getItemLabel()); - emit propertyItemPropertyChanged(it.key(), propertyName); + emit subItemPropertyChanged(it.key(), propertyName); // emit propertyItemChanged(it.key()); if (m_parent) m_parent->onChildPropertyChange(); return; } } - throw GUIHelpers::Error("ParameterizedItem::onPropertyItemChanged() ->" + throw GUIHelpers::Error("ParameterizedItem::onSubItemPropertyChanged() ->" " Error. No such propertyItem found"); } @@ -192,7 +192,7 @@ void ParameterizedItem::addPropertyItem(QString name, ParameterizedItem *item) } m_sub_items[name] = item; item->m_parent = this; - connect(item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyItemChanged(QString))); + connect(item, SIGNAL(propertyChanged(QString)), this, SLOT(onSubItemPropertyChanged(QString))); onChildPropertyChange(); qDebug() << "ParameterizedItem::addPropertyItem() -> about to leave" << name; } diff --git a/GUI/coregui/Models/ParameterizedItem.h b/GUI/coregui/Models/ParameterizedItem.h index 869f81562c46dbf9f048dc7182f222feb7ffab23..66eb7d1ac59a0f035bd2fd51d9f2a738c156eaab 100644 --- a/GUI/coregui/Models/ParameterizedItem.h +++ b/GUI/coregui/Models/ParameterizedItem.h @@ -132,12 +132,12 @@ public: virtual void onChildPropertyChange(); public slots: - void onPropertyItemChanged(const QString &propertyName); + virtual void onSubItemPropertyChanged(const QString &propertyName); signals: void propertyChanged(const QString &propertyName); void propertyItemChanged(const QString &propertyName); - void propertyItemPropertyChanged(const QString &property_group, const QString &property_name); + void subItemPropertyChanged(const QString &property_group, const QString &property_name); protected: void addToValidChildren(const QString &name, PortInfo::EPorts nport = PortInfo::PORT_0, int nmax_children = 0); diff --git a/GUI/coregui/Views/InstrumentWidgets/TestBeamEditorWidget.cpp b/GUI/coregui/Views/InstrumentWidgets/TestBeamEditorWidget.cpp index 7c9fb2fbb823384cd37a94a55117c2b3906542b0..2d248b176bd4e991e8b9617acfd20ed09b86ddf3 100644 --- a/GUI/coregui/Views/InstrumentWidgets/TestBeamEditorWidget.cpp +++ b/GUI/coregui/Views/InstrumentWidgets/TestBeamEditorWidget.cpp @@ -39,6 +39,7 @@ TestBeamEditorWidget::TestBeamEditorWidget(QWidget *parent) QGridLayout *gridLayout = new QGridLayout; m_wavelengthEditor = new AwesomePropertyEditor(this, AwesomePropertyEditor::BROWSER_GROUPBOX_TYPE); +// m_wavelengthEditor = new AwesomePropertyEditor(this); gridLayout->addWidget(m_wavelengthEditor, 0, 0); groupLayout->addLayout(gridLayout); @@ -79,6 +80,7 @@ void TestBeamEditorWidget::initWavelengthWidget() // Q_ASSERT(distributionItem); m_wavelengthEditor->addItemProperties(wavelengthItem, QString("Wavelength"), AwesomePropertyEditor::INSERT_AFTER); +// m_wavelengthEditor->addItemProperties(wavelengthItem, QString("Wavelength")); } diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp index eeb0b3215fd7d28b4a8104a18e023f6acc25e44c..4a8b3c46e60243b9efb86c2ca447beab0d979ba0 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapPlot.cpp @@ -49,7 +49,7 @@ void ColorMapPlot::setItem(IntensityDataItem *item) if (m_item) { disconnect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } @@ -62,7 +62,7 @@ void ColorMapPlot::setItem(IntensityDataItem *item) connect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } diff --git a/GUI/coregui/Views/IntensityDataWidgets/HorizontalSlicePlot.cpp b/GUI/coregui/Views/IntensityDataWidgets/HorizontalSlicePlot.cpp index 1f009c576536ab2c23341ee43fa2bf5e0f7ee870..2f0d0b3ef0a919cca414301246930c3dae4e79c6 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/HorizontalSlicePlot.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/HorizontalSlicePlot.cpp @@ -45,7 +45,7 @@ void HorizontalSlicePlot::setItem(IntensityDataItem *item) if (m_item) { // disconnect(m_item, SIGNAL(propertyChanged(QString)), // this, SLOT(onPropertyChanged(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } @@ -58,7 +58,7 @@ void HorizontalSlicePlot::setItem(IntensityDataItem *item) // connect(m_item, SIGNAL(propertyChanged(QString)), // this, SLOT(onPropertyChanged(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } diff --git a/GUI/coregui/Views/PropertyEditor/AwesomePropertyEditor.cpp b/GUI/coregui/Views/PropertyEditor/AwesomePropertyEditor.cpp index 905703b55c6fe0fdf358476809157daf6f70f311..1127bfa3fc2b5c7fe94cf8c264821f6d01a551b1 100644 --- a/GUI/coregui/Views/PropertyEditor/AwesomePropertyEditor.cpp +++ b/GUI/coregui/Views/PropertyEditor/AwesomePropertyEditor.cpp @@ -397,7 +397,8 @@ void AwesomePropertyEditor::insertQtVariantProperty(QtVariantProperty *qtVariant if(m_d->m_browser->items(parent_qtproperty).size() == 1) { // inserting qtVariantItem after parent property, so we need to know parent of parent QtProperty *new_parent = m_d->m_browser->items(parent_qtproperty).at(0)->parent()->property(); - new_parent->insertSubProperty(qtVariantItem, parent_qtproperty); + //new_parent->insertSubProperty(qtVariantItem, parent_qtproperty); + new_parent->insertSubProperty(qtVariantItem, new_parent->subProperties().back()); } else { // our parent property is already at the top, so need to add into the browser QtBrowserItem *browserItem = m_d->m_browser->insertProperty(qtVariantItem, parent_qtproperty); diff --git a/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp b/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp index ab08ee02d259b07fd215b2bcf0b12398e6b6fc98..0853cb83d02dd145b447a588fd82cf08c8169458 100644 --- a/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp +++ b/GUI/coregui/Views/PropertyEditor/UniversalPropertyEditor.cpp @@ -156,7 +156,7 @@ void UniversalPropertyEditor::updateSubItems(const QString &name) this, SLOT(onPropertyChanged(QString))); disconnect(m_item, SIGNAL(propertyItemChanged(QString)), this, SLOT(updateSubItems(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); clearEditor(); @@ -166,7 +166,7 @@ void UniversalPropertyEditor::updateSubItems(const QString &name) this, SLOT(updateSubItems(QString))); connect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } @@ -183,7 +183,7 @@ void UniversalPropertyEditor::onPropertyChanged(const QString &property_name) this, SLOT(onPropertyChanged(QString))); disconnect(m_item, SIGNAL(propertyItemChanged(QString)), this, SLOT(updateSubItems(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); variant_property->setValue(property_value); @@ -199,7 +199,7 @@ void UniversalPropertyEditor::onPropertyChanged(const QString &property_name) this, SLOT(onPropertyChanged(QString))); connect(m_item, SIGNAL(propertyItemChanged(QString)), this, SLOT(updateSubItems(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); } } @@ -217,7 +217,7 @@ void UniversalPropertyEditor::onPropertyItemPropertyChanged(const QString &prope this, SLOT(onPropertyChanged(QString))); disconnect(m_item, SIGNAL(propertyItemChanged(QString)), this, SLOT(updateSubItems(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); variant_property->setValue(property_value); @@ -233,7 +233,7 @@ void UniversalPropertyEditor::onPropertyItemPropertyChanged(const QString &prope this, SLOT(onPropertyChanged(QString))); connect(m_item, SIGNAL(propertyItemChanged(QString)), this, SLOT(updateSubItems(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); @@ -253,7 +253,7 @@ void UniversalPropertyEditor::setItem(ParameterizedItem *item) this, SLOT(updateSubItems(QString))); disconnect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); - disconnect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + disconnect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); clearEditor(); @@ -269,7 +269,7 @@ void UniversalPropertyEditor::setItem(ParameterizedItem *item) this, SLOT(updateSubItems(QString))); connect(m_item, SIGNAL(propertyChanged(QString)), this, SLOT(onPropertyChanged(QString))); - connect(m_item, SIGNAL(propertyItemPropertyChanged(QString,QString)), + connect(m_item, SIGNAL(subItemPropertyChanged(QString,QString)), this, SLOT(onPropertyItemPropertyChanged(QString,QString))); }