amuse/Editor/EditorWidget.cpp

41 lines
866 B
C++
Raw Normal View History

#include "EditorWidget.hpp"
#include "MainWindow.hpp"
2018-08-06 04:20:42 +00:00
#include <QStandardItemModel>
EditorWidget::EditorWidget(QWidget* parent)
: QWidget(parent)
{
}
void EditorUndoCommand::undo()
{
g_MainWindow->openEditor(m_node.get());
}
void EditorUndoCommand::redo()
{
g_MainWindow->openEditor(m_node.get());
}
2018-08-06 04:20:42 +00:00
FieldProjectNode::FieldProjectNode(ProjectModel::CollectionNode* collection, QWidget* parent)
: FieldComboBox(parent)
{
setCollection(collection);
}
void FieldProjectNode::setCollection(ProjectModel::CollectionNode* collection)
{
m_collection = collection;
if (!collection)
{
setModel(new QStandardItemModel(0, 1, this));
return;
}
ProjectModel* model = g_MainWindow->projectModel();
setModel(model->getNullProxy());
setRootModelIndex(model->getNullProxy()->mapFromSource(model->index(collection)));
}