mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-12 12:38:02 +00:00
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
|
|
||
|
#include "referenceablecreator.hpp"
|
||
|
|
||
|
#include <QComboBox>
|
||
|
#include <QLabel>
|
||
|
|
||
|
#include "../../model/world/universalid.hpp"
|
||
|
#include "../../model/world/commands.hpp"
|
||
|
|
||
|
void CSVWorld::ReferenceableCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const
|
||
|
{
|
||
|
command.setType (
|
||
|
static_cast<CSMWorld::UniversalId::Type> (mType->itemData (mType->currentIndex()).toInt()));
|
||
|
}
|
||
|
|
||
|
CSVWorld::ReferenceableCreator::ReferenceableCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||
|
const CSMWorld::UniversalId& id)
|
||
|
: GenericCreator (data, undoStack, id)
|
||
|
{
|
||
|
QLabel *label = new QLabel ("Type", this);
|
||
|
insertBeforeButtons (label, false);
|
||
|
|
||
|
std::vector<CSMWorld::UniversalId::Type> types = CSMWorld::UniversalId::listReferenceableTypes();
|
||
|
|
||
|
mType = new QComboBox (this);
|
||
|
|
||
|
for (std::vector<CSMWorld::UniversalId::Type>::const_iterator iter (types.begin());
|
||
|
iter!=types.end(); ++iter)
|
||
|
{
|
||
|
CSMWorld::UniversalId id (*iter, "");
|
||
|
|
||
|
mType->addItem (QIcon (id.getIcon().c_str()), id.getTypeName().c_str(),
|
||
|
static_cast<int> (id.getType()));
|
||
|
}
|
||
|
|
||
|
insertBeforeButtons (mType, false);
|
||
|
}
|
||
|
|
||
|
void CSVWorld::ReferenceableCreator::reset()
|
||
|
{
|
||
|
mType->setCurrentIndex (0);
|
||
|
GenericCreator::reset();
|
||
|
}
|