mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Wrap code for better readability
This commit is contained in:
@@ -72,32 +72,43 @@ void AutoNumberingDockWidget::projectClosed()
|
||||
@param projectview: projectview to be setted
|
||||
assign Project and ProjectView, connect all signals and setContext
|
||||
*/
|
||||
void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *projectview)
|
||||
void AutoNumberingDockWidget::setProject(QETProject *project,
|
||||
ProjectView *projectview)
|
||||
{
|
||||
//Disconnect previous project
|
||||
if (m_project && m_project_view)
|
||||
{
|
||||
//Conductor Signals
|
||||
disconnect(m_project, SIGNAL(conductorAutoNumChanged()),this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(conductorAutoNumAdded()), this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),this,SLOT(setConductorActive(DiagramView*)));
|
||||
disconnect(m_project, SIGNAL(conductorAutoNumChanged()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(conductorAutoNumRemoved()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(conductorAutoNumAdded()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
disconnect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),
|
||||
this,SLOT(setConductorActive(DiagramView*)));
|
||||
|
||||
//Element Signals
|
||||
disconnect (m_project,SIGNAL(elementAutoNumRemoved(QString)), this,SLOT(elementAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(elementAutoNumAdded(QString)), this,SLOT(elementAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(elementAutoNumRemoved(QString)),
|
||||
this,SLOT(elementAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(elementAutoNumAdded(QString)),
|
||||
this,SLOT(elementAutoNumChanged()));
|
||||
|
||||
//Folio Signals
|
||||
disconnect (m_project,SIGNAL(folioAutoNumRemoved()), this,SLOT(folioAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(folioAutoNumAdded()), this,SLOT(folioAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(folioAutoNumRemoved()),
|
||||
this,SLOT(folioAutoNumChanged()));
|
||||
disconnect (m_project,SIGNAL(folioAutoNumAdded()),
|
||||
this,SLOT(folioAutoNumChanged()));
|
||||
disconnect (this,
|
||||
SIGNAL(folioAutoNumChanged(QString)),
|
||||
&m_project_view->currentDiagram()->diagram()->border_and_titleblock,
|
||||
SLOT (slot_setAutoPageNum(QString)));
|
||||
disconnect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),this,SLOT(setActive()));
|
||||
disconnect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),
|
||||
this,SLOT(setActive()));
|
||||
|
||||
//Conductor, Element and Folio Signals
|
||||
disconnect(m_project, &QETProject::destroyed, this, &AutoNumberingDockWidget::projectClosed);
|
||||
disconnect(m_project, &QETProject::destroyed,
|
||||
this, &AutoNumberingDockWidget::projectClosed);
|
||||
}
|
||||
|
||||
m_project = project;
|
||||
@@ -105,26 +116,36 @@ void AutoNumberingDockWidget::setProject(QETProject *project, ProjectView *proje
|
||||
this->setEnabled(true);
|
||||
|
||||
//Conductor Signals
|
||||
connect(m_project, SIGNAL(conductorAutoNumChanged()),this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project,SIGNAL(conductorAutoNumRemoved()), this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project,SIGNAL(conductorAutoNumAdded()), this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),this,SLOT(setConductorActive(DiagramView*)));
|
||||
connect(m_project, SIGNAL(conductorAutoNumChanged()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project,SIGNAL(conductorAutoNumRemoved()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project,SIGNAL(conductorAutoNumAdded()),
|
||||
this,SLOT(conductorAutoNumChanged()));
|
||||
connect(m_project_view,SIGNAL(diagramActivated(DiagramView*)),
|
||||
this,SLOT(setConductorActive(DiagramView*)));
|
||||
|
||||
//Element Signals
|
||||
connect (m_project,SIGNAL(elementAutoNumRemoved(QString)), this,SLOT(elementAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(elementAutoNumAdded(QString)), this,SLOT(elementAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(elementAutoNumRemoved(QString)),
|
||||
this,SLOT(elementAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(elementAutoNumAdded(QString)),
|
||||
this,SLOT(elementAutoNumChanged()));
|
||||
|
||||
//Folio Signals
|
||||
connect (m_project,SIGNAL(folioAutoNumRemoved()), this,SLOT(folioAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(folioAutoNumAdded()), this,SLOT(folioAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(folioAutoNumRemoved()),
|
||||
this,SLOT(folioAutoNumChanged()));
|
||||
connect (m_project,SIGNAL(folioAutoNumAdded()),
|
||||
this,SLOT(folioAutoNumChanged()));
|
||||
connect (this,
|
||||
SIGNAL(folioAutoNumChanged(QString)),
|
||||
&m_project_view->currentDiagram()->diagram()->border_and_titleblock,
|
||||
SLOT (slot_setAutoPageNum(QString)));
|
||||
connect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),this,SLOT(setActive()));
|
||||
connect(m_project, SIGNAL(defaultTitleBlockPropertiesChanged()),
|
||||
this,SLOT(setActive()));
|
||||
|
||||
//Conductor, Element and Folio Signals
|
||||
connect(m_project, &QETProject::destroyed, this, &AutoNumberingDockWidget::projectClosed);
|
||||
connect(m_project, &QETProject::destroyed,
|
||||
this, &AutoNumberingDockWidget::projectClosed);
|
||||
|
||||
//Set Combobox Context
|
||||
setContext();
|
||||
@@ -144,21 +165,24 @@ void AutoNumberingDockWidget::setContext() {
|
||||
ui->m_conductor_cb->addItem("");
|
||||
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
||||
if (!keys_conductor.isEmpty()) {
|
||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||
foreach (QString str, keys_conductor)
|
||||
{ ui->m_conductor_cb-> addItem(str); }
|
||||
}
|
||||
|
||||
//Element Combobox
|
||||
ui->m_element_cb->addItem("");
|
||||
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
||||
if (!keys_element.isEmpty()) {
|
||||
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
|
||||
foreach (QString str, keys_element)
|
||||
{ui->m_element_cb -> addItem(str);}
|
||||
}
|
||||
|
||||
//Folio Combobox
|
||||
ui->m_folio_cb->addItem("");
|
||||
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
||||
if (!keys_folio.isEmpty()) {
|
||||
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
|
||||
foreach (QString str, keys_folio)
|
||||
{ ui->m_folio_cb -> addItem(str);}
|
||||
}
|
||||
|
||||
this->setActive();
|
||||
@@ -216,7 +240,8 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
||||
ui->m_conductor_cb->addItem("");
|
||||
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
||||
if (!keys_conductor.isEmpty()) {
|
||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||
foreach (QString str, keys_conductor)
|
||||
{ ui->m_conductor_cb-> addItem(str); }
|
||||
}
|
||||
setActive();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ AutoNumberingManagementW::~AutoNumberingManagementW()
|
||||
@brief AutoNumberingManagementW::setProjectContext
|
||||
Add Default Project Status
|
||||
*/
|
||||
void AutoNumberingManagementW::setProjectContext() {
|
||||
void AutoNumberingManagementW::setProjectContext()
|
||||
{
|
||||
ui->m_status_cb->addItem(tr("Under Development"));
|
||||
ui->m_status_cb->addItem(tr("Installing"));
|
||||
ui->m_status_cb->addItem(tr("Built"));
|
||||
@@ -73,7 +74,8 @@ void AutoNumberingManagementW::setProjectContext() {
|
||||
Load Default Status Options
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index) {
|
||||
void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index)
|
||||
{
|
||||
|
||||
//Under Development
|
||||
if (index == 0) {
|
||||
@@ -105,7 +107,8 @@ void AutoNumberingManagementW::on_m_status_cb_currentIndexChanged(int index) {
|
||||
@brief AutoNumberingManagementW::on_m_apply_folios_rb_clicked
|
||||
Set From Folios Combobox
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
||||
void AutoNumberingManagementW::on_m_apply_folios_rb_clicked()
|
||||
{
|
||||
if (ui->m_apply_folios_rb->isChecked()) {
|
||||
ui->m_selected_folios_widget->setEnabled(true);
|
||||
ui->m_selected_folios_le->setEnabled(true);
|
||||
@@ -114,8 +117,13 @@ void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
||||
ui->m_from_folios_cb->addItem("");
|
||||
foreach (Diagram *diagram, project_->diagrams()){
|
||||
if (diagram->title() != "")
|
||||
ui->m_from_folios_cb->addItem(diagram->title(),diagram->folioIndex());
|
||||
else ui->m_from_folios_cb->addItem(QString::number(diagram->folioIndex()),diagram->folioIndex());
|
||||
ui->m_from_folios_cb->addItem(
|
||||
diagram->title(),
|
||||
diagram->folioIndex());
|
||||
else ui->m_from_folios_cb->addItem(
|
||||
QString::number(
|
||||
diagram->folioIndex()),
|
||||
diagram->folioIndex());
|
||||
}
|
||||
}
|
||||
if (ui->m_from_folios_cb->currentIndex() > 0)
|
||||
@@ -129,7 +137,9 @@ void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
||||
Set To Folios Combobox
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index) {
|
||||
void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(
|
||||
int index)
|
||||
{
|
||||
ui->m_to_folios_cb->clear();
|
||||
ui->m_selected_folios_le->clear();
|
||||
ui->m_selected_folios_le->setEnabled(true);
|
||||
@@ -159,7 +169,8 @@ void AutoNumberingManagementW::on_m_from_folios_cb_currentIndexChanged(int index
|
||||
Set selected folios Line Edit content
|
||||
@param index
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index) {
|
||||
void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index)
|
||||
{
|
||||
if (index > 0) {
|
||||
QString from = ui->m_from_folios_cb->currentText();
|
||||
QString to = ui->m_to_folios_cb->currentText();
|
||||
@@ -174,7 +185,8 @@ void AutoNumberingManagementW::on_m_to_folios_cb_currentIndexChanged(int index)
|
||||
@brief AutoNumberingManagementW::on_m_apply_project_rb_clicked
|
||||
Disable folio widget
|
||||
*/
|
||||
void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
|
||||
void AutoNumberingManagementW::on_m_apply_project_rb_clicked()
|
||||
{
|
||||
ui->m_selected_folios_widget->setDisabled(true);
|
||||
ui->m_selected_folios_le->setDisabled(true);
|
||||
applyEnable(true);
|
||||
@@ -185,7 +197,8 @@ void AutoNumberingManagementW::on_m_apply_project_rb_clicked() {
|
||||
Action on buttonBox clicked
|
||||
@param button
|
||||
*/
|
||||
void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button)
|
||||
{
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
switch (answer) {
|
||||
@@ -216,15 +229,18 @@ void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
enable/disable the apply button
|
||||
@param b
|
||||
*/
|
||||
void AutoNumberingManagementW::applyEnable(bool b) {
|
||||
void AutoNumberingManagementW::applyEnable(bool b)
|
||||
{
|
||||
if (b){
|
||||
bool valid= true;
|
||||
if (ui->m_apply_project_rb->isChecked())
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)
|
||||
->setEnabled(valid);
|
||||
else if (ui->m_apply_folios_rb->isChecked())
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid);
|
||||
ui->buttonBox-> button(QDialogButtonBox::Apply)
|
||||
->setEnabled(valid);
|
||||
}
|
||||
else {
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ FolioAutonumberingW::~FolioAutonumberingW()
|
||||
@brief FolioAutonumberingW::setContext
|
||||
construct autonums in the comboBox selected in the autonum_chooser QcomboBox
|
||||
*/
|
||||
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||
void FolioAutonumberingW::setContext(QList <QString> autonums)
|
||||
{
|
||||
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
||||
}
|
||||
|
||||
@@ -58,7 +59,8 @@ void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||
@brief FolioAutonumberingW::autoNumSelected
|
||||
returns the current autonum selected
|
||||
*/
|
||||
QString FolioAutonumberingW::autoNumSelected(){
|
||||
QString FolioAutonumberingW::autoNumSelected()
|
||||
{
|
||||
return ui->m_autonums_cb->currentText();
|
||||
}
|
||||
|
||||
@@ -66,7 +68,8 @@ QString FolioAutonumberingW::autoNumSelected(){
|
||||
@brief FolioAutonumberingW::fromFolio
|
||||
returns the current "From Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::fromFolio(){
|
||||
int FolioAutonumberingW::fromFolio()
|
||||
{
|
||||
return ui->m_from_cb->currentIndex()-1;
|
||||
}
|
||||
|
||||
@@ -74,7 +77,8 @@ int FolioAutonumberingW::fromFolio(){
|
||||
@brief FolioAutonumberingW::toFolio
|
||||
returns the current "To Folio" index
|
||||
*/
|
||||
int FolioAutonumberingW::toFolio(){
|
||||
int FolioAutonumberingW::toFolio()
|
||||
{
|
||||
return ui->m_to_cb->currentIndex()+this->fromFolio()+1;
|
||||
}
|
||||
|
||||
@@ -82,14 +86,16 @@ int FolioAutonumberingW::toFolio(){
|
||||
@brief FolioAutonumberingW::newFoliosNumber
|
||||
returns the number of folios to create
|
||||
*/
|
||||
int FolioAutonumberingW::newFoliosNumber(){
|
||||
int FolioAutonumberingW::newFoliosNumber()
|
||||
{
|
||||
return ui->m_new_tabs_sb->value();
|
||||
}
|
||||
/**
|
||||
@brief FolioAutonumberingW::updateFolioList
|
||||
update Folio List in From and To ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::updateFolioList(){
|
||||
void FolioAutonumberingW::updateFolioList()
|
||||
{
|
||||
ui -> m_from_cb->clear();
|
||||
ui -> m_to_cb->clear();
|
||||
if (newFolios){
|
||||
@@ -103,7 +109,8 @@ void FolioAutonumberingW::updateFolioList(){
|
||||
@brief FolioAutonumberingW::on_m_create_new_tabs_rb_clicked
|
||||
* Enable New Tabs SpinBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||
void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked()
|
||||
{
|
||||
ui->m_from_cb->setEnabled(false);
|
||||
ui->m_to_cb->setEnabled(false);
|
||||
ui->m_new_tabs_sb->setEnabled(true);
|
||||
@@ -115,7 +122,8 @@ void FolioAutonumberingW::on_m_create_new_tabs_rb_clicked() {
|
||||
@brief FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked
|
||||
* Enable From ComboBox, fill From ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||
void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked()
|
||||
{
|
||||
ui->m_new_tabs_sb->setEnabled(false);
|
||||
ui->m_from_cb->setEnabled(true);
|
||||
ui->m_to_cb->setEnabled(true);
|
||||
@@ -134,7 +142,8 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
||||
@brief FolioAutonumberingW::on_m_new_tabs_sb_valueChanged
|
||||
* Enable Apply if any new folio is to be created
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(int){
|
||||
void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(int)
|
||||
{
|
||||
if (ui->m_new_tabs_sb->value()>0) applyEnable(true);
|
||||
else applyEnable(false);
|
||||
}
|
||||
@@ -143,13 +152,15 @@ void FolioAutonumberingW::on_m_new_tabs_sb_valueChanged(int){
|
||||
@brief FolioAutonumberingW::on_m_from_cb_currentIndexChanged
|
||||
* Enable To ComboBox
|
||||
*/
|
||||
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int){
|
||||
void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int)
|
||||
{
|
||||
int index = ui->m_from_cb->currentIndex();
|
||||
ui->m_to_cb->clear();
|
||||
if (index > 0){
|
||||
ui->m_to_cb->setEnabled(true);
|
||||
for (int i=index;i<project_->diagrams().size();i++)
|
||||
ui->m_to_cb->addItem(project_->diagrams().at(i)->title());
|
||||
ui->m_to_cb->addItem(project_
|
||||
->diagrams().at(i)->title());
|
||||
applyEnable(true);
|
||||
}
|
||||
else{
|
||||
@@ -162,7 +173,8 @@ void FolioAutonumberingW::on_m_from_cb_currentIndexChanged(int){
|
||||
@brief SelectAutonumW::on_buttonBox_clicked
|
||||
Action on buttonBox clicked
|
||||
*/
|
||||
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button)
|
||||
{
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
|
||||
@@ -200,19 +212,23 @@ void FolioAutonumberingW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
@brief SelectAutonumW::applyEnable
|
||||
enable/disable the apply button
|
||||
*/
|
||||
void FolioAutonumberingW::applyEnable(bool b) {
|
||||
void FolioAutonumberingW::applyEnable(bool b)
|
||||
{
|
||||
if (b){
|
||||
bool valid = true;
|
||||
if (ui->m_create_new_tabs_rb->isChecked()){
|
||||
if (ui->m_new_tabs_sb->value()==0) valid = false;
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)
|
||||
->setEnabled(valid);
|
||||
}
|
||||
else{
|
||||
if (ui->m_to_cb->currentText()=="") valid = false;
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)
|
||||
->setEnabled(valid);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
||||
ui->buttonBox->button(QDialogButtonBox::Apply)
|
||||
->setEnabled(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FormulaAutonumberingW)
|
||||
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setContext(formula_);
|
||||
@@ -46,7 +45,8 @@ FormulaAutonumberingW::~FormulaAutonumberingW()
|
||||
@brief FormulaAutonumberingW::setContext
|
||||
@param formula to be inserted into context
|
||||
*/
|
||||
void FormulaAutonumberingW::setContext(const QString& formula) {
|
||||
void FormulaAutonumberingW::setContext(const QString& formula)
|
||||
{
|
||||
ui->m_formula_le->insert(formula);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ void FormulaAutonumberingW::setContext(const QString& formula) {
|
||||
@brief FormulaAutonumberingW::clearContext
|
||||
@param clear formula line edit text
|
||||
*/
|
||||
void FormulaAutonumberingW::clearContext() {
|
||||
void FormulaAutonumberingW::clearContext()
|
||||
{
|
||||
ui->m_formula_le->clear();
|
||||
}
|
||||
|
||||
@@ -62,7 +63,8 @@ void FormulaAutonumberingW::clearContext() {
|
||||
@brief FormulaAutonumberingW::formula
|
||||
@return formula to be stored into project
|
||||
*/
|
||||
QString FormulaAutonumberingW::formula() {
|
||||
QString FormulaAutonumberingW::formula()
|
||||
{
|
||||
return ui->m_formula_le->text();
|
||||
}
|
||||
|
||||
@@ -70,6 +72,7 @@ QString FormulaAutonumberingW::formula() {
|
||||
@brief FormulaAutonumberingW::on_m_formula_le_textChanged
|
||||
Update Apply Button
|
||||
*/
|
||||
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text)
|
||||
{
|
||||
emit (textChanged(std::move(text)));
|
||||
}
|
||||
|
||||
@@ -60,20 +60,34 @@ NumPartEditorW::NumPartEditorW (NumerotationContext &context,
|
||||
|
||||
else {
|
||||
QStringList strl = context.itemAt(i);
|
||||
if (strl.at(0)=="unit") setType(NumPartEditorW::unit, true);
|
||||
else if (strl.at(0)=="unitfolio") setType(NumPartEditorW::unitfolio, true);
|
||||
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten, true);
|
||||
else if (strl.at(0)=="tenfolio") setType(NumPartEditorW::tenfolio, true);
|
||||
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred, true);
|
||||
else if (strl.at(0)=="hundredfolio") setType(NumPartEditorW::hundredfolio, true);
|
||||
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
||||
else if (strl.at(0)=="idfolio") setType(NumPartEditorW::idfolio);
|
||||
else if (strl.at(0)=="folio") setType(NumPartEditorW::folio);
|
||||
else if (strl.at(0)=="plant") setType(NumPartEditorW::plant);
|
||||
else if (strl.at(0)=="locmach") setType(NumPartEditorW::locmach);
|
||||
else if (strl.at(0)=="elementline") setType(NumPartEditorW::elementline);
|
||||
else if (strl.at(0)=="elementcolumn") setType(NumPartEditorW::elementcolumn);
|
||||
else if (strl.at(0)=="elementprefix") setType(NumPartEditorW::elementprefix);
|
||||
if (strl.at(0)=="unit")
|
||||
setType(NumPartEditorW::unit, true);
|
||||
else if (strl.at(0)=="unitfolio")
|
||||
setType(NumPartEditorW::unitfolio, true);
|
||||
else if (strl.at(0)=="ten")
|
||||
setType(NumPartEditorW::ten, true);
|
||||
else if (strl.at(0)=="tenfolio")
|
||||
setType(NumPartEditorW::tenfolio, true);
|
||||
else if (strl.at(0)=="hundred")
|
||||
setType(NumPartEditorW::hundred, true);
|
||||
else if (strl.at(0)=="hundredfolio")
|
||||
setType(NumPartEditorW::hundredfolio, true);
|
||||
else if (strl.at(0)=="string")
|
||||
setType(NumPartEditorW::string);
|
||||
else if (strl.at(0)=="idfolio")
|
||||
setType(NumPartEditorW::idfolio);
|
||||
else if (strl.at(0)=="folio")
|
||||
setType(NumPartEditorW::folio);
|
||||
else if (strl.at(0)=="plant")
|
||||
setType(NumPartEditorW::plant);
|
||||
else if (strl.at(0)=="locmach")
|
||||
setType(NumPartEditorW::locmach);
|
||||
else if (strl.at(0)=="elementline")
|
||||
setType(NumPartEditorW::elementline);
|
||||
else if (strl.at(0)=="elementcolumn")
|
||||
setType(NumPartEditorW::elementcolumn);
|
||||
else if (strl.at(0)=="elementprefix")
|
||||
setType(NumPartEditorW::elementprefix);
|
||||
ui -> value_field -> setText(strl.at(1));
|
||||
ui -> increase_spinBox -> setValue(strl.at(2).toInt());
|
||||
}
|
||||
@@ -275,10 +289,27 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
||||
|
||||
//if @t is a numeric type and preview type @type_ isn't a numeric type
|
||||
//or @fnum is true, we set numeric behavior
|
||||
if ( ((t==unit || t==unitfolio || t==ten || t==tenfolio || t==hundred || t==hundredfolio) &&
|
||||
(type_==string || type_==folio || type_==plant || type_==locmach ||type_==idfolio ||
|
||||
type_==elementcolumn || type_==elementline || type_==elementprefix))
|
||||
|| fnum) {
|
||||
if (
|
||||
(
|
||||
(t==unit
|
||||
|| t==unitfolio
|
||||
|| t==ten
|
||||
|| t==tenfolio
|
||||
|| t==hundred
|
||||
|| t==hundredfolio
|
||||
)
|
||||
&& (type_==string
|
||||
|| type_==folio
|
||||
|| type_==plant
|
||||
|| type_==locmach
|
||||
|| type_==idfolio
|
||||
|| type_==elementcolumn
|
||||
|| type_==elementline
|
||||
|| type_==elementprefix)
|
||||
)
|
||||
|| fnum
|
||||
)
|
||||
{
|
||||
ui -> value_field -> clear();
|
||||
ui -> value_field -> setEnabled(true);
|
||||
ui -> value_field -> setValidator(intValidator);
|
||||
@@ -286,8 +317,14 @@ void NumPartEditorW::setType(NumPartEditorW::type t, bool fnum) {
|
||||
ui -> increase_spinBox -> setValue(1);
|
||||
}
|
||||
//@t isn't a numeric type
|
||||
else if (t == string || t == folio || t == idfolio || t == elementline || t == plant || t == locmach ||
|
||||
t == elementcolumn || t == elementprefix) {
|
||||
else if (t == string
|
||||
|| t == folio
|
||||
|| t == idfolio
|
||||
|| t == elementline
|
||||
|| t == plant
|
||||
|| t == locmach
|
||||
|| t == elementcolumn
|
||||
|| t == elementprefix) {
|
||||
ui -> value_field -> clear();
|
||||
ui -> increase_spinBox -> setDisabled(true);
|
||||
if (t==string) {
|
||||
|
||||
@@ -22,15 +22,16 @@
|
||||
#include <QValidator>
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
/**
|
||||
*This class represent a single part num widget. By this widget, we can define and edit
|
||||
*how the num auto must work .
|
||||
*This widget is called by selectautonumw.
|
||||
*/
|
||||
namespace Ui {
|
||||
class NumPartEditorW;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief The NumPartEditorW class
|
||||
This class represent a single part num widget.
|
||||
By this widget, we can define and edit how the num auto must work.
|
||||
This widget is called by selectautonumw.
|
||||
*/
|
||||
class NumPartEditorW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -38,7 +39,10 @@ class NumPartEditorW : public QWidget
|
||||
//METHODS
|
||||
public:
|
||||
explicit NumPartEditorW(int type, QWidget *parent = nullptr);
|
||||
NumPartEditorW (NumerotationContext &, int, int type, QWidget *parent=nullptr);
|
||||
NumPartEditorW (NumerotationContext &,
|
||||
int,
|
||||
int type,
|
||||
QWidget *parent=nullptr);
|
||||
~NumPartEditorW() override;
|
||||
|
||||
enum type {unit,unitfolio,ten,tenfolio, hundred, hundredfolio,
|
||||
@@ -66,7 +70,7 @@ class NumPartEditorW : public QWidget
|
||||
private:
|
||||
Ui::NumPartEditorW *ui;
|
||||
QValidator *intValidator;
|
||||
int m_edited_type = -1; //0 == element : 1 == conductor : 2 == folio
|
||||
int m_edited_type = -1; ///<0 == element : 1 == conductor : 2 == folio
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,15 +24,18 @@
|
||||
#include "ui_formulaautonumberingw.h"
|
||||
#include "assignvariables.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief SelectAutonumW::SelectAutonumW
|
||||
Constructor
|
||||
@param type : int m_edited_type
|
||||
@param parent : QWidget
|
||||
*/
|
||||
SelectAutonumW::SelectAutonumW(int type, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SelectAutonumW),
|
||||
m_edited_type(type)
|
||||
{
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->m_comboBox->lineEdit()->setClearButtonEnabled(true);
|
||||
if (m_edited_type == 0)
|
||||
@@ -50,6 +53,13 @@ SelectAutonumW::SelectAutonumW(int type, QWidget *parent) :
|
||||
setContext(NumerotationContext());
|
||||
}
|
||||
|
||||
/**
|
||||
@brief SelectAutonumW::SelectAutonumW
|
||||
Constructor
|
||||
@param context : NumerotationContext
|
||||
@param type : int m_edited_type
|
||||
@param parent : QWidget
|
||||
*/
|
||||
SelectAutonumW::SelectAutonumW(const NumerotationContext &context,
|
||||
int type,
|
||||
QWidget *parent) :
|
||||
@@ -74,6 +84,7 @@ SelectAutonumW::SelectAutonumW(const NumerotationContext &context,
|
||||
}
|
||||
|
||||
/**
|
||||
@brief SelectAutonumW::~SelectAutonumW
|
||||
Destructor
|
||||
*/
|
||||
SelectAutonumW::~SelectAutonumW()
|
||||
@@ -181,7 +192,8 @@ QComboBox *SelectAutonumW::contextComboBox() const
|
||||
Action on button clicked
|
||||
@param button
|
||||
*/
|
||||
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button)
|
||||
{
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
switch (answer) {
|
||||
|
||||
Reference in New Issue
Block a user