[qet] [2198] add widget to configure rotation conductor text by default ( not finish)

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2198
Author:   blacksun
Date:     2013-06-02 23:37:04 +0200 (Sun, 02 Jun 2013)
Log Message:
-----------
add widget to configure rotation conductor text by default (not finish)

Modified Paths:
--------------
    trunk/sources/conductor.cpp
    trunk/sources/conductorproperties.cpp
    trunk/sources/conductorproperties.h
    trunk/sources/conductorpropertieswidget.cpp
    trunk/sources/conductorpropertieswidget.h
    trunk/sources/diagramview.cpp

Modified: trunk/sources/conductor.cpp
===================================================================
--- trunk/sources/conductor.cpp	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/conductor.cpp	2013-06-02 21:37:04 UTC (rev 2198)
@@ -1124,7 +1124,8 @@
 	} else {
 		// positionnement automatique basique
 		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 @@
 void Conductor::readProperties() {
 	// la couleur n'est vraiment applicable que lors du rendu du conducteur
 	setText(properties_.text);
+	calculateTextItemPosition();
 	text_item -> setVisible(properties_.type == ConductorProperties::Multi);
 }
 

Modified: trunk/sources/conductorproperties.cpp
===================================================================
--- trunk/sources/conductorproperties.cpp	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/conductorproperties.cpp	2013-06-02 21:37:04 UTC (rev 2198)
@@ -346,6 +346,8 @@
 		other.color == color &&\
 		other.style == style &&\
 		other.text == text &&\
+		other.verti_rotate_text == verti_rotate_text &&\
+		other.horiz_rotate_text == horiz_rotate_text &&\
 		other.singleLineProperties == singleLineProperties
 	);
 }
@@ -360,6 +362,8 @@
 		other.color != color ||\
 		other.style != style ||\
 		other.text != text ||\
+		other.verti_rotate_text != verti_rotate_text ||\
+		other.horiz_rotate_text != horiz_rotate_text ||\
 		other.singleLineProperties != singleLineProperties
 	);
 }

Modified: trunk/sources/conductorproperties.h
===================================================================
--- trunk/sources/conductorproperties.h	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/conductorproperties.h	2013-06-02 21:37:04 UTC (rev 2198)
@@ -79,6 +79,9 @@
 	QColor color;
 	/// Texte displayed for multiline conductors
 	QString text;
+	/// rotation angle texte
+	double verti_rotate_text;
+	double horiz_rotate_text;
 	/// conducteur style (Qt::SolidLine or Qt::DashLine)
 	Qt::PenStyle style;
 	

Modified: trunk/sources/conductorpropertieswidget.cpp
===================================================================
--- trunk/sources/conductorpropertieswidget.cpp	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/conductorpropertieswidget.cpp	2013-06-02 21:37:04 UTC (rev 2198)
@@ -19,6 +19,7 @@
 #include <QtGui>
 #include "conductor.h"
 #include "qeticons.h"
+#include "qetapp.h"
 
 /**
 	Constructeur
@@ -46,7 +47,6 @@
 void ConductorPropertiesWidget::buildInterface() {
 	
 	setFocusPolicy(Qt::StrongFocus);
-	setMinimumSize(380, 350);
 	
 	QVBoxLayout *main_layout = new QVBoxLayout(this);
 	main_layout -> setContentsMargins(0, 0, 0, 0);
@@ -65,6 +65,22 @@
 	text_field = new QLineEdit();
 	multiline_layout -> addWidget(text);
 	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"));
 	
@@ -132,12 +148,13 @@
 	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);
@@ -160,6 +177,8 @@
 	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()));
 }
 
 /**
@@ -204,10 +223,14 @@
 	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()));
 }
 
 /// Destructeur
 ConductorPropertiesWidget::~ConductorPropertiesWidget() {
+	delete verti_select;
+	delete horiz_select;
 }
 
 /// Met a jour les proprietes
@@ -216,6 +239,8 @@
 	properties_.color = colorButton();
 	properties_.style = static_cast<Qt::PenStyle>(line_style -> itemData(line_style -> currentIndex()).toInt());
 	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.hasNeutral = neutral_checkbox -> isChecked();
 	properties_.singleLineProperties.is_pen = merge_checkbox -> isChecked();
@@ -240,6 +265,8 @@
 	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();

Modified: trunk/sources/conductorpropertieswidget.h
===================================================================
--- trunk/sources/conductorpropertieswidget.h	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/conductorpropertieswidget.h	2013-06-02 21:37:04 UTC (rev 2198)
@@ -18,6 +18,7 @@
 #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
@@ -62,6 +63,8 @@
 	QRadioButton *simple;
 	QRadioButton *multiline;
 	QLineEdit *text_field;
+	QTextOrientationSpinBoxWidget *verti_select;
+	QTextOrientationSpinBoxWidget *horiz_select;
 	QRadioButton *singleline;
 	QCheckBox *phase_checkbox;
 	QSlider *phase_slider;

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2013-06-01 18:38:38 UTC (rev 2197)
+++ trunk/sources/diagramview.cpp	2013-06-02 21:37:04 UTC (rev 2198)
@@ -545,8 +545,6 @@
 	popup.setWindowFlags(Qt::Sheet);
 #endif
 	
-	popup.setMinimumWidth(786);
-	popup.setMinimumHeight(500);
 	popup.setWindowTitle(tr("Propri\351t\351s du sch\351ma", "window title"));
 	
 	BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup);
@@ -588,6 +586,9 @@
 	layout_v.addLayout(hlayout1);
 	layout_v.addStretch();
 	layout_v.addWidget(&boutons);
+	//workaround to get a good size by default with this widget
+	popup.setMinimumSize(popup.minimumSizeHint());
+
 	// si le dialogue est accepte
 	if (popup.exec() == QDialog::Accepted && !diagram_is_read_only) {
 		TitleBlockProperties new_titleblock   = titleblock_infos  -> titleBlockProperties();


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/