mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
add dialog to configure the autonumerotation context
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2164 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -224,7 +224,7 @@ void QETDiagramEditor::actions() {
|
||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un sch\351ma"), this);
|
||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer le sch\351ma"), this);
|
||||
prj_clean = new QAction(QET::Icons::EditClear, tr("Nettoyer le projet"), this);
|
||||
prj_diagramNum = new QAction(QET::Icons::ConductorSettings, tr("Annoter les sch\351mas (beta)"), this);
|
||||
prj_diagramNum = new QAction(QET::Icons::ConductorSettings, tr("Annoter les sch\351mas"), this);
|
||||
prj_nomenclature = new QAction(QET::Icons::DocumentExport, tr("Exporter une nomenclature (beta)"), this);
|
||||
|
||||
zoom_in = new QAction(QET::Icons::ZoomIn, tr("Zoom avant"), this);
|
||||
@@ -1153,7 +1153,6 @@ void QETDiagramEditor::slot_updateActions() {
|
||||
|
||||
//display the beta feature only in debug mode
|
||||
#ifdef QT_NO_DEBUG
|
||||
prj_diagramNum -> setVisible(false);
|
||||
prj_nomenclature -> setVisible(false);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
|
||||
diagramselection::diagramselection(QETProject *prj, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::diagramselection)
|
||||
ui(new Ui::diagramselection),
|
||||
prj_ (prj),
|
||||
list_diagram_ (prj -> diagrams())
|
||||
{
|
||||
ui -> setupUi(this);
|
||||
prj_ = prj;
|
||||
// list all diagrams presents in project
|
||||
list_diagram_ = prj_ -> diagrams();
|
||||
|
||||
|
||||
QString project_title = prj_ -> title();
|
||||
if (project_title.isEmpty()) project_title = tr("Projet sans titre");
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "conductorautonumerotation.h"
|
||||
#include "qetmessagebox.h"
|
||||
#include "ui/selectautonumw.h"
|
||||
|
||||
/**
|
||||
* @brief DialogAutoNum::DialogAutoNum
|
||||
@@ -28,14 +29,15 @@
|
||||
*/
|
||||
DialogAutoNum::DialogAutoNum(Diagram *dg, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogAutoNum)
|
||||
ui(new Ui::DialogAutoNum),
|
||||
dg_ (dg)
|
||||
{
|
||||
ui -> setupUi(this);
|
||||
dg_ = dg;
|
||||
|
||||
// create widget of diagram selection
|
||||
dgselect_ = new diagramselection( dg_ -> project(), this );
|
||||
ui -> verticalLayout_Selection -> addWidget( dgselect_ );
|
||||
ui -> configuration_layout -> addWidget (new SelectAutonumW(dg_ -> project() -> diagrams(), ui -> configuration_tab));
|
||||
|
||||
dgselect_ = new diagramselection( dg_ -> project(), ui -> annotation_tab);
|
||||
ui -> verticalLayout_Selection -> addWidget(dgselect_);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +65,7 @@ void DialogAutoNum::on_pushButton_delete_clicked() {
|
||||
this,
|
||||
tr("Suppression des annotations conducteurs", "Attention"),
|
||||
QString(
|
||||
tr("Voulez vraiment supprimer les annotations conducteurs de :\n\n%1 ?")
|
||||
tr("Voulez-vous vraiment supprimer les annotations conducteurs de :\n\n%1 ?")
|
||||
).arg(diagramsTitle),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No
|
||||
@@ -96,7 +98,7 @@ void DialogAutoNum::on_pushButton_annotation_clicked(){
|
||||
this,
|
||||
tr("Annotation des conducteurs", "Attention"),
|
||||
QString(
|
||||
tr("Voulez vraiment annoter les conducteurs de :\n\n%1 ?")
|
||||
tr("Voulez-vous vraiment annoter les conducteurs de :\n\n%1 ?")
|
||||
).arg(diagramsTitle),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No
|
||||
@@ -104,6 +106,10 @@ void DialogAutoNum::on_pushButton_annotation_clicked(){
|
||||
|
||||
// if yes numerate all
|
||||
if( answer == QMessageBox::Yes) {
|
||||
foreach (Diagram *d, listDiag) {
|
||||
ConductorAutoNumerotation can(d);
|
||||
can.numerateDiagram();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,16 +119,3 @@ void DialogAutoNum::on_pushButton_annotation_clicked(){
|
||||
void DialogAutoNum::on_pushButton_close_clicked() {
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
NumerotationContext num;
|
||||
for(int i=0; i<listDiag.count(); i++){
|
||||
num.clear();
|
||||
num.addValue("ten",5);
|
||||
num.addValue("string","U");
|
||||
num.addValue("folio");
|
||||
listDiag.at(i)->setNumerotation(Diagram::Conductors, num);
|
||||
qDebug() << "ok";
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ class DialogAutoNum : public QDialog
|
||||
private:
|
||||
Ui::DialogAutoNum *ui;
|
||||
Diagram *dg_;
|
||||
diagramselection *dgselect_;
|
||||
|
||||
diagramselection *dgselect_;
|
||||
};
|
||||
|
||||
#endif // DialogAutoNum_H
|
||||
|
||||
@@ -23,17 +23,21 @@
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="configuration_tab">
|
||||
<attribute name="title">
|
||||
<string>Configuration</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5"/>
|
||||
<layout class="QVBoxLayout" name="configuration_layout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_annotation">
|
||||
<widget class="QWidget" name="annotation_tab">
|
||||
<attribute name="title">
|
||||
<string>Annotation</string>
|
||||
</attribute>
|
||||
@@ -88,8 +92,11 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_annotation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Numérotée les folio sélectionné</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Annotation</string>
|
||||
<string>Annotation (alpha)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
@@ -99,6 +106,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_delete">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Supprimé la numérotation des folio sélectionné</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Supprimer l'annotation</string>
|
||||
</property>
|
||||
@@ -116,19 +126,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
||||
142
sources/ui/numparteditorw.cpp
Normal file
142
sources/ui/numparteditorw.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
#include <QRegExp>
|
||||
#include "numparteditorw.h"
|
||||
#include "ui_numparteditorw.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
NumPartEditorW::NumPartEditorW(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NumPartEditorW),
|
||||
intValidator (new QIntValidator(0,99999,this))
|
||||
{
|
||||
ui -> setupUi(this);
|
||||
setType(NumPartEditorW::unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Build with value of @context at position i
|
||||
*/
|
||||
NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, QWidget *parent):
|
||||
QWidget(parent),
|
||||
ui(new Ui::NumPartEditorW),
|
||||
intValidator (new QIntValidator(0,99999,this))
|
||||
{
|
||||
ui -> setupUi(this);
|
||||
|
||||
//if @context contains nothing build with default value
|
||||
if(context.size()==0) setType(NumPartEditorW::unit);
|
||||
|
||||
else {
|
||||
QStringList strl = context.itemAt(i);
|
||||
if (strl.at(0)=="unit") setType(NumPartEditorW::unit);
|
||||
else if (strl.at(0)=="ten") setType(NumPartEditorW::ten);
|
||||
else if (strl.at(0)=="hundred") setType(NumPartEditorW::hundred);
|
||||
else if (strl.at(0)=="string") setType(NumPartEditorW::string);
|
||||
else if (strl.at(0)== "folio") setType(NumPartEditorW::folio);
|
||||
ui -> value_field -> setText(strl.at(1));
|
||||
ui -> increase_spinBox -> setValue(strl.at(2).toInt());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
NumPartEditorW::~NumPartEditorW()
|
||||
{
|
||||
delete intValidator;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::toNumContext
|
||||
* @return the display to NumerotationContext
|
||||
*/
|
||||
NumerotationContext NumPartEditorW::toNumContext() {
|
||||
NumerotationContext nc;
|
||||
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value());
|
||||
return nc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_type_combo_activated
|
||||
* Action when user change the type comboBox
|
||||
*/
|
||||
void NumPartEditorW::on_type_combo_activated(int index) {
|
||||
emit changed();
|
||||
switch (index) {
|
||||
case unit:
|
||||
setType(unit);
|
||||
break;
|
||||
case ten:
|
||||
setType(ten);
|
||||
break;
|
||||
case hundred:
|
||||
setType(hundred);
|
||||
break;
|
||||
case string:
|
||||
setType(string);
|
||||
break;
|
||||
case folio:
|
||||
setType(folio);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_value_field_textChanged
|
||||
* emit changed when @value_field text changed
|
||||
*/
|
||||
void NumPartEditorW::on_value_field_textChanged() {
|
||||
emit changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::on_increase_spinBox_valueChanged
|
||||
*emit changed when @increase_spinBox value changed
|
||||
*/
|
||||
void NumPartEditorW::on_increase_spinBox_valueChanged() {
|
||||
emit changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief NumPartEditorW::setType
|
||||
* Set good behavior by type @t
|
||||
*/
|
||||
void NumPartEditorW::setType(NumPartEditorW::type t) {
|
||||
ui -> type_combo -> setCurrentIndex(t);
|
||||
ui -> value_field -> clear();
|
||||
ui -> increase_spinBox -> setValue(1);
|
||||
switch (t) {
|
||||
case unit:
|
||||
ui -> value_field -> setEnabled(true);
|
||||
ui ->value_field -> setValidator(intValidator);
|
||||
ui -> increase_spinBox -> setEnabled(true);
|
||||
type_str = "unit";
|
||||
break;
|
||||
case ten:
|
||||
ui -> value_field -> setEnabled(true);
|
||||
ui ->value_field -> setValidator(intValidator);
|
||||
ui -> increase_spinBox -> setEnabled(true);
|
||||
type_str = "ten";
|
||||
break;
|
||||
case hundred:
|
||||
ui -> value_field -> setEnabled(true);
|
||||
ui ->value_field -> setValidator(intValidator);
|
||||
ui -> increase_spinBox -> setEnabled(true);
|
||||
type_str = "hundred";
|
||||
break;
|
||||
case string:
|
||||
ui -> value_field -> setValidator(0);
|
||||
ui -> value_field -> setEnabled(true);
|
||||
ui -> increase_spinBox -> setDisabled(true);
|
||||
type_str = "string";
|
||||
break;
|
||||
case folio:
|
||||
ui -> value_field -> setDisabled(true);
|
||||
ui -> increase_spinBox -> setDisabled(true);
|
||||
type_str = "folio";
|
||||
break;
|
||||
};
|
||||
}
|
||||
41
sources/ui/numparteditorw.h
Normal file
41
sources/ui/numparteditorw.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef NUMPARTEDITORW_H
|
||||
#define NUMPARTEDITORW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QValidator>
|
||||
#include "numerotationcontext.h"
|
||||
|
||||
namespace Ui {
|
||||
class NumPartEditorW;
|
||||
}
|
||||
|
||||
class NumPartEditorW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit NumPartEditorW(QWidget *parent = 0);
|
||||
NumPartEditorW (NumerotationContext &, int, QWidget *parent=0);
|
||||
~NumPartEditorW();
|
||||
|
||||
enum type {unit,ten,hundred,string,folio};
|
||||
NumerotationContext toNumContext();
|
||||
|
||||
private slots:
|
||||
void on_type_combo_activated(int);
|
||||
void on_value_field_textChanged();
|
||||
void on_increase_spinBox_valueChanged();
|
||||
void setType (NumPartEditorW::type t);
|
||||
|
||||
signals:
|
||||
void changed ();
|
||||
|
||||
private:
|
||||
Ui::NumPartEditorW *ui;
|
||||
QValidator *intValidator;
|
||||
QString type_str;
|
||||
|
||||
};
|
||||
|
||||
#endif // NUMPARTEDITORW_H
|
||||
107
sources/ui/numparteditorw.ui
Normal file
107
sources/ui/numparteditorw.ui
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NumPartEditorW</class>
|
||||
<widget class="QWidget" name="NumPartEditorW">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="type_combo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Unité</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dizaine</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Centaine</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Texte</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>N° folio</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="value_field">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="increase_spinBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="wrapping">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
135
sources/ui/selectautonumw.cpp
Normal file
135
sources/ui/selectautonumw.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
#include "selectautonumw.h"
|
||||
#include "ui_selectautonumw.h"
|
||||
#include "diagram.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
SelectAutonumW::SelectAutonumW(const QList <Diagram *> &diagrams, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SelectAutonumW),
|
||||
diagram_list(diagrams)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
initDiagramChooser();
|
||||
setCurrentContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
SelectAutonumW::~SelectAutonumW()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::setDiagramChooser
|
||||
* build the content of QComboBox @diagram_chooser.
|
||||
*/
|
||||
void SelectAutonumW::initDiagramChooser() {
|
||||
for (int i=0; i<diagram_list.size(); ++i) {
|
||||
QString diagram_title = diagram_list.at(i) -> title();
|
||||
if (diagram_title.isEmpty()) diagram_title = (tr("Sch\351ma sans titre"));
|
||||
ui -> diagram_chooser -> addItem(diagram_title);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::setCurrentContext
|
||||
* build the context of current diagram selected in the @diagram_chooser QcomboBox
|
||||
*/
|
||||
void SelectAutonumW::setCurrentContext() {
|
||||
NumerotationContext nc = diagram_list.at(ui->diagram_chooser->currentIndex()) -> getNumerotation(Diagram::Conductors);
|
||||
|
||||
if (nc.size() == 0) { //@nc contain nothing, build a default numPartEditor
|
||||
on_add_button_clicked();
|
||||
applyEnable(false);
|
||||
return;
|
||||
}
|
||||
for (int i=0; i<nc.size(); ++i) { //build with the content of @nc
|
||||
NumPartEditorW *part= new NumPartEditorW(nc, i, this);
|
||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
num_part_list_ << part;
|
||||
ui -> editor_layout -> addWidget(part);
|
||||
}
|
||||
applyEnable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::toNumContext
|
||||
* @return the content to @num_part_list to NumerotationContext
|
||||
*/
|
||||
NumerotationContext SelectAutonumW::toNumContext() const {
|
||||
NumerotationContext nc;
|
||||
foreach (NumPartEditorW *npew, num_part_list_) nc << npew -> toNumContext();
|
||||
return nc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_add_button_clicked
|
||||
* Action on add_button, add a @NumPartEditor
|
||||
*/
|
||||
void SelectAutonumW::on_add_button_clicked() {
|
||||
applyEnable();
|
||||
NumPartEditorW *part = new NumPartEditorW(this);
|
||||
connect (part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
num_part_list_ << part;
|
||||
ui -> editor_layout -> addWidget(part);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_remove_button_clicked
|
||||
* Action on remove button, remove the last @NumPartEditor
|
||||
*/
|
||||
void SelectAutonumW::on_remove_button_clicked() {
|
||||
applyEnable();
|
||||
//remove if @num_part_list contains more than one item
|
||||
if (num_part_list_.size() > 1) {
|
||||
NumPartEditorW *part = num_part_list_.takeLast();
|
||||
disconnect(part, SIGNAL(changed()), this, SLOT(applyEnable()));
|
||||
delete part;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_diagram_chooser_activated
|
||||
* Action on diagram_chooser
|
||||
*/
|
||||
void SelectAutonumW::on_diagram_chooser_activated() {
|
||||
foreach(NumPartEditorW *npew, num_part_list_) delete npew;
|
||||
num_part_list_.clear();
|
||||
setCurrentContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::on_buttonBox_clicked
|
||||
* Action on @buttonBox clicked
|
||||
*/
|
||||
void SelectAutonumW::on_buttonBox_clicked(QAbstractButton *button) {
|
||||
//transform button to int
|
||||
int answer = ui -> buttonBox -> buttonRole(button);
|
||||
|
||||
switch (answer) {
|
||||
//reset the displayed context to default context of @diagram_chooser.
|
||||
case QDialogButtonBox::ResetRole:
|
||||
on_diagram_chooser_activated();
|
||||
applyEnable(false);
|
||||
break;
|
||||
//apply the context in the diagram displayed by @diagram_chooser.
|
||||
case QDialogButtonBox::ApplyRole:
|
||||
NumerotationContext nc = toNumContext();
|
||||
diagram_list.at(ui -> diagram_chooser -> currentIndex()) -> setNumerotation(Diagram::Conductors, nc);
|
||||
applyEnable(false);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SelectAutonumW::applyEnable
|
||||
* enable/disable the apply button
|
||||
*/
|
||||
void SelectAutonumW::applyEnable(bool b) {
|
||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(b);
|
||||
}
|
||||
41
sources/ui/selectautonumw.h
Normal file
41
sources/ui/selectautonumw.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef SELECTAUTONUMW_H
|
||||
#define SELECTAUTONUMW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "diagram.h"
|
||||
#include "ui/numparteditorw.h"
|
||||
|
||||
namespace Ui {
|
||||
class SelectAutonumW;
|
||||
}
|
||||
|
||||
class SelectAutonumW : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
//METHODS
|
||||
public:
|
||||
explicit SelectAutonumW(const QList <Diagram *> &, QWidget *parent = 0);
|
||||
~SelectAutonumW();
|
||||
|
||||
private:
|
||||
void initDiagramChooser();
|
||||
void setCurrentContext ();
|
||||
NumerotationContext toNumContext() const;
|
||||
|
||||
//SLOT
|
||||
private slots:
|
||||
void on_add_button_clicked();
|
||||
void on_remove_button_clicked();
|
||||
void on_diagram_chooser_activated();
|
||||
void on_buttonBox_clicked(QAbstractButton *);
|
||||
void applyEnable (bool = true);
|
||||
|
||||
//ATTRIBUTS
|
||||
private:
|
||||
Ui::SelectAutonumW *ui;
|
||||
const QList <Diagram *> diagram_list;
|
||||
QList <NumPartEditorW *> num_part_list_;
|
||||
};
|
||||
|
||||
#endif // SELECTAUTONUMW_H
|
||||
173
sources/ui/selectautonumw.ui
Normal file
173
sources/ui/selectautonumw.ui
Normal file
@@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SelectAutonumW</class>
|
||||
<widget class="QWidget" name="SelectAutonumW">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Folio: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="diagram_chooser">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Choisir le folio</p></body></html></string>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remove_button">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Supprimer une variable de numérotation</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/22x22/list-remove.png</normaloff>:/ico/22x22/list-remove.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="add_button">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Ajouter une variable de numérotation</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qelectrotech.qrc">
|
||||
<normaloff>:/ico/22x22/list-add.png</normaloff>:/ico/22x22/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="definition_groupe">
|
||||
<property name="title">
|
||||
<string>Définition</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="editor_layout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="label_layout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="type_label">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="value_label">
|
||||
<property name="text">
|
||||
<string>Valeur</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="increase_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Incrémentation</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../qelectrotech.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user