QElectroTech  0.70
Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QTextOrientationWidget Class Reference

#include <qtextorientationwidget.h>

Public Slots

void setOrientation (const double &)
 

Signals

void orientationChanged (double)
 

Public Member Functions

 QTextOrientationWidget (QWidget *=nullptr)
 
 ~QTextOrientationWidget () override
 
double orientation () const
 
void setFont (const QFont &)
 
QFont font () const
 
void setDisplayText (bool)
 
bool textDisplayed () const
 
void setUsableTexts (const QStringList &)
 
QStringList usableTexts () const
 
bool isReadOnly () const
 
void setReadOnly (bool)
 

Protected Member Functions

QSize sizeHint () const override
 
int heightForWidth (int) const override
 
void paintEvent (QPaintEvent *) override
 
void mouseMoveEvent (QMouseEvent *) override
 
void mouseReleaseEvent (QMouseEvent *) override
 

Private Member Functions

 QTextOrientationWidget (const QTextOrientationWidget &)
 
QTextOrientationWidgetoperator= (const QTextOrientationWidget &)
 
QString getMostUsableStringForRadius (const qreal &)
 
void generateTextSizeHash ()
 
bool positionIsASquare (const QPointF &, double *=nullptr)
 

Private Attributes

double squares_interval_
 Interval between commonly used angles (represented by squares), in degrees. More...
 
double current_orientation_
 current angle More...
 
bool display_text_
 Whether to display an example text. More...
 
QFont text_font_
 Font used to render the example text. More...
 
QHash< QString, qreal > text_size_hash_
 Associate available example texts with their length (in pixels) More...
 
double highlight_angle_
 Specific angle to be highlighted. More...
 
bool must_highlight_angle_
 Whether to highlight a specific angle. More...
 
bool read_only_
 Whether this widget is read only. More...
 

Detailed Description

This class provides a visual representation of a text orientation.

Definition at line 24 of file qtextorientationwidget.h.

Constructor & Destructor Documentation

◆ QTextOrientationWidget() [1/2]

QTextOrientationWidget::QTextOrientationWidget ( QWidget *  parent = nullptr)

Constructeur Par defaut, ce widget met en valeur les angles multiples de 45 degres et presente un texte oriente a 0 degre, avec la police par defaut de l'application. Le texte affiche est

Parameters
parentWidget parent

Definition at line 28 of file qtextorientationwidget.cpp.

References text_size_hash_, and QET::Icons::tr.

◆ ~QTextOrientationWidget()

QTextOrientationWidget::~QTextOrientationWidget ( )
override

Destructeur

Definition at line 55 of file qtextorientationwidget.cpp.

◆ QTextOrientationWidget() [2/2]

QTextOrientationWidget::QTextOrientationWidget ( const QTextOrientationWidget )
private

Member Function Documentation

◆ font()

QFont QTextOrientationWidget::font ( ) const
Returns
la police utilisee pour le texte affiche

Definition at line 93 of file qtextorientationwidget.cpp.

References text_font_.

Referenced by setFont().

◆ generateTextSizeHash()

void QTextOrientationWidget::generateTextSizeHash ( )
private

S'assure que le hash associant les textes utilisables a leur taille soit correctement rempli.

Definition at line 307 of file qtextorientationwidget.cpp.

References text_font_, and text_size_hash_.

Referenced by getMostUsableStringForRadius().

◆ getMostUsableStringForRadius()

QString QTextOrientationWidget::getMostUsableStringForRadius ( const qreal &  radius)
private
Parameters
radiusRayon du cercle qui limitera le rendu du texte
Returns
la chaine la plus appropriee en fonction de la taille du widget.

Definition at line 280 of file qtextorientationwidget.cpp.

References generateTextSizeHash(), and text_size_hash_.

Referenced by paintEvent().

◆ heightForWidth()

int QTextOrientationWidget::heightForWidth ( int  w) const
overrideprotected
Parameters
wune largeur donnee
Returns
la hauteur preferee pour une largeur donnee Pour ce widget : retourne la largeur fournie afin de maintenir le widget carre

Definition at line 170 of file qtextorientationwidget.cpp.

◆ isReadOnly()

bool QTextOrientationWidget::isReadOnly ( ) const
Returns
true si le widget est en mode "lecture seule", false sinon

Definition at line 147 of file qtextorientationwidget.cpp.

References read_only_.

◆ mouseMoveEvent()

void QTextOrientationWidget::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Gere les mouvements de la souris sur ce widget

Parameters
eventEvenement decrivant le mouvement de la souris

Definition at line 247 of file qtextorientationwidget.cpp.

References highlight_angle_, must_highlight_angle_, positionIsASquare(), and read_only_.

◆ mouseReleaseEvent()

void QTextOrientationWidget::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Gere les relachements de la souris sur ce widget

Parameters
eventEvenement decrivant le relachement de la souris

Definition at line 262 of file qtextorientationwidget.cpp.

References must_highlight_angle_, orientationChanged(), positionIsASquare(), read_only_, and setOrientation().

◆ operator=()

QTextOrientationWidget& QTextOrientationWidget::operator= ( const QTextOrientationWidget )
private

◆ orientation()

double QTextOrientationWidget::orientation ( ) const
Returns
l'orientation / l'angle actuellement selectionne(e) 0 degre correspond a un texte horizontal, de gauche a droite 90 degres correspondent a un texte vertical de haut en bas

Definition at line 73 of file qtextorientationwidget.cpp.

References current_orientation_.

◆ orientationChanged

void QTextOrientationWidget::orientationChanged ( double  )
signal

