mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 17:09:40 +00:00
dealing with unset attribute fields
This commit is contained in:
parent
ec6bdbeb40
commit
384c88182d
4 changed files with 16 additions and 9 deletions
|
@ -61,7 +61,7 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
new CSVWorld::EnumDelegateFactory (sSpecialisations));
|
||||
|
||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_Attribute,
|
||||
new CSVWorld::EnumDelegateFactory (sAttributes));
|
||||
new CSVWorld::EnumDelegateFactory (sAttributes, true));
|
||||
}
|
||||
|
||||
CSVDoc::ViewManager::~ViewManager()
|
||||
|
|
|
@ -92,10 +92,13 @@ void CSVWorld::EnumDelegate::paint (QPainter *painter, const QStyleOptionViewIte
|
|||
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory() {}
|
||||
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory (const char **names)
|
||||
CSVWorld::EnumDelegateFactory::EnumDelegateFactory (const char **names, bool allowNone)
|
||||
{
|
||||
assert (names);
|
||||
|
||||
if (allowNone)
|
||||
add (-1, "");
|
||||
|
||||
for (int i=0; names[i]; ++i)
|
||||
add (i, names[i]);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace CSVWorld
|
|||
|
||||
EnumDelegateFactory();
|
||||
|
||||
EnumDelegateFactory (const char **names);
|
||||
EnumDelegateFactory (const char **names, bool allowNone = false);
|
||||
///< \param names Array of char pointer with a 0-pointer as end mark
|
||||
/// \param allowNone Use value of -1 for "none selected" (empty string)
|
||||
|
||||
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||
|
|
|
@ -127,15 +127,18 @@ void Skill::save(ESMWriter &esm)
|
|||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "#";
|
||||
if (index!=-1)
|
||||
{
|
||||
stream << "#";
|
||||
|
||||
if (index<10)
|
||||
stream << "0";
|
||||
if (index<10)
|
||||
stream << "0";
|
||||
|
||||
stream << index;
|
||||
stream << index;
|
||||
|
||||
if (index>=0 && index<Length)
|
||||
stream << sSkillNameIds[index].substr (6);
|
||||
if (index>=0 && index<Length)
|
||||
stream << sSkillNameIds[index].substr (6);
|
||||
}
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue