QElectroTech
0.70
|
#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 &) | |
QTextOrientationWidget & | operator= (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... | |
This class provides a visual representation of a text orientation.
Definition at line 24 of file qtextorientationwidget.h.
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
parent | Widget parent |
Definition at line 28 of file qtextorientationwidget.cpp.
References text_size_hash_, and QET::Icons::tr.
|
override |
Destructeur
Definition at line 55 of file qtextorientationwidget.cpp.
|
private |
QFont QTextOrientationWidget::font | ( | ) | const |
Definition at line 93 of file qtextorientationwidget.cpp.
References text_font_.
Referenced by setFont().
|
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().
|
private |
radius | Rayon du cercle qui limitera le rendu du texte |
Definition at line 280 of file qtextorientationwidget.cpp.
References generateTextSizeHash(), and text_size_hash_.
Referenced by paintEvent().
|
overrideprotected |
w | une largeur donnee |
Definition at line 170 of file qtextorientationwidget.cpp.
bool QTextOrientationWidget::isReadOnly | ( | ) | const |
Definition at line 147 of file qtextorientationwidget.cpp.
References read_only_.
|
overrideprotected |
Gere les mouvements de la souris sur ce widget
event | Evenement decrivant le mouvement de la souris |
Definition at line 247 of file qtextorientationwidget.cpp.
References highlight_angle_, must_highlight_angle_, positionIsASquare(), and read_only_.
|
overrideprotected |
Gere les relachements de la souris sur ce widget
event | Evenement decrivant le relachement de la souris |
Definition at line 262 of file qtextorientationwidget.cpp.
References must_highlight_angle_, orientationChanged(), positionIsASquare(), read_only_, and setOrientation().
|
private |
double QTextOrientationWidget::orientation | ( | ) | const |
Definition at line 73 of file qtextorientationwidget.cpp.
References current_orientation_.
|
signal |
Signal emitted when users specify an orientation by clicking the widget.
Referenced by mouseReleaseEvent().
|
overrideprotected |
Effectue le rendu du widget
event | Evenement 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_.
|
private |
Determine si une position donnee correspond a un des carres representant un angle pertinent.
pos | Position donnee |
angle_value_ptr | Si 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().
void QTextOrientationWidget::setDisplayText | ( | bool | display_text | ) |
display_text | true pour afficher un texte, false sinon |
Definition at line 100 of file qtextorientationwidget.cpp.
References display_text_.
void QTextOrientationWidget::setFont | ( | const QFont & | font | ) |
Definit la police de caracteres a utiliser pour le texte affiche
font | Une police de caracteres |
Definition at line 81 of file qtextorientationwidget.cpp.
References font(), text_font_, and text_size_hash_.
|
slot |
angle | la 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().
void QTextOrientationWidget::setReadOnly | ( | bool | ro | ) |
ro | true 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.
void QTextOrientationWidget::setUsableTexts | ( | const QStringList & | texts_list | ) |
texts_list | Une 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_.
|
overrideprotected |
Definition at line 161 of file qtextorientationwidget.cpp.
bool QTextOrientationWidget::textDisplayed | ( | ) | const |
Definition at line 107 of file qtextorientationwidget.cpp.
References display_text_.
QStringList QTextOrientationWidget::usableTexts | ( | ) | const |
Definition at line 140 of file qtextorientationwidget.cpp.
References text_size_hash_.
|
private |
current angle
Definition at line 68 of file qtextorientationwidget.h.
Referenced by orientation(), paintEvent(), and setOrientation().
|
private |
Whether to display an example text.
Definition at line 70 of file qtextorientationwidget.h.
Referenced by paintEvent(), setDisplayText(), and textDisplayed().
|
private |
Specific angle to be highlighted.
Definition at line 76 of file qtextorientationwidget.h.
Referenced by mouseMoveEvent(), and paintEvent().
|
private |
Whether to highlight a specific angle.
Definition at line 78 of file qtextorientationwidget.h.
Referenced by mouseMoveEvent(), mouseReleaseEvent(), and paintEvent().
|
private |
Whether this widget is read only.
Definition at line 80 of file qtextorientationwidget.h.
Referenced by isReadOnly(), mouseMoveEvent(), mouseReleaseEvent(), and setReadOnly().
|
private |
Interval between commonly used angles (represented by squares), in degrees.
Definition at line 66 of file qtextorientationwidget.h.
Referenced by paintEvent(), and positionIsASquare().
|
private |
Font used to render the example text.
Definition at line 72 of file qtextorientationwidget.h.
Referenced by font(), generateTextSizeHash(), paintEvent(), and setFont().
|
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().