Disable reference creator widget when in the clone mode.

actorid
Marek Kochanowicz 11 years ago
parent dda7ddb6f8
commit c87d9ff38d

@ -29,11 +29,13 @@ namespace CSVWorld
std::string mErrors;
QHBoxLayout *mLayout;
bool mLocked;
bool mCloneMode;
std::string mClonedId;
CSMWorld::UniversalId::Type mClonedType;
CSMWorld::UniversalId::ArgumentType mArgumentType;
protected:
bool mCloneMode;
protected:
void update();

@ -49,8 +49,13 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
{
std::string errors = GenericCreator::getErrors();
if (mCloneMode)
{
return errors;
}
std::string cell = mCell->text().toUtf8().constData();
if (cell.empty())
{
if (!errors.empty())
@ -72,4 +77,16 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
void CSVWorld::ReferenceCreator::cellChanged()
{
update();
}
}
void CSVWorld::ReferenceCreator::toggleWidgets(bool active)
{
CSVWorld::GenericCreator::toggleWidgets(active);
mCell->setEnabled(active);
}
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType)
{
CSVWorld::GenericCreator::cloneMode(originid, type, argumentType);
cellChanged(); //otherwise ok button will remain disabled
}

@ -25,7 +25,12 @@ namespace CSVWorld
ReferenceCreator (CSMWorld::Data& data, QUndoStack& undoStack,
const CSMWorld::UniversalId& id);
virtual void cloneMode(const std::string& originid,
const CSMWorld::UniversalId::Type type,
const CSMWorld::UniversalId::ArgumentType argumentType);
virtual void reset();
virtual void toggleWidgets(bool active = true);
virtual std::string getErrors() const;
///< Return formatted error descriptions for the current state of the creator. if an empty

Loading…
Cancel
Save