mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Diagram command : minor imrpovement
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3391 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -160,7 +160,7 @@ PasteDiagramCommand::PasteDiagramCommand(
|
||||
QUndoCommand(parent),
|
||||
content(c),
|
||||
diagram(dia),
|
||||
filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove),
|
||||
filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove | DiagramContent::Shapes),
|
||||
first_redo(true)
|
||||
{
|
||||
|
||||
@@ -353,22 +353,6 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Ajoute un champ de texte de conducteur a deplacer
|
||||
@param text_item Champ de texte a deplacer
|
||||
@param old_pos Position du champ de texte avant le deplacement
|
||||
@param new_pos Position du champ de texte apres le deplacement
|
||||
*/
|
||||
void MoveElementsCommand::addConductorTextItemMovement(ConductorTextItem *text_item, const QPointF &old_pos, const QPointF &new_pos) {
|
||||
if (moved_conductor_texts_.contains(text_item)) return;
|
||||
if (!text_item -> wasMovedByUser()) return;
|
||||
if (new_pos == old_pos) return;
|
||||
moved_conductor_texts_.insert(
|
||||
text_item,
|
||||
qMakePair(old_pos, new_pos)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MoveElementsCommand::setupAnimation
|
||||
* Set up the animation for this undo command
|
||||
|
||||
@@ -159,7 +159,6 @@ class MoveElementsCommand : public QUndoCommand {
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
virtual void move(const QPointF &);
|
||||
virtual void addConductorTextItemMovement(ConductorTextItem *, const QPointF &, const QPointF &);
|
||||
|
||||
private:
|
||||
void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant start, const QVariant end);
|
||||
@@ -174,13 +173,6 @@ class MoveElementsCommand : public QUndoCommand {
|
||||
QPointF movement;
|
||||
///animation group
|
||||
QParallelAnimationGroup *m_anim_group;
|
||||
/**
|
||||
Moving elements impacts their conductors: either they are moved, or their path
|
||||
needs to be generated again, which in turn tends to move their child text
|
||||
items. This attribute holds both new and previous positions for each moved
|
||||
text item.
|
||||
*/
|
||||
QHash<ConductorTextItem *, QPair<QPointF, QPointF> > moved_conductor_texts_;
|
||||
/// prevent the first call to redo()
|
||||
bool first_redo;
|
||||
};
|
||||
|
||||
@@ -155,17 +155,6 @@ void ElementsMover::endMovement() {
|
||||
current_movement_
|
||||
);
|
||||
|
||||
// Add info needed to the position of conductors texte
|
||||
foreach(ConductorTextItem *text_item, updated_conductors_text_pos_.keys()) {
|
||||
if (text_item -> pos() != updated_conductors_text_pos_[text_item]) {
|
||||
undo_object -> addConductorTextItemMovement(
|
||||
text_item,
|
||||
updated_conductors_text_pos_[text_item],
|
||||
text_item -> pos()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
diagram_ -> undoStack().push(undo_object);
|
||||
}
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, int conductors_co
|
||||
|
||||
if (shapes_count) {
|
||||
text += QObject::tr(
|
||||
"%n image(s)",
|
||||
"%n forme(s)",
|
||||
"part of a sentence listing the content of a diagram",
|
||||
shapes_count
|
||||
);
|
||||
|
||||
@@ -46,6 +46,7 @@ QGIManager::~QGIManager(){
|
||||
@param qgi QGraphicsItem a gerer
|
||||
*/
|
||||
void QGIManager::manage(QGraphicsItem *qgi) {
|
||||
if (qgi -> parentItem()) return;
|
||||
if (qgi_manager.contains(qgi)) ++ qgi_manager[qgi];
|
||||
else qgi_manager.insert(qgi, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user