A layout element displaying a text. More...
#include <qcustomplot.h>
Signals | |
void | clicked (QMouseEvent *event) |
void | doubleClicked (QMouseEvent *event) |
void | selectableChanged (bool selectable) |
void | selectionChanged (bool selected) |
![]() | |
void | layerChanged (QCPLayer *newLayer) |
Public Member Functions | |
QFont | font () const |
virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE |
virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE |
virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE |
QCPTextElement (QCustomPlot *parentPlot) | |
QCPTextElement (QCustomPlot *parentPlot, const QString &text) | |
QCPTextElement (QCustomPlot *parentPlot, const QString &text, double pointSize) | |
QCPTextElement (QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize) | |
QCPTextElement (QCustomPlot *parentPlot, const QString &text, const QFont &font) | |
bool | selectable () const |
bool | selected () const |
QFont | selectedFont () const |
QColor | selectedTextColor () const |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
void | setFont (const QFont &font) |
Q_SLOT void | setSelectable (bool selectable) |
Q_SLOT void | setSelected (bool selected) |
void | setSelectedFont (const QFont &font) |
void | setSelectedTextColor (const QColor &color) |
void | setText (const QString &text) |
void | setTextColor (const QColor &color) |
void | setTextFlags (int flags) |
QString | text () const |
QColor | textColor () const |
int | textFlags () const |
![]() | |
QCP::MarginSides | autoMargins () const |
virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
QCPLayout * | layout () const |
QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
QMargins | margins () const |
QSize | maximumSize () const |
QMargins | minimumMargins () const |
QSize | minimumSize () const |
QRect | outerRect () const |
QCPLayoutElement (QCustomPlot *parentPlot=0) | |
QRect | rect () const |
void | setAutoMargins (QCP::MarginSides sides) |
void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
void | setMargins (const QMargins &margins) |
void | setMaximumSize (const QSize &size) |
void | setMaximumSize (int width, int height) |
void | setMinimumMargins (const QMargins &margins) |
void | setMinimumSize (const QSize &size) |
void | setMinimumSize (int width, int height) |
void | setOuterRect (const QRect &rect) |
void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
SizeConstraintRect | sizeConstraintRect () const |
virtual void | update (UpdatePhase phase) |
virtual | ~QCPLayoutElement () |
![]() | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
bool | setLayer (const QString &layerName) |
void | setVisible (bool on) |
bool | visible () const |
virtual | ~QCPLayerable () |
Protected Member Functions | |
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
virtual void | deselectEvent (bool *selectionStateChanged) Q_DECL_OVERRIDE |
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
QFont | mainFont () const |
QColor | mainTextColor () const |
virtual QSize | maximumOuterSizeHint () const Q_DECL_OVERRIDE |
virtual QSize | minimumOuterSizeHint () const Q_DECL_OVERRIDE |
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE |
![]() | |
virtual int | calculateAutoMargin (QCP::MarginSide side) |
virtual void | layoutChanged () |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
![]() | |
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
virtual QRect | clipRect () const |
void | initializeParentPlot (QCustomPlot *parentPlot) |
virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
bool | moveToLayer (QCPLayer *layer, bool prepend) |
virtual QCP::Interaction | selectionCategory () const |
void | setParentLayerable (QCPLayerable *parentLayerable) |
virtual void | wheelEvent (QWheelEvent *event) |
Protected Attributes | |
QFont | mFont |
bool | mSelectable |
bool | mSelected |
QFont | mSelectedFont |
QColor | mSelectedTextColor |
QString | mText |
QRect | mTextBoundingRect |
QColor | mTextColor |
int | mTextFlags |
![]() | |
QCP::MarginSides | mAutoMargins |
QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
QMargins | mMargins |
QSize | mMaximumSize |
QMargins | mMinimumMargins |
QSize | mMinimumSize |
QRect | mOuterRect |
QCPLayout * | mParentLayout |
QRect | mRect |
SizeConstraintRect | mSizeConstraintRect |
![]() | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
Additional Inherited Members | |
![]() | |
enum | SizeConstraintRect { scrInnerRect, scrOuterRect } |
enum | UpdatePhase { upPreparation, upMargins, upLayout } |
A layout element displaying a text.
The text may be specified with setText, the formatting can be controlled with setFont, setTextColor, and setTextFlags.
A text element can be added as follows:
Definition at line 4937 of file qcustomplot.h.
|
explicit |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Creates a new QCPTextElement instance and sets default values. The initial text is empty (setText).
Definition at line 18925 of file qcustomplot.cpp.
QCPTextElement::QCPTextElement | ( | QCustomPlot * | parentPlot, |
const QString & | text | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Creates a new QCPTextElement instance and sets default values.
The initial text is set to text.
Definition at line 18950 of file qcustomplot.cpp.
QCPTextElement::QCPTextElement | ( | QCustomPlot * | parentPlot, |
const QString & | text, | ||
double | pointSize | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Creates a new QCPTextElement instance and sets default values.
The initial text is set to text with pointSize.
Definition at line 18975 of file qcustomplot.cpp.
QCPTextElement::QCPTextElement | ( | QCustomPlot * | parentPlot, |
const QString & | text, | ||
const QString & | fontFamily, | ||
double | pointSize | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Creates a new QCPTextElement instance and sets default values.
The initial text is set to text with pointSize and the specified fontFamily.
Definition at line 19002 of file qcustomplot.cpp.
QCPTextElement::QCPTextElement | ( | QCustomPlot * | parentPlot, |
const QString & | text, | ||
const QFont & | font | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Creates a new QCPTextElement instance and sets default values.
The initial text is set to text with the specified font.
Definition at line 19022 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPLayoutElement.
Definition at line 19143 of file qcustomplot.cpp.
|
signal |
This signal is emitted when the text element is clicked.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Definition at line 19191 of file qcustomplot.cpp.
|
signal |
This signal is emitted when the text element is double clicked.
|
protectedvirtual |
Reimplemented from QCPLayoutElement.
Definition at line 19149 of file qcustomplot.cpp.
|
inline |
Definition at line 4959 of file qcustomplot.h.
|
protected |
Definition at line 19264 of file qcustomplot.cpp.
|
protected |
Definition at line 19274 of file qcustomplot.cpp.
|
protectedvirtual |
Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
if a maximum size (setMaximumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMaximumOuterSize) to determine the maximum allowed size of this layout element.
A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX
.
The default implementation simply returns QWIDGETSIZE_MAX
for both width and height, implying no suggested maximum size. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented from QCPLayoutElement.
Definition at line 19167 of file qcustomplot.cpp.
|
protectedvirtual |
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
A manual minimum size is considered set if it is non-zero.
The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented from QCPLayoutElement.
Definition at line 19157 of file qcustomplot.cpp.
|
virtual |
Emits the doubleClicked signal.
Reimplemented from QCPLayerable.
Definition at line 19253 of file qcustomplot.cpp.
|
virtual |
Accepts the mouse event in order to emit the according click signal in the mouseReleaseEvent.
Reimplemented from QCPLayerable.
Definition at line 19230 of file qcustomplot.cpp.
|
virtual |
Emits the clicked signal if the cursor hasn't moved by more than a few pixels since the mousePressEvent.
Reimplemented from QCPLayerable.
Definition at line 19242 of file qcustomplot.cpp.
|
inline |
Definition at line 4963 of file qcustomplot.h.
|
signal |
|
inline |
Definition at line 4964 of file qcustomplot.h.
|
inline |
Definition at line 4961 of file qcustomplot.h.
|
inline |
Definition at line 4962 of file qcustomplot.h.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Definition at line 19177 of file qcustomplot.cpp.
|
signal |
This signal is emitted when the selection state has changed to selected, either by user interaction or by a direct call to setSelected.
|
virtual |
Returns 0.99*selectionTolerance (see QCustomPlot::setSelectionTolerance) when pos is within the bounding box of the text element's text. Note that this bounding box is updated in the draw call.
If pos is outside the text's bounding box or if onlySelectable is true and this text element is not selectable (setSelectable), returns -1.
Reimplemented from QCPLayoutElement.
Definition at line 19212 of file qcustomplot.cpp.
void QCPTextElement::setFont | ( | const QFont & | font | ) |
Sets the font of the text.
Definition at line 19076 of file qcustomplot.cpp.
void QCPTextElement::setSelectable | ( | bool | selectable | ) |
Sets whether the user may select this text element.
Note that even when selectable is set to false
, the selection state may be changed programmatically via setSelected.
Definition at line 19117 of file qcustomplot.cpp.
void QCPTextElement::setSelected | ( | bool | selected | ) |
Sets the selection state of this text element to selected. If the selection has changed, selectionChanged is emitted.
Note that this function can change the selection state independently of the current setSelectable state.
Definition at line 19133 of file qcustomplot.cpp.
void QCPTextElement::setSelectedFont | ( | const QFont & | font | ) |
Sets the font of the text that will be used if the text element is selected (setSelected).
Definition at line 19096 of file qcustomplot.cpp.
void QCPTextElement::setSelectedTextColor | ( | const QColor & | color | ) |
Sets the color of the text that will be used if the text element is selected (setSelected).
Definition at line 19106 of file qcustomplot.cpp.
void QCPTextElement::setText | ( | const QString & | text | ) |
Sets the text that will be displayed to text. Multiple lines can be created by insertion of "\n".
Definition at line 19041 of file qcustomplot.cpp.
void QCPTextElement::setTextColor | ( | const QColor & | color | ) |
Sets the color of the text.
Definition at line 19086 of file qcustomplot.cpp.
void QCPTextElement::setTextFlags | ( | int | flags | ) |
Sets options for text alignment and wrapping behaviour. flags is a bitwise OR-combination of Qt::AlignmentFlag
and Qt::TextFlag
enums.
Possible enums are:
Definition at line 19066 of file qcustomplot.cpp.
|
inline |
Definition at line 4957 of file qcustomplot.h.
|
inline |
Definition at line 4960 of file qcustomplot.h.
|
inline |
Definition at line 4958 of file qcustomplot.h.
|
protected |
Definition at line 4992 of file qcustomplot.h.
|
protected |
Definition at line 4997 of file qcustomplot.h.
|
protected |
Definition at line 4997 of file qcustomplot.h.
|
protected |
Definition at line 4994 of file qcustomplot.h.
|
protected |
Definition at line 4995 of file qcustomplot.h.
|
protected |
Definition at line 4990 of file qcustomplot.h.
|
protected |
Definition at line 4996 of file qcustomplot.h.
|
protected |
Definition at line 4993 of file qcustomplot.h.
|
protected |
Definition at line 4991 of file qcustomplot.h.