Newer
Older
{
QtBrowserItem* item(NULL);
item = m_cfTree->currentItem();
if ( ! item )
return;
// is it a fit property ?
QtProperty* prop = item->property();
if ( prop == m_properties["StartX"] || prop == m_properties["EndX"] )
return;
// is it already fixed?
bool fixed = prop->propertyManager() != m_dblManager;
if ( fixed && prop->propertyManager() != m_stringManager )
return;
// Create the menu
QMenu* menu = new QMenu("ConvFit", m_cfTree);
QAction* action;
if ( ! fixed )
{
action = new QAction("Fix", m_parentWidget);
connect(action, SIGNAL(triggered()), this, SLOT(fixItem()));
}
else
{
action = new QAction("Remove Fix", m_parentWidget);
connect(action, SIGNAL(triggered()), this, SLOT(unFixItem()));
}
menu->addAction(action);
// Show the menu
menu->popup(QCursor::pos());
}
void ConvFit::fixItem()
{
QtBrowserItem* item = m_cfTree->currentItem();
// Determine what the property is.
QtProperty* prop = item->property();
QtProperty* fixedProp = m_stringManager->addProperty( prop->propertyName() );
QtProperty* fprlbl = m_stringManager->addProperty("Fixed");
fixedProp->addSubProperty(fprlbl);
m_stringManager->setValue(fixedProp, prop->valueText());
item->parent()->property()->addSubProperty(fixedProp);
m_fixedProps[fixedProp] = prop;
item->parent()->property()->removeSubProperty(prop);
}
void ConvFit::unFixItem()
{
QtBrowserItem* item = m_cfTree->currentItem();
QtProperty* prop = item->property();
if ( prop->subProperties().empty() )
item = item->parent();
prop = item->property();
}
item->parent()->property()->addSubProperty(m_fixedProps[prop]);
item->parent()->property()->removeSubProperty(prop);
m_fixedProps.remove(prop);
QtProperty* proplbl = prop->subProperties()[0];
delete proplbl;
delete prop;
}
void ConvFit::showTieCheckbox(QString fitType)
{
uiForm().confit_ckTieCentres->setVisible( fitType == "Two Lorentzians" );
}
} // namespace IDA
} // namespace CustomInterfaces
} // namespace MantidQt