add documentation

This commit is contained in:
Simon De Backer 2020-07-15 18:02:11 +02:00 committed by Laurent Trinques
parent 0c381eae28
commit 251dfdf37a
8 changed files with 164 additions and 38 deletions

View File

@ -292,6 +292,7 @@ inline void Diagram::setConductor(bool adding) {
}
/**
@brief Diagram::setConductorStart
Set the start point of the conductor setter.
@param start the point (in scene coordinates) which the newly created
conductor should start from.
@ -301,6 +302,7 @@ inline void Diagram::setConductorStart(QPointF start) {
}
/**
@brief Diagram::setConductorStop
Set the end point of the conductor setter.
@param end the point (in scene coordinates) upon to which the newly created
conductor should be drawn.
@ -310,6 +312,7 @@ inline void Diagram::setConductorStop(QPointF end) {
}
/**
@brief Diagram::setDisplayGrid
Set whether the diagram grid should be drawn.
@param dg true to render the grid, false otherwise.
*/
@ -318,13 +321,15 @@ inline void Diagram::setDisplayGrid(bool dg) {
}
/**
@return true if the grid is drawn, false otherwise.
@brief Diagram::displayGrid
@return draw_grid_ true if the grid is drawn, false otherwise.
*/
inline bool Diagram::displayGrid() {
return(draw_grid_);
}
/**
@brief Diagram::setUseBorder
Set whether the diagram border (including rows/colums headers and the title
block) should be rendered along with the diagram. When set to false, the size
of the smallest rectangle containing all items is considered as the diagram
@ -336,14 +341,16 @@ inline void Diagram::setUseBorder(bool ub) {
}
/**
@return true if the border is rendered and take into account, false
otherwise.
@brief Diagram::useBorder
@return use_border_ true if the border is rendered and take into account,
false otherwise.
*/
inline bool Diagram::useBorder() {
return(use_border_);
}
/**
@brief Diagram::setBorderOptions
Set the rendering options for the diagram border (including rows/colums
headers and the title block)
@param bo Enabled options ORed together
@ -356,6 +363,7 @@ inline void Diagram::setBorderOptions(Diagram::BorderOptions bo) {
}
/**
@brief Diagram::borderOptions
@return The rendering optios for the diagram border
@see setBorderOptions
*/
@ -368,22 +376,34 @@ inline Diagram::BorderOptions Diagram::borderOptions() {
return(options);
}
/// @return the diagram undo stack
/**
@brief Diagram::undoStack
@return the diagram undo stack
*/
inline QUndoStack &Diagram::undoStack() {
return *(project()->undoStack());
}
/// @return the diagram graphics item manager
/**
@brief Diagram::qgiManager
@return the diagram graphics item manager
*/
inline QGIManager &Diagram::qgiManager() {
return(*qgi_manager_);
}
/// @return true if terminals are rendered, false otherwise
/**
@brief Diagram::drawTerminals
@return true if terminals are rendered, false otherwise
*/
inline bool Diagram::drawTerminals() const {
return(draw_terminals_);
}
/// @return true if conductors colors are rendered, false otherwise.
/**
@brief Diagram::drawColoredConductors
@return true if conductors colors are rendered, false otherwise.
*/
inline bool Diagram::drawColoredConductors() const {
return(draw_colored_conductors_);
}

View File

