NameList widget : add a combo box for easily paste texts, like the variables for title block.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5687 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2019-01-02 16:56:46 +00:00
parent 2d76065b98
commit 04e890ab7d
20 changed files with 724 additions and 321 deletions

View File

@@ -16,7 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "newelementwizard.h"
#include "nameslistwidget.h"
#include "namelistwidget.h"
#include "qetelementeditor.h"
#include "qfilenameedit.h"
#include "qetmessagebox.h"
@@ -130,7 +130,7 @@ QWizardPage *NewElementWizard::buildStep3() {
page -> setSubTitle(tr("Indiquez le ou les noms de l'élément.", "wizard page subtitle"));
QVBoxLayout *layout = new QVBoxLayout();
m_names_list = new NamesListWidget();
m_names_list = new NameListWidget(this);
NamesList hash_name;
hash_name.addName(QLocale::system().name().left(2), tr("Nom du nouvel élément", "default name when creating a new element"));
m_names_list -> setNames(hash_name);
@@ -144,14 +144,22 @@ QWizardPage *NewElementWizard::buildStep3() {
* @brief NewElementWizard::validateCurrentPage
* @return true if the current step is valid
*/
bool NewElementWizard::validateCurrentPage() {
bool NewElementWizard::validateCurrentPage()
{
WizardState wizard_state = static_cast<WizardState>(currentPage() -> property("WizardState").toInt());
if (wizard_state == Category) return(validStep1());
else if (wizard_state == Filename) return(validStep2());
else if (wizard_state == Names) {
// must have one name minimum
if (m_names_list -> checkOneName())
if (wizard_state == Category) {
return(validStep1());
}
else if (wizard_state == Filename) {
return(validStep2());
}
else if (wizard_state == Names)
{
// must have one name minimum
if (!m_names_list->isEmpty()) {
createNewElement();
}
return true;
}
else return(true);