mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Il est desormais possible d'autoriser ou non les connexions internes dans l'editeur d'element
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@227 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -475,3 +475,30 @@ void ChangeZValueCommand::applySendBackward(const QList<QGraphicsItem *> &items_
|
||||
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
|
||||
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
|
||||
}
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@param elmt ElementScene concernee
|
||||
@param allow true pour que les connexions internes soient acceptees, false sinon
|
||||
@param parent QUndoCommand parent
|
||||
*/
|
||||
AllowInternalConnectionsCommand::AllowInternalConnectionsCommand(ElementScene *elmt, bool allow, QUndoCommand *parent) :
|
||||
QUndoCommand(QObject::tr("modification connexions internes"), parent),
|
||||
element(elmt),
|
||||
ic(allow)
|
||||
{
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
AllowInternalConnectionsCommand::~AllowInternalConnectionsCommand() {
|
||||
}
|
||||
|
||||
/// Annule le changement d'autorisation pour les connexions internes
|
||||
void AllowInternalConnectionsCommand::undo() {
|
||||
element -> setInternalConnections(!ic);
|
||||
}
|
||||
|
||||
/// Refait le changement d'autorisation pour les connexions internes
|
||||
void AllowInternalConnectionsCommand::redo() {
|
||||
element -> setInternalConnections(ic);
|
||||
}
|
||||
|
||||
@@ -277,4 +277,29 @@ class ChangeZValueCommand : public QUndoCommand {
|
||||
/// type de traitement
|
||||
Option option;
|
||||
};
|
||||
|
||||
/**
|
||||
Cette classe represente l'action d'autoriser ou non les connexions
|
||||
internes pour un element.
|
||||
*/
|
||||
class AllowInternalConnectionsCommand : public QUndoCommand {
|
||||
// constructeurs, destructeur
|
||||
public:
|
||||
AllowInternalConnectionsCommand(ElementScene *, bool, QUndoCommand * = 0);
|
||||
virtual ~AllowInternalConnectionsCommand();
|
||||
private:
|
||||
AllowInternalConnectionsCommand(const AllowInternalConnectionsCommand &);
|
||||
|
||||
// methodes
|
||||
public:
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
|
||||
// attributs
|
||||
private:
|
||||
/// Element edite auquel il faut appliquer les modifications
|
||||
ElementScene *element;
|
||||
/// autorisation des connexions internes apres modification
|
||||
bool ic;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -584,7 +584,7 @@ void ElementScene::slot_editOrientations() {
|
||||
// cree un dialogue
|
||||
QDialog dialog_ori;
|
||||
dialog_ori.setModal(true);
|
||||
dialog_ori.setFixedSize(400, 230);
|
||||
dialog_ori.setFixedSize(400, 260);
|
||||
dialog_ori.setWindowTitle(tr("\311diter les orientations"));
|
||||
QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_ori);
|
||||
|
||||
@@ -599,6 +599,11 @@ void ElementScene::slot_editOrientations() {
|
||||
ori_widget -> setOrientationSet(ori);
|
||||
dialog_layout -> addWidget(ori_widget);
|
||||
|
||||
// ajoute une case a cocher pour les connexions internes
|
||||
QCheckBox *ic_checkbox = new QCheckBox(tr("Autoriser les connexions internes"));
|
||||
ic_checkbox -> setChecked(internal_connections);
|
||||
dialog_layout -> addWidget(ic_checkbox);
|
||||
|
||||
// ajoute deux boutons au dialogue
|
||||
QDialogButtonBox *dialog_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
dialog_layout -> addWidget(dialog_buttons);
|
||||
@@ -611,6 +616,9 @@ void ElementScene::slot_editOrientations() {
|
||||
if (new_ori != ori) {
|
||||
undoStack().push(new ChangeOrientationsCommand(this, ori, new_ori));
|
||||
}
|
||||
if (ic_checkbox -> isChecked() != internal_connections) {
|
||||
undoStack().push(new AllowInternalConnectionsCommand(this, ic_checkbox -> isChecked()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ class ElementScene : public QGraphicsScene {
|
||||
NamesList names() const;
|
||||
OrientationSet orientations();
|
||||
void setOrientations(const OrientationSet &);
|
||||
bool internalConnections();
|
||||
void setInternalConnections(bool);
|
||||
virtual const QDomDocument toXml() const;
|
||||
virtual void fromXml(const QDomDocument &);
|
||||
virtual QList<QGraphicsItem *> zItems(bool = false) const;
|
||||
@@ -213,4 +215,18 @@ inline void ElementScene::setOrientations(const OrientationSet &orientation_set)
|
||||
ori = orientation_set;
|
||||
}
|
||||
|
||||
/**
|
||||
@return true si les connexions internes sont acceptees, false sinon
|
||||
*/
|
||||
inline bool ElementScene::internalConnections() {
|
||||
return(internal_connections);
|
||||
}
|
||||
|
||||
/**
|
||||
@param ic true pour que les connexions internes soient acceptees, false sinon
|
||||
*/
|
||||
inline void ElementScene::setInternalConnections(bool ic) {
|
||||
internal_connections = ic;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user