mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
text editor and textfield editor : use QPropertyUndoCommand instead of ChangePartCommand
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4072 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "parttext.h"
|
#include "parttext.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "qtextorientationspinboxwidget.h"
|
#include "qtextorientationspinboxwidget.h"
|
||||||
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -28,7 +29,8 @@
|
|||||||
*/
|
*/
|
||||||
TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent) :
|
TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent) :
|
||||||
ElementItemEditor(editor, parent),
|
ElementItemEditor(editor, parent),
|
||||||
part(text)
|
part(text),
|
||||||
|
m_locked(false)
|
||||||
{
|
{
|
||||||
qle_x = new QDoubleSpinBox();
|
qle_x = new QDoubleSpinBox();
|
||||||
qle_y = new QDoubleSpinBox();
|
qle_y = new QDoubleSpinBox();
|
||||||
@@ -101,18 +103,21 @@ TextEditor::~TextEditor() {
|
|||||||
@param new_part Nouvelle primitive a editer
|
@param new_part Nouvelle primitive a editer
|
||||||
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
||||||
*/
|
*/
|
||||||
bool TextEditor::setPart(CustomElementPart *new_part) {
|
bool TextEditor::setPart(CustomElementPart *new_part)
|
||||||
if (!new_part) {
|
{
|
||||||
|
if (!new_part)
|
||||||
|
{
|
||||||
part = 0;
|
part = 0;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartText *part_text = dynamic_cast<PartText *>(new_part)) {
|
if (PartText *part_text = dynamic_cast<PartText *>(new_part))
|
||||||
|
{
|
||||||
|
if (part == part_text) return true;
|
||||||
part = part_text;
|
part = part_text;
|
||||||
updateForm();
|
updateForm();
|
||||||
return(true);
|
return(true);
|
||||||
} else {
|
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,28 +127,81 @@ CustomElementPart *TextEditor::currentPart() const {
|
|||||||
return(part);
|
return(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// Met a jour le texte et cree un objet d'annulation
|
||||||
Met a jour le champ de texte a partir des donnees du formulaire
|
void TextEditor::updateTextT()
|
||||||
*/
|
{
|
||||||
void TextEditor::updateText() {
|
if(m_locked) return;
|
||||||
if (!part) return;
|
m_locked = true;
|
||||||
part -> setProperty("size", font_size -> value());
|
QString text = qle_text->text();
|
||||||
part -> setPlainText(qle_text -> text());
|
if (text != part->property("text"))
|
||||||
part -> setPos(qle_x -> value(), qle_y -> value());
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "text", part->property("text"), text);
|
||||||
|
undo->setText(tr("Modifier le contenu d'un champ texte"));
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Met a jour l'abscisse de la position du texte et cree un objet d'annulation
|
|
||||||
void TextEditor::updateTextX() { addChangePartCommand(tr("abscisse"), part, "x", qle_x -> value()); }
|
|
||||||
/// Met a jour l'ordonnee de la position du texte et cree un objet d'annulation
|
|
||||||
void TextEditor::updateTextY() { addChangePartCommand(tr("ordonnée"), part, "y", qle_y -> value()); }
|
|
||||||
/// Met a jour le texte et cree un objet d'annulation
|
|
||||||
void TextEditor::updateTextT() { addChangePartCommand(tr("contenu"), part, "text", qle_text -> text()); }
|
|
||||||
/// Met a jour la taille du texte et cree un objet d'annulation
|
/// Met a jour la taille du texte et cree un objet d'annulation
|
||||||
void TextEditor::updateTextS() { addChangePartCommand(tr("taille"), part, "size", font_size -> value()); }
|
void TextEditor::updateTextS()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
int size = font_size->value();
|
||||||
|
if (size != part->property("size"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "size", part->property("size"), size);
|
||||||
|
undo->setText(tr("Modifier la taille d'un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Update the text color and create an undo object
|
/// Update the text color and create an undo object
|
||||||
void TextEditor::updateTextC() { addChangePartCommand(tr("couleur", "undo caption"), part, "color", color_ -> checkedId()); }
|
void TextEditor::updateTextC()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
int color = color_->checkedId();
|
||||||
|
if (color != part->property("color"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "color", part->property("color"), color);
|
||||||
|
undo->setText(tr("Modifier la couleur d'un champ texte"));
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
|
/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
|
||||||
void TextEditor::updateTextRotationAngle() { addChangePartCommand(tr("angle de rotation"), part, "rotation", rotation_angle_ -> value()); }
|
void TextEditor::updateTextRotationAngle()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
double rot = rotation_angle_->value();
|
||||||
|
if (rot != part->property("rotation"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "rotation", part->property("rotation"), rot);
|
||||||
|
undo->setText(tr("Modifier l'angle d'un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextEditor::updatePos()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
QPointF pos(qle_x->value(), qle_y->value());
|
||||||
|
if (pos != part->pos())
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "pos", part->pos(), pos);
|
||||||
|
undo->setText(tr("Déplacer un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met a jour le formulaire a partir du champ de texte
|
Met a jour le formulaire a partir du champ de texte
|
||||||
@@ -162,16 +220,20 @@ void TextEditor::updateForm() {
|
|||||||
activeConnections(true);
|
activeConnections(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditor::activeConnections(bool active) {
|
void TextEditor::activeConnections(bool active)
|
||||||
if (active) {
|
{
|
||||||
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextX()));
|
if (active)
|
||||||
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextY()));
|
{
|
||||||
|
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
|
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextT()));
|
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextT()));
|
||||||
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextS()));
|
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextS()));
|
||||||
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextRotationAngle()));
|
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextRotationAngle()));
|
||||||
} else {
|
}
|
||||||
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextX()));
|
else
|
||||||
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextY()));
|
{
|
||||||
|
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
|
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextT()));
|
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextT()));
|
||||||
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextS()));
|
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextS()));
|
||||||
disconnect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextRotationAngle()));
|
disconnect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextRotationAngle()));
|
||||||
|
|||||||
@@ -17,16 +17,25 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef TEXT_EDITOR_H
|
#ifndef TEXT_EDITOR_H
|
||||||
#define TEXT_EDITOR_H
|
#define TEXT_EDITOR_H
|
||||||
#include <QtWidgets>
|
|
||||||
#include "elementitemeditor.h"
|
#include "elementitemeditor.h"
|
||||||
|
|
||||||
class PartText;
|
class PartText;
|
||||||
class QTextOrientationSpinBoxWidget;
|
class QTextOrientationSpinBoxWidget;
|
||||||
|
class QLineEdit;
|
||||||
|
class QDoubleSpinBox;
|
||||||
|
class QSpinBox;
|
||||||
|
class QButtonGroup;
|
||||||
|
class QRadioButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class provides a widget to edit static texts within the element
|
This class provides a widget to edit static texts within the element
|
||||||
editor.
|
editor.
|
||||||
*/
|
*/
|
||||||
class TextEditor : public ElementItemEditor {
|
class TextEditor : public ElementItemEditor
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// Constructors, destructor
|
// Constructors, destructor
|
||||||
public:
|
public:
|
||||||
TextEditor(QETElementEditor *, PartText * = 0, QWidget * = 0);
|
TextEditor(QETElementEditor *, PartText * = 0, QWidget * = 0);
|
||||||
@@ -43,6 +52,7 @@ class TextEditor : public ElementItemEditor {
|
|||||||
QButtonGroup *color_;
|
QButtonGroup *color_;
|
||||||
QRadioButton *black_color_, *white_color_;
|
QRadioButton *black_color_, *white_color_;
|
||||||
QTextOrientationSpinBoxWidget *rotation_angle_;
|
QTextOrientationSpinBoxWidget *rotation_angle_;
|
||||||
|
bool m_locked;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
@@ -50,13 +60,11 @@ class TextEditor : public ElementItemEditor {
|
|||||||
virtual CustomElementPart *currentPart() const;
|
virtual CustomElementPart *currentPart() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateText();
|
|
||||||
void updateTextX();
|
|
||||||
void updateTextY();
|
|
||||||
void updateTextT();
|
void updateTextT();
|
||||||
void updateTextS();
|
void updateTextS();
|
||||||
void updateTextC();
|
void updateTextC();
|
||||||
void updateTextRotationAngle();
|
void updateTextRotationAngle();
|
||||||
|
void updatePos();
|
||||||
void updateForm();
|
void updateForm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "parttextfield.h"
|
#include "parttextfield.h"
|
||||||
#include "qtextorientationspinboxwidget.h"
|
#include "qtextorientationspinboxwidget.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param editor L'editeur d'element concerne
|
@param editor L'editeur d'element concerne
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
*/
|
*/
|
||||||
TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfield, QWidget *parent) :
|
TextFieldEditor::TextFieldEditor(QETElementEditor *editor, PartTextField *textfield, QWidget *parent) :
|
||||||
ElementItemEditor(editor, parent),
|
ElementItemEditor(editor, parent),
|
||||||
part(textfield)
|
part(textfield),
|
||||||
|
m_locked(false)
|
||||||
{
|
{
|
||||||
qle_x = new QDoubleSpinBox();
|
qle_x = new QDoubleSpinBox();
|
||||||
qle_y = new QDoubleSpinBox();
|
qle_y = new QDoubleSpinBox();
|
||||||
@@ -98,18 +100,21 @@ TextFieldEditor::~TextFieldEditor() {
|
|||||||
@param new_part Nouvelle primitive a editer
|
@param new_part Nouvelle primitive a editer
|
||||||
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
@return true si l'editeur a accepter d'editer la primitive, false sinon
|
||||||
*/
|
*/
|
||||||
bool TextFieldEditor::setPart(CustomElementPart *new_part) {
|
bool TextFieldEditor::setPart(CustomElementPart *new_part)
|
||||||
if (!new_part) {
|
{
|
||||||
|
if (!new_part)
|
||||||
|
{
|
||||||
part = 0;
|
part = 0;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
if (PartTextField *part_textfield = dynamic_cast<PartTextField *>(new_part)) {
|
if (PartTextField *part_textfield = dynamic_cast<PartTextField *>(new_part))
|
||||||
|
{
|
||||||
|
if(part == part_textfield) return true;
|
||||||
part = part_textfield;
|
part = part_textfield;
|
||||||
updateForm();
|
updateForm();
|
||||||
return(true);
|
return(true);
|
||||||
} else {
|
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,31 +124,95 @@ CustomElementPart *TextFieldEditor::currentPart() const {
|
|||||||
return(part);
|
return(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// Met a jour le texte du champ de texte et cree un objet d'annulation
|
||||||
Met a jour le champ de texte a partir des donnees du formulaire
|
void TextFieldEditor::updateTextFieldT()
|
||||||
*/
|
{
|
||||||
void TextFieldEditor::updateTextField() {
|
if(m_locked) return;
|
||||||
if (!part) return;
|
m_locked = true;
|
||||||
part -> setProperty("size", font_size -> value());
|
QString text = qle_text->text();
|
||||||
part -> setPlainText(qle_text -> text());
|
if (text != part->property("text"))
|
||||||
part -> setPos(qle_x->value(), qle_y->value());
|
{
|
||||||
part -> setFollowParentRotations(!rotate -> isChecked());
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "text", part->property("text"), text);
|
||||||
part -> setTagg(m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());
|
undo->setText(tr("Modifier le contenu d'un champ texte"));
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Met a jour l'abscisse de la position du champ de texte et cree un objet d'annulation
|
|
||||||
void TextFieldEditor::updateTextFieldX() { addChangePartCommand(tr("abscisse"), part, "x", qle_x -> value()); }
|
|
||||||
/// Met a jour l'ordonnee de la position du champ de texte et cree un objet d'annulation
|
|
||||||
void TextFieldEditor::updateTextFieldY() { addChangePartCommand(tr("ordonnée"), part, "y", qle_y -> value()); }
|
|
||||||
/// Met a jour le texte du champ de texte et cree un objet d'annulation
|
|
||||||
void TextFieldEditor::updateTextFieldT() { addChangePartCommand(tr("contenu"), part, "text", qle_text -> text()); }
|
|
||||||
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
||||||
void TextFieldEditor::updateTextFieldS() { addChangePartCommand(tr("taille"), part, "size", font_size -> value()); }
|
void TextFieldEditor::updateTextFieldS()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
int size = font_size->value();
|
||||||
|
if (size != part->property("size"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "size", part->property("size"), size);
|
||||||
|
undo->setText(tr("Modifier la taille d'un champ texte"));
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
/// Met a jour la taille du champ de texte et cree un objet d'annulation
|
||||||
void TextFieldEditor::updateTextFieldR() { addChangePartCommand(tr("propriété"), part, "rotate", !rotate -> isChecked()); }
|
void TextFieldEditor::updateTextFieldR()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
bool rot = !rotate -> isChecked();
|
||||||
|
if (rot != part->property("rotate"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "rotate", part->property("rotate"), rot);
|
||||||
|
undo->setText(tr("Modifier les propriétés d'un champ texte"));
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
|
/// Met a jour l'angle de rotation du champ de texte et cree un objet d'annulation
|
||||||
void TextFieldEditor::updateTextFieldRotationAngle() { addChangePartCommand(tr("angle de rotation"), part, "rotation_angle", rotation_angle_ -> value()); }
|
void TextFieldEditor::updateTextFieldRotationAngle()
|
||||||
void TextFieldEditor::updateTagg() { addChangePartCommand(tr("tagg"), part, "tagg", m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());}
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
double rot = rotation_angle_ -> value();
|
||||||
|
if (rot != part->property("rotation_angle"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "rotation_angle", part->property("rotation_angle"), rot);
|
||||||
|
undo->setText(tr("Modifier l'angle de rotation d'un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
void TextFieldEditor::updateTagg()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
QVariant var(m_tagg_cb->itemData(m_tagg_cb->currentIndex()).toString());
|
||||||
|
if (var != part->property("tagg"))
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "tagg", part->property("tagg"), var);
|
||||||
|
undo->setText(tr("Modifier le tagg d'un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextFieldEditor::updatePos()
|
||||||
|
{
|
||||||
|
if(m_locked) return;
|
||||||
|
m_locked = true;
|
||||||
|
QPointF pos(qle_x->value(), qle_y->value());
|
||||||
|
if (pos != part->pos())
|
||||||
|
{
|
||||||
|
QPropertyUndoCommand *undo = new QPropertyUndoCommand(part, "pos", part->pos(), pos);
|
||||||
|
undo->setText(tr("Déplacer un champ texte"));
|
||||||
|
undo->enableAnimation();
|
||||||
|
undoStack().push(undo);
|
||||||
|
}
|
||||||
|
m_locked= false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TextFieldEditor::updateForm
|
* @brief TextFieldEditor::updateForm
|
||||||
@@ -168,18 +237,22 @@ void TextFieldEditor::updateForm() {
|
|||||||
Active ou desactive les connexionx signaux/slots entre les widgets internes.
|
Active ou desactive les connexionx signaux/slots entre les widgets internes.
|
||||||
@param active true pour activer les connexions, false pour les desactiver
|
@param active true pour activer les connexions, false pour les desactiver
|
||||||
*/
|
*/
|
||||||
void TextFieldEditor::activeConnections(bool active) {
|
void TextFieldEditor::activeConnections(bool active)
|
||||||
if (active) {
|
{
|
||||||
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
if (active)
|
||||||
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
{
|
||||||
|
connect(qle_x, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
|
connect(qle_y, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
connect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||||
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
connect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||||
connect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
connect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||||
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
connect(rotation_angle_, SIGNAL(editingFinished()), this, SLOT(updateTextFieldRotationAngle()));
|
||||||
connect(m_tagg_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
|
connect(m_tagg_cb, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTagg()));
|
||||||
} else {
|
}
|
||||||
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updateTextFieldX()));
|
else
|
||||||
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updateTextFieldY()));
|
{
|
||||||
|
disconnect(qle_x, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
|
disconnect(qle_y, SIGNAL(editingFinished()), this, SLOT(updatePos()));
|
||||||
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
disconnect(qle_text, SIGNAL(editingFinished()), this, SLOT(updateTextFieldT()));
|
||||||
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
disconnect(font_size, SIGNAL(editingFinished()), this, SLOT(updateTextFieldS()));
|
||||||
disconnect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
disconnect(rotate, SIGNAL(stateChanged(int)), this, SLOT(updateTextFieldR()));
|
||||||
|
|||||||
@@ -17,15 +17,24 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef TEXTFIELD_EDITOR_H
|
#ifndef TEXTFIELD_EDITOR_H
|
||||||
#define TEXTFIELD_EDITOR_H
|
#define TEXTFIELD_EDITOR_H
|
||||||
#include <QtWidgets>
|
|
||||||
#include "elementitemeditor.h"
|
#include "elementitemeditor.h"
|
||||||
|
|
||||||
class PartTextField;
|
class PartTextField;
|
||||||
class QTextOrientationSpinBoxWidget;
|
class QTextOrientationSpinBoxWidget;
|
||||||
|
class QLineEdit;
|
||||||
|
class QComboBox;
|
||||||
|
class QSpinBox;
|
||||||
|
class QDoubleSpinBox;
|
||||||
|
class QCheckBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class provides a widget to edit text fields within the element editor.
|
This class provides a widget to edit text fields within the element editor.
|
||||||
*/
|
*/
|
||||||
class TextFieldEditor : public ElementItemEditor {
|
class TextFieldEditor : public ElementItemEditor
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// Constructors, destructor
|
// Constructors, destructor
|
||||||
public:
|
public:
|
||||||
TextFieldEditor(QETElementEditor *, PartTextField * = 0, QWidget * = 0);
|
TextFieldEditor(QETElementEditor *, PartTextField * = 0, QWidget * = 0);
|
||||||
@@ -42,6 +51,7 @@ class TextFieldEditor : public ElementItemEditor {
|
|||||||
QDoubleSpinBox *qle_x, *qle_y;
|
QDoubleSpinBox *qle_x, *qle_y;
|
||||||
QCheckBox *rotate;
|
QCheckBox *rotate;
|
||||||
QTextOrientationSpinBoxWidget *rotation_angle_;
|
QTextOrientationSpinBoxWidget *rotation_angle_;
|
||||||
|
bool m_locked;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
@@ -49,14 +59,12 @@ class TextFieldEditor : public ElementItemEditor {
|
|||||||
virtual CustomElementPart *currentPart() const;
|
virtual CustomElementPart *currentPart() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateTextField();
|
|
||||||
void updateTextFieldX();
|
|
||||||
void updateTextFieldY();
|
|
||||||
void updateTextFieldT();
|
void updateTextFieldT();
|
||||||
void updateTextFieldS();
|
void updateTextFieldS();
|
||||||
void updateTextFieldR();
|
void updateTextFieldR();
|
||||||
void updateTextFieldRotationAngle();
|
void updateTextFieldRotationAngle();
|
||||||
void updateTagg();
|
void updateTagg();
|
||||||
|
void updatePos();
|
||||||
void updateForm();
|
void updateForm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user