mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
add widget to configure rotation conductor text by default (not finish)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2198 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1124,7 +1124,8 @@ void Conductor::calculateTextItemPosition() {
|
|||||||
} else {
|
} else {
|
||||||
// positionnement automatique basique
|
// positionnement automatique basique
|
||||||
text_item -> setPos(middleSegment() -> middle());
|
text_item -> setPos(middleSegment() -> middle());
|
||||||
middleSegment() -> isVertical()? text_item -> setRotationAngle(270): text_item -> setRotationAngle(0);
|
middleSegment() -> isVertical()? text_item -> setRotationAngle(properties_.verti_rotate_text):
|
||||||
|
text_item -> setRotationAngle(properties_.horiz_rotate_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1222,6 +1223,7 @@ ConductorProperties Conductor::properties() const {
|
|||||||
void Conductor::readProperties() {
|
void Conductor::readProperties() {
|
||||||
// la couleur n'est vraiment applicable que lors du rendu du conducteur
|
// la couleur n'est vraiment applicable que lors du rendu du conducteur
|
||||||
setText(properties_.text);
|
setText(properties_.text);
|
||||||
|
calculateTextItemPosition();
|
||||||
text_item -> setVisible(properties_.type == ConductorProperties::Multi);
|
text_item -> setVisible(properties_.type == ConductorProperties::Multi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,8 @@ int ConductorProperties::operator==(const ConductorProperties &other) {
|
|||||||
other.color == color &&\
|
other.color == color &&\
|
||||||
other.style == style &&\
|
other.style == style &&\
|
||||||
other.text == text &&\
|
other.text == text &&\
|
||||||
|
other.verti_rotate_text == verti_rotate_text &&\
|
||||||
|
other.horiz_rotate_text == horiz_rotate_text &&\
|
||||||
other.singleLineProperties == singleLineProperties
|
other.singleLineProperties == singleLineProperties
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -360,6 +362,8 @@ int ConductorProperties::operator!=(const ConductorProperties &other) {
|
|||||||
other.color != color ||\
|
other.color != color ||\
|
||||||
other.style != style ||\
|
other.style != style ||\
|
||||||
other.text != text ||\
|
other.text != text ||\
|
||||||
|
other.verti_rotate_text != verti_rotate_text ||\
|
||||||
|
other.horiz_rotate_text != horiz_rotate_text ||\
|
||||||
other.singleLineProperties != singleLineProperties
|
other.singleLineProperties != singleLineProperties
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class ConductorProperties {
|
|||||||
QColor color;
|
QColor color;
|
||||||
/// Texte displayed for multiline conductors
|
/// Texte displayed for multiline conductors
|
||||||
QString text;
|
QString text;
|
||||||
|
/// rotation angle texte
|
||||||
|
double verti_rotate_text;
|
||||||
|
double horiz_rotate_text;
|
||||||
/// conducteur style (Qt::SolidLine or Qt::DashLine)
|
/// conducteur style (Qt::SolidLine or Qt::DashLine)
|
||||||
Qt::PenStyle style;
|
Qt::PenStyle style;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -46,7 +47,6 @@ ConductorPropertiesWidget::ConductorPropertiesWidget(const ConductorProperties &
|
|||||||
void ConductorPropertiesWidget::buildInterface() {
|
void ConductorPropertiesWidget::buildInterface() {
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setMinimumSize(380, 350);
|
|
||||||
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||||
main_layout -> setContentsMargins(0, 0, 0, 0);
|
main_layout -> setContentsMargins(0, 0, 0, 0);
|
||||||
@@ -65,6 +65,22 @@ void ConductorPropertiesWidget::buildInterface() {
|
|||||||
text_field = new QLineEdit();
|
text_field = new QLineEdit();
|
||||||
multiline_layout -> addWidget(text);
|
multiline_layout -> addWidget(text);
|
||||||
multiline_layout -> addWidget(text_field);
|
multiline_layout -> addWidget(text_field);
|
||||||
|
|
||||||
|
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"));
|
singleline = new QRadioButton(tr("Unifilaire"));
|
||||||
|
|
||||||
@@ -132,12 +148,13 @@ void ConductorPropertiesWidget::buildInterface() {
|
|||||||
groupbox_layout -> addWidget(simple);
|
groupbox_layout -> addWidget(simple);
|
||||||
groupbox_layout -> addWidget(multiline);
|
groupbox_layout -> addWidget(multiline);
|
||||||
groupbox_layout -> addLayout(multiline_layout);
|
groupbox_layout -> addLayout(multiline_layout);
|
||||||
|
groupbox_layout -> addLayout(rotate_text_layout);
|
||||||
groupbox_layout -> addWidget(singleline);
|
groupbox_layout -> addWidget(singleline);
|
||||||
groupbox_layout -> addLayout(singleline_layout1);
|
groupbox_layout -> addLayout(singleline_layout1);
|
||||||
|
|
||||||
groupbox2_layout -> addLayout(color_layout);
|
groupbox2_layout -> addLayout(color_layout);
|
||||||
groupbox2_layout -> addLayout(style_layout);
|
groupbox2_layout -> addLayout(style_layout);
|
||||||
|
|
||||||
radio_buttons = new QButtonGroup(this);
|
radio_buttons = new QButtonGroup(this);
|
||||||
radio_buttons -> addButton(simple, ConductorProperties::Simple);
|
radio_buttons -> addButton(simple, ConductorProperties::Simple);
|
||||||
radio_buttons -> addButton(multiline, ConductorProperties::Multi);
|
radio_buttons -> addButton(multiline, ConductorProperties::Multi);
|
||||||
@@ -160,6 +177,8 @@ void ConductorPropertiesWidget::buildConnections() {
|
|||||||
connect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
connect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
||||||
connect(line_style, SIGNAL(currentIndexChanged(int)), this, SLOT(updateConfig()));
|
connect(line_style, SIGNAL(currentIndexChanged(int)), this, SLOT(updateConfig()));
|
||||||
connect(color_button, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,10 +223,14 @@ void ConductorPropertiesWidget::destroyConnections() {
|
|||||||
disconnect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
disconnect(text_field, SIGNAL(textChanged(const QString &)), this, SLOT(updateConfig()));
|
||||||
disconnect(color_button, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
disconnect(color_button, SIGNAL(clicked()), this, SLOT(chooseColor()));
|
||||||
disconnect(line_style, SIGNAL(currentIndexChanged(int)), this, SLOT(updateConfig()));
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructeur
|
/// Destructeur
|
||||||
ConductorPropertiesWidget::~ConductorPropertiesWidget() {
|
ConductorPropertiesWidget::~ConductorPropertiesWidget() {
|
||||||
|
delete verti_select;
|
||||||
|
delete horiz_select;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Met a jour les proprietes
|
/// Met a jour les proprietes
|
||||||
@@ -216,6 +239,8 @@ void ConductorPropertiesWidget::updateConfig() {
|
|||||||
properties_.color = colorButton();
|
properties_.color = colorButton();
|
||||||
properties_.style = static_cast<Qt::PenStyle>(line_style -> itemData(line_style -> currentIndex()).toInt());
|
properties_.style = static_cast<Qt::PenStyle>(line_style -> itemData(line_style -> currentIndex()).toInt());
|
||||||
properties_.text = text_field -> text();
|
properties_.text = text_field -> text();
|
||||||
|
properties_.verti_rotate_text = verti_select -> value();
|
||||||
|
properties_.horiz_rotate_text = horiz_select -> value();
|
||||||
properties_.singleLineProperties.hasGround = ground_checkbox -> isChecked();
|
properties_.singleLineProperties.hasGround = ground_checkbox -> isChecked();
|
||||||
properties_.singleLineProperties.hasNeutral = neutral_checkbox -> isChecked();
|
properties_.singleLineProperties.hasNeutral = neutral_checkbox -> isChecked();
|
||||||
properties_.singleLineProperties.is_pen = merge_checkbox -> isChecked();
|
properties_.singleLineProperties.is_pen = merge_checkbox -> isChecked();
|
||||||
@@ -240,6 +265,8 @@ void ConductorPropertiesWidget::updateDisplay() {
|
|||||||
phase_spinbox -> setValue(properties_.singleLineProperties.phasesCount());
|
phase_spinbox -> setValue(properties_.singleLineProperties.phasesCount());
|
||||||
phase_slider -> setValue(properties_.singleLineProperties.phasesCount());
|
phase_slider -> setValue(properties_.singleLineProperties.phasesCount());
|
||||||
phase_checkbox -> setChecked(properties_.singleLineProperties.phasesCount());
|
phase_checkbox -> setChecked(properties_.singleLineProperties.phasesCount());
|
||||||
|
verti_select -> setValue(properties_.verti_rotate_text);
|
||||||
|
horiz_select -> setValue(properties_.horiz_rotate_text);
|
||||||
|
|
||||||
buildConnections();
|
buildConnections();
|
||||||
updatePreview();
|
updatePreview();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#ifndef CONDUCTOR_PROPERTIES_WIDGET_H
|
#ifndef CONDUCTOR_PROPERTIES_WIDGET_H
|
||||||
#define CONDUCTOR_PROPERTIES_WIDGET_H
|
#define CONDUCTOR_PROPERTIES_WIDGET_H
|
||||||
#include "conductorproperties.h"
|
#include "conductorproperties.h"
|
||||||
|
#include "qtextorientationspinboxwidget.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
/**
|
/**
|
||||||
This widget enables users to change the properties of a particular
|
This widget enables users to change the properties of a particular
|
||||||
@@ -62,6 +63,8 @@ class ConductorPropertiesWidget : public QWidget {
|
|||||||
QRadioButton *simple;
|
QRadioButton *simple;
|
||||||
QRadioButton *multiline;
|
QRadioButton *multiline;
|
||||||
QLineEdit *text_field;
|
QLineEdit *text_field;
|
||||||
|
QTextOrientationSpinBoxWidget *verti_select;
|
||||||
|
QTextOrientationSpinBoxWidget *horiz_select;
|
||||||
QRadioButton *singleline;
|
QRadioButton *singleline;
|
||||||
QCheckBox *phase_checkbox;
|
QCheckBox *phase_checkbox;
|
||||||
QSlider *phase_slider;
|
QSlider *phase_slider;
|
||||||
|
|||||||
@@ -545,8 +545,6 @@ void DiagramView::editDiagramProperties() {
|
|||||||
popup.setWindowFlags(Qt::Sheet);
|
popup.setWindowFlags(Qt::Sheet);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
popup.setMinimumWidth(786);
|
|
||||||
popup.setMinimumHeight(500);
|
|
||||||
popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
|
popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
|
||||||
|
|
||||||
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
|
BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
|
||||||
@@ -588,6 +586,9 @@ void DiagramView::editDiagramProperties() {
|
|||||||
layout_v.addLayout(hlayout1);
|
layout_v.addLayout(hlayout1);
|
||||||
layout_v.addStretch();
|
layout_v.addStretch();
|
||||||
layout_v.addWidget(&boutons);
|
layout_v.addWidget(&boutons);
|
||||||
|
//workaround to get a good size by default with this widget
|
||||||
|
popup.setMinimumSize(popup.minimumSizeHint());
|
||||||
|
|
||||||
// si le dialogue est accepte
|
// si le dialogue est accepte
|
||||||
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
|
||||||
TitleBlockProperties new_titleblock = titleblock_infos -> titleBlockProperties();
|
TitleBlockProperties new_titleblock = titleblock_infos -> titleBlockProperties();
|
||||||
|
|||||||
Reference in New Issue
Block a user