Beispiel #1
0
void IqtFit::fixItem() {
  QtBrowserItem *item = m_ffTree->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);
}
Beispiel #2
0
void IqtFit::unFixItem() {
  QtBrowserItem *item = m_ffTree->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;
}
/** Utiltiy function for retrieving the selected layer id
@return int The id of the selected layer or -1
*/
int QtSpacescapeMainWindow::getSelectedLayerId()
{
    // get the current selected item
    QtBrowserItem* bi = ui->layerProperties->currentItem();
    if(!bi) {
        return -1;
    }

    // get the top level layer this item belongs to
    if(bi->parent()) {
        while(bi->parent()) {
            bi = bi->parent();
        }
    }

    int index = ui->layerProperties->topLevelItems().indexOf(bi);
    if(index > -1) {
        return ui->layerProperties->topLevelItems().size() - 1 - index;
    }

    return -1;
}
Beispiel #4
0
// The current property item is changed.  Update the help box.
void GenericHID::onPropertiesCurrentItemChanged( QtBrowserItem * current )
{
    // Set the help text
    if ( current == NULL || current->property() == NULL )
        ui.textBrowser->setSource( QString(":index.html") );
    else
    {
        QString sText = current->property()->toolTip();
        if ( sText.isEmpty() )
        {
            QtBrowserItem * item = current;
            while ( (item = item->parent()) != NULL )
            {
                sText = item->property()->toolTip();
                if ( !sText.isEmpty() )
                    break;
            }
        }
        ui.textBrowser->setSource( sText );
    }
}