focus main input widget when bringing up creator bar (Fixes #2514)

This commit is contained in:
Marc Zinnschlag 2015-05-02 13:20:42 +02:00
parent 0bf28a6eab
commit d873c2c603
8 changed files with 30 additions and 1 deletions

View file

@ -40,6 +40,9 @@ namespace CSVWorld
/// Default implementation: Throw an exception if scope!=Scope_Content. /// Default implementation: Throw an exception if scope!=Scope_Content.
virtual void setScope (unsigned int scope); virtual void setScope (unsigned int scope);
/// Focus main input widget
virtual void focus() = 0;
signals: signals:
void done(); void done();

View file

@ -225,6 +225,11 @@ void CSVWorld::GenericCreator::toggleWidgets(bool active)
{ {
} }
void CSVWorld::GenericCreator::focus()
{
mId->setFocus();
}
void CSVWorld::GenericCreator::setScope (unsigned int scope) void CSVWorld::GenericCreator::setScope (unsigned int scope)
{ {
mScopes = scope; mScopes = scope;

View file

@ -101,6 +101,9 @@ namespace CSVWorld
virtual void setScope (unsigned int scope); virtual void setScope (unsigned int scope);
/// Focus main input widget
virtual void focus();
private slots: private slots:
void textChanged (const QString& text); void textChanged (const QString& text);

View file

@ -91,6 +91,11 @@ std::string CSVWorld::InfoCreator::getErrors() const
return errors; return errors;
} }
void CSVWorld::InfoCreator::focus()
{
mTopic->setFocus();
}
void CSVWorld::InfoCreator::topicChanged() void CSVWorld::InfoCreator::topicChanged()
{ {
update(); update();

View file

@ -36,6 +36,9 @@ namespace CSVWorld
///< Return formatted error descriptions for the current state of the creator. if an empty ///< Return formatted error descriptions for the current state of the creator. if an empty
/// string is returned, there is no error. /// string is returned, there is no error.
/// Focus main input widget
virtual void focus();
private slots: private slots:
void topicChanged(); void topicChanged();

View file

@ -118,6 +118,11 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
return errors; return errors;
} }
void CSVWorld::ReferenceCreator::focus()
{
mCell->setFocus();
}
void CSVWorld::ReferenceCreator::cellChanged() void CSVWorld::ReferenceCreator::cellChanged()
{ {
update(); update();

View file

@ -39,6 +39,9 @@ namespace CSVWorld
///< Return formatted error descriptions for the current state of the creator. if an empty ///< Return formatted error descriptions for the current state of the creator. if an empty
/// string is returned, there is no error. /// string is returned, there is no error.
/// Focus main input widget
virtual void focus();
private slots: private slots:
void cellChanged(); void cellChanged();

View file

@ -157,6 +157,7 @@ void CSVWorld::TableBottomBox::createRequest()
mLayout->setCurrentWidget (mCreator); mLayout->setCurrentWidget (mCreator);
setVisible (true); setVisible (true);
mCreating = true; mCreating = true;
mCreator->focus();
} }
void CSVWorld::TableBottomBox::cloneRequest(const std::string& id, void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
@ -168,4 +169,5 @@ void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
mCreator->toggleWidgets(false); mCreator->toggleWidgets(false);
setVisible (true); setVisible (true);
mCreating = true; mCreating = true;
mCreator->focus();
} }