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

test
Marc Zinnschlag 10 years ago
parent 0bf28a6eab
commit d873c2c603

@ -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();

@ -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;

@ -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);

@ -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();

@ -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();

@ -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();

@ -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();

@ -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();
} }

Loading…
Cancel
Save