Example #1
0
void IqtFit::fitContextMenu(const QPoint &) {
  QtBrowserItem *item(NULL);

  item = m_ffTree->currentItem();

  if (!item)
    return;

  // is it a fit property ?
  QtProperty *prop = item->property();

  // is it already fixed?
  bool fixed = prop->propertyManager() != m_dblManager;

  if (fixed && prop->propertyManager() != m_stringManager)
    return;

  // Create the menu
  QMenu *menu = new QMenu("IqtFit", m_ffTree);
  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());
}
Example #2
0
    void LineEditPropertyFactory::EditorDestroyed(QObject *object)
    {
        QMap<QLineEdit*, QtProperty*>::ConstIterator iter = editorToProperty_.constBegin();
        while (iter != editorToProperty_.constEnd()) 
        {
            if (iter.key() == object)
            {
                QLineEdit *editor = iter.key();
                QtProperty *property = iter.value();
                QtStringPropertyManager *stringManager = qobject_cast<QtStringPropertyManager*>(property->propertyManager());
                if(stringManager)
                    stringManager->setValue(property, iter.key()->text());

                editorToProperty_.remove(editor);
                propertyToEditor_.remove(property);
                int size = editorToProperty_.size();
                size = propertyToEditor_.size();
                break;
            }
            iter++;
        }
    }