From: Arnaud Giersch Date: Fri, 3 Dec 2010 08:44:15 +0000 (+0100) Subject: Add methods setAntialiasing and setPenWidth. X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/graphlib.git/commitdiff_plain/82eedfb6e65f90d4d5eed986d66818272886c6c2 Add methods setAntialiasing and setPenWidth. Thanks to Yoann Blein for his suggestion. --- diff --git a/CHANGES b/CHANGES index b44444b..951c20a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +-- ven., 03 déc. 2010 09:34:15 +0100 + + * Ajout des méthodes setAntialiasing et setPenWidth. + Merci à Yoann Blein pour sa suggestion. + -- mer., 01 déc. 2010 12:11:36 +0100 * Autorise un paramètre de type std::string pour drawText et drawTextBg. diff --git a/DrawingWindow.cpp b/DrawingWindow.cpp index dac4246..db33a3f 100644 --- a/DrawingWindow.cpp +++ b/DrawingWindow.cpp @@ -345,6 +345,19 @@ void DrawingWindow::setBgColor(float red, float green, float blue) setBgColor(QColor::fromRgbF(red, green, blue)); } +//! Change l'épaisseur du pinceau +/*! + * Le pinceau à une épaisseur de 1 par défaut. + * + * \param width épaisseur du pinceau + */ +void DrawingWindow::setPenWidth(int width) +{ + QPen pen(painter->pen()); + pen.setWidth(width); + painter->setPen(pen); +} + //! Retourne la fonte courante utilisée pour dessiner du texte. /*! * \see QFont, setFont @@ -363,6 +376,20 @@ void DrawingWindow::setFont(const QFont &font) painter->setFont(font); } +//! Active ou non l'antialiasing. +/*! + * Permet de lisser le dessin. + * Fonctionnalité désactivée par défaut. + * + * \param state état de l'antialiasing + * + * \bug expérimental + */ +void DrawingWindow::setAntialiasing(bool state) +{ + painter->setRenderHint(QPainter::Antialiasing, state); +} + //! Efface la fenêtre. /*! * La fenêtre est effacée avec la couleur de fond courante. diff --git a/DrawingWindow.h b/DrawingWindow.h index c38d9bd..4a9b9df 100644 --- a/DrawingWindow.h +++ b/DrawingWindow.h @@ -45,9 +45,13 @@ public: void setBgColor(const char *name); void setBgColor(float red, float green, float blue); + void setPenWidth(int width); + const QFont &getFont() const; void setFont(const QFont &font); + void setAntialiasing(bool state); + void clearGraph(); void drawPoint(int x, int y);