Ajout d'un widget permettant d'editer l'angle d'orientation d'un texte plus intuitivement.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@833 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2010-01-03 19:45:33 +00:00
parent 27e2c052b2
commit 07bf60674d
4 changed files with 460 additions and 3 deletions

View File

@@ -17,7 +17,8 @@
*/
#include "textfieldeditor.h"
#include "parttextfield.h"
#include "qtextorientationwidget.h"
#include "qetapp.h"
/**
Constructeur
@param editor L'editeur d'element concerne
@@ -36,8 +37,20 @@ TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfi
rotate -> setChecked(true);
rotation_angle_ = new QDoubleSpinBox();
rotation_angle_ -> setRange(-360.0, 360.0);
rotation_angle_ -> setSingleStep(-90.0);
rotation_angle_ -> setSuffix("\260");
rotation_widget_ = new QTextOrientationWidget();
rotation_widget_ -> setFont(QETApp::diagramTextsFont());
rotation_widget_ -> setUsableTexts(QList<QString>()
<< tr("Q", "Single-letter example text - translate length, not meaning")
<< tr("QET", "Small example text - translate length, not meaning")
<< tr("Schema", "Normal example text - translate length, not meaning")
<< tr("Electrique", "Normal example text - translate length, not meaning")
<< tr("QElectroTech", "Long example text - translate length, not meaning")
);
rotation_widget_ -> setMinimumSize(90.0, 90.0);
connect(rotation_angle_, SIGNAL(valueChanged(double)), rotation_widget_, SLOT(setOrientation(double)));
connect(rotation_widget_, SIGNAL(orientationChanged(double)), rotation_angle_, SLOT(setValue(double)));
connect(rotation_widget_, SIGNAL(orientationChanged(double)), rotation_angle_, SIGNAL(editingFinished()));
qle_x -> setValidator(new QDoubleValidator(qle_x));
qle_y -> setValidator(new QDoubleValidator(qle_y));
@@ -64,6 +77,7 @@ TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfi
QHBoxLayout *rotation_angle_layout = new QHBoxLayout();
rotation_angle_layout -> addWidget(new QLabel(tr("Angle de rotation par d\351faut : ")));
rotation_angle_layout -> addWidget(rotation_widget_);
rotation_angle_layout -> addWidget(rotation_angle_);
main_layout -> addLayout(rotation_angle_layout);
@@ -113,7 +127,8 @@ void TextFieldEditor::updateForm() {
qle_text -> setText(part -> property("text").toString());
font_size -> setValue(part -> property("size").toInt());
rotate -> setChecked(!part -> property("rotate").toBool());
rotation_angle_ -> setValue(part -> property("rotation angle").toInt());
rotation_angle_ -> setValue(part -> property("rotation angle").toDouble());
rotation_widget_ -> setOrientation(part -> property("rotation angle").toDouble());
activeConnections(true);
}