@ -135,6 +135,7 @@ void PasteDiagramCommand::redo()
}
/**
@brief CutDiagramCommand::CutDiagramCommand
Constructeur
@param dia Schema dont on coupe des elements et conducteurs
@param content Contenu coupe
@ -157,7 +158,10 @@ CutDiagramCommand::CutDiagramCommand(
);
}
/// Destructeur
/**
@brief CutDiagramCommand::~CutDiagramCommand
Destructeur
*/
CutDiagramCommand::~CutDiagramCommand() {
}
@ -293,11 +297,9 @@ void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &prop
}
/**
@brief MoveConductorsTextsCommand::MoveConductorsTextsCommand
Constructeur
@param diagram Schema sur lequel on deplace des champs de texte
@param texts Textes deplaces : chaque ConductorTextItem est associe a un
couple de position : avant et apres le deplacement
@param m translation subie par les elements
@param parent QUndoCommand parent
*/
MoveConductorsTextsCommand::MoveConductorsTextsCommand(
@ -310,11 +312,17 @@ MoveConductorsTextsCommand::MoveConductorsTextsCommand(
{
}
/// Destructeur
/**
@brief MoveConductorsTextsCommand::~MoveConductorsTextsCommand
Destructeur
*/
MoveConductorsTextsCommand::~MoveConductorsTextsCommand() {
}
/// annule le deplacement
/**
@brief MoveConductorsTextsCommand::undo
annule le deplacement
*/
void MoveConductorsTextsCommand::undo() {
diagram -> showMe();
foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
@ -328,7 +336,10 @@ void MoveConductorsTextsCommand::undo() {
}
}
/// refait le deplacement
/**
@brief MoveConductorsTextsCommand::redo
refait le deplacement
*/
void MoveConductorsTextsCommand::redo() {
diagram -> showMe();
if (first_redo) {
@ -344,11 +355,15 @@ void MoveConductorsTextsCommand::redo() {
}
/**
@brief MoveConductorsTextsCommand::addTextMovement
Ajout un mouvement de champ de texte a cet objet
@param text_item Champ de texte deplace ; si celui-ci est deja connu de l'objet d'annulation, il sera ignore
@param text_item Champ de texte deplace ;
si celui-ci est deja connu de l'objet d'annulation,
il sera ignore
@param old_pos Position du champ de texte avant le mouvement
@param new_pos Position du champ de texte apres le mouvement
@param alread_moved true si le champ de texte etait deja a une position personnalisee par l'utilisateur, false sinon
@param alread_moved true si le champ de texte etait deja a une position
personnalisee par l'utilisateur, false sinon
*/
void MoveConductorsTextsCommand::addTextMovement(ConductorTextItem *text_item, const QPointF &old_pos, const QPointF &new_pos, bool already_moved) {
// si le champ de texte est deja connu de l'objet d'annulation, il sera ignore
@ -362,6 +377,7 @@ void MoveConductorsTextsCommand::addTextMovement(ConductorTextItem *text_item, c
}
/**
@brief MoveConductorsTextsCommand::regenerateTextLabel
Genere la description de l'objet d'annulation
*/
void MoveConductorsTextsCommand::regenerateTextLabel() {
@ -378,6 +394,7 @@ void MoveConductorsTextsCommand::regenerateTextLabel() {
}
/**
@brief ChangeDiagramTextCommand::ChangeDiagramTextCommand
Constructeur
@param dti Champ de texte modifie
@param before texte avant
@ -399,19 +416,25 @@ ChangeDiagramTextCommand::ChangeDiagramTextCommand(
{
}
/// destructeur
/**
@brief ChangeDiagramTextCommand::~ChangeDiagramTextCommand
destructeur
*/
ChangeDiagramTextCommand::~ChangeDiagramTextCommand() {
}
/// annule la modification de texte
/**
@brief ChangeDiagramTextCommand::undo
annule la modification de texte
*/
void ChangeDiagramTextCommand::undo() {
diagram -> showMe();
text_item -> setHtml(text_before);
}
/**
* @brief ChangeDiagramTextCommand::redo
*/
@brief ChangeDiagramTextCommand::redo
*/
void ChangeDiagramTextCommand::redo()
{
diagram -> showMe();
@ -419,6 +442,7 @@ void ChangeDiagramTextCommand::redo()
}
/**
@brief ChangeConductorCommand::ChangeConductorCommand
Constructeur
@param c Conducteur modifie
@param old_p ancien profil du conducteur
@ -443,18 +467,27 @@ ChangeConductorCommand::ChangeConductorCommand(
{
}
/// Destructeur
/**
@brief ChangeConductorCommand::~ChangeConductorCommand
Destructeur
*/
ChangeConductorCommand::~ChangeConductorCommand() {
}
/// Annule la modification du conducteur
/**
@brief ChangeConductorCommand::undo
Annule la modification du conducteur
*/
void ChangeConductorCommand::undo() {
diagram -> showMe();
conductor -> setProfile(old_profile, path_type);
conductor -> textItem() -> setPos(text_pos_before_mov_);
}
/// Refait la modification du conducteur
/**
@brief ChangeConductorCommand::redo
Refait la modification du conducteur
*/
void ChangeConductorCommand::redo() {
diagram -> showMe();
if (first_redo) {
@ -466,6 +499,7 @@ void ChangeConductorCommand::redo() {
}
/**
@brief ChangeConductorCommand::setConductorTextItemMove
Integre dans cet objet d'annulation le repositionnement du champ de texte
du conducteur
@param pos_before Position du texte avant la modification du conducteur
@ -526,31 +560,46 @@ void ResetConductorCommand::redo() {
}
/**
@brief ChangeBorderCommand::ChangeBorderCommand
Constructeur
@param dia Schema modifie
@param old_bp Anciennes proprietes du cadre du schema
@param new_bp Nouvelles proprietes du cadre du schema
@param parent QUndoCommand parent
*/
ChangeBorderCommand::ChangeBorderCommand(Diagram *dia, const BorderProperties &old_bp, const BorderProperties &new_bp, QUndoCommand *parent) :
QUndoCommand(QObject::tr("modifier les dimensions du folio", "undo caption"), parent),
ChangeBorderCommand::ChangeBorderCommand(Diagram *dia,
const BorderProperties &old_bp,
const BorderProperties &new_bp,
QUndoCommand *parent) :
QUndoCommand(
QObject::tr("modifier les dimensions du folio", "undo caption"),
parent),
diagram(dia),
old_properties(old_bp),
new_properties(new_bp)
{
}
/// Destructeur
/**
@brief ChangeBorderCommand::~ChangeBorderCommand
Destructeur
*/
ChangeBorderCommand::~ChangeBorderCommand() {
}
/// Annule les changements apportes au schema
/**
@brief ChangeBorderCommand::undo
Annule les changements apportes au schema
*/
void ChangeBorderCommand::undo() {
diagram -> showMe();
diagram -> border_and_titleblock.importBorder(old_properties);
}
/// Refait les changements apportes au schema
/**
@brief ChangeBorderCommand::redo
Refait les changements apportes au schema
*/
void ChangeBorderCommand::redo() {
diagram -> showMe();
diagram -> border_and_titleblock.importBorder(new_properties);

View File

@ -82,6 +82,7 @@ QString itemText(const IndependentTextItem *item);
QString itemText(const Conductor *item);
/**
@brief The PasteDiagramCommand class
This command pastes some content onto a particular diagram.
*/
class PasteDiagramCommand : public QUndoCommand {
@ -110,6 +111,7 @@ class PasteDiagramCommand : public QUndoCommand {
};
/**
@brief The CutDiagramCommand class
This command cuts content from a particular diagram.
*/
class CutDiagramCommand : public DeleteQGraphicsItemCommand {
@ -122,6 +124,7 @@ class CutDiagramCommand : public DeleteQGraphicsItemCommand {
};
/**
@brief The MoveElementsCommand class
This command moves some content on a particular diagram.
*/
class MoveElementsCommand : public QUndoCommand {
@ -156,8 +159,9 @@ class MoveElementsCommand : public QUndoCommand {
};
/**
This command moves text items related to conductors on a particular
diagram.
@brief The MoveConductorsTextsCommand class
This command moves text items related to conductors
on a particular diagram.
*/
class MoveConductorsTextsCommand : public QUndoCommand {
// constructors, destructor

View File

@ -92,9 +92,17 @@ void ExportPropertiesWidget::setExportProperties(const ExportProperties &export_
}
/**
@brief ExportPropertiesWidget::setPrintingMode
Puts the widget in Print or Export mode. Print mode
does not display as many options as Export mode.
/
Passe le widget en mode Impression ou en mode Export. Le mode Impression
n'affiche pas autant d'options que le mode Export.
@param mode true pour utiliser le widget en mode impression, false pour
@param mode
true to use the widget in print mode,
false to use it in export mode
/
true pour utiliser le widget en mode impression, false pour
l'utiliser en mode export
*/
void ExportPropertiesWidget::setPrintingMode(bool mode) {

View File

@ -240,6 +240,7 @@ void Terminal::removeConductor(Conductor *conductor)
}
/**
@brief Terminal::paint
Fonction de dessin des bornes
@param p Le QPainter a utiliser
@param options Les options de dessin
@ -405,6 +406,7 @@ QLineF Terminal::HelpLine() const
}
/**
@brief Terminal::boundingRect
@return Le rectangle (en precision flottante) delimitant la borne et ses alentours.
*/
QRectF Terminal::boundingRect() const {
@ -485,6 +487,7 @@ Terminal* Terminal::alignedWithTerminal() const
}
/**
@brief Terminal::hoverEnterEvent
Gere l'entree de la souris sur la zone de la Borne.
*/
void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
@ -493,12 +496,14 @@ void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
}
/**
@brief Terminal::hoverMoveEvent
Gere les mouvements de la souris sur la zone de la Borne.
*/
void Terminal::hoverMoveEvent(QGraphicsSceneHoverEvent *) {
}
/**
@brief Terminal::hoverLeaveEvent
Gere le fait que la souris sorte de la zone de la Borne.
*/
void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
@ -507,6 +512,7 @@ void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
}
/**
@brief Terminal::mousePressEvent
Gere le fait qu'on enfonce un bouton de la souris sur la Borne.
@param e L'evenement souris correspondant
*/
@ -520,6 +526,7 @@ void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) {
}
/**
@brief Terminal::mouseMoveEvent
Gere le fait qu'on bouge la souris sur la Borne.
@param e L'evenement souris correspondant
*/
@ -660,6 +667,7 @@ void Terminal::updateConductor() {
}
/**
@brief Terminal::isLinkedTo
@param other_terminal Autre borne
@return true si cette borne est reliee a other_terminal, false sion
*/
@ -695,6 +703,7 @@ bool Terminal::canBeLinkedTo(Terminal *other_terminal)
}
/**
@brief Terminal::conductors
@return La liste des conducteurs lies a cette borne
*/
QList<Conductor *> Terminal::conductors() const {
@ -702,6 +711,7 @@ QList<Conductor *> Terminal::conductors() const {
}
/**
@brief Terminal::toXml
Methode d'export en XML
@param doc Le Document XML a utiliser pour creer l'element XML
@return un QDomElement representant cette borne
@ -718,6 +728,7 @@ QDomElement Terminal::toXml(QDomDocument &doc) const {
}
/**
@brief Terminal::valideXml
Permet de savoir si un element XML represente une borne
@param terminal Le QDomElement a analyser
@return true si le QDomElement passe en parametre est une borne, false sinon
@ -754,9 +765,12 @@ bool Terminal::valideXml(QDomElement &terminal) {
}
/**
Permet de savoir si un element XML represente cette borne. Attention, l'element XML n'est pas verifie
@brief Terminal::fromXml
Permet de savoir si un element XML represente cette borne. Attention,
l'element XML n'est pas verifie
@param terminal Le QDomElement a analyser
@return true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon
@return true si la borne "se reconnait"
(memes coordonnes, meme orientation), false sinon
*/
bool Terminal::fromXml(QDomElement &terminal) {
number_terminal_ = terminal.attribute("number");
@ -771,6 +785,7 @@ bool Terminal::fromXml(QDomElement &terminal) {
}
/**
@brief Terminal::dockConductor
@return the position, relative to the scene, of the docking point for
conductors.
*/
@ -779,13 +794,16 @@ QPointF Terminal::dockConductor() const {
}
/**
@return le Diagram auquel cette borne appartient, ou 0 si cette borne est independant
@brief Terminal::diagram
@return le Diagram auquel cette borne appartient,
ou 0 si cette borne est independant
*/
Diagram *Terminal::diagram() const {
return(qobject_cast<Diagram *>(scene()));
}
/**
@brief Terminal::parentElement
@return L'element auquel cette borne est rattachee
*/
Element *Terminal::parentElement() const {

View File

@ -26,6 +26,7 @@ class Element;
class TerminalData;
/**
@brief The Terminal class
This class represents a terminal of an electrical element, i.e. a possible
plug point for conductors.
This class handles all mouse events for connecting conductors
@ -51,8 +52,12 @@ class Terminal : public QGraphicsObject
// methods
public:
//Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into a Terminal
//@return the QGraphicsItem type
/**
@brief type
Enable the use of qgraphicsitem_cast to safely
cast a QGraphicsItem into a Terminal
@return the QGraphicsItem type
*/
int type() const override { return Type; }
void paint (QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
@ -146,6 +151,7 @@ class Terminal : public QGraphicsObject
};
/**
@brief Terminal::conductorsCount
@return the number of conductors attached to the terminal.
*/
inline int Terminal::conductorsCount() const {
@ -153,6 +159,7 @@ inline int Terminal::conductorsCount() const {
}
/**
@brief Terminal::number
@return the number of terminal.
*/
inline QString Terminal::number() const {

View File

@ -19,10 +19,20 @@
#include "singleapplication.h"
#include <QFileOpenEvent>
/**
@brief MacOSXOpenEvent::MacOSXOpenEvent
@param parent
*/
MacOSXOpenEvent::MacOSXOpenEvent(QObject *parent) :
QObject(parent)
{}
/**
@brief MacOSXOpenEvent::eventFilter
@param watched
@param event
@return bool
*/
bool MacOSXOpenEvent::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::FileOpen)

View File

@ -19,6 +19,11 @@
#include <QString>
#include <QStringList>
/**
@brief QETUtils::marginsToString
@param margins
@return QString str "left;top;right;bottom"
*/
QString QETUtils::marginsToString(const QMargins &margins)
{
QString str;
@ -33,6 +38,11 @@ QString QETUtils::marginsToString(const QMargins &margins)
return str;
}
/**
@brief QETUtils::marginsFromString
@param string
@return QMargins margins
*/
QMargins QETUtils::marginsFromString(const QString &string)
{
QMargins margins;