mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-06 04:59:58 +01:00
Wrap code for better readability
This commit is contained in:
@@ -75,7 +75,8 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) :
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
ArcEditor::~ArcEditor() {}
|
||||
ArcEditor::~ArcEditor()
|
||||
{}
|
||||
|
||||
void ArcEditor::setUpChangeConnections()
|
||||
{
|
||||
@@ -140,11 +141,13 @@ bool ArcEditor::setParts(QList <CustomElementPart *> parts)
|
||||
@brief ArcEditor::currentPart
|
||||
@return the curent edited part, or 0 if there is no edited part
|
||||
*/
|
||||
CustomElementPart *ArcEditor::currentPart() const {
|
||||
CustomElementPart *ArcEditor::currentPart() const
|
||||
{
|
||||
return(part);
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> ArcEditor::currentParts() const {
|
||||
QList<CustomElementPart*> ArcEditor::currentParts() const
|
||||
{
|
||||
return style_->currentParts();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,15 @@ ElementEditionCommand::ElementEditionCommand(const QString &text,
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
ElementEditionCommand::~ElementEditionCommand() {
|
||||
ElementEditionCommand::~ElementEditionCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@return the element editor/scene the command should take place on
|
||||
*/
|
||||
ElementScene *ElementEditionCommand::elementScene() const {
|
||||
ElementScene *ElementEditionCommand::elementScene() const
|
||||
{
|
||||
return(m_scene);
|
||||
}
|
||||
|
||||
@@ -76,7 +78,8 @@ void ElementEditionCommand::setElementScene(ElementScene *scene) {
|
||||
/**
|
||||
@return the view the effect of the command should be rendered on
|
||||
*/
|
||||
ElementView *ElementEditionCommand::elementView() const {
|
||||
ElementView *ElementEditionCommand::elementView() const
|
||||
{
|
||||
return(m_view);
|
||||
}
|
||||
|
||||
@@ -108,14 +111,16 @@ DeletePartsCommand::DeletePartsCommand(
|
||||
}
|
||||
|
||||
/// Destructeur : detruit egalement les parties supprimees
|
||||
DeletePartsCommand::~DeletePartsCommand() {
|
||||
DeletePartsCommand::~DeletePartsCommand()
|
||||
{
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
m_scene -> qgiManager().release(qgi);
|
||||
}
|
||||
}
|
||||
|
||||
/// Restaure les parties supprimees
|
||||
void DeletePartsCommand::undo() {
|
||||
void DeletePartsCommand::undo()
|
||||
{
|
||||
m_scene -> blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
m_scene -> addItem(qgi);
|
||||
@@ -124,7 +129,8 @@ void DeletePartsCommand::undo() {
|
||||
}
|
||||
|
||||
/// Supprime les parties
|
||||
void DeletePartsCommand::redo() {
|
||||
void DeletePartsCommand::redo()
|
||||
{
|
||||
m_scene -> blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
||||
m_scene -> removeItem(qgi);
|
||||
@@ -150,7 +156,8 @@ CutPartsCommand::CutPartsCommand(
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
CutPartsCommand::~CutPartsCommand() {
|
||||
CutPartsCommand::~CutPartsCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/*** MovePartsCommand ***/
|
||||
@@ -175,16 +182,19 @@ MovePartsCommand::MovePartsCommand(
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
MovePartsCommand::~MovePartsCommand() {
|
||||
MovePartsCommand::~MovePartsCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// Annule le deplacement
|
||||
void MovePartsCommand::undo() {
|
||||
void MovePartsCommand::undo()
|
||||
{
|
||||
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
|
||||
}
|
||||
|
||||
/// Refait le deplacement
|
||||
void MovePartsCommand::redo() {
|
||||
void MovePartsCommand::redo()
|
||||
{
|
||||
// le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire
|
||||
if (first_redo) {
|
||||
first_redo = false;
|
||||
@@ -215,17 +225,20 @@ AddPartCommand::AddPartCommand(
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
AddPartCommand::~AddPartCommand() {
|
||||
AddPartCommand::~AddPartCommand()
|
||||
{
|
||||
m_scene -> qgiManager().release(part);
|
||||
}
|
||||
|
||||
/// Annule l'ajout
|
||||
void AddPartCommand::undo() {
|
||||
void AddPartCommand::undo()
|
||||
{
|
||||
m_scene -> removeItem(part);
|
||||
}
|
||||
|
||||
/// Refait l'ajout
|
||||
void AddPartCommand::redo() {
|
||||
void AddPartCommand::redo()
|
||||
{
|
||||
// le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire
|
||||
if (first_redo) {
|
||||
if (!part -> zValue()) {
|
||||
@@ -262,16 +275,19 @@ ChangeNamesCommand::ChangeNamesCommand(
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
ChangeNamesCommand::~ChangeNamesCommand() {
|
||||
ChangeNamesCommand::~ChangeNamesCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// Annule le changement
|
||||
void ChangeNamesCommand::undo() {
|
||||
void ChangeNamesCommand::undo()
|
||||
{
|
||||
m_scene -> setNames(names_before);
|
||||
}
|
||||
|
||||
/// Refait le changement
|
||||
void ChangeNamesCommand::redo() {
|
||||
void ChangeNamesCommand::redo()
|
||||
{
|
||||
m_scene -> setNames(names_after);
|
||||
}
|
||||
|
||||
@@ -312,16 +328,19 @@ ChangeZValueCommand::ChangeZValueCommand(
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
ChangeZValueCommand::~ChangeZValueCommand() {
|
||||
ChangeZValueCommand::~ChangeZValueCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// Annule les changements de zValue
|
||||
void ChangeZValueCommand::undo() {
|
||||
void ChangeZValueCommand::undo()
|
||||
{
|
||||
foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
|
||||
}
|
||||
|
||||
/// Refait les changements de zValue
|
||||
void ChangeZValueCommand::redo() {
|
||||
void ChangeZValueCommand::redo()
|
||||
{
|
||||
foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
|
||||
}
|
||||
|
||||
@@ -423,16 +442,19 @@ ChangeInformationsCommand::ChangeInformationsCommand(ElementScene *elmt, const Q
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
ChangeInformationsCommand::~ChangeInformationsCommand() {
|
||||
ChangeInformationsCommand::~ChangeInformationsCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/// Annule le changement d'autorisation pour les connexions internes
|
||||
void ChangeInformationsCommand::undo() {
|
||||
void ChangeInformationsCommand::undo()
|
||||
{
|
||||
m_scene -> setInformations(old_informations_);
|
||||
}
|
||||
|
||||
/// Refait le changement d'autorisation pour les connexions internes
|
||||
void ChangeInformationsCommand::redo() {
|
||||
void ChangeInformationsCommand::redo()
|
||||
{
|
||||
m_scene -> setInformations(new_informations_);
|
||||
}
|
||||
|
||||
@@ -449,20 +471,23 @@ ScalePartsCommand::ScalePartsCommand(ElementScene *scene, QUndoCommand * parent)
|
||||
/**
|
||||
Destructor
|
||||
*/
|
||||
ScalePartsCommand::~ScalePartsCommand() {
|
||||
ScalePartsCommand::~ScalePartsCommand()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Undo the scaling operation
|
||||
*/
|
||||
void ScalePartsCommand::undo() {
|
||||
void ScalePartsCommand::undo()
|
||||
{
|
||||
scale(new_rect_, original_rect_);
|
||||
}
|
||||
|
||||
/**
|
||||
Redo the scaling operation
|
||||
*/
|
||||
void ScalePartsCommand::redo() {
|
||||
void ScalePartsCommand::redo()
|
||||
{
|
||||
if (first_redo) {
|
||||
first_redo = false;
|
||||
return;
|
||||
@@ -473,7 +498,8 @@ void ScalePartsCommand::redo() {
|
||||
/**
|
||||
@return the element editor/scene the command should take place on
|
||||
*/
|
||||
ElementScene *ScalePartsCommand::elementScene() const {
|
||||
ElementScene *ScalePartsCommand::elementScene() const
|
||||
{
|
||||
return(m_scene);
|
||||
}
|
||||
|
||||
@@ -488,7 +514,8 @@ void ScalePartsCommand::setScaledPrimitives(const QList<CustomElementPart *> &pr
|
||||
/**
|
||||
@return the list of primitives to be scaled by this command
|
||||
*/
|
||||
QList<CustomElementPart *> ScalePartsCommand::scaledPrimitives() const {
|
||||
QList<CustomElementPart *> ScalePartsCommand::scaledPrimitives() const
|
||||
{
|
||||
return(scaled_primitives_);
|
||||
}
|
||||
|
||||
@@ -511,7 +538,8 @@ void ScalePartsCommand::setTransformation(const QRectF &original_rect,
|
||||
are the bounding rectangles for all scaled primitives respectively before
|
||||
and after the operation.
|
||||
*/
|
||||
QPair<QRectF, QRectF> ScalePartsCommand::transformation() {
|
||||
QPair<QRectF, QRectF> ScalePartsCommand::transformation()
|
||||
{
|
||||
return(QPair<QRectF, QRectF>(original_rect_, new_rect_));
|
||||
}
|
||||
|
||||
@@ -532,7 +560,8 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
|
||||
/**
|
||||
Generate the text describing what this command does exactly.
|
||||
*/
|
||||
void ScalePartsCommand::adjustText() {
|
||||
void ScalePartsCommand::adjustText()
|
||||
{
|
||||
if (scaled_primitives_.count() == 1) {
|
||||
setText(QObject::tr("redimensionnement %1", "undo caption -- %1 is the resized primitive type name").arg(scaled_primitives_.first() -> name()));
|
||||
} else {
|
||||
@@ -562,7 +591,8 @@ ChangePropertiesCommand::ChangePropertiesCommand(
|
||||
setText(QObject::tr("Modifier les propriétés"));
|
||||
}
|
||||
|
||||
ChangePropertiesCommand::~ChangePropertiesCommand() {}
|
||||
ChangePropertiesCommand::~ChangePropertiesCommand()
|
||||
{}
|
||||
|
||||
void ChangePropertiesCommand::undo()
|
||||
{
|
||||
|
||||
@@ -31,22 +31,26 @@ ElementItemEditor::ElementItemEditor(QETElementEditor *editor, QWidget *parent)
|
||||
}
|
||||
|
||||
/// @return le QETElementEditor auquel cet editeur appartient
|
||||
QETElementEditor *ElementItemEditor::elementEditor() const {
|
||||
QETElementEditor *ElementItemEditor::elementEditor() const
|
||||
{
|
||||
return(element_editor);
|
||||
}
|
||||
|
||||
/// @return l'ElementScene contenant les parties editees par cet editeur
|
||||
ElementScene *ElementItemEditor::elementScene() const {
|
||||
ElementScene *ElementItemEditor::elementScene() const
|
||||
{
|
||||
return(element_editor -> elementScene());
|
||||
}
|
||||
|
||||
/// @return la QUndoStack a utiliser pour les annulations
|
||||
QUndoStack &ElementItemEditor::undoStack() const {
|
||||
QUndoStack &ElementItemEditor::undoStack() const
|
||||
{
|
||||
return(elementScene() -> undoStack());
|
||||
}
|
||||
|
||||
/// @return Le nom du type d'element edite
|
||||
QString ElementItemEditor::elementTypeName() const {
|
||||
QString ElementItemEditor::elementTypeName() const
|
||||
{
|
||||
return(element_type_name);
|
||||
}
|
||||
|
||||
@@ -60,6 +64,7 @@ void ElementItemEditor::setElementTypeName(const QString &name) {
|
||||
Equivaut a setPart(0)
|
||||
@see setPart
|
||||
*/
|
||||
void ElementItemEditor::detach() {
|
||||
void ElementItemEditor::detach()
|
||||
{
|
||||
setPart(nullptr);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ ElementPrimitiveDecorator::~ElementPrimitiveDecorator()
|
||||
@return the internal bouding rect, i.e. the smallest rectangle containing
|
||||
the bounding rectangle of every selected item.
|
||||
*/
|
||||
QRectF ElementPrimitiveDecorator::internalBoundingRect() const {
|
||||
QRectF ElementPrimitiveDecorator::internalBoundingRect() const
|
||||
{
|
||||
if (!decorated_items_.count() || !scene()) return(QRectF());
|
||||
|
||||
//if @decorated_items_ contain one item and if this item is a vertical or horizontal partline, apply a specific methode
|
||||
@@ -139,14 +140,16 @@ void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items)
|
||||
/**
|
||||
@return the list of items this decorator is supposed to manipulate
|
||||
*/
|
||||
QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
|
||||
QList<CustomElementPart *> ElementPrimitiveDecorator::items() const
|
||||
{
|
||||
return(decorated_items_);
|
||||
}
|
||||
|
||||
/**
|
||||
@return the list of items this decorator is supposed to manipulate
|
||||
*/
|
||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const
|
||||
{
|
||||
QList<QGraphicsItem *> list;
|
||||
foreach (CustomElementPart *part_item, decorated_items_) {
|
||||
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||
@@ -337,7 +340,8 @@ void ElementPrimitiveDecorator::init()
|
||||
/**
|
||||
Save the original bounding rectangle.
|
||||
*/
|
||||
void ElementPrimitiveDecorator::saveOriginalBoundingRect() {
|
||||
void ElementPrimitiveDecorator::saveOriginalBoundingRect()
|
||||
{
|
||||
original_bounding_rect_ = internalBoundingRect();
|
||||
}
|
||||
|
||||
@@ -345,7 +349,8 @@ void ElementPrimitiveDecorator::saveOriginalBoundingRect() {
|
||||
Adjust the effective bounding rect. This method should be called after the
|
||||
modified_bouding_rect_ attribute was modified.
|
||||
*/
|
||||
void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
|
||||
void ElementPrimitiveDecorator::adjustEffectiveBoundingRect()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
effective_bounding_rect_ = modified_bounding_rect_ | effective_bounding_rect_;
|
||||
update();
|
||||
@@ -355,7 +360,8 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
|
||||
/**
|
||||
Start a movement (i.e. either a move or scaling operation)
|
||||
*/
|
||||
void ElementPrimitiveDecorator::startMovement() {
|
||||
void ElementPrimitiveDecorator::startMovement()
|
||||
{
|
||||
adjust();
|
||||
|
||||
foreach(CustomElementPart *item, decorated_items_) {
|
||||
@@ -409,7 +415,8 @@ void ElementPrimitiveDecorator::applyMovementToRect(int movement_type, const QPo
|
||||
}
|
||||
}
|
||||
|
||||
CustomElementPart *ElementPrimitiveDecorator::singleItem() const {
|
||||
CustomElementPart *ElementPrimitiveDecorator::singleItem() const
|
||||
{
|
||||
if (decorated_items_.count() == 1) {
|
||||
return(decorated_items_.first());
|
||||
}
|
||||
@@ -450,7 +457,8 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR
|
||||
/**
|
||||
@return the bounding rectangle of \a item, in scene coordinates
|
||||
*/
|
||||
QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const {
|
||||
QRectF ElementPrimitiveDecorator::getSceneBoundingRect(QGraphicsItem *item) const
|
||||
{
|
||||
if (!item) return(QRectF());
|
||||
return(item -> mapRectToScene(item -> boundingRect()));
|
||||
}
|
||||
@@ -655,7 +663,8 @@ QPointF ElementPrimitiveDecorator::deltaForRoundScaling(const QRectF &original,
|
||||
Round the coordinates of \a point so it is snapped to the grid defined by the
|
||||
grid_step_x_ and grid_step_y_ attributes.
|
||||
*/
|
||||
QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const {
|
||||
QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) const
|
||||
{
|
||||
return(
|
||||
QPointF(
|
||||
qRound(point.x() / grid_step_x_) * grid_step_x_,
|
||||
@@ -668,7 +677,8 @@ QPointF ElementPrimitiveDecorator::snapConstPointToGrid(const QPointF &point) co
|
||||
Round the coordinates of \a point so it is snapped to the grid defined by the
|
||||
grid_step_x_ and grid_step_y_ attributes.
|
||||
*/
|
||||
void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const {
|
||||
void ElementPrimitiveDecorator::snapPointToGrid(QPointF &point) const
|
||||
{
|
||||
point.rx() = qRound(point.x() / grid_step_x_) * grid_step_x_;
|
||||
point.ry() = qRound(point.y() / grid_step_y_) * grid_step_y_;
|
||||
}
|
||||
|
||||
@@ -347,7 +347,8 @@ void ElementScene::setBehavior(ElementScene::Behavior b) {
|
||||
m_behavior = b;
|
||||
}
|
||||
|
||||
ElementScene::Behavior ElementScene::behavior() const {
|
||||
ElementScene::Behavior ElementScene::behavior() const
|
||||
{
|
||||
return m_behavior;
|
||||
}
|
||||
|
||||
@@ -356,7 +357,8 @@ ElementScene::Behavior ElementScene::behavior() const {
|
||||
@return the horizontal size of the grid
|
||||
\~French la taille horizontale de la grille
|
||||
*/
|
||||
int ElementScene::xGrid() const {
|
||||
int ElementScene::xGrid() const
|
||||
{
|
||||
return(m_x_grid);
|
||||
}
|
||||
|
||||
@@ -365,7 +367,8 @@ int ElementScene::xGrid() const {
|
||||
@return vertical grid size
|
||||
\~French la taille verticale de la grille
|
||||
*/
|
||||
int ElementScene::yGrid() const {
|
||||
int ElementScene::yGrid() const
|
||||
{
|
||||
return(m_y_grid);
|
||||
}
|
||||
|
||||
@@ -580,7 +583,8 @@ QRectF ElementScene::elementSceneGeometricRect() const{
|
||||
\~French true si l'element comporte au moins une borne,
|
||||
false s'il n'en a aucune.
|
||||
*/
|
||||
bool ElementScene::containsTerminals() const {
|
||||
bool ElementScene::containsTerminals() const
|
||||
{
|
||||
foreach(QGraphicsItem *qgi,items()) {
|
||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||
return(true);
|
||||
@@ -594,7 +598,8 @@ bool ElementScene::containsTerminals() const {
|
||||
@return the undo stack of this element editor
|
||||
\~French la pile d'annulations de cet editeur d'element
|
||||
*/
|
||||
QUndoStack &ElementScene::undoStack() {
|
||||
QUndoStack &ElementScene::undoStack()
|
||||
{
|
||||
return(m_undo_stack);
|
||||
}
|
||||
|
||||
@@ -603,7 +608,8 @@ QUndoStack &ElementScene::undoStack() {
|
||||
@return the QGraphicsItem manager of this item editor
|
||||
\~French le gestionnaire de QGraphicsItem de cet editeur d'element
|
||||
*/
|
||||
QGIManager &ElementScene::qgiManager() {
|
||||
QGIManager &ElementScene::qgiManager()
|
||||
{
|
||||
return(m_qgi_manager);
|
||||
}
|
||||
|
||||
@@ -612,7 +618,8 @@ QGIManager &ElementScene::qgiManager() {
|
||||
@return true if the clipboard appears to contain an element
|
||||
\~French true si le presse-papier semble contenir un element
|
||||
*/
|
||||
bool ElementScene::clipboardMayContainElement() {
|
||||
bool ElementScene::clipboardMayContainElement()
|
||||
{
|
||||
QString clipboard_text = QApplication::clipboard() -> text().trimmed();
|
||||
bool may_be_element = clipboard_text.startsWith("<definition")
|
||||
&& clipboard_text.endsWith("</definition>");
|
||||
@@ -639,7 +646,8 @@ bool ElementScene::wasCopiedFromThisElement(const QString &clipboard_content) {
|
||||
\~French Gere le fait de couper la selection
|
||||
= l'exporter en XML dans le presse-papier puis la supprimer.
|
||||
*/
|
||||
void ElementScene::cut() {
|
||||
void ElementScene::cut()
|
||||
{
|
||||
copy();
|
||||
QList<QGraphicsItem *> cut_content = selectedItems();
|
||||
clearSelection();
|
||||
@@ -653,7 +661,8 @@ void ElementScene::cut() {
|
||||
\~French Gere le fait de copier la selection
|
||||
= l'exporter en XML dans lepresse-papier.
|
||||
*/
|
||||
void ElementScene::copy() {
|
||||
void ElementScene::copy()
|
||||
{
|
||||
// accede au presse-papier
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
|
||||
@@ -674,7 +683,8 @@ void ElementScene::copy() {
|
||||
@brief ElementScene::editor
|
||||
@return
|
||||
*/
|
||||
QETElementEditor* ElementScene::editor() const {
|
||||
QETElementEditor* ElementScene::editor() const
|
||||
{
|
||||
return m_element_editor;
|
||||
}
|
||||
|
||||
@@ -727,7 +737,8 @@ void ElementScene::slot_select(const ElementContent &content)
|
||||
@brief ElementScene::slot_selectAll
|
||||
Select all items
|
||||
*/
|
||||
void ElementScene::slot_selectAll() {
|
||||
void ElementScene::slot_selectAll()
|
||||
{
|
||||
slot_select(items());
|
||||
}
|
||||
|
||||
@@ -735,7 +746,8 @@ void ElementScene::slot_selectAll() {
|
||||
@brief ElementScene::slot_deselectAll
|
||||
deselect all item
|
||||
*/
|
||||
void ElementScene::slot_deselectAll() {
|
||||
void ElementScene::slot_deselectAll()
|
||||
{
|
||||
slot_select(ElementContent());
|
||||
}
|
||||
|
||||
@@ -744,7 +756,8 @@ void ElementScene::slot_deselectAll() {
|
||||
Inverse Selection
|
||||
\~French Inverse la selection
|
||||
*/
|
||||
void ElementScene::slot_invertSelection() {
|
||||
void ElementScene::slot_invertSelection()
|
||||
{
|
||||
blockSignals(true);
|
||||
foreach(QGraphicsItem *qgi,
|
||||
items()) qgi -> setSelected(!qgi -> isSelected());
|
||||
@@ -757,7 +770,8 @@ void ElementScene::slot_invertSelection() {
|
||||
Delete selected items
|
||||
\~French Supprime les elements selectionnes
|
||||
*/
|
||||
void ElementScene::slot_delete() {
|
||||
void ElementScene::slot_delete()
|
||||
{
|
||||
// check that there is something selected
|
||||
// verifie qu'il y a qqc de selectionne
|
||||
QList<QGraphicsItem *> selected_items = selectedItems();
|
||||
@@ -781,7 +795,8 @@ void ElementScene::slot_delete() {
|
||||
de cet element. Concretement, ce champ libre est destine a accueillir
|
||||
des informations sur l'auteur de l'element, sa licence, etc.
|
||||
*/
|
||||
void ElementScene::slot_editAuthorInformations() {
|
||||
void ElementScene::slot_editAuthorInformations()
|
||||
{
|
||||
bool is_read_only = m_element_editor && m_element_editor -> isReadOnly();
|
||||
|
||||
// create a dialogue
|
||||
@@ -886,7 +901,8 @@ void ElementScene::slot_editNames()
|
||||
@brief ElementScene::primitives
|
||||
@return the list of primitives currently present on the scene.
|
||||
*/
|
||||
QList<CustomElementPart *> ElementScene::primitives() const {
|
||||
QList<CustomElementPart *> ElementScene::primitives() const
|
||||
{
|
||||
QList<CustomElementPart *> primitives_list;
|
||||
foreach (QGraphicsItem *item, items()) {
|
||||
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||
@@ -902,7 +918,8 @@ QList<CustomElementPart *> ElementScene::primitives() const {
|
||||
@return the parts of the element ordered by increasing zValue
|
||||
\~French les parties de l'element ordonnes par zValue croissante
|
||||
*/
|
||||
QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
|
||||
QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const
|
||||
{
|
||||
// handle dummy request, i.e. when neither Selected nor NonSelected are set
|
||||
if (!(options & ElementScene::Selected)
|
||||
&&
|
||||
@@ -968,7 +985,8 @@ QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
|
||||
@return the selected graphic parts
|
||||
\~French les parties graphiques selectionnees
|
||||
*/
|
||||
ElementContent ElementScene::selectedContent() const {
|
||||
ElementContent ElementScene::selectedContent() const
|
||||
{
|
||||
ElementContent content;
|
||||
foreach(QGraphicsItem *qgi, zItems()) {
|
||||
if (qgi -> isSelected()) content << qgi;
|
||||
@@ -1031,7 +1049,8 @@ void ElementScene::reset()
|
||||
exprime dans les coordonnes de la scene
|
||||
*/
|
||||
QRectF ElementScene::elementContentBoundingRect(
|
||||
const ElementContent &content) const {
|
||||
const ElementContent &content) const
|
||||
{
|
||||
QRectF bounding_rect;
|
||||
foreach(QGraphicsItem *qgi, content) {
|
||||
// skip non-primitives QGraphicsItems (paste area, selection decorator)
|
||||
@@ -1234,7 +1253,8 @@ void ElementScene::addPrimitive(QGraphicsItem *primitive) {
|
||||
Initializes the paste area
|
||||
\~French Initialise la zone de collage
|
||||
*/
|
||||
void ElementScene::initPasteArea() {
|
||||
void ElementScene::initPasteArea()
|
||||
{
|
||||
m_paste_area = new QGraphicsRectItem();
|
||||
m_paste_area -> setZValue(1000000);
|
||||
|
||||
@@ -1282,7 +1302,8 @@ bool ElementScene::zValueLessThan(QGraphicsItem *item1, QGraphicsItem *item2) {
|
||||
try to center better is possible the element to the scene
|
||||
(the calcul isn't optimal but work good)
|
||||
*/
|
||||
void ElementScene::centerElementToOrigine() {
|
||||
void ElementScene::centerElementToOrigine()
|
||||
{
|
||||
QRectF size= elementSceneGeometricRect();
|
||||
int center_x = qRound(size.center().x());
|
||||
int center_y = qRound(size.center().y());
|
||||
|
||||
@@ -192,7 +192,8 @@ inline void ElementScene::setNames(const NamesList &nameslist) {
|
||||
@brief ElementScene::names
|
||||
@return the list of names of the currently edited element
|
||||
*/
|
||||
inline NamesList ElementScene::names() const {
|
||||
inline NamesList ElementScene::names() const
|
||||
{
|
||||
return(m_names_list);
|
||||
}
|
||||
|
||||
@@ -200,7 +201,8 @@ inline NamesList ElementScene::names() const {
|
||||
@brief ElementScene::informations
|
||||
@return extra informations of the currently edited element
|
||||
*/
|
||||
inline QString ElementScene::informations() const {
|
||||
inline QString ElementScene::informations() const
|
||||
{
|
||||
return(m_informations);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,18 +41,21 @@ ElementView::ElementView(ElementScene *scene, QWidget *parent) :
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
ElementView::~ElementView() {
|
||||
ElementView::~ElementView()
|
||||
{
|
||||
}
|
||||
|
||||
/// @return l'ElementScene visualisee par cette ElementView
|
||||
ElementScene *ElementView::scene() const {
|
||||
ElementScene *ElementView::scene() const
|
||||
{
|
||||
return(m_scene);
|
||||
}
|
||||
|
||||
/**
|
||||
@return le rectangle de l'element visualise par cet ElementView
|
||||
*/
|
||||
QRectF ElementView::viewedSceneRect() const {
|
||||
QRectF ElementView::viewedSceneRect() const
|
||||
{
|
||||
// recupere la taille du widget viewport
|
||||
QSize viewport_size = viewport() -> size();
|
||||
|
||||
@@ -79,7 +82,8 @@ void ElementView::setScene(ElementScene *s) {
|
||||
/**
|
||||
Set the Diagram in visualisation mode
|
||||
*/
|
||||
void ElementView::setVisualisationMode() {
|
||||
void ElementView::setVisualisationMode()
|
||||
{
|
||||
setDragMode(ScrollHandDrag);
|
||||
setInteractive(false);
|
||||
emit(modeChanged());
|
||||
@@ -88,7 +92,8 @@ void ElementView::setVisualisationMode() {
|
||||
/**
|
||||
Set the Diagram in Selection mode
|
||||
*/
|
||||
void ElementView::setSelectionMode() {
|
||||
void ElementView::setSelectionMode()
|
||||
{
|
||||
setDragMode(RubberBandDrag);
|
||||
setInteractive(true);
|
||||
emit(modeChanged());
|
||||
@@ -97,7 +102,8 @@ void ElementView::setSelectionMode() {
|
||||
/**
|
||||
Agrandit le schema (+33% = inverse des -25 % de zoomMoins())
|
||||
*/
|
||||
void ElementView::zoomIn() {
|
||||
void ElementView::zoomIn()
|
||||
{
|
||||
adjustSceneRect();
|
||||
scale(4.0/3.0, 4.0/3.0);
|
||||
}
|
||||
@@ -105,7 +111,8 @@ void ElementView::zoomIn() {
|
||||
/**
|
||||
Retrecit le schema (-25% = inverse des +33 % de zoomPlus())
|
||||
*/
|
||||
void ElementView::zoomOut() {
|
||||
void ElementView::zoomOut()
|
||||
{
|
||||
adjustSceneRect();
|
||||
scale(0.75, 0.75);
|
||||
}
|
||||
@@ -113,14 +120,16 @@ void ElementView::zoomOut() {
|
||||
/**
|
||||
Agrandit le schema avec le trackpad
|
||||
*/
|
||||
void ElementView::zoomInSlowly() {
|
||||
void ElementView::zoomInSlowly()
|
||||
{
|
||||
scale(1.02, 1.02);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrecit le schema avec le trackpad
|
||||
*/
|
||||
void ElementView::zoomOutSlowly() {
|
||||
void ElementView::zoomOutSlowly()
|
||||
{
|
||||
scale(0.98, 0.98);
|
||||
}
|
||||
|
||||
@@ -129,7 +138,8 @@ void ElementView::zoomOutSlowly() {
|
||||
schema soient visibles a l'ecran. S'il n'y a aucun element sur le schema,
|
||||
le zoom est reinitialise
|
||||
*/
|
||||
void ElementView::zoomFit() {
|
||||
void ElementView::zoomFit()
|
||||
{
|
||||
resetSceneRect();
|
||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
@@ -137,7 +147,8 @@ void ElementView::zoomFit() {
|
||||
/**
|
||||
Reinitialise le zoom
|
||||
*/
|
||||
void ElementView::zoomReset() {
|
||||
void ElementView::zoomReset()
|
||||
{
|
||||
resetSceneRect();
|
||||
resetTransform();
|
||||
scale(4.0, 4.0);
|
||||
@@ -148,7 +159,8 @@ void ElementView::zoomReset() {
|
||||
Adjust the scenRect, so that he include all primitives of element
|
||||
plus the viewport of the scene with a margin of 1/3 of herself
|
||||
*/
|
||||
void ElementView::adjustSceneRect() {
|
||||
void ElementView::adjustSceneRect()
|
||||
{
|
||||
QRectF esgr = m_scene -> elementSceneGeometricRect();
|
||||
QRectF vpbr = mapToScene(this -> viewport()->rect()).boundingRect();
|
||||
QRectF new_scene_rect = vpbr.adjusted(-vpbr.width()/3, -vpbr.height()/3, vpbr.width()/3, vpbr.height()/3);
|
||||
@@ -160,7 +172,8 @@ void ElementView::adjustSceneRect() {
|
||||
reset le sceneRect (zone du schéma visualisée par l'ElementView) afin que
|
||||
celui-ci inclut uniquement les primitives de l'élément dessiné.
|
||||
*/
|
||||
void ElementView::resetSceneRect() {
|
||||
void ElementView::resetSceneRect()
|
||||
{
|
||||
setSceneRect(m_scene -> elementSceneGeometricRect());
|
||||
}
|
||||
|
||||
@@ -168,7 +181,8 @@ void ElementView::resetSceneRect() {
|
||||
Gere le fait de couper la selection = l'exporter en XML dans le
|
||||
presse-papier puis la supprimer.
|
||||
*/
|
||||
void ElementView::cut() {
|
||||
void ElementView::cut()
|
||||
{
|
||||
// delegue cette action a la scene
|
||||
m_scene -> cut();
|
||||
offset_paste_count_ = -1;
|
||||
@@ -178,7 +192,8 @@ void ElementView::cut() {
|
||||
Gere le fait de copier la selection = l'exporter en XML dans le
|
||||
presse-papier.
|
||||
*/
|
||||
void ElementView::copy() {
|
||||
void ElementView::copy()
|
||||
{
|
||||
// delegue cette action a la scene
|
||||
m_scene -> copy();
|
||||
offset_paste_count_ = 0;
|
||||
@@ -194,7 +209,8 @@ void ElementView::copy() {
|
||||
collage devra s'effectuer.
|
||||
@see pasteAreaDefined(const QRectF &)
|
||||
*/
|
||||
void ElementView::paste() {
|
||||
void ElementView::paste()
|
||||
{
|
||||
QString clipboard_text = QApplication::clipboard() -> text();
|
||||
if (clipboard_text.isEmpty()) return;
|
||||
|
||||
@@ -218,7 +234,8 @@ void ElementView::paste() {
|
||||
Colle le contenu du presse-papier en demandant systematiquement a
|
||||
l'utilisateur de choisir une zone de collage
|
||||
*/
|
||||
void ElementView::pasteInArea() {
|
||||
void ElementView::pasteInArea()
|
||||
{
|
||||
QString clipboard_text = QApplication::clipboard() -> text();
|
||||
if (clipboard_text.isEmpty()) return;
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
EllipseEditor::~EllipseEditor() {
|
||||
EllipseEditor::~EllipseEditor()
|
||||
{
|
||||
}
|
||||
|
||||
void EllipseEditor::setUpChangeConnections()
|
||||
@@ -126,11 +127,13 @@ bool EllipseEditor::setParts(QList <CustomElementPart *> parts)
|
||||
/**
|
||||
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
|
||||
*/
|
||||
CustomElementPart *EllipseEditor::currentPart() const {
|
||||
CustomElementPart *EllipseEditor::currentPart() const
|
||||
{
|
||||
return(part);
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> EllipseEditor::currentParts() const {
|
||||
QList<CustomElementPart*> EllipseEditor::currentParts() const
|
||||
{
|
||||
return style_->currentParts();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ ESEventAddArc::ESEventAddArc(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddArc::~ESEventAddArc
|
||||
*/
|
||||
ESEventAddArc::~ESEventAddArc() {
|
||||
ESEventAddArc::~ESEventAddArc()
|
||||
{
|
||||
if (m_running || m_abort)
|
||||
delete m_arc;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ ESEventAddDynamicTextField::ESEventAddDynamicTextField(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddDynamicTextField::~ESEventAddDynamicTextField
|
||||
*/
|
||||
ESEventAddDynamicTextField::~ESEventAddDynamicTextField() {
|
||||
ESEventAddDynamicTextField::~ESEventAddDynamicTextField()
|
||||
{
|
||||
delete m_text;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ ESEventAddEllipse::ESEventAddEllipse(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddEllipse::~ESEventAddEllipse
|
||||
*/
|
||||
ESEventAddEllipse::~ESEventAddEllipse() {
|
||||
ESEventAddEllipse::~ESEventAddEllipse()
|
||||
{
|
||||
if (m_running || m_abort){
|
||||
delete m_ellipse;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ ESEventAddLine::ESEventAddLine(ElementScene *scene) :
|
||||
@brief ESEventAddLine::~ESEventAddLine
|
||||
destructor
|
||||
*/
|
||||
ESEventAddLine::~ESEventAddLine() {
|
||||
ESEventAddLine::~ESEventAddLine()
|
||||
{
|
||||
if (m_running || m_abort)
|
||||
delete m_line;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ ESEventAddPolygon::ESEventAddPolygon(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddPolygon::~ESEventAddPolygon
|
||||
*/
|
||||
ESEventAddPolygon::~ESEventAddPolygon() {
|
||||
ESEventAddPolygon::~ESEventAddPolygon()
|
||||
{
|
||||
if (m_running || m_abort)
|
||||
delete m_polygon;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ ESEventAddRect::ESEventAddRect(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddRect::~ESEventAddRect
|
||||
*/
|
||||
ESEventAddRect::~ESEventAddRect() {
|
||||
ESEventAddRect::~ESEventAddRect()
|
||||
{
|
||||
if (m_running || m_abort)
|
||||
delete m_rect;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ ESEventAddTerminal::ESEventAddTerminal(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddTerminal::~ESEventAddTerminal
|
||||
*/
|
||||
ESEventAddTerminal::~ESEventAddTerminal() {
|
||||
ESEventAddTerminal::~ESEventAddTerminal()
|
||||
{
|
||||
delete m_terminal;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ ESEventAddText::ESEventAddText(ElementScene *scene) :
|
||||
/**
|
||||
@brief ESEventAddText::~ESEventAddText
|
||||
*/
|
||||
ESEventAddText::~ESEventAddText() {
|
||||
ESEventAddText::~ESEventAddText()
|
||||
{
|
||||
delete m_text;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,11 +99,13 @@ bool ESEventInterface::KeyReleaseEvent(QKeyEvent *event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ESEventInterface::isRunning() const {
|
||||
bool ESEventInterface::isRunning() const
|
||||
{
|
||||
return m_running;
|
||||
}
|
||||
|
||||
bool ESEventInterface::isFinish() const {
|
||||
bool ESEventInterface::isFinish() const
|
||||
{
|
||||
return !m_running;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,8 @@ QRectF AbstractPartEllipse::boundingRect() const
|
||||
and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF AbstractPartEllipse::sceneGeometricRect() const {
|
||||
QRectF AbstractPartEllipse::sceneGeometricRect() const
|
||||
{
|
||||
return(mapToScene(rect()).boundingRect());
|
||||
}
|
||||
|
||||
@@ -95,7 +96,8 @@ QRectF AbstractPartEllipse::sceneGeometricRect() const {
|
||||
@brief AbstractPartEllipse::sceneTopLeft
|
||||
@return return the top left of rectangle, in scene coordinate
|
||||
*/
|
||||
QPointF AbstractPartEllipse::sceneTopLeft() const {
|
||||
QPointF AbstractPartEllipse::sceneTopLeft() const
|
||||
{
|
||||
return(mapToScene(rect().topLeft()));
|
||||
}
|
||||
|
||||
@@ -103,7 +105,8 @@ QPointF AbstractPartEllipse::sceneTopLeft() const {
|
||||
@brief AbstractPartEllipse::rect
|
||||
Returns the item's ellipse geometry as a QRectF.
|
||||
*/
|
||||
QRectF AbstractPartEllipse::rect() const {
|
||||
QRectF AbstractPartEllipse::rect() const
|
||||
{
|
||||
return m_rect;
|
||||
}
|
||||
|
||||
@@ -131,7 +134,8 @@ void AbstractPartEllipse::setRect(const QRectF &rect)
|
||||
and does not deserve to be Retained / registered.
|
||||
An ellipse is relevant when is rect is not null.
|
||||
*/
|
||||
bool AbstractPartEllipse::isUseless() const {
|
||||
bool AbstractPartEllipse::isUseless() const
|
||||
{
|
||||
return(rect().isNull());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#include "qetelementeditor.h"
|
||||
|
||||
/// @return le QETElementEditor auquel cet editeur appartient
|
||||
QETElementEditor *CustomElementPart::elementEditor() const {
|
||||
QETElementEditor *CustomElementPart::elementEditor() const
|
||||
{
|
||||
return(element_editor);
|
||||
}
|
||||
|
||||
@@ -27,24 +28,28 @@ QETElementEditor *CustomElementPart::elementEditor() const {
|
||||
Appelle le slot updateCurrentPartEditor de l'editeur
|
||||
@see QETElementEditor::updateCurrentPartEditor()
|
||||
*/
|
||||
void CustomElementPart::updateCurrentPartEditor() const {
|
||||
void CustomElementPart::updateCurrentPartEditor() const
|
||||
{
|
||||
if (element_editor) {
|
||||
element_editor -> updateCurrentPartEditor();
|
||||
}
|
||||
}
|
||||
|
||||
/// @return l'ElementScene contenant les parties editees par cet editeur
|
||||
ElementScene *CustomElementPart::elementScene() const {
|
||||
ElementScene *CustomElementPart::elementScene() const
|
||||
{
|
||||
return(element_editor -> elementScene());
|
||||
}
|
||||
|
||||
/// @return la QUndoStack a utiliser pour les annulations
|
||||
QUndoStack &CustomElementPart::undoStack() const {
|
||||
QUndoStack &CustomElementPart::undoStack() const
|
||||
{
|
||||
return(elementScene() -> undoStack());
|
||||
}
|
||||
|
||||
/// @return this primitive as a QGraphicsItem
|
||||
QGraphicsItem *CustomElementPart::toItem() {
|
||||
QGraphicsItem *CustomElementPart::toItem()
|
||||
{
|
||||
return(dynamic_cast<QGraphicsItem *>(this));
|
||||
}
|
||||
|
||||
@@ -55,7 +60,8 @@ QGraphicsItem *CustomElementPart::toItem() {
|
||||
The default implementation systematically returns
|
||||
QET::SnapScalingPointToGrid
|
||||
*/
|
||||
QET::ScalingMethod CustomElementPart::preferredScalingMethod() const {
|
||||
QET::ScalingMethod CustomElementPart::preferredScalingMethod() const
|
||||
{
|
||||
return(QET::SnapScalingPointToGrid);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
|
||||
@param xml_document : Xml document to use for create the xml element.
|
||||
@return : an xml element that describe this arc
|
||||
*/
|
||||
const QDomElement PartArc::toXml(QDomDocument &xml_document) const {
|
||||
const QDomElement PartArc::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
QDomElement xml_element = xml_document.createElement("arc");
|
||||
QPointF top_left(sceneTopLeft());
|
||||
xml_element.setAttribute("x", QString("%1").arg(top_left.x()));
|
||||
|
||||
@@ -49,11 +49,13 @@ PartDynamicTextField::PartDynamicTextField(QETElementEditor *editor, QGraphicsIt
|
||||
document() -> setDefaultTextOption(option);
|
||||
}
|
||||
|
||||
QString PartDynamicTextField::name() const {
|
||||
QString PartDynamicTextField::name() const
|
||||
{
|
||||
return tr("Champ de texte dynamique", "element part name");
|
||||
}
|
||||
|
||||
QString PartDynamicTextField::xmlName() const {
|
||||
QString PartDynamicTextField::xmlName() const
|
||||
{
|
||||
return QString("dynamic_text");
|
||||
}
|
||||
|
||||
@@ -90,7 +92,8 @@ void PartDynamicTextField::handleUserTransformation(
|
||||
@param dom_doc
|
||||
@return
|
||||
*/
|
||||
const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const {
|
||||
const QDomElement PartDynamicTextField::toXml(QDomDocument &dom_doc) const
|
||||
{
|
||||
QDomElement root_element = dom_doc.createElement(xmlName());
|
||||
|
||||
root_element.setAttribute("x", QString::number(pos().x()));
|
||||
@@ -260,7 +263,8 @@ void PartDynamicTextField::fromTextFieldXml(const QDomElement &dom_element)
|
||||
@brief PartDynamicTextField::textFrom
|
||||
@return what the final text is created from.
|
||||
*/
|
||||
DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const {
|
||||
DynamicElementTextItem::TextFrom PartDynamicTextField::textFrom() const
|
||||
{
|
||||
return m_text_from;
|
||||
}
|
||||
|
||||
@@ -291,7 +295,8 @@ void PartDynamicTextField::setTextFrom(DynamicElementTextItem::TextFrom text_fro
|
||||
@brief PartDynamicTextField::text
|
||||
@return the text of this text
|
||||
*/
|
||||
QString PartDynamicTextField::text() const {
|
||||
QString PartDynamicTextField::text() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
@@ -337,7 +342,8 @@ void PartDynamicTextField::setCompositeText(const QString &text) {
|
||||
@brief PartDynamicTextField::compositeText
|
||||
@return the composite text of this text
|
||||
*/
|
||||
QString PartDynamicTextField::compositeText() const {
|
||||
QString PartDynamicTextField::compositeText() const
|
||||
{
|
||||
return m_composite_text;
|
||||
}
|
||||
|
||||
@@ -354,7 +360,8 @@ void PartDynamicTextField::setColor(const QColor& color) {
|
||||
@brief PartDynamicTextField::color
|
||||
@return The color of this text
|
||||
*/
|
||||
QColor PartDynamicTextField::color() const {
|
||||
QColor PartDynamicTextField::color() const
|
||||
{
|
||||
return defaultTextColor();
|
||||
}
|
||||
|
||||
@@ -364,7 +371,8 @@ void PartDynamicTextField::setFrame(bool frame) {
|
||||
emit frameChanged(m_frame);
|
||||
}
|
||||
|
||||
bool PartDynamicTextField::frame() const {
|
||||
bool PartDynamicTextField::frame() const
|
||||
{
|
||||
return m_frame;
|
||||
}
|
||||
|
||||
@@ -403,7 +411,8 @@ void PartDynamicTextField::setAlignment(Qt::Alignment alignment) {
|
||||
emit alignmentChanged(m_alignment);
|
||||
}
|
||||
|
||||
Qt::Alignment PartDynamicTextField::alignment() const {
|
||||
Qt::Alignment PartDynamicTextField::alignment() const
|
||||
{
|
||||
return m_alignment;
|
||||
}
|
||||
|
||||
@@ -532,7 +541,8 @@ void PartDynamicTextField::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
||||
Used to up to date this text field,
|
||||
when the element information (see elementScene) changed
|
||||
*/
|
||||
void PartDynamicTextField::elementInfoChanged() {
|
||||
void PartDynamicTextField::elementInfoChanged()
|
||||
{
|
||||
if(!elementScene())
|
||||
return;
|
||||
|
||||
@@ -543,11 +553,13 @@ void PartDynamicTextField::elementInfoChanged() {
|
||||
m_composite_text, elementScene() -> elementInformation()));
|
||||
}
|
||||
|
||||
void PartDynamicTextField::prepareAlignment() {
|
||||
void PartDynamicTextField::prepareAlignment()
|
||||
{
|
||||
m_alignment_rect = boundingRect();
|
||||
}
|
||||
|
||||
void PartDynamicTextField::finishAlignment() {
|
||||
void PartDynamicTextField::finishAlignment()
|
||||
{
|
||||
if(m_block_alignment)
|
||||
return;
|
||||
|
||||
|
||||
@@ -346,7 +346,8 @@ void PartLine::removeHandler()
|
||||
@brief PartLine::sceneP1
|
||||
@return the point p1 in scene coordinate
|
||||
*/
|
||||
QPointF PartLine::sceneP1() const {
|
||||
QPointF PartLine::sceneP1() const
|
||||
{
|
||||
return(mapToScene(m_line.p1()));
|
||||
}
|
||||
|
||||
@@ -354,7 +355,8 @@ QPointF PartLine::sceneP1() const {
|
||||
@brief PartLine::sceneP2
|
||||
@return the point p2 in scen coordinate
|
||||
*/
|
||||
QPointF PartLine::sceneP2() const {
|
||||
QPointF PartLine::sceneP2() const
|
||||
{
|
||||
return(mapToScene(m_line.p2()));
|
||||
}
|
||||
|
||||
@@ -473,7 +475,8 @@ QRectF PartLine::firstEndCircleRect() const
|
||||
@brief PartLine::secondEndCircleRect
|
||||
@return the rectangle bordering the entirety of the second extremity
|
||||
*/
|
||||
QRectF PartLine::secondEndCircleRect() const {
|
||||
QRectF PartLine::secondEndCircleRect() const
|
||||
{
|
||||
QList<QPointF> interesting_points = fourEndPoints(m_line.p2(),
|
||||
m_line.p1(),
|
||||
second_length);
|
||||
@@ -543,7 +546,8 @@ QRectF PartLine::boundingRect() const
|
||||
@return true if this part is irrelevant and does not deserve to be Retained / registered.
|
||||
A line is relevant when is two point is different
|
||||
*/
|
||||
bool PartLine::isUseless() const {
|
||||
bool PartLine::isUseless() const
|
||||
{
|
||||
return(m_line.p1() == m_line.p2());
|
||||
}
|
||||
|
||||
@@ -554,7 +558,8 @@ bool PartLine::isUseless() const {
|
||||
to imply any margin, and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF PartLine::sceneGeometricRect() const {
|
||||
QRectF PartLine::sceneGeometricRect() const
|
||||
{
|
||||
return(QRectF(sceneP1(), sceneP2()));
|
||||
}
|
||||
|
||||
@@ -617,7 +622,8 @@ QList<QPointF> PartLine::fourEndPoints(const QPointF &end_point, const QPointF &
|
||||
return(QList<QPointF>() << o << a << b << c);
|
||||
}
|
||||
|
||||
QLineF PartLine::line() const {
|
||||
QLineF PartLine::line() const
|
||||
{
|
||||
return m_line;
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,8 @@ bool PartPolygon::isUseless() const
|
||||
to imply any margin, and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF PartPolygon::sceneGeometricRect() const {
|
||||
QRectF PartPolygon::sceneGeometricRect() const
|
||||
{
|
||||
return(mapToScene(m_polygon.boundingRect()).boundingRect());
|
||||
}
|
||||
|
||||
@@ -185,7 +186,8 @@ void PartPolygon::handleUserTransformation(const QRectF &initial_selection_rect,
|
||||
single primitive is being scaled.
|
||||
@return : This reimplementation systematically returns QET::RoundScaleRatios.
|
||||
*/
|
||||
QET::ScalingMethod PartPolygon::preferredScalingMethod() const {
|
||||
QET::ScalingMethod PartPolygon::preferredScalingMethod() const
|
||||
{
|
||||
return(QET::RoundScaleRatios);
|
||||
}
|
||||
|
||||
@@ -193,7 +195,8 @@ QET::ScalingMethod PartPolygon::preferredScalingMethod() const {
|
||||
@brief PartPolygon::polygon
|
||||
@return the item's polygon, or an empty polygon if no polygon has been set.
|
||||
*/
|
||||
QPolygonF PartPolygon::polygon() const {
|
||||
QPolygonF PartPolygon::polygon() const
|
||||
{
|
||||
return m_polygon;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ PartRectangle::PartRectangle(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
/**
|
||||
@brief PartRectangle::~PartRectangle
|
||||
*/
|
||||
PartRectangle::~PartRectangle() {
|
||||
PartRectangle::~PartRectangle()
|
||||
{
|
||||
removeHandler();
|
||||
}
|
||||
|
||||
@@ -126,7 +127,8 @@ void PartRectangle::fromXml(const QDomElement &qde)
|
||||
@brief PartRectangle::rect
|
||||
@return : Returns the item's rectangle.
|
||||
*/
|
||||
QRectF PartRectangle::rect() const {
|
||||
QRectF PartRectangle::rect() const
|
||||
{
|
||||
return m_rect;
|
||||
}
|
||||
|
||||
@@ -167,7 +169,8 @@ void PartRectangle::setYRadius(qreal Y)
|
||||
to imply any margin, and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF PartRectangle::sceneGeometricRect() const {
|
||||
QRectF PartRectangle::sceneGeometricRect() const
|
||||
{
|
||||
return(mapToScene(rect()).boundingRect());
|
||||
}
|
||||
|
||||
@@ -175,7 +178,8 @@ QRectF PartRectangle::sceneGeometricRect() const {
|
||||
@brief PartRectangle::sceneTopLeft
|
||||
@return the top left of rectangle, in scene coordinate
|
||||
*/
|
||||
QPointF PartRectangle::sceneTopLeft() const {
|
||||
QPointF PartRectangle::sceneTopLeft() const
|
||||
{
|
||||
return(mapToScene(rect().topLeft()));
|
||||
}
|
||||
|
||||
@@ -228,7 +232,8 @@ QRectF PartRectangle::boundingRect() const
|
||||
@return true if this part is irrelevant and does not deserve to be Retained / registered.
|
||||
An rectangle is relevant when he's not null.
|
||||
*/
|
||||
bool PartRectangle::isUseless() const {
|
||||
bool PartRectangle::isUseless() const
|
||||
{
|
||||
return(rect().isNull());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ PartTerminal::PartTerminal(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
PartTerminal::~PartTerminal() {
|
||||
PartTerminal::~PartTerminal()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,8 @@ void PartTerminal::fromXml(const QDomElement &xml_elmt) {
|
||||
@param xml_document Document XML a utiliser pour creer l'element XML
|
||||
@return un element XML decrivant la borne
|
||||
*/
|
||||
const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const {
|
||||
const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
return d -> toXml(xml_document);
|
||||
}
|
||||
|
||||
@@ -97,7 +99,8 @@ void PartTerminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, Q
|
||||
@brief PartTerminal::shape
|
||||
@return the shape of this item
|
||||
*/
|
||||
QPainterPath PartTerminal::shape() const {
|
||||
QPainterPath PartTerminal::shape() const
|
||||
{
|
||||
QPainterPath shape;
|
||||
shape.lineTo(d -> second_point);
|
||||
|
||||
@@ -111,7 +114,8 @@ QPainterPath PartTerminal::shape() const {
|
||||
@brief PartTerminal::boundingRect
|
||||
@return the bounding rect of this item
|
||||
*/
|
||||
QRectF PartTerminal::boundingRect() const {
|
||||
QRectF PartTerminal::boundingRect() const
|
||||
{
|
||||
QRectF br(QPointF(0, 0), d -> second_point);
|
||||
br = br.normalized();
|
||||
|
||||
@@ -141,7 +145,8 @@ void PartTerminal::setName(QString& name) {
|
||||
emit nameChanged();
|
||||
}
|
||||
|
||||
void PartTerminal::setNewUuid() {
|
||||
void PartTerminal::setNewUuid()
|
||||
{
|
||||
d -> m_uuid = QUuid::createUuid();
|
||||
}
|
||||
|
||||
@@ -149,7 +154,8 @@ void PartTerminal::setNewUuid() {
|
||||
Met a jour la position du second point en fonction de la position et de
|
||||
l'orientation de la borne.
|
||||
*/
|
||||
void PartTerminal::updateSecondPoint() {
|
||||
void PartTerminal::updateSecondPoint()
|
||||
{
|
||||
qreal ts = 4.0; // terminal size
|
||||
switch(d -> m_orientation) {
|
||||
case Qet::North: d -> second_point = QPointF(0.0, ts); break;
|
||||
@@ -165,7 +171,8 @@ void PartTerminal::updateSecondPoint() {
|
||||
Une borne est toujours pertinente ; cette fonction renvoie donc
|
||||
toujours false
|
||||
*/
|
||||
bool PartTerminal::isUseless() const {
|
||||
bool PartTerminal::isUseless() const
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -175,7 +182,8 @@ bool PartTerminal::isUseless() const {
|
||||
to imply any margin, and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF PartTerminal::sceneGeometricRect() const {
|
||||
QRectF PartTerminal::sceneGeometricRect() const
|
||||
{
|
||||
return(sceneBoundingRect());
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
PartText::~PartText() {
|
||||
PartText::~PartText()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +96,8 @@ void PartText::fromXml(const QDomElement &xml_element) {
|
||||
@param xml_document Document XML a utiliser pour creer l'element XML
|
||||
@return un element XML decrivant le texte statique
|
||||
*/
|
||||
const QDomElement PartText::toXml(QDomDocument &xml_document) const {
|
||||
const QDomElement PartText::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
QDomElement xml_element = xml_document.createElement(xmlName());
|
||||
|
||||
xml_element.setAttribute("x", QString::number(pos().x()));
|
||||
@@ -111,7 +113,8 @@ const QDomElement PartText::toXml(QDomDocument &xml_document) const {
|
||||
/**
|
||||
@return Les coordonnees du point situe en bas a gauche du texte.
|
||||
*/
|
||||
QPointF PartText::margin() const {
|
||||
QPointF PartText::margin() const
|
||||
{
|
||||
QFont used_font = font();
|
||||
QFontMetrics qfm(used_font);
|
||||
qreal document_margin = document() -> documentMargin();
|
||||
@@ -191,7 +194,8 @@ QVariant PartText::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
/**
|
||||
@return le rectangle delimitant cette partie.
|
||||
*/
|
||||
QRectF PartText::boundingRect() const {
|
||||
QRectF PartText::boundingRect() const
|
||||
{
|
||||
QRectF r = QGraphicsTextItem::boundingRect();
|
||||
r.adjust(0.0, -1.1, 0.0, 0.0);
|
||||
return(r);
|
||||
@@ -202,7 +206,8 @@ QRectF PartText::boundingRect() const {
|
||||
conservee / enregistree.
|
||||
Un texte statique n'est pas pertinent lorsque son texte est vide.
|
||||
*/
|
||||
bool PartText::isUseless() const {
|
||||
bool PartText::isUseless() const
|
||||
{
|
||||
return(toPlainText().isEmpty());
|
||||
}
|
||||
|
||||
@@ -212,7 +217,8 @@ bool PartText::isUseless() const {
|
||||
to imply any margin, and it is different from shape because it is a regular
|
||||
rectangle, not a complex shape.
|
||||
*/
|
||||
QRectF PartText::sceneGeometricRect() const {
|
||||
QRectF PartText::sceneGeometricRect() const
|
||||
{
|
||||
return(sceneBoundingRect());
|
||||
}
|
||||
|
||||
@@ -327,7 +333,8 @@ void PartText::setEditable(bool editable) {
|
||||
/**
|
||||
Start text edition by storing the former value of the text.
|
||||
*/
|
||||
void PartText::startEdition() {
|
||||
void PartText::startEdition()
|
||||
{
|
||||
// !previous_text.isNull() means the text is being edited
|
||||
previous_text = toPlainText();
|
||||
}
|
||||
@@ -336,7 +343,8 @@ void PartText::startEdition() {
|
||||
End text edition, potentially generating a ChangePartCommand if the text
|
||||
has changed.
|
||||
*/
|
||||
void PartText::endEdition() {
|
||||
void PartText::endEdition()
|
||||
{
|
||||
if (!previous_text.isNull()) {
|
||||
// the text was being edited
|
||||
QString new_text = toPlainText();
|
||||
|
||||
@@ -89,7 +89,8 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
LineEditor::~LineEditor() {
|
||||
LineEditor::~LineEditor()
|
||||
{
|
||||
}
|
||||
|
||||
void LineEditor::setUpChangeConnections()
|
||||
@@ -155,11 +156,13 @@ bool LineEditor::setParts(QList <CustomElementPart *> parts)
|
||||
/**
|
||||
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
|
||||
*/
|
||||
CustomElementPart *LineEditor::currentPart() const {
|
||||
CustomElementPart *LineEditor::currentPart() const
|
||||
{
|
||||
return(part);
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> LineEditor::currentParts() const {
|
||||
QList<CustomElementPart*> LineEditor::currentParts() const
|
||||
{
|
||||
return style_->currentParts();
|
||||
}
|
||||
|
||||
@@ -167,7 +170,8 @@ QList<CustomElementPart*> LineEditor::currentParts() const {
|
||||
@brief LineEditor::editedP1
|
||||
@return The edited P1 in item coordinate
|
||||
*/
|
||||
QPointF LineEditor::editedP1() const {
|
||||
QPointF LineEditor::editedP1() const
|
||||
{
|
||||
return part -> mapFromScene(x1->value(), y1->value());
|
||||
}
|
||||
|
||||
@@ -175,7 +179,8 @@ QPointF LineEditor::editedP1() const {
|
||||
@brief LineEditor::editedP2
|
||||
@return The edited P2 in item coordinate
|
||||
*/
|
||||
QPointF LineEditor::editedP2() const {
|
||||
QPointF LineEditor::editedP2() const
|
||||
{
|
||||
return part -> mapFromScene(x2->value(), y2->value());
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,8 @@ QETElementEditor::QETElementEditor(QWidget *parent) :
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
QETElementEditor::~QETElementEditor() {
|
||||
QETElementEditor::~QETElementEditor()
|
||||
{
|
||||
/*
|
||||
retire le widget d'edition de primitives affiche par le dock
|
||||
cela evite qu'il ne soit supprime par son widget parent
|
||||
@@ -135,7 +136,8 @@ void QETElementEditor::setFileName(const QString &fn) {
|
||||
@brief QETElementEditor::setupActions
|
||||
Create action used in Element editor
|
||||
*/
|
||||
void QETElementEditor::setupActions() {
|
||||
void QETElementEditor::setupActions()
|
||||
{
|
||||
new_element = new QAction(QET::Icons::DocumentNew, tr("&Nouveau"), this);
|
||||
open = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir"), this);
|
||||
open_file = new QAction(QET::Icons::FolderOpen, tr("&Ouvrir depuis un fichier"), this);
|
||||
@@ -361,7 +363,8 @@ void QETElementEditor::setupActions() {
|
||||
/**
|
||||
@brief QETElementEditor::setupMenus
|
||||
*/
|
||||
void QETElementEditor::setupMenus() {
|
||||
void QETElementEditor::setupMenus()
|
||||
{
|
||||
file_menu = new QMenu(tr("&Fichier"), this);
|
||||
edit_menu = new QMenu(tr("&Édition"), this);
|
||||
display_menu = new QMenu(tr("Afficha&ge"), this);
|
||||
@@ -461,7 +464,8 @@ void QETElementEditor::contextMenu(QPoint p, QList<QAction *> actions) {
|
||||
/**
|
||||
Met a jour les menus
|
||||
*/
|
||||
void QETElementEditor::slot_updateMenus() {
|
||||
void QETElementEditor::slot_updateMenus()
|
||||
{
|
||||
bool selected_items = !read_only && !m_elmt_scene -> selectedItems().isEmpty();
|
||||
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
|
||||
|
||||
@@ -497,7 +501,8 @@ void QETElementEditor::slot_updateMenus() {
|
||||
/**
|
||||
Met a jour le titre de la fenetre
|
||||
*/
|
||||
void QETElementEditor::slot_updateTitle() {
|
||||
void QETElementEditor::slot_updateTitle()
|
||||
{
|
||||
QString title = min_title;
|
||||
title += " - " + m_elmt_scene -> names().name() + " ";
|
||||
if (!filename_.isEmpty() || !location_.isNull()) {
|
||||
@@ -514,7 +519,8 @@ void QETElementEditor::slot_updateTitle() {
|
||||
/**
|
||||
@brief QETElementEditor::setupInterface
|
||||
*/
|
||||
void QETElementEditor::setupInterface() {
|
||||
void QETElementEditor::setupInterface()
|
||||
{
|
||||
// editeur
|
||||
m_elmt_scene = new ElementScene(this, this);
|
||||
m_view = new ElementView(m_elmt_scene, this);
|
||||
@@ -592,14 +598,16 @@ void QETElementEditor::setupInterface() {
|
||||
Passe l'editeur d'element en mode selection : le pointeur deplace les
|
||||
elements selectionnes et il est possible d'utiliser un rectangle de selection.
|
||||
*/
|
||||
void QETElementEditor::slot_setRubberBandToView() {
|
||||
void QETElementEditor::slot_setRubberBandToView()
|
||||
{
|
||||
m_view -> setDragMode(QGraphicsView::RubberBandDrag);
|
||||
}
|
||||
|
||||
/**
|
||||
Passe l'editeur d'element en mode immobile (utilise pour la lecture seule)
|
||||
*/
|
||||
void QETElementEditor::slot_setNoDragToView() {
|
||||
void QETElementEditor::slot_setNoDragToView()
|
||||
{
|
||||
m_view -> setDragMode(QGraphicsView::NoDrag);
|
||||
}
|
||||
|
||||
@@ -608,7 +616,8 @@ void QETElementEditor::slot_setNoDragToView() {
|
||||
Si plusieurs primitives sont selectionnees, seule leur quantite est
|
||||
affichee. Sinon, un widget d'edition approprie est mis en place.
|
||||
*/
|
||||
void QETElementEditor::slot_updateInformations() {
|
||||
void QETElementEditor::slot_updateInformations()
|
||||
{
|
||||
QList<QGraphicsItem *> selected_qgis = m_elmt_scene -> selectedItems();
|
||||
if (selected_qgis.isEmpty()) {
|
||||
clearToolsDock();
|
||||
@@ -752,7 +761,8 @@ void QETElementEditor::slot_updateInformations() {
|
||||
Do several check about element.
|
||||
If error is occurred return false
|
||||
*/
|
||||
bool QETElementEditor::checkElement() {
|
||||
bool QETElementEditor::checkElement()
|
||||
{
|
||||
//List of warning and error
|
||||
typedef QPair<QString, QString> QETWarning;
|
||||
QList<QETWarning> warnings;
|
||||
@@ -998,7 +1008,8 @@ void QETElementEditor::setReadOnly(bool ro) {
|
||||
/**
|
||||
@return true si l'editeur d'element est en mode lecture seule
|
||||
*/
|
||||
bool QETElementEditor::isReadOnly() const {
|
||||
bool QETElementEditor::isReadOnly() const
|
||||
{
|
||||
return(read_only);
|
||||
}
|
||||
|
||||
@@ -1006,7 +1017,8 @@ bool QETElementEditor::isReadOnly() const {
|
||||
@brief QETElementEditor::addLine
|
||||
Set line creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addLine() {
|
||||
void QETElementEditor::addLine()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddLine(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1014,7 +1026,8 @@ void QETElementEditor::addLine() {
|
||||
@brief QETElementEditor::addRect
|
||||
Set rectangle creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addRect() {
|
||||
void QETElementEditor::addRect()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddRect(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1022,7 +1035,8 @@ void QETElementEditor::addRect() {
|
||||
@brief QETElementEditor::addEllipse
|
||||
Set ellipse creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addEllipse() {
|
||||
void QETElementEditor::addEllipse()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddEllipse(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1030,7 +1044,8 @@ void QETElementEditor::addEllipse() {
|
||||
@brief QETElementEditor::addPolygon
|
||||
Set polygon creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addPolygon() {
|
||||
void QETElementEditor::addPolygon()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddPolygon(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1038,7 +1053,8 @@ void QETElementEditor::addPolygon() {
|
||||
@brief QETElementEditor::addArc
|
||||
Set arc creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addArc() {
|
||||
void QETElementEditor::addArc()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddArc(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1046,7 +1062,8 @@ void QETElementEditor::addArc() {
|
||||
@brief QETElementEditor::addText
|
||||
Set text creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addText() {
|
||||
void QETElementEditor::addText()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddText(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1054,7 +1071,8 @@ void QETElementEditor::addText() {
|
||||
@brief QETElementEditor::addTerminal
|
||||
Set terminal creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addTerminal() {
|
||||
void QETElementEditor::addTerminal()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddTerminal(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1062,7 +1080,8 @@ void QETElementEditor::addTerminal() {
|
||||
@brief QETElementEditor::addDynamicTextField
|
||||
Set dynamic text field creation interface to scene
|
||||
*/
|
||||
void QETElementEditor::addDynamicTextField() {
|
||||
void QETElementEditor::addDynamicTextField()
|
||||
{
|
||||
m_elmt_scene -> setEventInterface(new ESEventAddDynamicTextField(m_elmt_scene));
|
||||
}
|
||||
|
||||
@@ -1070,7 +1089,8 @@ void QETElementEditor::addDynamicTextField() {
|
||||
@brief QETElementEditor::UncheckAddPrimitive
|
||||
Uncheck all action related to primitive
|
||||
*/
|
||||
void QETElementEditor::UncheckAddPrimitive() {
|
||||
void QETElementEditor::UncheckAddPrimitive()
|
||||
{
|
||||
foreach(QAction *action, parts -> actions()) {
|
||||
action -> setChecked(false);
|
||||
}
|
||||
@@ -1079,7 +1099,8 @@ void QETElementEditor::UncheckAddPrimitive() {
|
||||
/**
|
||||
Lance l'assistant de creation d'un nouvel element.
|
||||
*/
|
||||
void QETElementEditor::slot_new() {
|
||||
void QETElementEditor::slot_new()
|
||||
{
|
||||
NewElementWizard new_element_wizard(this);
|
||||
new_element_wizard.exec();
|
||||
}
|
||||
@@ -1087,7 +1108,8 @@ void QETElementEditor::slot_new() {
|
||||
/**
|
||||
Ouvre un element
|
||||
*/
|
||||
void QETElementEditor::slot_open() {
|
||||
void QETElementEditor::slot_open()
|
||||
{
|
||||
// demande le chemin virtuel de l'element a ouvrir a l'utilisateur
|
||||
ElementsLocation location = ElementDialog::getOpenElementLocation(this);
|
||||
if (location.isNull()) {
|
||||
@@ -1100,7 +1122,8 @@ void QETElementEditor::slot_open() {
|
||||
Ouvre un fichier
|
||||
Demande un fichier a l'utilisateur et ouvre ce fichier
|
||||
*/
|
||||
void QETElementEditor::slot_openFile() {
|
||||
void QETElementEditor::slot_openFile()
|
||||
{
|
||||
// repertoire a afficher initialement dans le dialogue
|
||||
QString open_dir = filename_.isEmpty() ? QETApp::customElementsDir() : QDir(filename_).absolutePath();
|
||||
|
||||
@@ -1129,7 +1152,8 @@ void QETElementEditor::openRecentFile(const QString &filepath) {
|
||||
/**
|
||||
@brief QETElementEditor::slot_openDxf
|
||||
*/
|
||||
void QETElementEditor::slot_openDxf (){
|
||||
void QETElementEditor::slot_openDxf ()
|
||||
{
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
|
||||
QString program = (QDir::homePath() + "/Application Data/qet/DXFtoQET.exe");
|
||||
@@ -1174,7 +1198,8 @@ void QETElementEditor::openElement(const QString &filepath) {
|
||||
@brief QETElementEditor::slot_reload
|
||||
Reload the element from the file or location
|
||||
*/
|
||||
void QETElementEditor::slot_reload() {
|
||||
void QETElementEditor::slot_reload()
|
||||
{
|
||||
//If user already edit the element, ask confirmation to reload
|
||||
if (!m_elmt_scene -> undoStack().isClean()) {
|
||||
QMessageBox::StandardButton answer = QET::QetMessageBox::question(this,
|
||||
@@ -1203,7 +1228,8 @@ void QETElementEditor::slot_reload() {
|
||||
If the filepath or location is unknown, use save_as instead
|
||||
@return true if save with success
|
||||
*/
|
||||
bool QETElementEditor::slot_save() {
|
||||
bool QETElementEditor::slot_save()
|
||||
{
|
||||
// Check element befor writing
|
||||
if (checkElement()) {
|
||||
//If we don't know the name of the current file, use save as instead
|
||||
@@ -1242,7 +1268,8 @@ bool QETElementEditor::slot_save() {
|
||||
to this location
|
||||
@return true if save with success
|
||||
*/
|
||||
bool QETElementEditor::slot_saveAs() {
|
||||
bool QETElementEditor::slot_saveAs()
|
||||
{
|
||||
// Check element befor writing
|
||||
if (checkElement()) {
|
||||
//Ask a location to user
|
||||
@@ -1269,7 +1296,8 @@ bool QETElementEditor::slot_saveAs() {
|
||||
Ask a file to user and save the current edited element to this file
|
||||
@return true if save with success
|
||||
*/
|
||||
bool QETElementEditor::slot_saveAsFile() {
|
||||
bool QETElementEditor::slot_saveAsFile()
|
||||
{
|
||||
// Check element befor writing
|
||||
if (checkElement()) {
|
||||
//Ask a filename to user, for save the element
|
||||
@@ -1312,7 +1340,8 @@ bool QETElementEditor::slot_saveAsFile() {
|
||||
Si l'element comporte des modifications, la question est posee a
|
||||
l'utilisateur.
|
||||
*/
|
||||
bool QETElementEditor::canClose() {
|
||||
bool QETElementEditor::canClose()
|
||||
{
|
||||
if (m_elmt_scene -> undoStack().isClean()) {
|
||||
return(true);
|
||||
}
|
||||
@@ -1351,7 +1380,8 @@ bool QETElementEditor::canClose() {
|
||||
parties.
|
||||
@return le widget enleve, ou 0 s'il n'y avait pas de widget a enlever
|
||||
*/
|
||||
QWidget *QETElementEditor::clearToolsDock() {
|
||||
QWidget *QETElementEditor::clearToolsDock()
|
||||
{
|
||||
if (QWidget *previous_widget = m_tools_dock_stack -> widget(1)) {
|
||||
m_tools_dock_stack -> removeWidget(previous_widget);
|
||||
previous_widget -> setParent(nullptr);
|
||||
@@ -1410,7 +1440,8 @@ void QETElementEditor::firstActivation(QEvent *event) {
|
||||
/**
|
||||
Remplit la liste des parties
|
||||
*/
|
||||
void QETElementEditor::slot_createPartsList() {
|
||||
void QETElementEditor::slot_createPartsList()
|
||||
{
|
||||
m_parts_list -> blockSignals(true);
|
||||
m_parts_list -> clear();
|
||||
QList<QGraphicsItem *> qgis = m_elmt_scene -> zItems();
|
||||
@@ -1441,7 +1472,8 @@ void QETElementEditor::slot_createPartsList() {
|
||||
/**
|
||||
Met a jour la selection dans la liste des parties
|
||||
*/
|
||||
void QETElementEditor::slot_updatePartsList() {
|
||||
void QETElementEditor::slot_updatePartsList()
|
||||
{
|
||||
int items_count = m_elmt_scene -> items().count();
|
||||
if (m_parts_list -> count() != items_count) {
|
||||
slot_createPartsList();
|
||||
@@ -1464,7 +1496,8 @@ void QETElementEditor::slot_updatePartsList() {
|
||||
Met a jour la selection des parties de l'element a partir de la liste des
|
||||
parties
|
||||
*/
|
||||
void QETElementEditor::slot_updateSelectionFromPartsList() {
|
||||
void QETElementEditor::slot_updateSelectionFromPartsList()
|
||||
{
|
||||
m_elmt_scene -> blockSignals(true);
|
||||
m_parts_list -> blockSignals(true);
|
||||
for (int i = 0 ; i < m_parts_list -> count() ; ++ i) {
|
||||
@@ -1484,7 +1517,8 @@ void QETElementEditor::slot_updateSelectionFromPartsList() {
|
||||
@brief QETElementEditor::readSettings
|
||||
Read settings
|
||||
*/
|
||||
void QETElementEditor::readSettings() {
|
||||
void QETElementEditor::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
// dimensions et position de la fenetre
|
||||
@@ -1507,7 +1541,8 @@ void QETElementEditor::readSettings() {
|
||||
@brief QETElementEditor::writeSettings
|
||||
Write the settings
|
||||
*/
|
||||
void QETElementEditor::writeSettings() {
|
||||
void QETElementEditor::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("elementeditor/geometry", saveGeometry());
|
||||
settings.setValue("elementeditor/state", saveState());
|
||||
@@ -1517,7 +1552,8 @@ void QETElementEditor::writeSettings() {
|
||||
@return les decalages horizontaux et verticaux (sous la forme d'un point) a
|
||||
utiliser lors d'un copier/coller avec decalage.
|
||||
*/
|
||||
QPointF QETElementEditor::pasteOffset() {
|
||||
QPointF QETElementEditor::pasteOffset()
|
||||
{
|
||||
QPointF paste_offset(5.0, 0.0);
|
||||
return(paste_offset);
|
||||
}
|
||||
@@ -1594,7 +1630,8 @@ void QETElementEditor::fromLocation(const ElementsLocation &location) {
|
||||
Demande un fichier a l'utilisateur, l'ouvre en tant que fichier element,
|
||||
met son contenu dans le presse-papiers, et appelle ElementView::PasteInArea
|
||||
*/
|
||||
void QETElementEditor::pasteFromFile() {
|
||||
void QETElementEditor::pasteFromFile()
|
||||
{
|
||||
// demande le chemin du fichier a ouvrir a l'utilisateur
|
||||
QString element_file_path = getOpenElementFileName(this);
|
||||
if (element_file_path.isEmpty()) {
|
||||
@@ -1627,7 +1664,8 @@ void QETElementEditor::pasteFromFile() {
|
||||
Ask an element to user, copy the xml definition of the element
|
||||
to the clipboard and call ElementView::PasteInArea
|
||||
*/
|
||||
void QETElementEditor::pasteFromElement() {
|
||||
void QETElementEditor::pasteFromElement()
|
||||
{
|
||||
//Ask for a location
|
||||
ElementsLocation location = ElementDialog::getOpenElementLocation(this);
|
||||
if (location.isNull()) {
|
||||
@@ -1659,7 +1697,8 @@ void QETElementEditor::pasteFromElement() {
|
||||
Met a jour l'editeur de primitive actuellement visible.
|
||||
Si aucun editeur de primitive n'est visible, ce slot ne fait rien.
|
||||
*/
|
||||
void QETElementEditor::updateCurrentPartEditor() {
|
||||
void QETElementEditor::updateCurrentPartEditor()
|
||||
{
|
||||
// si aucun widget d'edition n'est affiche, on ne fait rien
|
||||
if (!m_tools_dock_stack -> currentIndex()) {
|
||||
return;
|
||||
|
||||
@@ -166,21 +166,24 @@ inline void QETElementEditor::setNames(const NamesList &nameslist) {
|
||||
/**
|
||||
@return the location of the currently edited element
|
||||
*/
|
||||
inline ElementsLocation QETElementEditor::location() const {
|
||||
inline ElementsLocation QETElementEditor::location() const
|
||||
{
|
||||
return(location_);
|
||||
}
|
||||
|
||||
/**
|
||||
@return the filename of the currently edited element
|
||||
*/
|
||||
inline QString QETElementEditor::fileName() const {
|
||||
inline QString QETElementEditor::fileName() const
|
||||
{
|
||||
return(filename_);
|
||||
}
|
||||
|
||||
/**
|
||||
@return the editing scene
|
||||
*/
|
||||
inline ElementScene *QETElementEditor::elementScene() const {
|
||||
inline ElementScene *QETElementEditor::elementScene() const
|
||||
{
|
||||
return(m_elmt_scene);
|
||||
}
|
||||
|
||||
|
||||
@@ -403,31 +403,37 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
StyleEditor::~StyleEditor() {
|
||||
StyleEditor::~StyleEditor()
|
||||
{
|
||||
}
|
||||
|
||||
/// Update antialiasing with undo command
|
||||
void StyleEditor::updatePartAntialiasing() {
|
||||
void StyleEditor::updatePartAntialiasing()
|
||||
{
|
||||
makeUndo(tr("style antialiasing"), "antialias", antialiasing -> isChecked());
|
||||
}
|
||||
|
||||
/// Update color with undo command
|
||||
void StyleEditor::updatePartColor() {
|
||||
void StyleEditor::updatePartColor()
|
||||
{
|
||||
makeUndo(tr("style couleur"),"color", outline_color->itemData(outline_color -> currentIndex()));
|
||||
}
|
||||
|
||||
/// Update style with undo command
|
||||
void StyleEditor::updatePartLineStyle() {
|
||||
void StyleEditor::updatePartLineStyle()
|
||||
{
|
||||
makeUndo(tr("style ligne"), "line_style", line_style->itemData(line_style -> currentIndex()));
|
||||
}
|
||||
|
||||
/// Update weight with undo command
|
||||
void StyleEditor::updatePartLineWeight() {
|
||||
void StyleEditor::updatePartLineWeight()
|
||||
{
|
||||
makeUndo(tr("style epaisseur"), "line_weight", size_weight->itemData(size_weight -> currentIndex()));
|
||||
}
|
||||
|
||||
/// Update color filling with undo command
|
||||
void StyleEditor::updatePartFilling() {
|
||||
void StyleEditor::updatePartFilling()
|
||||
{
|
||||
makeUndo(tr("style remplissage"), "filling", filling_color->itemData(filling_color -> currentIndex()));
|
||||
}
|
||||
|
||||
@@ -536,11 +542,13 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
||||
/**
|
||||
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
|
||||
*/
|
||||
CustomElementPart *StyleEditor::currentPart() const {
|
||||
CustomElementPart *StyleEditor::currentPart() const
|
||||
{
|
||||
return(part);
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> StyleEditor::currentParts() const {
|
||||
QList<CustomElementPart*> StyleEditor::currentParts() const
|
||||
{
|
||||
return m_cep_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,8 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor,
|
||||
/**
|
||||
@brief TerminalEditor::init
|
||||
*/
|
||||
void TerminalEditor::init() {
|
||||
void TerminalEditor::init()
|
||||
{
|
||||
qle_x = new QDoubleSpinBox();
|
||||
qle_y = new QDoubleSpinBox();
|
||||
|
||||
@@ -98,7 +99,8 @@ void TerminalEditor::init() {
|
||||
@brief TerminalEditor::~TerminalEditor
|
||||
Destructeur
|
||||
*/
|
||||
TerminalEditor::~TerminalEditor() {
|
||||
TerminalEditor::~TerminalEditor()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,11 +163,13 @@ bool TerminalEditor::setParts(QList<CustomElementPart *> parts) {
|
||||
/**
|
||||
@return la primitive actuellement editee, ou 0 si ce widget n'en edite pas
|
||||
*/
|
||||
CustomElementPart *TerminalEditor::currentPart() const {
|
||||
CustomElementPart *TerminalEditor::currentPart() const
|
||||
{
|
||||
return(m_part);
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> TerminalEditor::currentParts() const {
|
||||
QList<CustomElementPart*> TerminalEditor::currentParts() const
|
||||
{
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto term: m_terminals) {
|
||||
parts.append(static_cast<CustomElementPart*>(term));
|
||||
@@ -174,7 +178,8 @@ QList<CustomElementPart*> TerminalEditor::currentParts() const {
|
||||
}
|
||||
|
||||
/// Met a jour l'orientation de la borne et cree un objet d'annulation
|
||||
void TerminalEditor::updateTerminalO() {
|
||||
void TerminalEditor::updateTerminalO()
|
||||
{
|
||||
if (m_locked) return;
|
||||
m_locked = true;
|
||||
QVariant var(orientation -> itemData(orientation -> currentIndex()));
|
||||
@@ -194,7 +199,8 @@ void TerminalEditor::updateTerminalO() {
|
||||
/**
|
||||
@brief TerminalEditor::updateXPos
|
||||
*/
|
||||
void TerminalEditor::updateXPos() {
|
||||
void TerminalEditor::updateXPos()
|
||||
{
|
||||
if (m_locked) return;
|
||||
m_locked = true;
|
||||
QPointF new_pos(qle_x->value(), 0);
|
||||
@@ -215,7 +221,8 @@ void TerminalEditor::updateXPos() {
|
||||
/**
|
||||
@brief TerminalEditor::updateYPos
|
||||
*/
|
||||
void TerminalEditor::updateYPos() {
|
||||
void TerminalEditor::updateYPos()
|
||||
{
|
||||
if (m_locked) return;
|
||||
m_locked = true;
|
||||
QPointF new_pos(0, qle_y->value()); // change only y value
|
||||
@@ -237,7 +244,8 @@ void TerminalEditor::updateYPos() {
|
||||
/**
|
||||
Met a jour le formulaire d'edition
|
||||
*/
|
||||
void TerminalEditor::updateForm() {
|
||||
void TerminalEditor::updateForm()
|
||||
{
|
||||
if (!m_part) return;
|
||||
activeConnections(false);
|
||||
qle_x -> setValue(m_part->property("x").toReal());
|
||||
|
||||
@@ -43,7 +43,8 @@ DynamicTextFieldEditor::DynamicTextFieldEditor(
|
||||
fillInfoComboBox();
|
||||
}
|
||||
|
||||
DynamicTextFieldEditor::~DynamicTextFieldEditor() {
|
||||
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||
{
|
||||
delete ui;
|
||||
if(!m_connection_list.isEmpty()) {
|
||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
||||
@@ -108,11 +109,13 @@ bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
|
||||
@return The current edited part, note they can return nullptr if
|
||||
there is not a currently edited part.
|
||||
*/
|
||||
CustomElementPart *DynamicTextFieldEditor::currentPart() const {
|
||||
CustomElementPart *DynamicTextFieldEditor::currentPart() const
|
||||
{
|
||||
return m_text_field.data();
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
|
||||
QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const
|
||||
{
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
@@ -120,7 +123,8 @@ QList<CustomElementPart*> DynamicTextFieldEditor::currentParts() const {
|
||||
return parts;
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::updateForm() {
|
||||
void DynamicTextFieldEditor::updateForm()
|
||||
{
|
||||
if(m_text_field) {
|
||||
ui -> m_x_sb -> setValue(m_text_field.data() -> x());
|
||||
ui -> m_y_sb -> setValue(m_text_field.data() ->y ());
|
||||
@@ -152,7 +156,8 @@ void DynamicTextFieldEditor::updateForm() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setUpConnections() {
|
||||
void DynamicTextFieldEditor::setUpConnections()
|
||||
{
|
||||
assert(m_connection_list.isEmpty());
|
||||
//Setup the connection
|
||||
m_connection_list << connect(m_text_field.data(), &PartDynamicTextField::colorChanged,
|
||||
@@ -177,7 +182,8 @@ void DynamicTextFieldEditor::setUpConnections() {
|
||||
[this](){this -> updateForm();});
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::disconnectConnections() {
|
||||
void DynamicTextFieldEditor::disconnectConnections()
|
||||
{
|
||||
//Remove previous connection
|
||||
if(!m_connection_list.isEmpty())
|
||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
||||
@@ -190,7 +196,8 @@ void DynamicTextFieldEditor::disconnectConnections() {
|
||||
@brief DynamicTextFieldEditor::fillInfoComboBox
|
||||
Fill the combo box "element information"
|
||||
*/
|
||||
void DynamicTextFieldEditor::fillInfoComboBox() {
|
||||
void DynamicTextFieldEditor::fillInfoComboBox()
|
||||
{
|
||||
ui -> m_elmt_info_cb -> clear();
|
||||
|
||||
QStringList strl;
|
||||
@@ -212,7 +219,8 @@ void DynamicTextFieldEditor::fillInfoComboBox() {
|
||||
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
|
||||
{
|
||||
double value = ui -> m_x_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "x", m_parts[i] -> x(), value);
|
||||
@@ -222,7 +230,8 @@ void DynamicTextFieldEditor::on_m_x_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_y_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_y_sb_editingFinished()
|
||||
{
|
||||
double value = ui -> m_y_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "y", m_parts[i] -> y(), value);
|
||||
@@ -232,7 +241,8 @@ void DynamicTextFieldEditor::on_m_y_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished()
|
||||
{
|
||||
int value = ui -> m_rotation_sb -> value();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "rotation", m_parts[i] -> rotation(), value);
|
||||
@@ -242,7 +252,8 @@ void DynamicTextFieldEditor::on_m_rotation_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_user_text_le_editingFinished()
|
||||
{
|
||||
QString text = ui -> m_user_text_le -> text();
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_parts[i], "text", m_parts[i] -> text(), text);
|
||||
@@ -251,7 +262,8 @@ void DynamicTextFieldEditor::on_m_user_text_le_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_size_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_size_sb_editingFinished()
|
||||
{
|
||||
QFont font_ = m_text_field -> font();
|
||||
font_.setPointSize(ui -> m_size_sb -> value());
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -261,7 +273,8 @@ void DynamicTextFieldEditor::on_m_size_sb_editingFinished() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_frame_cb_clicked()
|
||||
{
|
||||
bool frame = ui -> m_frame_cb -> isChecked();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -273,7 +286,8 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished() {
|
||||
void DynamicTextFieldEditor::on_m_width_sb_editingFinished()
|
||||
{
|
||||
qreal width = (qreal)ui -> m_width_sb -> value();
|
||||
|
||||
for (int i = 0; i < m_parts.length(); i++) {
|
||||
@@ -335,7 +349,8 @@ void DynamicTextFieldEditor::on_m_text_from_cb_activated(int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_composite_text_pb_clicked()
|
||||
{
|
||||
CompositeTextEditDialog ctd(m_text_field.data() -> compositeText(), this);
|
||||
if(ctd.exec()) {
|
||||
QString ct = ctd.plainText();
|
||||
@@ -349,7 +364,8 @@ void DynamicTextFieldEditor::on_m_composite_text_pb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_alignment_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_alignment_pb_clicked()
|
||||
{
|
||||
AlignmentTextDialog atd(m_text_field.data() -> alignment(), this);
|
||||
atd.exec();
|
||||
|
||||
@@ -364,7 +380,8 @@ void DynamicTextFieldEditor::on_m_alignment_pb_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::on_m_font_pb_clicked() {
|
||||
void DynamicTextFieldEditor::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QFont font_ = QFontDialog::getFont(&ok, m_text_field -> font(), this);
|
||||
if (ok && font_ != this -> font()) {
|
||||
|
||||
@@ -48,7 +48,8 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor,
|
||||
/**
|
||||
@brief PolygonEditor::~PolygonEditor
|
||||
*/
|
||||
PolygonEditor::~PolygonEditor() {
|
||||
PolygonEditor::~PolygonEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -115,11 +116,13 @@ bool PolygonEditor::setPart(CustomElementPart *new_part)
|
||||
@brief PolygonEditor::currentPart
|
||||
@return the curent edited part
|
||||
*/
|
||||
CustomElementPart *PolygonEditor::currentPart() const {
|
||||
CustomElementPart *PolygonEditor::currentPart() const
|
||||
{
|
||||
return m_part;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> PolygonEditor::currentParts() const {
|
||||
QList<CustomElementPart*> PolygonEditor::currentParts() const
|
||||
{
|
||||
return m_style->currentParts();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ RectangleEditor::RectangleEditor(QETElementEditor *editor, PartRectangle *rect,
|
||||
/**
|
||||
@brief RectangleEditor::~RectangleEditor
|
||||
*/
|
||||
RectangleEditor::~RectangleEditor() {
|
||||
RectangleEditor::~RectangleEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -112,11 +113,13 @@ bool RectangleEditor::setParts(QList <CustomElementPart *> parts)
|
||||
@brief RectangleEditor::currentPart
|
||||
@return
|
||||
*/
|
||||
CustomElementPart *RectangleEditor::currentPart() const {
|
||||
CustomElementPart *RectangleEditor::currentPart() const
|
||||
{
|
||||
return m_part;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> RectangleEditor::currentParts() const {
|
||||
QList<CustomElementPart*> RectangleEditor::currentParts() const
|
||||
{
|
||||
return m_style->currentParts();
|
||||
}
|
||||
|
||||
@@ -124,7 +127,8 @@ QList<CustomElementPart*> RectangleEditor::currentParts() const {
|
||||
@brief RectangleEditor::topLeft
|
||||
@return The edited topLeft already mapped to part coordinate
|
||||
*/
|
||||
QPointF RectangleEditor::editedTopLeft() const {
|
||||
QPointF RectangleEditor::editedTopLeft() const
|
||||
{
|
||||
return m_part->mapFromScene(ui->m_x_sb->value(), ui->m_y_sb->value());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *paren
|
||||
/**
|
||||
@brief TextEditor::~TextEditor
|
||||
*/
|
||||
TextEditor::~TextEditor() {
|
||||
TextEditor::~TextEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -79,14 +80,16 @@ void TextEditor::setUpChangeConnection(QPointer<PartText> part) {
|
||||
m_change_connection << connect(part, &PartText::colorChanged, this, &TextEditor::updateForm);
|
||||
}
|
||||
|
||||
void TextEditor::disconnectChangeConnection() {
|
||||
void TextEditor::disconnectChangeConnection()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connection) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connection.clear();
|
||||
}
|
||||
|
||||
void TextEditor::disconnectEditConnection() {
|
||||
void TextEditor::disconnectEditConnection()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_edit_connection) {
|
||||
disconnect(c);
|
||||
}
|
||||
@@ -150,11 +153,13 @@ bool TextEditor::setParts(QList <CustomElementPart *> parts) {
|
||||
@brief TextEditor::currentPart
|
||||
@return The current part
|
||||
*/
|
||||
CustomElementPart *TextEditor::currentPart() const {
|
||||
CustomElementPart *TextEditor::currentPart() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
QList<CustomElementPart*> TextEditor::currentParts() const {
|
||||
QList<CustomElementPart*> TextEditor::currentParts() const
|
||||
{
|
||||
QList<CustomElementPart*> parts;
|
||||
for (auto part: m_parts) {
|
||||
parts.append(static_cast<CustomElementPart*>(part));
|
||||
@@ -167,7 +172,8 @@ QList<CustomElementPart*> TextEditor::currentParts() const {
|
||||
Setup the connection between the widgets of this editor and the undo command
|
||||
use to apply the change to the edited text.
|
||||
*/
|
||||
void TextEditor::setUpEditConnection() {
|
||||
void TextEditor::setUpEditConnection()
|
||||
{
|
||||
disconnectEditConnection();
|
||||
|
||||
m_edit_connection << connect(ui -> m_line_edit, &QLineEdit::editingFinished, [this]() {
|
||||
@@ -236,7 +242,8 @@ void TextEditor::setUpEditConnection() {
|
||||
/**
|
||||
@brief TextEditor::on_m_font_pb_clicked
|
||||
*/
|
||||
void TextEditor::on_m_font_pb_clicked() {
|
||||
void TextEditor::on_m_font_pb_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QFont font_ = QFontDialog::getFont(&ok, m_text -> font(), this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user