mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 00:30:53 +01:00
Ajout de la possibilite de modifier la hauteur du schema
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@53 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -34,7 +34,7 @@ void BorderInset::updateRectangles() {
|
||||
border = QRectF(0, 0, nb_columns * columns_width, columns_height);
|
||||
|
||||
// rectangles relatifs au cartouche
|
||||
inset = QRectF(border.bottomRight().x() - inset_width, border.bottomRight().y() - inset_height, inset_width, inset_height);
|
||||
inset = QRectF(border.bottomLeft().x(), border.bottomLeft().y(), inset_width, inset_height);
|
||||
inset_author = QRectF(inset.topLeft(), QSizeF(2.0 * inset_width / 9.0, 0.5 * inset_height));
|
||||
inset_date = QRectF(inset_author.bottomLeft(), inset_author.size());
|
||||
inset_title = QRectF(inset_author.topRight(), QSizeF(5.0 * inset_width / 9.0, inset_height));
|
||||
@@ -118,6 +118,7 @@ void BorderInset::draw(QPainter *qp, qreal x, qreal y) {
|
||||
*/
|
||||
void BorderInset::addColumn() {
|
||||
++ nb_columns;
|
||||
setInsetWidth(nb_columns * columns_width);
|
||||
updateRectangles();
|
||||
}
|
||||
|
||||
@@ -127,6 +128,7 @@ void BorderInset::addColumn() {
|
||||
void BorderInset::removeColumn() {
|
||||
if (nb_columns == 3) return;
|
||||
-- nb_columns;
|
||||
setInsetWidth(nb_columns * columns_width);
|
||||
updateRectangles();
|
||||
}
|
||||
|
||||
@@ -150,10 +152,10 @@ void BorderInset::setColumnsHeaderHeight(const qreal &new_chh) {
|
||||
|
||||
/**
|
||||
Change la hauteur des colonnes (et donc du cadre). Cette hauteur doit
|
||||
rester superieure a 10px.
|
||||
rester superieure a la hauteur des en-tetes de colonnes + 20px.
|
||||
*/
|
||||
void BorderInset::setColumnsHeight(const qreal &new_ch) {
|
||||
columns_height = qMax(10.0, new_ch);
|
||||
columns_height = qMax(columns_header_height + 20.0, new_ch);
|
||||
updateRectangles();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
void draw(QPainter *, qreal = 0.0, qreal = 0.0);
|
||||
|
||||
// methodes d'acces en lecture aux dimensions
|
||||
int nbColumn() const { return(nb_columns); }
|
||||
qreal columnsWidth() const { return(columns_width); }
|
||||
qreal columnsHeaderHeight() const { return(columns_header_height); }
|
||||
qreal columnsHeight() const { return(columns_height); }
|
||||
qreal borderWidth() const { return(nb_columns * columns_width); }
|
||||
qreal borderHeight() const { return(columns_height); }
|
||||
qreal insetWidth() const { return(inset_width); }
|
||||
qreal insetHeight() const { return(inset_height); }
|
||||
int nbColumn() const { return(nb_columns); }
|
||||
qreal columnsWidth() const { return(columns_width); }
|
||||
qreal columnsHeaderHeight() const { return(columns_header_height); }
|
||||
qreal columnsHeight() const { return(columns_height); }
|
||||
qreal borderWidth() const { return(nb_columns * columns_width); }
|
||||
qreal borderHeight() const { return(columns_height + inset_height); }
|
||||
qreal insetWidth() const { return(inset_width); }
|
||||
qreal insetHeight() const { return(inset_height); }
|
||||
|
||||
// methodes d'acces en lecture aux informations du cartouche
|
||||
QString author() const { return(bi_author); }
|
||||
|
||||
@@ -526,3 +526,24 @@ void DiagramView::removeColumn() {
|
||||
// rafraichit la vue
|
||||
scene -> update(sceneRect());
|
||||
}
|
||||
|
||||
void DiagramView::expand() {
|
||||
// ajoute 10 pixels
|
||||
scene -> border_and_inset.setColumnsHeight(scene -> border_and_inset.columnsHeight() + 20.0);
|
||||
|
||||
// met a jour la zone affichee par la vue
|
||||
QRectF sr = sceneRect();
|
||||
sr.setHeight(20.0 + sr.height());
|
||||
setSceneRect(sr);
|
||||
|
||||
// rafraichit la vue
|
||||
scene -> update(sceneRect());
|
||||
}
|
||||
|
||||
void DiagramView::shrink() {
|
||||
// enleve 10 pixels
|
||||
scene -> border_and_inset.setColumnsHeight(scene -> border_and_inset.columnsHeight() - 20.0);
|
||||
|
||||
// rafraichit la vue
|
||||
scene -> update(sceneRect());
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
void dialogPrint();
|
||||
void addColumn();
|
||||
void removeColumn();
|
||||
void expand();
|
||||
void shrink();
|
||||
Diagram *diagram() { return(scene); }
|
||||
bool hasSelectedItems();
|
||||
|
||||
|
||||
30
qetapp.cpp
30
qetapp.cpp
@@ -225,9 +225,11 @@ void QETApp::actions() {
|
||||
sel_inverse = new QAction( tr("Inverser la s\351lection"), this);
|
||||
supprimer = new QAction(QIcon(":/ico/delete.png"), tr("Supprimer"), this);
|
||||
pivoter = new QAction(QIcon(":/ico/pivoter.png"), tr("Pivoter"), this);
|
||||
infos_diagram = new QAction(QIcon(":/ico/info.png"), tr("Informations sur le sch\351ma"), this);
|
||||
infos_diagram = new QAction(QIcon(":/ico/info.png"), tr("Informations sur le sch\351ma"), this);
|
||||
add_column = new QAction( tr("Ajouter une colonne"), this);
|
||||
remove_column = new QAction( tr("Enlever une colonne"), this);
|
||||
expand_diagram = new QAction( tr("Agrandir le sch\351ma"), this);
|
||||
shrink_diagram = new QAction( tr("R\351tr\351cir le sch\351ma"), this);
|
||||
|
||||
toggle_aa = new QAction( tr("D\351sactiver l'&antialiasing"), this);
|
||||
zoom_avant = new QAction(QIcon(":/ico/viewmag+.png"), tr("Zoom avant"), this);
|
||||
@@ -308,9 +310,11 @@ void QETApp::actions() {
|
||||
sel_inverse -> setStatusTip(tr("D\351s\351lectionne les \351l\351ments s\351lectionn\351s et s\351lectionne les \351l\351ments non s\351lectionn\351s"));
|
||||
supprimer -> setStatusTip(tr("Enl\350ve les \351l\351ments s\351lectionn\351s du sch\351ma"));
|
||||
pivoter -> setStatusTip(tr("Pivote les \351l\351ments s\351lectionn\351s"));
|
||||
infos_diagram -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche"));
|
||||
infos_diagram -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche"));
|
||||
add_column -> setStatusTip(tr("Ajoute une colonne au sch\351ma"));
|
||||
remove_column -> setStatusTip(tr("Enl\350ve une colonne au sch\351ma"));
|
||||
expand_diagram -> setStatusTip(tr("Agrandit le sch\351ma en hauteur"));
|
||||
shrink_diagram -> setStatusTip(tr("R\351tr\351cit le sch\351ma en hauteur"));
|
||||
|
||||
toggle_aa -> setStatusTip(tr("Active / d\351sactive l'antialiasing pour le rendu du sch\351ma courant"));
|
||||
zoom_avant -> setStatusTip(tr("Agrandit le sch\351ma"));
|
||||
@@ -382,6 +386,8 @@ void QETApp::actions() {
|
||||
connect(infos_diagram, SIGNAL(activated()), this, SLOT(slot_editInfos()) );
|
||||
connect(add_column, SIGNAL(activated()), this, SLOT(slot_addColumn()) );
|
||||
connect(remove_column, SIGNAL(activated()), this, SLOT(slot_removeColumn()) );
|
||||
connect(expand_diagram, SIGNAL(activated()), this, SLOT(slot_expand()) );
|
||||
connect(shrink_diagram, SIGNAL(activated()), this, SLOT(slot_shrink()) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -436,6 +442,8 @@ void QETApp::menus() {
|
||||
menu_edition -> addAction(infos_diagram);
|
||||
menu_edition -> addAction(add_column);
|
||||
menu_edition -> addAction(remove_column);
|
||||
menu_edition -> addAction(expand_diagram);
|
||||
menu_edition -> addAction(shrink_diagram);
|
||||
|
||||
// menu Affichage > Afficher
|
||||
QMenu *menu_aff_aff = new QMenu(tr("Afficher"));
|
||||
@@ -947,3 +955,21 @@ void QETApp::slot_removeColumn() {
|
||||
if (!sv) return;
|
||||
sv -> removeColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
Allonge le schema en cours en hauteur
|
||||
*/
|
||||
void QETApp::slot_expand() {
|
||||
DiagramView *sv = diagramEnCours();
|
||||
if (!sv) return;
|
||||
sv -> expand();
|
||||
}
|
||||
|
||||
/**
|
||||
Retrecit le schema en cours en hauteur
|
||||
*/
|
||||
void QETApp::slot_shrink() {
|
||||
DiagramView *sv = diagramEnCours();
|
||||
if (!sv) return;
|
||||
sv -> shrink();
|
||||
}
|
||||
|
||||
4
qetapp.h
4
qetapp.h
@@ -57,6 +57,8 @@
|
||||
void slot_updateMenuFenetres();
|
||||
void slot_addColumn();
|
||||
void slot_removeColumn();
|
||||
void slot_expand();
|
||||
void slot_shrink();
|
||||
|
||||
protected:
|
||||
// Actions faisables au travers de menus dans l'application QElectroTech
|
||||
@@ -85,6 +87,8 @@
|
||||
QAction *infos_diagram;
|
||||
QAction *add_column;
|
||||
QAction *remove_column;
|
||||
QAction *expand_diagram;
|
||||
QAction *shrink_diagram;
|
||||
QAction *poser_fil;
|
||||
QAction *reduce_appli;
|
||||
QAction *restore_appli;
|
||||
|
||||
Reference in New Issue
Block a user