mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
conductor properties widget: replace widget made by c++ by widget build by ui file
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3216 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1,376 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2006-2014 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "conductorpropertieswidget.h"
|
|
||||||
#include <QtGui>
|
|
||||||
#include "qetgraphicsitem/conductor.h"
|
|
||||||
#include "qeticons.h"
|
|
||||||
#include "qetapp.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructeur
|
|
||||||
@param parent QWidget parent
|
|
||||||
*/
|
|
||||||
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
buildInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructeur
|
|
||||||
@param parent QWidget parent
|
|
||||||
@param cp Proprietes a editer
|
|
||||||
*/
|
|
||||||
ConductorPropertiesWidget::ConductorPropertiesWidget(const ConductorProperties &cp, QWidget *parent) :
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
buildInterface();
|
|
||||||
setConductorProperties(cp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// construit l'interface du widget
|
|
||||||
void ConductorPropertiesWidget::buildInterface() {
|
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
|
||||||
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
|
||||||
main_layout -> setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
QGroupBox *groupbox = new QGroupBox(tr("Type de conducteur"));
|
|
||||||
main_layout -> addWidget(groupbox);
|
|
||||||
|
|
||||||
QVBoxLayout *groupbox_layout = new QVBoxLayout();
|
|
||||||
groupbox -> setLayout(groupbox_layout);
|
|
||||||
|
|
||||||
simple = new QRadioButton(tr("Simple"));
|
|
||||||
multiline = new QRadioButton(tr("Multifilaire"));
|
|
||||||
|
|
||||||
QHBoxLayout *multiline_layout = new QHBoxLayout();
|
|
||||||
QLabel *text = new QLabel(tr("Texte :"));
|
|
||||||
text_field = new QLineEdit();
|
|
||||||
QLabel *size_text = new QLabel(tr("Taille"), this);
|
|
||||||
text_size_sb = new QSpinBox(this);
|
|
||||||
text_size_sb->setRange(5,9);
|
|
||||||
multiline_layout -> addWidget(text);
|
|
||||||
multiline_layout -> addWidget(text_field);
|
|
||||||
multiline_layout -> addWidget(size_text);
|
|
||||||
multiline_layout -> addWidget(text_size_sb);
|
|
||||||
|
|
||||||
QGridLayout *rotate_text_layout = new QGridLayout;
|
|
||||||
QLabel *rotate_label = new QLabel(tr("Rotation du texte sur conducteur :"));
|
|
||||||
rotate_text_layout -> addWidget(rotate_label, 0, 0);
|
|
||||||
|
|
||||||
QLabel *verti_text = new QLabel(tr("Vertical"));
|
|
||||||
verti_select = QETApp::createTextOrientationSpinBoxWidget();
|
|
||||||
rotate_text_layout -> addWidget(verti_text, 1, 0);
|
|
||||||
rotate_text_layout -> setAlignment(verti_text, Qt::AlignCenter);
|
|
||||||
rotate_text_layout -> addWidget(verti_select, 2, 0);
|
|
||||||
|
|
||||||
QLabel *horiz_text = new QLabel(tr("Horizontal"));
|
|
||||||
horiz_select = QETApp::createTextOrientationSpinBoxWidget();
|
|
||||||
rotate_text_layout -> addWidget(horiz_text, 1, 1);
|
|
||||||
rotate_text_layout -> setAlignment(horiz_text, Qt::AlignCenter);
|
|
||||||
rotate_text_layout -> addWidget(horiz_select, 2, 1);
|
|
||||||
|
|
||||||
singleline = new QRadioButton(tr("Unifilaire"));
|
|
||||||
|
|
||||||
ground_checkbox = new QCheckBox(tr("terre"));
|
|
||||||
ground_checkbox -> setIcon(QET::Icons::Ground);
|
|
||||||
neutral_checkbox = new QCheckBox(tr("neutre"));
|
|
||||||
neutral_checkbox -> setIcon(QET::Icons::Neutral);
|
|
||||||
merge_checkbox = new QCheckBox(tr("PEN", "Protective Earth Neutral"));
|
|
||||||
merge_checkbox -> setToolTip(tr("Protective Earth Neutral", "Tooltip displaying the meaning of the 'PEN' acronym"));
|
|
||||||
|
|
||||||
QVBoxLayout *singleline_layout5 = new QVBoxLayout();
|
|
||||||
singleline_layout5 -> addWidget(ground_checkbox);
|
|
||||||
singleline_layout5 -> addWidget(neutral_checkbox);
|
|
||||||
|
|
||||||
QHBoxLayout *singleline_layout4 = new QHBoxLayout();
|
|
||||||
singleline_layout4 -> addLayout(singleline_layout5);
|
|
||||||
singleline_layout4 -> addWidget(merge_checkbox, 4, Qt::AlignVCenter | Qt::AlignLeft);
|
|
||||||
|
|
||||||
QHBoxLayout *singleline_layout3 = new QHBoxLayout();
|
|
||||||
phase_checkbox = new QCheckBox(tr("phase"));
|
|
||||||
phase_checkbox -> setIcon(QET::Icons::Phase);
|
|
||||||
phase_slider = new QSlider(Qt::Horizontal);
|
|
||||||
phase_slider -> setRange(1, 3);
|
|
||||||
phase_spinbox = new QSpinBox();
|
|
||||||
phase_spinbox -> setRange(1, 3);
|
|
||||||
singleline_layout3 -> addWidget(phase_checkbox);
|
|
||||||
singleline_layout3 -> addWidget(phase_slider);
|
|
||||||
singleline_layout3 -> addWidget(phase_spinbox);
|
|
||||||
|
|
||||||
QVBoxLayout *singleline_layout2 = new QVBoxLayout();
|
|
||||||
singleline_layout2 -> addLayout(singleline_layout4);
|
|
||||||
singleline_layout2 -> addLayout(singleline_layout3);
|
|
||||||
|
|
||||||
QHBoxLayout *singleline_layout1 = new QHBoxLayout();
|
|
||||||
preview = new QLabel();
|
|
||||||
preview -> setFixedSize(150, 150);
|
|
||||||
singleline_layout1 -> addWidget(preview);
|
|
||||||
singleline_layout1 -> addLayout(singleline_layout2);
|
|
||||||
|
|
||||||
QGroupBox *groupbox2 = new QGroupBox(tr("Apparence du conducteur"));
|
|
||||||
main_layout -> addWidget(groupbox2);
|
|
||||||
|
|
||||||
QVBoxLayout *groupbox2_layout = new QVBoxLayout();
|
|
||||||
groupbox2 -> setLayout(groupbox2_layout);
|
|
||||||
|
|
||||||
QHBoxLayout *color_layout = new QHBoxLayout();
|
|
||||||
QLabel *text1 = new QLabel(tr("Couleur :"));
|
|
||||||
color_button = new QPushButton("");
|
|
||||||
color_layout -> addWidget(text1);
|
|
||||||
color_layout -> addWidget(color_button);
|
|
||||||
|
|
||||||
QHBoxLayout *style_layout = new QHBoxLayout();
|
|
||||||
QLabel *text2 = new QLabel(tr("Style :", "conductor line style"));
|
|
||||||
line_style = new QComboBox();
|
|
||||||
line_style -> addItem(tr("Trait plein", "conductor style: solid line"), Qt::SolidLine);
|
|
||||||
line_style -> addItem(tr("Trait en pointill\351s", "conductor style: dashed line"), Qt::DashLine);
|
|
||||||
line_style -> addItem(tr("Traits et points", "conductor style: dashed and dotted line"), Qt::DashDotLine);
|
|
||||||
style_layout -> addWidget(text2);
|
|
||||||
style_layout -> addWidget(line_style);
|
|
||||||
|
|
||||||
setColorButton(properties_.color);
|
|
||||||
int index = line_style -> findData(properties_.style);
|
|
||||||
if (index != -1) line_style -> setCurrentIndex(index);
|
|
||||||
|
|
||||||
groupbox_layout -> addWidget(simple);
|
|
||||||
groupbox_layout -> addWidget(multiline);
|
|
||||||
groupbox_layout -> addLayout(multiline_layout);
|
|
||||||
groupbox_layout -> addLayout(rotate_text_layout);
|
|
||||||
groupbox_layout -> addWidget(singleline);
|
|
||||||
groupbox_layout -> addLayout(singleline_layout1);
|
|
||||||
|
|
||||||
groupbox2_layout -> addLayout(color_layout);
|
|
||||||
groupbox2_layout -> addLayout(style_layout);
|
|
||||||
|
|
||||||
radio_buttons = new QButtonGroup(this);
|
|
||||||
radio_buttons -> addButton(simple, ConductorProperties::Simple);
|
|
||||||
radio_buttons -> addButton(multiline, ConductorProperties::Multi);
|
|
||||||
radio_buttons -> addButton(singleline, ConductorProperties::Single);
|
|
||||||
|
|
||||||
buildConnections();
|
|
||||||
setConductorType(ConductorProperties::Multi);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Met en place les connexions signaux/slots
|
|
||||||
void ConductorPropertiesWidget::buildConnections() {
|
|
||||||
connect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
|
||||||
connect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
|
||||||
connect(ground_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
connect(neutral_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
connect(merge_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
connect(phase_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
connect(phase_slider, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
connect(radio_buttons, SIGNAL(buttonClicked(int)), this, SLOT(updateConfig()));
|
|
||||||
connect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
|
||||||
connect(line_style, SIGNAL(currentIndexChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
connect(color_button, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
|
||||||
connect(verti_select, SIGNAL(editingFinished(double)), this, SLOT(updateConfig()));
|
|
||||||
connect(horiz_select, SIGNAL(editingFinished(double)), this, SLOT(updateConfig()));
|
|
||||||
connect(text_size_sb, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Demande a l'utilisateur de choisir une couleur via un dialogue approprie.
|
|
||||||
*/
|
|
||||||
void ConductorPropertiesWidget::chooseColor() {
|
|
||||||
QColor user_chosen_color = QColorDialog::getColor(properties_.color);
|
|
||||||
if (user_chosen_color.isValid()) {
|
|
||||||
setColorButton(user_chosen_color);
|
|
||||||
updateConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@return la couleur actuelle du bouton permettant de choisir la couleur du
|
|
||||||
conducteur
|
|
||||||
*/
|
|
||||||
QColor ConductorPropertiesWidget::colorButton() const {
|
|
||||||
return(color_button -> palette().color(QPalette::Button));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Change la couleur du bouton permettant de choisir la couleur du conducteur
|
|
||||||
@param color Nouvelle couleur a afficher
|
|
||||||
*/
|
|
||||||
void ConductorPropertiesWidget::setColorButton(const QColor &color) {
|
|
||||||
QPalette palette;
|
|
||||||
palette.setColor(QPalette::Button, color);
|
|
||||||
color_button -> setPalette(palette);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Enleve les connexions signaux/slots
|
|
||||||
void ConductorPropertiesWidget::destroyConnections() {
|
|
||||||
disconnect(phase_slider, SIGNAL(valueChanged(int)), phase_spinbox, SLOT(setValue(int)));
|
|
||||||
disconnect(phase_spinbox, SIGNAL(valueChanged(int)), phase_slider, SLOT(setValue(int)));
|
|
||||||
disconnect(ground_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(neutral_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(merge_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(phase_checkbox, SIGNAL(toggled(bool)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(phase_slider, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(radio_buttons, SIGNAL(buttonClicked(int)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(color_button, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
|
||||||
disconnect(line_style, SIGNAL(currentIndexChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(verti_select, SIGNAL(editingFinished(double)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(horiz_select, SIGNAL(editingFinished(double)), this, SLOT(updateConfig()));
|
|
||||||
disconnect(text_size_sb, SIGNAL(valueChanged(int)), this, SLOT(updateConfig()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destructeur
|
|
||||||
ConductorPropertiesWidget::~ConductorPropertiesWidget() {
|
|
||||||
delete verti_select;
|
|
||||||
delete horiz_select;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Met a jour les proprietes
|
|
||||||
void ConductorPropertiesWidget::updateConfig() {
|
|
||||||
properties_.type = static_cast<ConductorProperties::ConductorType>(radio_buttons -> checkedId());
|
|
||||||
properties_.color = colorButton();
|
|
||||||
properties_.style = static_cast<Qt::PenStyle>(line_style -> itemData(line_style -> currentIndex()).toInt());
|
|
||||||
properties_.text = text_field -> text();
|
|
||||||
properties_.text_size = text_size_sb->value();
|
|
||||||
properties_.verti_rotate_text = verti_select -> value();
|
|
||||||
properties_.horiz_rotate_text = horiz_select -> value();
|
|
||||||
properties_.singleLineProperties.hasGround = ground_checkbox -> isChecked();
|
|
||||||
properties_.singleLineProperties.hasNeutral = neutral_checkbox -> isChecked();
|
|
||||||
properties_.singleLineProperties.is_pen = merge_checkbox -> isChecked();
|
|
||||||
properties_.singleLineProperties.setPhasesCount(phase_checkbox -> isChecked() ? phase_spinbox -> value() : 0);
|
|
||||||
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Met a jour l'affichage des proprietes
|
|
||||||
void ConductorPropertiesWidget::updateDisplay() {
|
|
||||||
destroyConnections();
|
|
||||||
|
|
||||||
setConductorType(properties_.type);
|
|
||||||
setColorButton(properties_.color);
|
|
||||||
int index = line_style -> findData(properties_.style);
|
|
||||||
if (index != -1) line_style -> setCurrentIndex(index);
|
|
||||||
text_field -> setText(properties_.text);
|
|
||||||
text_size_sb -> setValue(properties_.text_size);
|
|
||||||
ground_checkbox -> setChecked(properties_.singleLineProperties.hasGround);
|
|
||||||
neutral_checkbox -> setChecked(properties_.singleLineProperties.hasNeutral);
|
|
||||||
merge_checkbox -> setChecked(properties_.singleLineProperties.is_pen);
|
|
||||||
merge_checkbox -> setEnabled(!isReadOnly() && properties_.type == ConductorProperties::Single && ground_checkbox -> isChecked() && neutral_checkbox -> isChecked());
|
|
||||||
phase_spinbox -> setValue(properties_.singleLineProperties.phasesCount());
|
|
||||||
phase_slider -> setValue(properties_.singleLineProperties.phasesCount());
|
|
||||||
phase_checkbox -> setChecked(properties_.singleLineProperties.phasesCount());
|
|
||||||
verti_select -> setValue(properties_.verti_rotate_text);
|
|
||||||
horiz_select -> setValue(properties_.horiz_rotate_text);
|
|
||||||
|
|
||||||
buildConnections();
|
|
||||||
updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Met a jour la previsualisation des attributs unifilaires
|
|
||||||
void ConductorPropertiesWidget::updatePreview() {
|
|
||||||
const QRect pixmap_rect(0, 0, 96, 96);
|
|
||||||
QPixmap pixmap(pixmap_rect.width(), pixmap_rect.height());
|
|
||||||
QPainter painter;
|
|
||||||
painter.begin(&pixmap);
|
|
||||||
painter.eraseRect(pixmap_rect);
|
|
||||||
painter.drawRect(pixmap_rect.adjusted(0,0,-1,-1));
|
|
||||||
painter.drawLine(QLineF(0, pixmap_rect.height() / 2, pixmap_rect.width(), pixmap_rect.height() / 2));
|
|
||||||
properties_.singleLineProperties.draw(&painter, QET::Horizontal, pixmap_rect);
|
|
||||||
painter.end();
|
|
||||||
preview -> setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Passe le widget en mode simple, unifilaire ou multifilaire
|
|
||||||
@param t le type de conducteur
|
|
||||||
*/
|
|
||||||
void ConductorPropertiesWidget::setConductorType(ConductorProperties::ConductorType t) {
|
|
||||||
|
|
||||||
// widgets lies au simple
|
|
||||||
simple -> setChecked(t == ConductorProperties::Simple);
|
|
||||||
|
|
||||||
// widgets lies au mode multifilaire
|
|
||||||
multiline -> setChecked(t == ConductorProperties::Multi);
|
|
||||||
text_field -> setEnabled(t == ConductorProperties::Multi);
|
|
||||||
|
|
||||||
// widgets lies au mode unifilaire
|
|
||||||
bool sl = (t == ConductorProperties::Single);
|
|
||||||
singleline -> setChecked(sl);
|
|
||||||
preview -> setEnabled(sl);
|
|
||||||
phase_checkbox -> setEnabled(sl);
|
|
||||||
phase_slider -> setEnabled(sl);
|
|
||||||
phase_spinbox -> setEnabled(sl);
|
|
||||||
ground_checkbox -> setEnabled(sl);
|
|
||||||
neutral_checkbox -> setEnabled(sl);
|
|
||||||
merge_checkbox -> setEnabled(sl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @param p les nouvelles proprietes
|
|
||||||
void ConductorPropertiesWidget::setConductorProperties(const ConductorProperties &p) {
|
|
||||||
properties_ = p;
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @return les proprietes editees
|
|
||||||
ConductorProperties ConductorPropertiesWidget::conductorProperties() const {
|
|
||||||
return(properties_);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@return true si ce widget est en lecture seule, false sinon
|
|
||||||
*/
|
|
||||||
bool ConductorPropertiesWidget::isReadOnly() const {
|
|
||||||
return(text_field -> isReadOnly());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param ro true pour passer ce widget en lecture seule, false sinon
|
|
||||||
*/
|
|
||||||
void ConductorPropertiesWidget::setReadOnly(bool ro) {
|
|
||||||
// enable or disable all child widgets according to the read only state
|
|
||||||
simple -> setDisabled(ro);
|
|
||||||
multiline -> setDisabled(ro);
|
|
||||||
singleline -> setDisabled(ro);
|
|
||||||
text_field -> setReadOnly(ro);
|
|
||||||
text_size_sb -> setReadOnly(ro);
|
|
||||||
phase_checkbox -> setDisabled(ro);
|
|
||||||
phase_spinbox -> setReadOnly(ro);
|
|
||||||
ground_checkbox -> setDisabled(ro);
|
|
||||||
neutral_checkbox -> setDisabled(ro);
|
|
||||||
merge_checkbox -> setDisabled(ro);
|
|
||||||
color_button -> setDisabled(ro);
|
|
||||||
line_style -> setDisabled(ro);
|
|
||||||
// if the widget is not read-only, we still need to disable some widgets for consistency
|
|
||||||
if (!ro) {
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Gere le focus de ce widget
|
|
||||||
*/
|
|
||||||
void ConductorPropertiesWidget::focusInEvent(QFocusEvent *event) {
|
|
||||||
if (properties_.type == ConductorProperties::Multi) {
|
|
||||||
text_field -> setFocus(Qt::ActiveWindowFocusReason);
|
|
||||||
text_field -> selectAll();
|
|
||||||
} else if (properties_.type == ConductorProperties::Single) {
|
|
||||||
phase_spinbox -> setFocus(Qt::ActiveWindowFocusReason);
|
|
||||||
phase_spinbox -> selectAll();
|
|
||||||
}
|
|
||||||
QWidget::focusInEvent(event);
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2006-2014 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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef CONDUCTOR_PROPERTIES_WIDGET_H
|
|
||||||
#define CONDUCTOR_PROPERTIES_WIDGET_H
|
|
||||||
#include "conductorproperties.h"
|
|
||||||
#include "qtextorientationspinboxwidget.h"
|
|
||||||
#include <QWidget>
|
|
||||||
/**
|
|
||||||
This widget enables users to change the properties of a particular
|
|
||||||
conductor; these properties include singleline symbols, style, color, and
|
|
||||||
conductor type but exclude the path it draws.
|
|
||||||
*/
|
|
||||||
class ConductorPropertiesWidget : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
// constructors, destructor
|
|
||||||
public:
|
|
||||||
ConductorPropertiesWidget(QWidget * = 0);
|
|
||||||
ConductorPropertiesWidget(const ConductorProperties &, QWidget * = 0);
|
|
||||||
virtual ~ConductorPropertiesWidget();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ConductorPropertiesWidget(const ConductorPropertiesWidget &);
|
|
||||||
|
|
||||||
// methods
|
|
||||||
public:
|
|
||||||
void setConductorProperties(const ConductorProperties &);
|
|
||||||
ConductorProperties conductorProperties() const;
|
|
||||||
bool isReadOnly() const;
|
|
||||||
void setReadOnly(bool);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setConductorType(ConductorProperties::ConductorType);
|
|
||||||
void setColorButton(const QColor &);
|
|
||||||
QColor colorButton() const;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updatePreview();
|
|
||||||
void updateConfig();
|
|
||||||
void updateDisplay();
|
|
||||||
void chooseColor();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void focusInEvent(QFocusEvent *);
|
|
||||||
|
|
||||||
// private attributes
|
|
||||||
private:
|
|
||||||
QButtonGroup *radio_buttons;
|
|
||||||
QRadioButton *simple;
|
|
||||||
QRadioButton *multiline;
|
|
||||||
QLineEdit *text_field;
|
|
||||||
QTextOrientationSpinBoxWidget *verti_select;
|
|
||||||
QTextOrientationSpinBoxWidget *horiz_select;
|
|
||||||
QRadioButton *singleline;
|
|
||||||
QCheckBox *phase_checkbox;
|
|
||||||
QSlider *phase_slider;
|
|
||||||
QSpinBox *phase_spinbox;
|
|
||||||
QCheckBox *ground_checkbox;
|
|
||||||
QCheckBox *neutral_checkbox;
|
|
||||||
QLabel *preview;
|
|
||||||
QPushButton *color_button;
|
|
||||||
QComboBox *line_style;
|
|
||||||
QCheckBox *merge_checkbox;
|
|
||||||
QSpinBox *text_size_sb;
|
|
||||||
|
|
||||||
ConductorProperties properties_;
|
|
||||||
|
|
||||||
// private methods
|
|
||||||
void buildInterface();
|
|
||||||
void buildConnections();
|
|
||||||
void destroyConnections();
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -81,7 +81,7 @@ void NewDiagramPage::applyConf() {
|
|||||||
ipw-> properties().toSettings(settings, "diagrameditor/default");
|
ipw-> properties().toSettings(settings, "diagrameditor/default");
|
||||||
|
|
||||||
// proprietes par defaut des conducteurs
|
// proprietes par defaut des conducteurs
|
||||||
cpw -> conductorProperties().toSettings(settings, "diagrameditor/defaultconductor");
|
cpw -> properties().toSettings(settings, "diagrameditor/defaultconductor");
|
||||||
|
|
||||||
// default report propertie
|
// default report propertie
|
||||||
rpw->toSettings(settings, "diagrameditor/defaultreport");
|
rpw->toSettings(settings, "diagrameditor/defaultreport");
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ void DiagramView::editDiagramProperties() {
|
|||||||
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
||||||
TitleBlockProperties new_titleblock = titleblock_infos -> properties();
|
TitleBlockProperties new_titleblock = titleblock_infos -> properties();
|
||||||
BorderProperties new_border = border_infos -> properties();
|
BorderProperties new_border = border_infos -> properties();
|
||||||
ConductorProperties new_conductors = cpw -> conductorProperties();
|
ConductorProperties new_conductors = cpw -> properties();
|
||||||
|
|
||||||
bool adjust_scene = false;
|
bool adjust_scene = false;
|
||||||
|
|
||||||
@@ -1016,7 +1016,7 @@ void DiagramView::editConductor(Conductor *edited_conductor) {
|
|||||||
// execute le dialogue et met a jour le conducteur
|
// execute le dialogue et met a jour le conducteur
|
||||||
if (conductor_dialog.exec() == QDialog::Accepted) {
|
if (conductor_dialog.exec() == QDialog::Accepted) {
|
||||||
// recupere les nouvelles proprietes
|
// recupere les nouvelles proprietes
|
||||||
ConductorProperties new_properties = cpw -> conductorProperties();
|
ConductorProperties new_properties = cpw -> properties();
|
||||||
|
|
||||||
if (new_properties != old_properties) {
|
if (new_properties != old_properties) {
|
||||||
if (cb_apply_all -> isChecked()) {
|
if (cb_apply_all -> isChecked()) {
|
||||||
|
|||||||
@@ -250,9 +250,9 @@ void ProjectNewDiagramConfigPage::applyProjectConf() {
|
|||||||
modified_project = true;
|
modified_project = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConductorProperties new_conductor_prop = conductor_ -> conductorProperties();
|
ConductorProperties new_conductor_prop = conductor_ -> properties();
|
||||||
if (project_ -> defaultConductorProperties() != new_conductor_prop) {
|
if (project_ -> defaultConductorProperties() != new_conductor_prop) {
|
||||||
project_ -> setDefaultConductorProperties(conductor_ -> conductorProperties());
|
project_ -> setDefaultConductorProperties(conductor_ -> properties());
|
||||||
modified_project = true;
|
modified_project = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ void ProjectNewDiagramConfigPage::initLayout() {
|
|||||||
*/
|
*/
|
||||||
void ProjectNewDiagramConfigPage::readValuesFromProject() {
|
void ProjectNewDiagramConfigPage::readValuesFromProject() {
|
||||||
border_ -> setProperties (project_ -> defaultBorderProperties());
|
border_ -> setProperties (project_ -> defaultBorderProperties());
|
||||||
conductor_ -> setConductorProperties (project_ -> defaultConductorProperties());
|
conductor_ -> setProperties (project_ -> defaultConductorProperties());
|
||||||
titleblock_ -> setProperties (project_ -> defaultTitleBlockProperties());
|
titleblock_ -> setProperties (project_ -> defaultTitleBlockProperties());
|
||||||
report_ -> setReportProperties (project_ -> defaultReportProperties());
|
report_ -> setReportProperties (project_ -> defaultReportProperties());
|
||||||
xref_ -> setProperties (project_ -> defaultXRefProperties());
|
xref_ -> setProperties (project_ -> defaultXRefProperties());
|
||||||
|
|||||||
233
sources/ui/conductorpropertieswidget.cpp
Normal file
233
sources/ui/conductorpropertieswidget.cpp
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "conductorpropertieswidget.h"
|
||||||
|
#include "ui_conductorpropertieswidget.h"
|
||||||
|
#include "conductorproperties.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
#include "qtextorientationspinboxwidget.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::ConductorPropertiesWidget
|
||||||
|
* Constructor
|
||||||
|
* @param parent, paretn widget
|
||||||
|
*/
|
||||||
|
ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::ConductorPropertiesWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
initWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::ConductorPropertiesWidget
|
||||||
|
* Constructor with properties
|
||||||
|
* @param properties, properties to edit
|
||||||
|
* @param parent, parent widget
|
||||||
|
*/
|
||||||
|
ConductorPropertiesWidget::ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::ConductorPropertiesWidget)
|
||||||
|
{
|
||||||
|
ui -> setupUi(this);
|
||||||
|
initWidget();
|
||||||
|
setProperties(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::~ConductorPropertiesWidget
|
||||||
|
* destructor
|
||||||
|
*/
|
||||||
|
ConductorPropertiesWidget::~ConductorPropertiesWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::setProperties
|
||||||
|
* Set the properties
|
||||||
|
* @param properties
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties) {
|
||||||
|
if (m_properties == properties) return;
|
||||||
|
m_properties = properties;
|
||||||
|
|
||||||
|
setColorButton(m_properties.color);
|
||||||
|
int index = ui -> m_line_style_cb->findData(m_properties.style);
|
||||||
|
if (index != -1) ui -> m_line_style_cb -> setCurrentIndex(index);
|
||||||
|
ui -> m_text_le -> setText (m_properties.text);
|
||||||
|
ui -> m_text_size_sb -> setValue (m_properties.text_size);
|
||||||
|
ui -> m_earth_cb -> setChecked (m_properties.singleLineProperties.hasGround);
|
||||||
|
ui -> m_neutral_cb -> setChecked (m_properties.singleLineProperties.hasNeutral);
|
||||||
|
ui -> m_pen_cb -> setChecked (m_properties.singleLineProperties.isPen());
|
||||||
|
ui -> m_phase_cb -> setChecked (m_properties.singleLineProperties.phasesCount());
|
||||||
|
ui -> m_phase_slider -> setValue (m_properties.singleLineProperties.phasesCount());
|
||||||
|
m_verti_select -> setValue (m_properties.verti_rotate_text);
|
||||||
|
m_horiz_select -> setValue (m_properties.horiz_rotate_text);
|
||||||
|
|
||||||
|
setConductorType(m_properties.type);
|
||||||
|
updatePreview(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::properties
|
||||||
|
* @return the edited properties
|
||||||
|
*/
|
||||||
|
ConductorProperties ConductorPropertiesWidget::properties() const {
|
||||||
|
ConductorProperties properties_;
|
||||||
|
if (ui -> m_simple_rb -> isChecked()) properties_.type = ConductorProperties::Simple;
|
||||||
|
else if (ui -> m_multi_rb -> isChecked()) properties_.type = ConductorProperties::Multi;
|
||||||
|
else if (ui -> m_single_rb -> isChecked()) properties_.type = ConductorProperties::Single;
|
||||||
|
properties_.color = ui->m_color_pb->palette().color(QPalette::Button);
|
||||||
|
properties_.style = static_cast<Qt::PenStyle>(ui->m_line_style_cb->itemData(ui->m_line_style_cb->currentIndex()).toInt());
|
||||||
|
properties_.text = ui -> m_text_le -> text();
|
||||||
|
properties_.text_size = ui -> m_text_size_sb -> value();
|
||||||
|
properties_.verti_rotate_text = m_verti_select -> value();
|
||||||
|
properties_.horiz_rotate_text = m_horiz_select -> value();
|
||||||
|
properties_.singleLineProperties.hasGround = ui -> m_earth_cb -> isChecked();
|
||||||
|
properties_.singleLineProperties.hasNeutral = ui -> m_neutral_cb -> isChecked();
|
||||||
|
properties_.singleLineProperties.is_pen = ui -> m_pen_cb -> isChecked();
|
||||||
|
properties_.singleLineProperties.setPhasesCount(ui -> m_phase_cb -> isChecked() ? ui -> m_phase_sb -> value() : 0);
|
||||||
|
|
||||||
|
return properties_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::setReadOnly
|
||||||
|
* @param ro if true this widget is disabled
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::setReadOnly(const bool &ro) {
|
||||||
|
this->setDisabled(ro);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::initWidget
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::initWidget() {
|
||||||
|
m_verti_select = QETApp::createTextOrientationSpinBoxWidget();
|
||||||
|
ui -> m_text_angle_gl -> addWidget(m_verti_select, 2, 0, Qt::AlignHCenter);
|
||||||
|
m_horiz_select = QETApp::createTextOrientationSpinBoxWidget();
|
||||||
|
ui -> m_text_angle_gl -> addWidget(m_horiz_select, 2, 1, Qt::AlignHCenter);
|
||||||
|
|
||||||
|
ui -> m_line_style_cb -> addItem(tr("Trait plein", "conductor style: solid line"), Qt::SolidLine);
|
||||||
|
ui -> m_line_style_cb -> addItem(tr("Trait en pointill\351s", "conductor style: dashed line"), Qt::DashLine);
|
||||||
|
ui -> m_line_style_cb -> addItem(tr("Traits et points", "conductor style: dashed and dotted line"), Qt::DashDotLine);
|
||||||
|
|
||||||
|
ui -> m_update_preview_pb -> setHidden(true);
|
||||||
|
//Check this checkbox for init the associated groupbox
|
||||||
|
ui -> m_single_rb -> setChecked(true);
|
||||||
|
ui -> m_multi_rb -> setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::setConductorType
|
||||||
|
* Update this widget to the new conductor type
|
||||||
|
* @param type
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::setConductorType(ConductorProperties::ConductorType type) {
|
||||||
|
switch (type) {
|
||||||
|
case ConductorProperties::Simple:
|
||||||
|
ui -> m_simple_rb -> setChecked(true);
|
||||||
|
break;
|
||||||
|
case ConductorProperties::Multi:
|
||||||
|
ui -> m_multi_rb -> setChecked(true);
|
||||||
|
break;
|
||||||
|
case ConductorProperties::Single:
|
||||||
|
ui -> m_single_rb -> setChecked(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ui -> m_multi_rb -> setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::updatePreview
|
||||||
|
* Update the preview for single lien
|
||||||
|
* @param b true: update from the value displayed by this widget
|
||||||
|
* false: update from the properties given at the constructor of this widget
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::updatePreview(bool b) {
|
||||||
|
const QRect pixmap_rect(0, 0, 96, 96);
|
||||||
|
QPixmap pixmap(pixmap_rect.width(), pixmap_rect.height());
|
||||||
|
QPainter painter;
|
||||||
|
painter.begin(&pixmap);
|
||||||
|
painter.eraseRect(pixmap_rect);
|
||||||
|
painter.drawRect(pixmap_rect.adjusted(0,0,-1,-1));
|
||||||
|
painter.drawLine(QLineF(0, pixmap_rect.height() / 2, pixmap_rect.width(), pixmap_rect.height() / 2));
|
||||||
|
|
||||||
|
if (b) properties().singleLineProperties.draw(&painter, QET::Horizontal, pixmap_rect);
|
||||||
|
else m_properties.singleLineProperties.draw(&painter, QET::Horizontal, pixmap_rect);
|
||||||
|
|
||||||
|
painter.end();
|
||||||
|
ui -> m_preview_label -> setPixmap(pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::on_m_earth_cb_toggled
|
||||||
|
* Update the widget when toggled
|
||||||
|
* @param checked
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::on_m_earth_cb_toggled(bool checked) {
|
||||||
|
if (checked && ui -> m_neutral_cb -> isChecked())
|
||||||
|
ui -> m_pen_cb -> setEnabled(true);
|
||||||
|
else ui -> m_pen_cb -> setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::on_m_neutral_cb_toggled
|
||||||
|
* Update the widget when toggled
|
||||||
|
* @param checked
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::on_m_neutral_cb_toggled(bool checked) {
|
||||||
|
if (checked && ui -> m_earth_cb -> isChecked())
|
||||||
|
ui -> m_pen_cb -> setEnabled(true);
|
||||||
|
else ui -> m_pen_cb -> setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::on_m_color_pb_clicked
|
||||||
|
* Open a color dialog, for choose the color of conductor
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::on_m_color_pb_clicked() {
|
||||||
|
QColor color = QColorDialog::getColor(m_properties.color, this);
|
||||||
|
if (color.isValid())
|
||||||
|
setColorButton(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::setColorButton
|
||||||
|
* Set m_color_pb to @color
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::setColorButton(const QColor &color) {
|
||||||
|
QPalette palette;
|
||||||
|
palette.setColor(QPalette::Button, color);
|
||||||
|
ui -> m_color_pb -> setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorPropertiesWidget::on_m_update_preview_pb_clicked
|
||||||
|
* Update the preview of single line.
|
||||||
|
* m_update_preview_pb is a no used button and hidden, his role is only
|
||||||
|
* to centralize signal from various widget to edit single ligne properties,
|
||||||
|
* for update the preview
|
||||||
|
*/
|
||||||
|
void ConductorPropertiesWidget::on_m_update_preview_pb_clicked() {
|
||||||
|
updatePreview();
|
||||||
|
}
|
||||||
64
sources/ui/conductorpropertieswidget.h
Normal file
64
sources/ui/conductorpropertieswidget.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2006-2014 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef CONDUCTORPROPERTIESWIDGET_H
|
||||||
|
#define CONDUCTORPROPERTIESWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "conductorproperties.h"
|
||||||
|
class QTextOrientationSpinBoxWidget;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ConductorPropertiesWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConductorPropertiesWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConductorPropertiesWidget(QWidget *parent = 0);
|
||||||
|
explicit ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent = 0);
|
||||||
|
~ConductorPropertiesWidget();
|
||||||
|
|
||||||
|
//METHODS
|
||||||
|
void setProperties(const ConductorProperties &properties);
|
||||||
|
ConductorProperties properties() const;
|
||||||
|
void setReadOnly(const bool &ro);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initWidget();
|
||||||
|
void setConductorType(ConductorProperties::ConductorType type);
|
||||||
|
|
||||||
|
//SLOTS
|
||||||
|
public slots:
|
||||||
|
void updatePreview(bool b = true);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_m_earth_cb_toggled(bool checked);
|
||||||
|
void on_m_neutral_cb_toggled(bool checked);
|
||||||
|
void on_m_color_pb_clicked();
|
||||||
|
void setColorButton (const QColor &color);
|
||||||
|
void on_m_update_preview_pb_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ConductorPropertiesWidget *ui;
|
||||||
|
ConductorProperties m_properties;
|
||||||
|
QTextOrientationSpinBoxWidget *m_verti_select, *m_horiz_select;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONDUCTORPROPERTIESWIDGET_H
|
||||||
466
sources/ui/conductorpropertieswidget.ui
Normal file
466
sources/ui/conductorpropertieswidget.ui
Normal file
@@ -0,0 +1,466 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ConductorPropertiesWidget</class>
|
||||||
|
<widget class="QWidget" name="ConductorPropertiesWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>430</width>
|
||||||
|
<height>571</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="Tooltip displaying the meaning of the 'PEN' acronym">Protective Earth Neutral</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="m_type_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string>Type de conducteur</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_simple_rb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Simple</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_multi_rb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Multifilaire</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="m_multi_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Texte :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="m_text_le"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Taille :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="m_text_size_sb">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rotation du texte de conducteur :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="m_text_angle_gl">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vertical</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Horizontal</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_single_rb">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unifilaire</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="m_single_gb">
|
||||||
|
<property name="title">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QSlider" name="m_phase_slider">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="m_neutral_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string>neutre</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/neutral.png</normaloff>:/ico/16x16/neutral.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="m_phase_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string>phase</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/phase.png</normaloff>:/ico/16x16/phase.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QSpinBox" name="m_phase_sb">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QCheckBox" name="m_pen_cb">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Protective Earth Neutral</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PEN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QCheckBox" name="m_earth_cb">
|
||||||
|
<property name="text">
|
||||||
|
<string>terre</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qelectrotech.qrc">
|
||||||
|
<normaloff>:/ico/16x16/ground.png</normaloff>:/ico/16x16/ground.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="3">
|
||||||
|
<widget class="QLabel" name="m_preview_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="m_update_preview_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Apparence du conducteur</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="m_line_style_cb"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Couleur :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="m_color_pb">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Style :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../qelectrotech.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>m_multi_rb</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_multi_gb</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>88</x>
|
||||||
|
<y>73</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>54</x>
|
||||||
|
<y>99</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_slider</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>m_phase_sb</receiver>
|
||||||
|
<slot>setValue(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>238</x>
|
||||||
|
<y>324</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>337</x>
|
||||||
|
<y>332</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>m_phase_slider</receiver>
|
||||||
|
<slot>setValue(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>356</x>
|
||||||
|
<y>322</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>207</x>
|
||||||
|
<y>325</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_single_rb</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_single_gb</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>78</x>
|
||||||
|
<y>192</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>81</x>
|
||||||
|
<y>250</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_cb</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_phase_slider</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>152</x>
|
||||||
|
<y>328</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>208</x>
|
||||||
|
<y>329</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_cb</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>m_phase_sb</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>106</x>
|
||||||
|
<y>326</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>338</x>
|
||||||
|
<y>323</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_earth_cb</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>m_update_preview_pb</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>142</x>
|
||||||
|
<y>249</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>228</x>
|
||||||
|
<y>249</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_neutral_cb</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>m_update_preview_pb</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>158</x>
|
||||||
|
<y>304</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>269</x>
|
||||||
|
<y>246</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_cb</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>m_update_preview_pb</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>126</x>
|
||||||
|
<y>340</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>254</x>
|
||||||
|
<y>248</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_pen_cb</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>m_update_preview_pb</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>222</x>
|
||||||
|
<y>276</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>242</x>
|
||||||
|
<y>245</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_phase_sb</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>m_update_preview_pb</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>357</x>
|
||||||
|
<y>340</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>305</x>
|
||||||
|
<y>248</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user