Example #1
0
QWidget* ParametersDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option, const QModelIndex &index) const
{
	const ParametersModel* model = static_cast< const ParametersModel* >( index.model() );
	SoField* field = model->ModelItem( index )->GetField();
	
	if( field->getTypeId().isDerivedFrom( SoSFEnum::getClassTypeId() ) )
	{
		QComboBox* editor = new QComboBox( parent );
		SoSFEnum* enumField = static_cast< SoSFEnum* >( field );
		for( int i = 0; i < enumField->getNumEnums() ; ++i )
		{
			SbName enumName;
			enumField->getEnum( i , enumName );
			editor->addItem( enumName.getString() );
		}
		return editor;
	}
	else if( field->getTypeId().isDerivedFrom( SoMField::getClassTypeId() ) )
	{
		ContainerEditor* editor = new ContainerEditor( parent );
	     editor->setGeometry(option.rect);

	     connect( editor, SIGNAL( editingFinished( )  ), this, SLOT( CloseEditor() ));
		return editor;
	}

	else
	{
		QLineEdit* editor = new QLineEdit(parent);
		return editor;
	}
}
int ProjectFrame::CloseFile()
{
	EditorView *vw = GetActiveEditor();
	if (vw)
		return CloseEditor(vw->GetItem());
	return 0;
}
				void DataGridContentProvider::OnItemModified(vint start, vint count, vint newCount)
				{
					if(!currentEditorRequestingSaveData)
					{
						CloseEditor(false);
					}
				}
				IDataEditor* DataGridContentProvider::OpenEditor(vint row, vint column, IDataEditorFactory* editorFactory)
				{
					CloseEditor(true);
					NotifySelectCell(row, column);
					if(editorFactory)
					{
						currentEditorOpening=true;
						currentEditor=editorFactory->CreateEditor(this);
						currentEditor->BeforeEditCell(dataProvider, row, column);
						dataProvider->BeforeEditCell(row, column, currentEditor.Obj());
						currentEditorOpening=false;
					}
					return currentEditor.Obj();
				}
Example #5
0
/*----------------------------------------------------------------------------------------------
	Clear out the window contents, and especially any active database connections, when the
	project is (about to be) changed. Return true if the close is OK.
	@return true if the close is OK.
----------------------------------------------------------------------------------------------*/
bool CleDeSplitChild::CloseProj()
{
	// Close current editor if there is one.
	if (!CloseEditor())
		return false;
	if (m_fNeedSync)
	{
		// Notify other apps of change.
		CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(MainWindow());
		Assert(pcmw);
		SyncInfo sync(ksyncPossList, pcmw->GetRootObj(), 0);
		m_qlpi->StoreSync(sync);
	}
	return SuperClass::CloseProj();
}
				bool DataGridContentProvider::SetSelectedCell(const GridPos& value, bool openEditor)
				{
					if(currentCell!=value)
					{
						if(value==GridPos(-1, -1))
						{
							CloseEditor(false);
							return true;
						}
						else if(0<=value.row && value.row<dataProvider->GetRowCount() && 0<=value.column && value.column<dataProvider->GetColumnCount())
						{
							IDataEditorFactory* editorFactory=openEditor?dataProvider->GetCellDataEditorFactory(value.row, value.column):0;
							OpenEditor(value.row, value.column, editorFactory);
							return true;
						}
						return false;
					}
					return true;
				}
void ProjectFrame::RemoveItem()
{
	ProjectItem *itm = prjTree->GetSelectedNode();
	if(itm)
	{
		bsString prompt;
		prompt = "Remove item '";
		prompt += itm->GetName();
		prompt += "'?";
		if (prjFrame->Verify(prompt, "Verify..."))
		{
			if (itm->RemoveItem())
			{
				CloseEditor(itm);
				prjTree->RemoveNode(itm);
				theProject->SetChange(1);
			}
		}
	}
}
Example #8
0
void cceMaterialShaderEditorDialog::Close ()
{
  if (ShaderChanged ())
    {
      int result = QMessageBox::question (this,
        "Shader changed - " CCE_TOOL_NAME,
				"The shader has unsaved changes. Save changes bevor closing?",
				QMessageBox::Save, QMessageBox::Close, QMessageBox::Cancel);
      switch (result)
        {
        case QMessageBox::Save:
          Save ();
          break;

        case QMessageBox::Cancel:
          return;

        case QMessageBox::Close:
          break;
        }

    }
  emit CloseEditor(_shader);
}
Example #9
0
void cceMaterialShaderEditorDialog::ForceClose()
{
  emit CloseEditor(_shader);
}
				DataGridContentProvider::~DataGridContentProvider()
				{
					CloseEditor(false);
				}