From 491fd3d0be333efb4696448818b681e0e4fadb2c Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sat, 18 Mar 2017 09:20:14 -0400 Subject: [PATCH] Editor: set combo box events for pathgrid creator - Handles when combo box should automatically gain or lose focus. - Checks user input when combo box selection changes. --- apps/opencs/view/world/pathgridcreator.cpp | 18 ++++++++++++++++++ apps/opencs/view/world/pathgridcreator.hpp | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index 166acafd27..ae9ce7242d 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -48,6 +48,8 @@ CSVWorld::PathgridCreator::PathgridCreator( mCell->model()->sort(0); mCell->setCurrentIndex(0); + + connect(mCell, SIGNAL (currentIndexChanged(const QString&)), this, SLOT (cellChanged())); } std::string CSVWorld::PathgridCreator::getErrors() const @@ -73,3 +75,19 @@ std::string CSVWorld::PathgridCreator::getErrors() const return errors; } + +void CSVWorld::PathgridCreator::focus() +{ + mCell->setFocus(); +} + +void CSVWorld::PathgridCreator::reset() +{ + CSVWorld::GenericCreator::reset(); + mCell->setCurrentIndex(0); +} + +void CSVWorld::PathgridCreator::cellChanged() +{ + update(); +} diff --git a/apps/opencs/view/world/pathgridcreator.hpp b/apps/opencs/view/world/pathgridcreator.hpp index 5508fadd7d..6ed8004e2f 100644 --- a/apps/opencs/view/world/pathgridcreator.hpp +++ b/apps/opencs/view/world/pathgridcreator.hpp @@ -29,6 +29,17 @@ namespace CSVWorld /// \return Error description for current user input. virtual std::string getErrors() const; + + /// \brief Set focus to cell ID input widget. + virtual void focus(); + + /// \brief Reset selected cell ID. + virtual void reset(); + + private slots: + + /// \brief Check user input for errors. + void cellChanged(); }; }