Signal emitted when users specify an orientation by clicking the widget.

Referenced by mouseReleaseEvent().

◆ paintEvent()

void QTextOrientationWidget::paintEvent ( QPaintEvent *  event)
overrideprotected

Effectue le rendu du widget

Parameters
eventEvenement decrivant la demande de rendu du widget

Definition at line 178 of file qtextorientationwidget.cpp.

References current_orientation_, display_text_, getMostUsableStringForRadius(), highlight_angle_, must_highlight_angle_, squares_interval_, and text_font_.

◆ positionIsASquare()

bool QTextOrientationWidget::positionIsASquare ( const QPointF &  pos,
double *  angle_value_ptr = nullptr 
)
private

Determine si une position donnee correspond a un des carres representant un angle pertinent.

Parameters
posPosition donnee
angle_value_ptrSi different de 0, le double pointe par ce parametre vaudra l'angle pertinent concerne

Definition at line 323 of file qtextorientationwidget.cpp.

References squares_interval_.

Referenced by mouseMoveEvent(), and mouseReleaseEvent().

◆ setDisplayText()

void QTextOrientationWidget::setDisplayText ( bool  display_text)
Parameters
display_texttrue pour afficher un texte, false sinon

Definition at line 100 of file qtextorientationwidget.cpp.

References display_text_.

◆ setFont()

void QTextOrientationWidget::setFont ( const QFont &  font)

Definit la police de caracteres a utiliser pour le texte affiche

Parameters
fontUne police de caracteres

Definition at line 81 of file qtextorientationwidget.cpp.

References font(), text_font_, and text_size_hash_.

◆ setOrientation

void QTextOrientationWidget::setOrientation ( const double &  angle)
slot
Parameters
anglela nouvelle orientation / le nouvel angle selectionne(e) 0 degre correspond a un texte horizontal, de gauche a droite 90 degres correspondent a un texte vertical de haut en bas

Definition at line 63 of file qtextorientationwidget.cpp.

References current_orientation_.

Referenced by mouseReleaseEvent().

◆ setReadOnly()

void QTextOrientationWidget::setReadOnly ( bool  ro)
Parameters
rotrue pour passer le widget en mode "lecture seule", false sinon

Definition at line 154 of file qtextorientationwidget.cpp.

References read_only_, and QET::Icons::ro.

◆ setUsableTexts()

void QTextOrientationWidget::setUsableTexts ( const QStringList &  texts_list)
Parameters
texts_listUne liste de chaines de caracteres utilisables par le widget afin d'afficher un texte en guise d'exemple. Le widget choisit la chaine la plus appropriee en fonction de sa taille. Note : la liste fournie ne doit pas etre vide. Utilisez setDisplayText si vous ne voulez plus afficher de texte.

Definition at line 118 of file qtextorientationwidget.cpp.

References text_size_hash_.

◆ sizeHint()

QSize QTextOrientationWidget::sizeHint ( ) const
overrideprotected
Returns
la taille recommandee pour ce widget

Definition at line 161 of file qtextorientationwidget.cpp.

◆ textDisplayed()

bool QTextOrientationWidget::textDisplayed ( ) const
Returns
la police utilisee pour le texte affiche

Definition at line 107 of file qtextorientationwidget.cpp.

References display_text_.

◆ usableTexts()

QStringList QTextOrientationWidget::usableTexts ( ) const
Returns
la liste des chaines dont le widget dispose pour afficher un texte

Definition at line 140 of file qtextorientationwidget.cpp.

References text_size_hash_.

Member Data Documentation

◆ current_orientation_

double QTextOrientationWidget::current_orientation_
private

current angle

Definition at line 68 of file qtextorientationwidget.h.

Referenced by orientation(), paintEvent(), and setOrientation().

◆ display_text_

bool QTextOrientationWidget::display_text_
private

Whether to display an example text.

Definition at line 70 of file qtextorientationwidget.h.

Referenced by paintEvent(), setDisplayText(), and textDisplayed().

◆ highlight_angle_

double QTextOrientationWidget::highlight_angle_
private

Specific angle to be highlighted.

Definition at line 76 of file qtextorientationwidget.h.

Referenced by mouseMoveEvent(), and paintEvent().

◆ must_highlight_angle_

bool QTextOrientationWidget::must_highlight_angle_
private

Whether to highlight a specific angle.

Definition at line 78 of file qtextorientationwidget.h.

Referenced by mouseMoveEvent(), mouseReleaseEvent(), and paintEvent().

◆ read_only_

bool QTextOrientationWidget::read_only_
private

Whether this widget is read only.

Definition at line 80 of file qtextorientationwidget.h.

Referenced by isReadOnly(), mouseMoveEvent(), mouseReleaseEvent(), and setReadOnly().

◆ squares_interval_

double QTextOrientationWidget::squares_interval_
private

Interval between commonly used angles (represented by squares), in degrees.

Definition at line 66 of file qtextorientationwidget.h.

Referenced by paintEvent(), and positionIsASquare().

◆ text_font_

QFont QTextOrientationWidget::text_font_
private

Font used to render the example text.

Definition at line 72 of file qtextorientationwidget.h.

Referenced by font(), generateTextSizeHash(), paintEvent(), and setFont().

◆ text_size_hash_

QHash<QString, qreal> QTextOrientationWidget::text_size_hash_
private

Associate available example texts with their length (in pixels)

Definition at line 74 of file qtextorientationwidget.h.

Referenced by generateTextSizeHash(), getMostUsableStringForRadius(), QTextOrientationWidget(), setFont(), setUsableTexts(), and usableTexts().


The documentation for this class was generated from the following files: