From 945d8562caff1586b80d72ae99ff16209586a88f Mon Sep 17 00:00:00 2001 From: blacksun Date: Sun, 26 Feb 2017 18:30:34 +0000 Subject: [PATCH] Improve some layout and widget item git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4920 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- .../autoNum/ui/autonumberingmanagementw.ui | 816 +++++++++--------- sources/autoNum/ui/dialogautonum.cpp | 113 --- sources/autoNum/ui/dialogautonum.h | 49 -- sources/autoNum/ui/dialogautonum.ui | 162 ---- sources/autoNum/ui/folioautonumbering.ui | 431 ++++----- sources/autoNum/ui/formulaautonumberingw.ui | 37 +- sources/autoNum/ui/numparteditorw.cpp | 19 +- sources/autoNum/ui/numparteditorw.h | 44 +- sources/autoNum/ui/selectautonumw.cpp | 67 +- sources/autoNum/ui/selectautonumw.h | 5 +- sources/autoNum/ui/selectautonumw.ui | 462 +++++----- sources/projectconfigpages.cpp | 220 ++--- sources/projectconfigpages.h | 13 +- sources/qetdiagrameditor.cpp | 2 - 14 files changed, 973 insertions(+), 1467 deletions(-) delete mode 100644 sources/autoNum/ui/dialogautonum.cpp delete mode 100644 sources/autoNum/ui/dialogautonum.h delete mode 100644 sources/autoNum/ui/dialogautonum.ui diff --git a/sources/autoNum/ui/autonumberingmanagementw.ui b/sources/autoNum/ui/autonumberingmanagementw.ui index 1a59d4000..be70d22b6 100644 --- a/sources/autoNum/ui/autonumberingmanagementw.ui +++ b/sources/autoNum/ui/autonumberingmanagementw.ui @@ -6,8 +6,8 @@ 0 0 - 650 - 550 + 460 + 508 @@ -25,432 +25,100 @@ Form - - - QLayout::SetDefaultConstraint - - - - - - 0 - 50 - + + + + + Range - - - 450 - 253 - - - - - 0 - 50 - - - - false - - - Qt::LeftToRight - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignHCenter|Qt::AlignTop - - - - - 0 - 0 - 630 - 495 - - - - - 0 - 0 - - - - - 430 - 250 - - - - - QLayout::SetFixedSize - - - - - - 0 - 0 - - - - - 75 - true - - - - Project Status: - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Range - - - - - - - - - - - - - Apply to Selected Locations - - - - - - - Apply to Selected Folios - - - - - - - Apply to Entire Project - - - - - - - - - - - - - - 0 - 0 - - - - From - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - To - - - - - - - - 0 - 0 - - - - - - - - - - - - - - Update Policy - - - - - - - - - - 75 - true - - - - Conductor - - - - - - - Both - - - true - - - - - - - Only New - - - true - - - - - - - Only Existent - - - true - - - - - - - Disable - - - - - - - - - - - 0 - 0 - - - - - - - - 75 - true - - - - Element - - - - - - - - 0 - 0 - - - - Both - - - true - - - - - - - - 0 - 0 - - - - Only New - - - true - - - - - - - - 0 - 0 - - - - Only Existent - - - true - - - - - - - - 0 - 0 - - - - Disable - - - - - - - - - - - 50 - false - true - - - - - - - - 75 - true - - - - Folio - - - - - - - Only New - - - true - - - - - - - Existent - - - true - - - - - - - Both - - - true - - - - - - - Disable - - - - - - - - - - - + + + + + + + + + + + + Apply to Selected Locations + + + + + + + Apply to Selected Folios + + + + + + + Apply to Entire Project + + + + + + + + + + + + + + 0 + 0 + + + + From + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + To + + + + + + + + 0 + 0 + + + + + + + + - + @@ -463,6 +131,304 @@ + + + + + 0 + 0 + + + + + 75 + true + + + + Project Status: + + + + + + + Update Policy + + + + + + + + + + 75 + true + + + + Conductor + + + + + + + Both + + + true + + + + + + + Only New + + + true + + + + + + + Only Existent + + + true + + + + + + + Disable + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + + + + + 75 + true + + + + Element + + + + + + + + 0 + 0 + + + + Both + + + true + + + + + + + + 0 + 0 + + + + Only New + + + true + + + + + + + + 0 + 0 + + + + Only Existent + + + true + + + + + + + + 0 + 0 + + + + Disable + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 50 + false + true + + + + + + + + 75 + true + + + + Folio + + + + + + + Only New + + + true + + + + + + + Existent + + + true + + + + + + + Both + + + true + + + + + + + Disable + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 0 + 0 + + + + QComboBox::AdjustToContents + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/sources/autoNum/ui/dialogautonum.cpp b/sources/autoNum/ui/dialogautonum.cpp deleted file mode 100644 index 4d04fa65b..000000000 --- a/sources/autoNum/ui/dialogautonum.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright 2006-2017 The QElectroTech Team - This file is part of QElectroTech. - - QElectroTech is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - QElectroTech is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QElectroTech. If not, see . -*/ -#include "dialogautonum.h" -#include "ui_dialogautonum.h" - -//#include "conductorautonumerotation.h" -#include "qetmessagebox.h" -#include "ui/selectautonumw.h" - -/** - * @brief DialogAutoNum::DialogAutoNum - * @param dg - * @param parent - */ -DialogAutoNum::DialogAutoNum(Diagram *dg, QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogAutoNum), - dg_ (dg) -{ - ui -> setupUi(this); - - ui -> configuration_layout -> addWidget (new SelectAutonumW()); - - dgselect_ = new diagramselection( dg_ -> project(), ui -> annotation_tab); - ui -> verticalLayout_Selection -> addWidget(dgselect_); -} - -/** - * @brief Destructor - */ -DialogAutoNum::~DialogAutoNum(){ - delete ui; -} - -/** - * @brief DialogAutoNum::on_pushButton_delete_clicked - */ -void DialogAutoNum::on_pushButton_delete_clicked() { - // get list of diagrams selected - QListlistDiag = dgselect_ -> list_of_DiagramSelected(); - if(listDiag.count()<=0) return; - - QString diagramsTitle; - for(int i=0; i title(); - if(i+1 < listDiag.count()) diagramsTitle += ", "; - } - // Ask if user is sure to delete the conductor numerotation - QMessageBox::StandardButton answer = QET::QetMessageBox::critical( - this, - tr("Suppression des annotations conducteurs", "Attention"), - QString( - tr("Voulez-vous vraiment supprimer les annotations conducteurs de :\n\n%1 ?") - ).arg(diagramsTitle), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No - ); - - // if yes remove all - if( answer == QMessageBox::Yes) { - for(int i=0; ilistDiag = dgselect_ -> list_of_DiagramSelected(); - if(listDiag.count()<=0) return; - - QString diagramsTitle; - for(int i=0; i title(); - if(i+1 < listDiag.count()) diagramsTitle += ", "; - } - // Ask if user is sure to numerate the conductor - QET::QetMessageBox::warning( - this, - tr("Annotation des conducteurs", "Attention"), - QString( - tr("Voulez-vous vraiment annoter les conducteurs de :\n\n%1 ?") - ).arg(diagramsTitle), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No - ); -} - -/** - * @brief Close the dialog - */ -void DialogAutoNum::on_pushButton_close_clicked() { - close(); -} diff --git a/sources/autoNum/ui/dialogautonum.h b/sources/autoNum/ui/dialogautonum.h deleted file mode 100644 index ab3f54c3f..000000000 --- a/sources/autoNum/ui/dialogautonum.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright 2006-2017 The QElectroTech Team - This file is part of QElectroTech. - - QElectroTech is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. - - QElectroTech is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QElectroTech. If not, see . -*/ -#ifndef DIALOGAUTONUM_H -#define DIALOGAUTONUM_H - -#include - -#include "diagram.h" -#include "ui/diagramselection.h" - -namespace Ui { - class DialogAutoNum; -} - -class DialogAutoNum : public QDialog -{ - Q_OBJECT - - public: - explicit DialogAutoNum(Diagram *dg, QWidget *parent = 0); - ~DialogAutoNum(); - - private slots: - void on_pushButton_annotation_clicked(); - void on_pushButton_delete_clicked(); - void on_pushButton_close_clicked(); - - private: - Ui::DialogAutoNum *ui; - Diagram *dg_; - diagramselection *dgselect_; -}; - -#endif // DialogAutoNum_H diff --git a/sources/autoNum/ui/dialogautonum.ui b/sources/autoNum/ui/dialogautonum.ui deleted file mode 100644 index 691baae24..000000000 --- a/sources/autoNum/ui/dialogautonum.ui +++ /dev/null @@ -1,162 +0,0 @@ - - - DialogAutoNum - - - - 0 - 0 - 482 - 416 - - - - Annotation des schémas - - - - :/ico/oxygen-icons/32x32/apps/qelectrotech.png:/ico/oxygen-icons/32x32/apps/qelectrotech.png - - - - - - 0 - - - - Configuration - - - - - - 0 - - - - - - - - Annotation - - - - - - - - Sélection - - - - - - - - Conducteurs - - - - :/ico/22x22/conductor2.png:/ico/22x22/conductor2.png - - - true - - - - - - - false - - - Composants - - - - :/ico/22x22/single_page.png:/ico/22x22/single_page.png - - - - - - - - - - - - - - - - - <html><head/><body><p>Numérotée les folio sélectionné</p></body></html> - - - Annotation (alpha) - - - - :/ico/16x16/edit-select-all.png:/ico/16x16/edit-select-all.png - - - - - - - <html><head/><body><p>Supprimé la numérotation des folio sélectionné</p></body></html> - - - Supprimer l'annotation - - - - :/ico/16x16/edit-delete.png:/ico/16x16/edit-delete.png - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Fermer - - - true - - - - - - - - - - - - diff --git a/sources/autoNum/ui/folioautonumbering.ui b/sources/autoNum/ui/folioautonumbering.ui index 152309d90..048e3535e 100644 --- a/sources/autoNum/ui/folioautonumbering.ui +++ b/sources/autoNum/ui/folioautonumbering.ui @@ -6,8 +6,8 @@ 0 0 - 524 - 550 + 460 + 309 @@ -26,254 +26,185 @@ Form - - QLayout::SetDefaultConstraint - - - - - 0 - 50 - - - - - 450 - 253 - - - - - 0 - 50 - - - - false - - - Qt::LeftToRight - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignHCenter|Qt::AlignTop - - - - - 0 - 0 - 504 - 495 - - - - - 0 - 0 - - - - - 430 - 250 - - - - - QLayout::SetFixedSize + + + + + + 0 + 0 + - - - - - 0 - 0 - - - - Options de numérotation - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - - 0 - 0 - - - - Nouveaux Folios - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - - 0 - 0 - - - - 999 - - - 10 - - - - - - - - 0 - 0 - - - - À - - - - - - - - 0 - 0 - - - - De - - - - - - - - - - - 0 - 0 - - - - Sélection: - - - - - - - 0 - 0 - - - - Créer de nouveaux Folios - - - - - - - - 0 - 0 - - - - NumAuto des folios séléctionnés - - - - - - - - - - - 0 - 0 - - - - Numérotation automatique de Folio : - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - + + Numérotation automatique de Folio : + + + + + + + + 0 + 0 + + + + QComboBox::AdjustToContents + + + + + + + + 0 + 0 + + + + Sélection: + + + + + + + 0 + 0 + + + + Créer de nouveaux Folios + + + + + + + + 0 + 0 + + + + NumAuto des folios séléctionnés + + + + + + + + + + + 0 + 0 + + + + Options de numérotation + + + + + + + 0 + 0 + + + + QComboBox::AdjustToContents + + + + + + + + 0 + 0 + + + + Nouveaux Folios + + + + + + + + 0 + 0 + + + + QComboBox::AdjustToContents + + + + + + + + 0 + 0 + + + + 999 + + + 10 + + + + + + + + 0 + 0 + + + + À + + + + + + + + 0 + 0 + + + + De + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + @@ -289,6 +220,10 @@ + buttonBox + verticalSpacer + gridLayoutWidget + verticalSpacer diff --git a/sources/autoNum/ui/formulaautonumberingw.ui b/sources/autoNum/ui/formulaautonumberingw.ui index 4204a2325..381ba49db 100644 --- a/sources/autoNum/ui/formulaautonumberingw.ui +++ b/sources/autoNum/ui/formulaautonumberingw.ui @@ -40,8 +40,21 @@ Auto Naming Pattern: - - + + + + + + 0 + 0 + + + + Formula: + + + + @@ -60,18 +73,18 @@ - - - - - 0 - 0 - + + + + Qt::Horizontal - - Formula: + + + 40 + 20 + - + diff --git a/sources/autoNum/ui/numparteditorw.cpp b/sources/autoNum/ui/numparteditorw.cpp index 3491a089f..beade696d 100644 --- a/sources/autoNum/ui/numparteditorw.cpp +++ b/sources/autoNum/ui/numparteditorw.cpp @@ -22,10 +22,11 @@ /** * Constructor */ -NumPartEditorW::NumPartEditorW(QWidget *parent) : +NumPartEditorW::NumPartEditorW(int type, QWidget *parent) : QWidget(parent), ui(new Ui::NumPartEditorW), - intValidator (new QIntValidator(0,99999,this)) + intValidator (new QIntValidator(0,99999,this)), + m_edited_type(type) { ui -> setupUi(this); setVisibleItems(); @@ -36,10 +37,11 @@ NumPartEditorW::NumPartEditorW(QWidget *parent) : * Constructor * Build with value of @context at position i */ -NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *parent): +NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, QWidget *parent): QWidget(parent), ui(new Ui::NumPartEditorW), - intValidator (new QIntValidator(0,99999,this)) + intValidator (new QIntValidator(0,99999,this)), + m_edited_type(type) { ui -> setupUi(this); setVisibleItems(); @@ -75,15 +77,18 @@ NumPartEditorW::~NumPartEditorW() delete ui; } -void NumPartEditorW::setVisibleItems() { +void NumPartEditorW::setVisibleItems() +{ ui->type_cb->setInsertPolicy(QComboBox::InsertAtBottom); QStringList items; - if (parentWidget()->parentWidget()->objectName()=="FolioTab") { + if (m_edited_type == 2) + { items << tr("Chiffre 1") << tr("Chiffre 01") << tr("Chiffre 001") << tr("Texte"); } - else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") { + else if (m_edited_type == 1) + { items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01") << tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio") << tr("Texte") << tr("N° folio") << tr("Folio") << tr("Machine") << tr("Locmach"); diff --git a/sources/autoNum/ui/numparteditorw.h b/sources/autoNum/ui/numparteditorw.h index 2c7618697..65b26a950 100644 --- a/sources/autoNum/ui/numparteditorw.h +++ b/sources/autoNum/ui/numparteditorw.h @@ -35,37 +35,39 @@ class NumPartEditorW : public QWidget { Q_OBJECT - //METHODS + //METHODS public: - explicit NumPartEditorW(QWidget *parent = 0); - NumPartEditorW (NumerotationContext &, int, QWidget *parent=0); - ~NumPartEditorW(); + explicit NumPartEditorW(int type, QWidget *parent = 0); + NumPartEditorW (NumerotationContext &, int, int type, QWidget *parent=0); + ~NumPartEditorW(); - enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio, - string,idfolio,folio,machine,locmach, - elementline,elementcolumn,elementprefix, - }; - NumerotationContext toNumContext(); - bool isValid (); - type type_; + enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio, + string,idfolio,folio,machine,locmach, + elementline,elementcolumn,elementprefix, + }; + NumerotationContext toNumContext(); + bool isValid (); + type type_; private: - void setVisibleItems(); - void disableItem(int index); - void setCurrentIndex(NumPartEditorW::type); + void setVisibleItems(); + void disableItem(int index); + void setCurrentIndex(NumPartEditorW::type); private slots: - void on_type_cb_activated(int); - void on_value_field_textEdited(); - void on_increase_spinBox_valueChanged(int); - void setType (NumPartEditorW::type t, bool=false); + void on_type_cb_activated(int); + void on_value_field_textEdited(); + void on_increase_spinBox_valueChanged(int); + void setType (NumPartEditorW::type t, bool=false); signals: - void changed (); + void changed (); private: - Ui::NumPartEditorW *ui; - QValidator *intValidator; + Ui::NumPartEditorW *ui; + QValidator *intValidator; + int m_edited_type = -1; //0 == element : 1 == conductor : 2 == folio + }; diff --git a/sources/autoNum/ui/selectautonumw.cpp b/sources/autoNum/ui/selectautonumw.cpp index cab80f636..72a54db90 100644 --- a/sources/autoNum/ui/selectautonumw.cpp +++ b/sources/autoNum/ui/selectautonumw.cpp @@ -27,36 +27,44 @@ /** * Constructor */ -SelectAutonumW::SelectAutonumW(QWidget *parent) : +SelectAutonumW::SelectAutonumW(int type, QWidget *parent) : QWidget(parent), - ui(new Ui::SelectAutonumW) + ui(new Ui::SelectAutonumW), + m_edited_type(type) { ui->setupUi(this); - if (this->parentWidget() -> objectName()=="ElementTab"){ + if (m_edited_type == 0) + { m_feaw = new FormulaAutonumberingW(); - ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw); + m_feaw->ui->label->setHidden(true); + ui->m_widget->layout()->addWidget(m_feaw); } - else if (this->parentWidget() -> objectName()=="ConductorTab"){ + else if (m_edited_type == 1) + { m_fcaw = new FormulaAutonumberingW(); m_fcaw->ui->label->setHidden(true); - ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw); + ui->m_widget->layout()->addWidget(m_fcaw); } setContext(NumerotationContext()); } -SelectAutonumW::SelectAutonumW(const NumerotationContext &context, QWidget *parent) : +SelectAutonumW::SelectAutonumW(const NumerotationContext &context, int type, QWidget *parent) : QWidget(parent), - ui(new Ui::SelectAutonumW) + ui(new Ui::SelectAutonumW), + m_edited_type(type) { - if (this->parentWidget() -> objectName()=="ElementTab"){ + if (m_edited_type == 0) + { m_feaw = new FormulaAutonumberingW(); - ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw); + m_feaw->ui->label->setHidden(true); + ui->m_widget->layout()->addWidget(m_feaw); } - else if (this->parentWidget() -> objectName()=="ConductorTab"){ + else if (m_edited_type == 1) + { m_fcaw = new FormulaAutonumberingW(); m_fcaw->ui->label->setHidden(true); - ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw); + ui->m_widget->layout()->addWidget(m_fcaw); } ui->setupUi(this); setContext(context); @@ -85,7 +93,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) { } else { for (int i=0; i editor_layout -> addWidget(part); @@ -113,9 +121,10 @@ NumerotationContext SelectAutonumW::toNumContext() const { * @brief SelectAutonumW::on_add_button_clicked * Action on add_button, add a @NumPartEditor */ -void SelectAutonumW::on_add_button_clicked() { +void SelectAutonumW::on_add_button_clicked() +{ applyEnable(false); - NumPartEditorW *part = new NumPartEditorW(this); + NumPartEditorW *part = new NumPartEditorW(m_edited_type, this); connect (part, SIGNAL(changed()), this, SLOT(applyEnable())); num_part_list_ << part; ui -> editor_layout -> addWidget(part); @@ -143,12 +152,14 @@ void SelectAutonumW::on_remove_button_clicked() { * @brief SelectAutonumW::formula * @return autonumbering widget formula */ -QString SelectAutonumW::formula() { - if (this->parentWidget() -> objectName()=="ElementTab") - return m_feaw->formula(); - else if (this->parentWidget() ->objectName()=="ConductorTab") - return m_fcaw->formula(); - else return ""; +QString SelectAutonumW::formula() +{ + if (m_edited_type == 0) + return m_feaw->formula(); + else if (m_edited_type == 1) + return m_fcaw->formula(); + else + return ""; } /** @@ -165,7 +176,8 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) { break; //help dialog case QDialogButtonBox::HelpRole: - if (this->parentWidget() -> objectName()=="FolioTab"){ + if (m_edited_type == 2) + { QMessageBox::information (this, tr("Folio Autonumérotation", "title window"), tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux folios.\n" "-Une numérotation est composée d'une variable minimum.\n" @@ -183,7 +195,8 @@ void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) { )); break; } - else{ + else + { QMessageBox::information (this, tr("Conducteur Autonumérotation", "title window"), tr("C'est ici que vous pouvez définir la manière dont sera numéroté les nouveaux conducteurs.\n" "-Une numérotation est composée d'une variable minimum.\n" @@ -234,9 +247,9 @@ void SelectAutonumW::applyEnable(bool b) { else { ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b); } - if (this->parentWidget() -> objectName()=="ElementTab") + if (m_edited_type == 0) contextToFormula(); - if (this->parentWidget()->objectName()=="ConductorTab") + if (m_edited_type == 1) contextToFormula(); } @@ -247,9 +260,9 @@ void SelectAutonumW::applyEnable(bool b) { void SelectAutonumW::contextToFormula() { FormulaAutonumberingW* m_faw = nullptr; - if (this->parentWidget() -> objectName()=="ElementTab") + if (m_edited_type == 0) m_faw = m_feaw; - else if (this->parentWidget()->objectName()=="ConductorTab") + else if (m_edited_type == 1) m_faw = m_fcaw; if (m_faw) diff --git a/sources/autoNum/ui/selectautonumw.h b/sources/autoNum/ui/selectautonumw.h index d569ad93b..1cf60151d 100644 --- a/sources/autoNum/ui/selectautonumw.h +++ b/sources/autoNum/ui/selectautonumw.h @@ -36,8 +36,8 @@ class SelectAutonumW : public QWidget //METHODS public: - explicit SelectAutonumW(QWidget *parent = 0); - explicit SelectAutonumW(const NumerotationContext &context, QWidget *parent = 0); + explicit SelectAutonumW(int type, QWidget *parent = 0); + explicit SelectAutonumW(const NumerotationContext &context, int type, QWidget *parent = 0); ~SelectAutonumW(); void setContext (const NumerotationContext &context); @@ -68,6 +68,7 @@ class SelectAutonumW : public QWidget NumerotationContext m_context; FormulaAutonumberingW *m_feaw; FormulaAutonumberingW *m_fcaw; + int m_edited_type = -1; //0 == element : 1 == conductor : 2 == folio }; #endif // SELECTAUTONUMW_H diff --git a/sources/autoNum/ui/selectautonumw.ui b/sources/autoNum/ui/selectautonumw.ui index ebff5388c..5651eab1c 100644 --- a/sources/autoNum/ui/selectautonumw.ui +++ b/sources/autoNum/ui/selectautonumw.ui @@ -6,8 +6,8 @@ 0 0 - 418 - 508 + 616 + 421 @@ -21,266 +21,214 @@ - - - - 0 - 0 - - - - - 400 - 455 - - - - - 0 - 0 - - - - false - - - Qt::LeftToRight - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAlwaysOff - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 400 - 453 - + + + + 0 - - - 0 - 0 - + + 0 - - - 400 - 450 - + + 0 - - - QLayout::SetFixedSize - - - - - - 0 - 0 - + + 0 + + + 0 + + + + + + 0 + 0 + + + + Définition + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + QLayout::SetDefaultConstraint - - Définition - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - QLayout::SetFixedSize - - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Supprimer une variable de numérotation</p></body></html> - - - - - - - :/ico/22x22/list-remove.png:/ico/22x22/list-remove.png - - - false - - - - - - - <html><head/><body><p>Ajouter une variable de numérotation</p></body></html> - - - - - - - :/ico/22x22/list-add.png:/ico/22x22/list-add.png - - - false - - - - - - - Précédent - - - - - - - :/ico/16x16/arrow-left.png:/ico/16x16/arrow-left.png - - - - - - - Suivant - - - - - - - :/ico/16x16/arrow-right.png:/ico/16x16/arrow-right.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - 0 - - - QLayout::SetDefaultConstraint - - - - - Type - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - Valeur - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Incrémentation - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 20 - 0 - - - - - - - - - + + + + 0 + + + QLayout::SetDefaultConstraint + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Supprimer une variable de numérotation</p></body></html> + + + + + + + :/ico/22x22/list-remove.png:/ico/22x22/list-remove.png + + + false + + + + + + + <html><head/><body><p>Ajouter une variable de numérotation</p></body></html> + + + + + + + :/ico/22x22/list-add.png:/ico/22x22/list-add.png + + + false + + + + + + + Précédent + + + + + + + :/ico/16x16/arrow-left.png:/ico/16x16/arrow-left.png + + + + + + + Suivant + + + + + + + :/ico/16x16/arrow-right.png:/ico/16x16/arrow-right.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + QLayout::SetDefaultConstraint + + + + + 0 + + + QLayout::SetDefaultConstraint + + + + + Type + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Valeur + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + Incrémentation + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -297,7 +245,7 @@ - + diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 949eb07b2..b25085b45 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -222,7 +222,6 @@ ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, QWidget ProjectConfigPage(project, parent) { initWidgets(); - initLayout(); buildConnections(); readValuesFromProject(); } @@ -254,127 +253,101 @@ void ProjectAutoNumConfigPage::applyProjectConf() {} * @brief ProjectAutoNumConfigPage::initWidgets * Init some widget of this page */ -void ProjectAutoNumConfigPage::initWidgets() { - - tab_widget = new QTabWidget(this); - - management_tab_widget = new QWidget(this); - m_amw = new AutoNumberingManagementW(project(), management_tab_widget); - - //Conductor Tab - conductor_tab_widget = new QWidget(this); - conductor_tab_widget->setObjectName("ConductorTab"); - - m_label_conductor = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), conductor_tab_widget); - - m_context_cb_conductor= new QComboBox(conductor_tab_widget); +void ProjectAutoNumConfigPage::initWidgets() +{ + QTabWidget *tab_widget = new QTabWidget(this); + + //Management tab + m_amw = new AutoNumberingManagementW(project()); + tab_widget->addTab(m_amw, tr("Management")); + + //Conductor tab + QWidget *conductor_widget = new QWidget(); + QVBoxLayout *conductor_layout = new QVBoxLayout(conductor_widget); + QHBoxLayout *bp_conductor_layout = new QHBoxLayout(); + + QLabel *label_conductor = new QLabel(tr("Numérotations disponibles :", "availables numerotations")); + m_context_cb_conductor= new QComboBox(); m_context_cb_conductor->setEditable(true); m_context_cb_conductor->lineEdit()->setClearButtonEnabled(true); m_context_cb_conductor->addItem(tr("Nom de la nouvelle numérotation")); - - m_remove_pb_conductor= new QPushButton(QET::Icons::EditDelete, QString(), conductor_tab_widget); + + m_remove_pb_conductor= new QPushButton(QET::Icons::EditDelete, QString()); m_remove_pb_conductor-> setToolTip(tr("Supprimer la numérotation")); - - m_saw_conductor = new SelectAutonumW(conductor_tab_widget); - - //Element Tab - element_tab_widget = new QWidget(this); - element_tab_widget->setObjectName("ElementTab"); - - m_label_element = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), element_tab_widget); - - m_context_cb_element = new QComboBox(element_tab_widget); + + m_saw_conductor = new SelectAutonumW(1); + + bp_conductor_layout->addWidget(label_conductor); + bp_conductor_layout->addStretch(); + bp_conductor_layout->addWidget(m_context_cb_conductor); + bp_conductor_layout->addWidget(m_remove_pb_conductor); + + conductor_layout->addLayout(bp_conductor_layout); + conductor_layout->addWidget(m_saw_conductor); + + tab_widget->addTab(conductor_widget, tr("Conducteur")); + + //Element tab + QWidget *element_widget = new QWidget(); + QVBoxLayout *element_layout = new QVBoxLayout(element_widget); + QHBoxLayout *bp_element_layout = new QHBoxLayout(); + + QLabel *label_element = new QLabel(tr("Numérotations disponibles :", "availables numerotations")); + + m_context_cb_element = new QComboBox(); m_context_cb_element->setEditable(true); m_context_cb_element->lineEdit()->setClearButtonEnabled(true); m_context_cb_element->addItem(tr("Nom de la nouvelle numérotation")); - - m_remove_pb_element = new QPushButton(QET::Icons::EditDelete, QString(), element_tab_widget); + + m_remove_pb_element = new QPushButton(QET::Icons::EditDelete, QString()); m_remove_pb_element -> setToolTip(tr("Supprimer la numérotation")); - - m_saw_element = new SelectAutonumW(element_tab_widget); - - //Folio Tab - folio_tab_widget = new QWidget(this); - folio_tab_widget->setObjectName("FolioTab"); - - m_label_folio = new QLabel(tr("Numérotations disponibles :", "availables numerotations"), folio_tab_widget); - - m_context_cb_folio = new QComboBox(folio_tab_widget); + + m_saw_element = new SelectAutonumW(0); + + bp_element_layout->addWidget(label_element); + bp_element_layout->addStretch(); + bp_element_layout->addWidget(m_context_cb_element); + bp_element_layout->addWidget(m_remove_pb_element); + + element_layout->addLayout(bp_element_layout); + element_layout->addWidget(m_saw_element); + + tab_widget->addTab(element_widget, tr("Element")); + + //Folio Tab + QWidget *folio_widget = new QWidget(); + QVBoxLayout *folio_layout = new QVBoxLayout(folio_widget); + QHBoxLayout *bp_folio_layout = new QHBoxLayout(); + + QLabel *label_folio = new QLabel(tr("Numérotations disponibles :", "availables numerotations")); + + m_context_cb_folio = new QComboBox(); m_context_cb_folio->setEditable(true); m_context_cb_folio->lineEdit()->setClearButtonEnabled(true); m_context_cb_folio->addItem(tr("Nom de la nouvelle numérotation")); - - m_remove_pb_folio = new QPushButton(QET::Icons::EditDelete, QString(), folio_tab_widget); + + m_remove_pb_folio = new QPushButton(QET::Icons::EditDelete, QString()); m_remove_pb_folio -> setToolTip(tr("Supprimer la numérotation")); - - m_saw_folio = new SelectAutonumW(folio_tab_widget); - - //AutoNumbering Tab - autoNumbering_tab_widget = new QWidget(this); - m_faw = new FolioAutonumberingW(project(),autoNumbering_tab_widget); -} - -/** - * @brief ProjectAutoNumConfigPage::initLayout - * Init the layout of this page - */ -void ProjectAutoNumConfigPage::initLayout() { - - //Management Tab - tab_widget->addTab(management_tab_widget, tr("Management")); - - //Conductor Tab - tab_widget->addTab(conductor_tab_widget, tr("Conductor")); - - QHBoxLayout *context_layout_conductor = new QHBoxLayout(); - context_layout_conductor -> addWidget (m_label_conductor); - context_layout_conductor -> addWidget (m_context_cb_conductor); - context_layout_conductor -> addWidget (m_remove_pb_conductor); - - QVBoxLayout *main_layout_conductor = new QVBoxLayout(); - QVBoxLayout *aux_layout_conductor = new QVBoxLayout(); - aux_layout_conductor->addLayout(context_layout_conductor); - aux_layout_conductor->addWidget(m_saw_conductor); - - main_layout_conductor->addLayout(aux_layout_conductor); - conductor_tab_widget -> setLayout (main_layout_conductor); - - //Element Tab - tab_widget->addTab(element_tab_widget,tr ("Element")); - - QHBoxLayout *element_context_layout = new QHBoxLayout(); - element_context_layout -> addWidget (m_label_element); - element_context_layout -> addWidget (m_context_cb_element); - element_context_layout -> addWidget (m_remove_pb_element); - - QVBoxLayout *main_layout_element = new QVBoxLayout(); - QVBoxLayout *aux_layout_element = new QVBoxLayout(); - aux_layout_element->addLayout(element_context_layout); - aux_layout_element->addWidget(m_saw_element); - - main_layout_element->addLayout(aux_layout_element); - element_tab_widget->setLayout(main_layout_element); - - // Folio Tab - tab_widget->addTab(folio_tab_widget, tr("Folio")); - - QHBoxLayout *context_layout_folio = new QHBoxLayout(); - context_layout_folio -> addWidget (m_label_folio); - context_layout_folio -> addWidget (m_context_cb_folio); - context_layout_folio -> addWidget (m_remove_pb_folio); - - QVBoxLayout *main_layout_folio = new QVBoxLayout(); - QVBoxLayout *aux_layout_folio = new QVBoxLayout(); - aux_layout_folio->addLayout(context_layout_folio); - aux_layout_folio->addWidget(m_saw_folio); - - main_layout_folio->addLayout(aux_layout_folio); - folio_tab_widget->setLayout(main_layout_folio); - - //Auto Numbering Tab - tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering")); - - tab_widget->resize(850,590); + + m_saw_folio = new SelectAutonumW(2); + + bp_folio_layout->addWidget(label_folio); + bp_folio_layout->addStretch(); + bp_folio_layout->addWidget(m_context_cb_folio); + bp_folio_layout->addWidget(m_remove_pb_folio); + + folio_layout->addLayout(bp_folio_layout); + folio_layout->addWidget(m_saw_folio); + + tab_widget->addTab(folio_widget, tr("Folio")); + + //AutoNumbering Tab + m_faw = new FolioAutonumberingW(project()); + tab_widget->addTab(m_faw, tr("Folio autonumérotation")); + + m_main_layout = new QHBoxLayout(); + m_main_layout->addWidget(tab_widget); + setLayout(m_main_layout); } /** @@ -417,7 +390,7 @@ void ProjectAutoNumConfigPage::adjustReadOnly() { */ void ProjectAutoNumConfigPage::buildConnections() { - connect(tab_widget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int))); + //connect(m_tab_widget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int))); //Management Tab connect (m_amw, SIGNAL(applyPressed()), this, SLOT(applyManagement())); @@ -724,26 +697,7 @@ void ProjectAutoNumConfigPage::removeContext_folio() { * @param tab index * Change to Selected Tab */ -void ProjectAutoNumConfigPage::changeToTab(int i){ - tab_widget->setCurrentIndex(i); -} - -/** - * @brief ProjectAutoNumConfigPage::tabChanged - * @param tab index - * Used to resize window to correct size - */ -void ProjectAutoNumConfigPage::tabChanged(int i){ - if (i>=1){ - if (tab_widget->currentIndex() == 4){ - tab_widget->resize(520,tab_widget->height()); - } - else if (tab_widget->currentIndex() == 1 || tab_widget->currentIndex() == 2 ){ - tab_widget->resize(495,tab_widget->height()); - } - else tab_widget->resize(475,tab_widget->height()); - } - else { - tab_widget->resize(850,tab_widget->height()); - } +void ProjectAutoNumConfigPage::changeToTab(int i) +{ + Q_UNUSED(i); } diff --git a/sources/projectconfigpages.h b/sources/projectconfigpages.h index ae26b3d30..3df7cf6e2 100644 --- a/sources/projectconfigpages.h +++ b/sources/projectconfigpages.h @@ -33,8 +33,8 @@ class QPushButton; class FolioAutonumberingW; class FormulaAutonumberingW; class AutoNumberingManagementW; -class QTabWidget; class QScrollArea; +class QHBoxLayout; /** This class, derived from ConfigPage, aims at providing the basic skeleton @@ -134,7 +134,7 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { virtual void changeToTab(int); protected: virtual void initWidgets(); - virtual void initLayout(); + virtual void initLayout() {} virtual void readValuesFromProject(); virtual void adjustReadOnly(); private: @@ -153,8 +153,6 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { void applyAutoNum(); void applyManagement(); - void tabChanged(int); - signals: void setAutoNum(QString); void setAutoNum(int,int); @@ -163,16 +161,13 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { //Attributes private: - QTabWidget *tab_widget; - QWidget *management_tab_widget; + QHBoxLayout *m_main_layout = nullptr; + QWidget *m_management_tab_widget; QWidget *conductor_tab_widget; QWidget *element_tab_widget; QWidget *folio_tab_widget; QWidget *autoNumbering_tab_widget; QScrollArea *scrollArea; - QLabel *m_label_conductor; - QLabel *m_label_folio; - QLabel *m_label_element; QComboBox *m_context_cb_conductor; QComboBox *m_context_cb_folio; QComboBox *m_context_cb_element; diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 32aaec44f..604b3e6cb 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -43,8 +43,6 @@ #include "elementscollectionwidget.h" #include "autonumberingdockwidget.h" -#include "ui/dialogautonum.h" - #include #include