mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Il est desormais possible d'afficher ou non les entetes des lignes et colonnes
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@372 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -30,21 +30,15 @@ BorderInset::BorderInset(QObject *parent) : QObject(parent) {
|
|||||||
// dimensions par defaut du schema
|
// dimensions par defaut du schema
|
||||||
importBorder(QETDiagramEditor::defaultBorderProperties());
|
importBorder(QETDiagramEditor::defaultBorderProperties());
|
||||||
|
|
||||||
|
// contenu par defaut du cartouche
|
||||||
|
importInset(QETDiagramEditor::defaultInsetProperties());
|
||||||
|
|
||||||
// hauteur du cartouche
|
// hauteur du cartouche
|
||||||
inset_height = 50.0;
|
inset_height = 50.0;
|
||||||
|
|
||||||
display_inset = true;
|
display_inset = true;
|
||||||
display_border = true;
|
display_border = true;
|
||||||
updateRectangles();
|
updateRectangles();
|
||||||
|
|
||||||
bi_author = QETApp::settings().value("diagrameditor/defaultauthor").toString();
|
|
||||||
bi_title = QETApp::settings().value("diagrameditor/defaulttitle").toString();
|
|
||||||
bi_folio = QETApp::settings().value("diagrameditor/defaultfolio").toString();
|
|
||||||
bi_filename = QETApp::settings().value("diagrameditor/defaultfilename").toString();
|
|
||||||
QString settings_date = QETApp::settings().value("diagrameditor/defaultdate").toString();
|
|
||||||
if (settings_date == "now") bi_date = QDate::currentDate();
|
|
||||||
else if (settings_date.isEmpty() || settings_date == "null") bi_date = QDate();
|
|
||||||
else bi_date = QDate::fromString(settings_date, "yyyyMMdd");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,6 +129,42 @@ void BorderInset::importBorder(const BorderProperties &bp) {
|
|||||||
displayRows(bp.display_rows);
|
displayRows(bp.display_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param di true pour afficher le cartouche, false sinon
|
||||||
|
*/
|
||||||
|
void BorderInset::displayInset(bool di) {
|
||||||
|
bool change = (di != display_inset);
|
||||||
|
display_inset = di;
|
||||||
|
if (change) emit(displayChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param dc true pour afficher les entetes des colonnes, false sinon
|
||||||
|
*/
|
||||||
|
void BorderInset::displayColumns(bool dc) {
|
||||||
|
bool change = (dc != display_columns);
|
||||||
|
display_columns = dc;
|
||||||
|
if (change) emit(displayChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param dr true pour afficher les entetes des lignes, false sinon
|
||||||
|
*/
|
||||||
|
void BorderInset::displayRows(bool dr) {
|
||||||
|
bool change = (dr != display_rows);
|
||||||
|
display_rows = dr;
|
||||||
|
if (change) emit(displayChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param db true pour afficher la bordure du schema, false sinon
|
||||||
|
*/
|
||||||
|
void BorderInset::displayBorder(bool db) {
|
||||||
|
bool change = (db != display_border);
|
||||||
|
display_border = db;
|
||||||
|
if (change) emit(displayChanged());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Methode recalculant les rectangles composant le cadre et le cartouche en
|
Methode recalculant les rectangles composant le cadre et le cartouche en
|
||||||
fonction des attributs de taille
|
fonction des attributs de taille
|
||||||
|
|||||||
@@ -142,14 +142,10 @@ class BorderInset : public QObject {
|
|||||||
void importBorder(const BorderProperties &);
|
void importBorder(const BorderProperties &);
|
||||||
|
|
||||||
// methodes d'acces en ecriture aux options
|
// methodes d'acces en ecriture aux options
|
||||||
/// @param di true pour afficher le cartouche, false sinon
|
void displayInset(bool);
|
||||||
void displayInset (bool di) { display_inset = di; }
|
void displayColumns(bool);
|
||||||
/// @param dc true pour afficher les entetes des colonnes, false sinon
|
void displayRows(bool);
|
||||||
void displayColumns (bool dc) { display_columns = dc; }
|
void displayBorder(bool);
|
||||||
/// @param dr true pour afficher les entetes des lignes, false sinon
|
|
||||||
void displayRows (bool dr) { display_rows = dr; }
|
|
||||||
/// @param db true pour afficher la bordure du schema, false sinon
|
|
||||||
void displayBorder (bool db) { display_border = db; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRectangles();
|
void updateRectangles();
|
||||||
@@ -163,6 +159,10 @@ class BorderInset : public QObject {
|
|||||||
@param new_border Nouvelle bordure
|
@param new_border Nouvelle bordure
|
||||||
*/
|
*/
|
||||||
void borderChanged(QRectF old_border, QRectF new_border);
|
void borderChanged(QRectF old_border, QRectF new_border);
|
||||||
|
/**
|
||||||
|
Signal emise lorsque des options d'affichage change
|
||||||
|
*/
|
||||||
|
void displayChanged();
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ BorderPropertiesWidget::~BorderPropertiesWidget() {
|
|||||||
@return the border properties edited and modified by
|
@return the border properties edited and modified by
|
||||||
*/
|
*/
|
||||||
const BorderProperties &BorderPropertiesWidget::borderProperties() {
|
const BorderProperties &BorderPropertiesWidget::borderProperties() {
|
||||||
border_.columns_count = columns_count -> value();
|
border_.columns_count = columns_count -> value();
|
||||||
border_.columns_width = columns_width -> value();
|
border_.columns_width = columns_width -> value();
|
||||||
border_.rows_count = rows_count -> value();
|
border_.display_columns = display_columns -> isChecked();
|
||||||
border_.rows_height = rows_height -> value();
|
border_.rows_count = rows_count -> value();
|
||||||
|
border_.rows_height = rows_height -> value();
|
||||||
|
border_.display_rows = display_rows -> isChecked();
|
||||||
return(border_);
|
return(border_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,10 +58,12 @@ const BorderProperties &BorderPropertiesWidget::borderProperties() {
|
|||||||
*/
|
*/
|
||||||
void BorderPropertiesWidget::setEditedBorder(const BorderProperties &bp) {
|
void BorderPropertiesWidget::setEditedBorder(const BorderProperties &bp) {
|
||||||
border_ = bp;
|
border_ = bp;
|
||||||
columns_count -> setValue(border_.columns_count);
|
columns_count -> setValue(border_.columns_count);
|
||||||
columns_width -> setValue(border_.columns_width);
|
columns_width -> setValue(border_.columns_width);
|
||||||
rows_count -> setValue(border_.rows_count);
|
display_columns -> setChecked(border_.display_columns);
|
||||||
rows_height -> setValue(border_.rows_height);
|
rows_count -> setValue(border_.rows_count);
|
||||||
|
rows_height -> setValue(border_.rows_height);
|
||||||
|
display_rows -> setChecked(border_.display_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,6 +88,8 @@ void BorderPropertiesWidget::build() {
|
|||||||
columns_width -> setPrefix(tr("\327"));
|
columns_width -> setPrefix(tr("\327"));
|
||||||
columns_width -> setSuffix(tr("px"));
|
columns_width -> setSuffix(tr("px"));
|
||||||
|
|
||||||
|
display_columns = new QCheckBox(tr("Afficher les en-t<>tes"), diagram_size_box);
|
||||||
|
|
||||||
// lignes : nombre et largeur
|
// lignes : nombre et largeur
|
||||||
QLabel *ds2 = new QLabel(tr("Lignes :"));
|
QLabel *ds2 = new QLabel(tr("Lignes :"));
|
||||||
|
|
||||||
@@ -96,13 +102,17 @@ void BorderPropertiesWidget::build() {
|
|||||||
rows_height -> setPrefix(tr("\327"));
|
rows_height -> setPrefix(tr("\327"));
|
||||||
rows_height -> setSuffix(tr("px"));
|
rows_height -> setSuffix(tr("px"));
|
||||||
|
|
||||||
|
display_rows = new QCheckBox(tr("Afficher les en-t<>tes"), diagram_size_box);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
diagram_size_box_layout -> addWidget(ds1, 0, 0);
|
diagram_size_box_layout -> addWidget(ds1, 0, 0);
|
||||||
diagram_size_box_layout -> addWidget(columns_count, 0, 1);
|
diagram_size_box_layout -> addWidget(columns_count, 0, 1);
|
||||||
diagram_size_box_layout -> addWidget(columns_width, 0, 2);
|
diagram_size_box_layout -> addWidget(columns_width, 0, 2);
|
||||||
|
diagram_size_box_layout -> addWidget(display_columns,0, 3);
|
||||||
diagram_size_box_layout -> addWidget(ds2, 1, 0);
|
diagram_size_box_layout -> addWidget(ds2, 1, 0);
|
||||||
diagram_size_box_layout -> addWidget(rows_count, 1, 1);
|
diagram_size_box_layout -> addWidget(rows_count, 1, 1);
|
||||||
diagram_size_box_layout -> addWidget(rows_height, 1, 2);
|
diagram_size_box_layout -> addWidget(rows_height, 1, 2);
|
||||||
|
diagram_size_box_layout -> addWidget(display_rows, 1, 3);
|
||||||
|
|
||||||
widget_layout -> addWidget(diagram_size_box);
|
widget_layout -> addWidget(diagram_size_box);
|
||||||
setLayout(widget_layout);
|
setLayout(widget_layout);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define BORDER_PROPERTIES_WIDGET_H
|
#define BORDER_PROPERTIES_WIDGET_H
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "borderproperties.h"
|
#include "borderproperties.h"
|
||||||
|
class QCheckBox;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
/**
|
/**
|
||||||
Cette classe represente un widget permettant d'editer les dimensions et les
|
Cette classe represente un widget permettant d'editer les dimensions et les
|
||||||
@@ -48,7 +49,9 @@ class BorderPropertiesWidget : public QWidget {
|
|||||||
BorderProperties border_; ///< Proprietes editees
|
BorderProperties border_; ///< Proprietes editees
|
||||||
QSpinBox *columns_count; ///< Widget d'edition du nombre de colonnes
|
QSpinBox *columns_count; ///< Widget d'edition du nombre de colonnes
|
||||||
QSpinBox *columns_width; ///< Widget d'edition de la largeur des colonnes
|
QSpinBox *columns_width; ///< Widget d'edition de la largeur des colonnes
|
||||||
|
QCheckBox *display_columns; ///< Case a cocher pour afficher ou non les entetes des colonnes
|
||||||
QSpinBox *rows_count; ///< Widget d'edition du nombre de lignes
|
QSpinBox *rows_count; ///< Widget d'edition du nombre de lignes
|
||||||
QSpinBox *rows_height; ///< Widget d'edition de la hauteur des lignes
|
QSpinBox *rows_height; ///< Widget d'edition de la hauteur des lignes
|
||||||
|
QCheckBox *display_rows; ///< Case a cocher pour afficher ou non les entetes des lignes
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -79,10 +79,12 @@ void NewDiagramPage::applyConf() {
|
|||||||
|
|
||||||
// dimensions des nouveaux schemas
|
// dimensions des nouveaux schemas
|
||||||
BorderProperties border = bpw -> borderProperties();
|
BorderProperties border = bpw -> borderProperties();
|
||||||
settings.setValue("diagrameditor/defaultcols", border.columns_count);
|
settings.setValue("diagrameditor/defaultcols", border.columns_count);
|
||||||
settings.setValue("diagrameditor/defaultcolsize", border.columns_width);
|
settings.setValue("diagrameditor/defaultcolsize", border.columns_width);
|
||||||
settings.setValue("diagrameditor/defaultrows", border.rows_count);
|
settings.setValue("diagrameditor/defaultdisplaycols", border.display_columns);
|
||||||
settings.setValue("diagrameditor/defaultrowsize", border.rows_height);
|
settings.setValue("diagrameditor/defaultrows", border.rows_count);
|
||||||
|
settings.setValue("diagrameditor/defaultrowsize", border.rows_height);
|
||||||
|
settings.setValue("diagrameditor/defaultdisplayrows", border.display_rows);
|
||||||
|
|
||||||
// proprietes du cartouche
|
// proprietes du cartouche
|
||||||
InsetProperties inset = ipw-> insetProperties();
|
InsetProperties inset = ipw-> insetProperties();
|
||||||
|
|||||||
@@ -253,6 +253,8 @@ QDomDocument Diagram::toXml(bool diagram) {
|
|||||||
racine.setAttribute("rowsize", border_and_inset.rowsHeight());
|
racine.setAttribute("rowsize", border_and_inset.rowsHeight());
|
||||||
// attribut datant de la version 0.1 - laisse pour retrocompatibilite
|
// attribut datant de la version 0.1 - laisse pour retrocompatibilite
|
||||||
racine.setAttribute("height", border_and_inset.diagramHeight());
|
racine.setAttribute("height", border_and_inset.diagramHeight());
|
||||||
|
racine.setAttribute("displaycols", border_and_inset.columnsAreDisplayed() ? "true" : "false");
|
||||||
|
racine.setAttribute("displayrows", border_and_inset.rowsAreDisplayed() ? "true" : "false");
|
||||||
|
|
||||||
// type de conducteur par defaut
|
// type de conducteur par defaut
|
||||||
QDomElement default_conductor = document.createElement("defaultconductor");
|
QDomElement default_conductor = document.createElement("defaultconductor");
|
||||||
@@ -371,6 +373,10 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
|
|||||||
if (ok) border_and_inset.setDiagramHeight(height);
|
if (ok) border_and_inset.setDiagramHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// affichage des lignes et colonnes
|
||||||
|
border_and_inset.displayColumns(root.attribute("displaycols") != "false");
|
||||||
|
border_and_inset.displayRows(root.attribute("displayrows") != "false");
|
||||||
|
|
||||||
border_and_inset.adjustInsetToColumns();
|
border_and_inset.adjustInsetToColumns();
|
||||||
|
|
||||||
// repere le permier element "defaultconductor"
|
// repere le permier element "defaultconductor"
|
||||||
|
|||||||
@@ -536,15 +536,11 @@ void ChangeInsetCommand::redo() {
|
|||||||
@param dia Schema modifie
|
@param dia Schema modifie
|
||||||
@param parent QUndoCommand parent
|
@param parent QUndoCommand parent
|
||||||
*/
|
*/
|
||||||
ChangeBorderCommand::ChangeBorderCommand(Diagram *dia, QUndoCommand *parent) :
|
ChangeBorderCommand::ChangeBorderCommand(Diagram *dia, const BorderProperties &old_bp, const BorderProperties &new_bp, QUndoCommand *parent) :
|
||||||
QUndoCommand(QObject::tr("modifier les dimensions du sch\351ma"), parent),
|
QUndoCommand(QObject::tr("modifier les dimensions du sch\351ma"), parent),
|
||||||
diagram(dia),
|
diagram(dia),
|
||||||
columnsCountDifference(0),
|
old_properties(old_bp),
|
||||||
rowsCountDifference(0),
|
new_properties(new_bp)
|
||||||
columnsWidthDifference(0.0),
|
|
||||||
rowsHeightDifference(0.0),
|
|
||||||
headersHeightDifference(0.0),
|
|
||||||
headersWidthDifference(0.0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,45 +548,14 @@ ChangeBorderCommand::ChangeBorderCommand(Diagram *dia, QUndoCommand *parent) :
|
|||||||
ChangeBorderCommand::~ChangeBorderCommand() {
|
ChangeBorderCommand::~ChangeBorderCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Applique les changements au schema
|
|
||||||
@param coeff comme les changements s'expriment sous forme de nombres dont
|
|
||||||
il suffit d'inverser le signe pour les annuler, ces valeurs sont ici
|
|
||||||
multipliees par le coefficient passe en parametre avant d'etre appliquees.
|
|
||||||
Pour resumer : 1 pour refaire, -1 pour annuler.
|
|
||||||
*/
|
|
||||||
void ChangeBorderCommand::applyChanges(int coeff) {
|
|
||||||
// reference vers l'objet border_and_inset du schema
|
|
||||||
BorderInset &border = diagram -> border_and_inset;
|
|
||||||
if (columnsCountDifference) {
|
|
||||||
border.setNbColumns(border.nbColumns() + (columnsCountDifference * coeff));
|
|
||||||
}
|
|
||||||
if (rowsCountDifference) {
|
|
||||||
border.setNbRows(border.nbRows() + (rowsCountDifference * coeff));
|
|
||||||
}
|
|
||||||
if (columnsWidthDifference) {
|
|
||||||
border.setColumnsWidth(border.columnsWidth() + (columnsWidthDifference * coeff));
|
|
||||||
}
|
|
||||||
if (rowsHeightDifference) {
|
|
||||||
border.setRowsHeight(border.rowsHeight() + (rowsHeightDifference * coeff));
|
|
||||||
}
|
|
||||||
if (headersHeightDifference) {
|
|
||||||
border.setColumnsHeaderHeight(border.columnsHeaderHeight() + (headersHeightDifference * coeff));
|
|
||||||
}
|
|
||||||
if (headersWidthDifference) {
|
|
||||||
border.setRowsHeaderWidth(border.rowsHeaderWidth() + (headersWidthDifference * coeff));
|
|
||||||
}
|
|
||||||
border.adjustInsetToColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Annule les changements apportes au schema
|
/// Annule les changements apportes au schema
|
||||||
void ChangeBorderCommand::undo() {
|
void ChangeBorderCommand::undo() {
|
||||||
applyChanges(-1);
|
diagram -> border_and_inset.importBorder(old_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refait les changements apportes au schema
|
/// Refait les changements apportes au schema
|
||||||
void ChangeBorderCommand::redo() {
|
void ChangeBorderCommand::redo() {
|
||||||
applyChanges(1);
|
diagram -> border_and_inset.importBorder(new_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,9 @@
|
|||||||
#include "diagramcontent.h"
|
#include "diagramcontent.h"
|
||||||
#include "diagramtextitem.h"
|
#include "diagramtextitem.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
|
#include "borderproperties.h"
|
||||||
#include "conductorproperties.h"
|
#include "conductorproperties.h"
|
||||||
|
#include "insetproperties.h"
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
/**
|
/**
|
||||||
Cette classe represente l'action d'ajouter un element au schema
|
Cette classe represente l'action d'ajouter un element au schema
|
||||||
@@ -325,16 +327,12 @@ class ChangeInsetCommand : public QUndoCommand {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cette classe represente l'action de modifier :
|
Cette classe represente l'action de modifier les dimensions d'un schema
|
||||||
-le nombre de colonnes d'un schema
|
|
||||||
-la hauteur des colonnes
|
|
||||||
-la largeur des colonnes
|
|
||||||
-la hauteur des en-tetes des colonnes
|
|
||||||
*/
|
*/
|
||||||
class ChangeBorderCommand : public QUndoCommand {
|
class ChangeBorderCommand : public QUndoCommand {
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
public:
|
public:
|
||||||
ChangeBorderCommand(Diagram *, QUndoCommand * = 0);
|
ChangeBorderCommand(Diagram *, const BorderProperties &, const BorderProperties &, QUndoCommand * = 0);
|
||||||
virtual ~ChangeBorderCommand();
|
virtual ~ChangeBorderCommand();
|
||||||
private:
|
private:
|
||||||
ChangeBorderCommand(const ChangeBorderCommand &);
|
ChangeBorderCommand(const ChangeBorderCommand &);
|
||||||
@@ -343,26 +341,16 @@ class ChangeBorderCommand : public QUndoCommand {
|
|||||||
public:
|
public:
|
||||||
virtual void undo();
|
virtual void undo();
|
||||||
virtual void redo();
|
virtual void redo();
|
||||||
private:
|
|
||||||
virtual void applyChanges(int = 1);
|
|
||||||
|
|
||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
/// schema modifie
|
/// schema modifie
|
||||||
Diagram *diagram;
|
Diagram *diagram;
|
||||||
public:
|
public:
|
||||||
/// nombre de colonnes ajoutees / enlevees
|
/// anciennes dimensions du schema
|
||||||
int columnsCountDifference;
|
BorderProperties old_properties;
|
||||||
/// nombre de lignes ajoutees / enlevees
|
/// nouvelles dimensions du schema
|
||||||
int rowsCountDifference;
|
BorderProperties new_properties;
|
||||||
/// delta pour la largeur des colonnes
|
|
||||||
qreal columnsWidthDifference;
|
|
||||||
/// delta pour la hauteur des lignes
|
|
||||||
qreal rowsHeightDifference;
|
|
||||||
/// delta pour la hauteur des entetes des colonnes
|
|
||||||
qreal headersHeightDifference;
|
|
||||||
/// delta pour la largeur des entetes des lignes
|
|
||||||
qreal headersWidthDifference;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ DiagramView::DiagramView(QWidget *parent) : QGraphicsView(parent), is_adding_tex
|
|||||||
|
|
||||||
connect(scene, SIGNAL(selectionEmptinessChanged()), this, SIGNAL(selectionChanged()));
|
connect(scene, SIGNAL(selectionEmptinessChanged()), this, SIGNAL(selectionChanged()));
|
||||||
connect(&(scene -> border_and_inset), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
|
connect(&(scene -> border_and_inset), SIGNAL(borderChanged(QRectF, QRectF)), this, SLOT(adjustSceneRect()));
|
||||||
|
connect(&(scene -> border_and_inset), SIGNAL(displayChanged()), this, SLOT(adjustSceneRect()));
|
||||||
connect(&(scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(updateWindowTitle()));
|
connect(&(scene -> undoStack()), SIGNAL(cleanChanged(bool)), this, SLOT(updateWindowTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,12 +583,7 @@ void DiagramView::dialogEditInfos() {
|
|||||||
|
|
||||||
// s'il y a des modifications aux dimensions du schema
|
// s'il y a des modifications aux dimensions du schema
|
||||||
if (new_border != border) {
|
if (new_border != border) {
|
||||||
ChangeBorderCommand *cbc = new ChangeBorderCommand(scene);
|
scene -> undoStack().push(new ChangeBorderCommand(scene, border, new_border));
|
||||||
cbc -> columnsCountDifference = new_border.columns_count - border.columns_count;
|
|
||||||
cbc -> columnsWidthDifference = new_border.columns_width - border.columns_width;
|
|
||||||
cbc -> rowsCountDifference = new_border.rows_count - border.rows_count;
|
|
||||||
cbc -> rowsHeightDifference = new_border.rows_height - border.rows_height;
|
|
||||||
scene -> undoStack().push(cbc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,36 +599,40 @@ bool DiagramView::hasSelectedItems() {
|
|||||||
Ajoute une colonne au schema.
|
Ajoute une colonne au schema.
|
||||||
*/
|
*/
|
||||||
void DiagramView::addColumn() {
|
void DiagramView::addColumn() {
|
||||||
ChangeBorderCommand *cbc = new ChangeBorderCommand(scene);
|
BorderProperties old_bp = scene -> border_and_inset.exportBorder();
|
||||||
cbc -> columnsCountDifference = 1;
|
BorderProperties new_bp = scene -> border_and_inset.exportBorder();
|
||||||
scene -> undoStack().push(cbc);
|
new_bp.columns_count += 1;
|
||||||
|
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enleve une colonne au schema.
|
Enleve une colonne au schema.
|
||||||
*/
|
*/
|
||||||
void DiagramView::removeColumn() {
|
void DiagramView::removeColumn() {
|
||||||
ChangeBorderCommand *cbc = new ChangeBorderCommand(scene);
|
BorderProperties old_bp = scene -> border_and_inset.exportBorder();
|
||||||
cbc -> columnsCountDifference = -1;
|
BorderProperties new_bp = scene -> border_and_inset.exportBorder();
|
||||||
scene -> undoStack().push(cbc);
|
new_bp.columns_count -= 1;
|
||||||
|
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Agrandit le schema en hauteur
|
Agrandit le schema en hauteur
|
||||||
*/
|
*/
|
||||||
void DiagramView::addRow() {
|
void DiagramView::addRow() {
|
||||||
ChangeBorderCommand *cbc = new ChangeBorderCommand(scene);
|
BorderProperties old_bp = scene -> border_and_inset.exportBorder();
|
||||||
cbc -> rowsCountDifference = 1;
|
BorderProperties new_bp = scene -> border_and_inset.exportBorder();
|
||||||
scene -> undoStack().push(cbc);
|
new_bp.rows_count += 1;
|
||||||
|
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrecit le schema en hauteur
|
Retrecit le schema en hauteur
|
||||||
*/
|
*/
|
||||||
void DiagramView::removeRow() {
|
void DiagramView::removeRow() {
|
||||||
ChangeBorderCommand *cbc = new ChangeBorderCommand(scene);
|
BorderProperties old_bp = scene -> border_and_inset.exportBorder();
|
||||||
cbc -> rowsCountDifference = -1;
|
BorderProperties new_bp = scene -> border_and_inset.exportBorder();
|
||||||
scene -> undoStack().push(cbc);
|
new_bp.rows_count -= 1;
|
||||||
|
scene -> undoStack().push(new ChangeBorderCommand(scene, old_bp, new_bp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1103,12 +1103,12 @@ BorderProperties QETDiagramEditor::defaultBorderProperties() {
|
|||||||
def.columns_count = settings.value("diagrameditor/defaultcols", 15).toInt();
|
def.columns_count = settings.value("diagrameditor/defaultcols", 15).toInt();
|
||||||
def.columns_width = qRound(settings.value("diagrameditor/defaultcolsize", 50.0).toDouble());
|
def.columns_width = qRound(settings.value("diagrameditor/defaultcolsize", 50.0).toDouble());
|
||||||
def.columns_header_height = 20.0;
|
def.columns_header_height = 20.0;
|
||||||
def.display_columns = true;
|
def.display_columns = settings.value("diagrameditor/defaultdisplaycols", true).toBool();
|
||||||
|
|
||||||
def.rows_count = settings.value("diagrameditor/defaultrows", 6).toInt();
|
def.rows_count = settings.value("diagrameditor/defaultrows", 6).toInt();
|
||||||
def.rows_height = qRound(settings.value("diagrameditor/defaultrowsize", 80.0).toDouble());
|
def.rows_height = qRound(settings.value("diagrameditor/defaultrowsize", 80.0).toDouble());
|
||||||
def.rows_header_width = 20.0;
|
def.rows_header_width = 20.0;
|
||||||
def.display_rows = true;
|
def.display_rows = settings.value("diagrameditor/defaultdisplayrows", true).toBool();
|
||||||
|
|
||||||
return(def);
|
return(def);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user