QCPBarsGroup
Public Types | |
enum | SpacingType { stAbsolute , stAxisRectRatio , stPlotCoords } |
Public Types inherited from QObject | |
typedef | QObjectList |
Public Member Functions | |
QCPBarsGroup (QCustomPlot *parentPlot) | |
void | append (QCPBars *bars) |
QList< QCPBars * > | bars () const |
QCPBars * | bars (int index) const |
void | clear () |
bool | contains (QCPBars *bars) const |
void | insert (int i, QCPBars *bars) |
bool | isEmpty () const |
void | remove (QCPBars *bars) |
void | setSpacing (double spacing) |
void | setSpacingType (SpacingType spacingType) |
int | size () const |
double | spacing () const |
SpacingType | spacingType () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
double | getPixelSpacing (const QCPBars *bars, double keyCoord) |
double | keyPixelOffset (const QCPBars *bars, double keyCoord) |
void | registerBars (QCPBars *bars) |
void | unregisterBars (QCPBars *bars) |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QList< QCPBars * > | mBars |
QCustomPlot * | mParentPlot |
double | mSpacing |
SpacingType | mSpacingType |
Additional Inherited Members | |
Properties inherited from QObject | |
objectName | |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Detailed Description
Groups multiple QCPBars together so they appear side by side.
When showing multiple QCPBars in one plot which have bars at identical keys, it may be desirable to have them appearing next to each other at each key. This is what adding the respective QCPBars plottables to a QCPBarsGroup achieves. (An alternative approach is to stack them on top of each other, see QCPBars::moveAbove.)
Usage
To add a QCPBars plottable to the group, create a new group and then add the respective bars intances:
Alternatively to appending to the group like shown above, you can also set the group on the QCPBars plottable via QCPBars::setBarsGroup.
The spacing between the bars can be configured via setSpacingType and setSpacing. The bars in this group appear in the plot in the order they were appended. To insert a bars plottable at a certain index position, or to reposition a bars plottable which is already in the group, use insert.
To remove specific bars from the group, use either remove or call QCPBars::setBarsGroup(0) on the respective bars plottable.
To clear the entire group, call clear, or simply delete the group.
Example
The image above is generated with the following code:
Definition at line 5717 of file qcustomplot.h.
Member Enumeration Documentation
◆ SpacingType
Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to setSpacing actually means.
- See also
- setSpacingType, setSpacing
Definition at line 5731 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPBarsGroup()
|
explicit |
Constructs a new bars group for the specified QCustomPlot instance.
Definition at line 24030 of file qcustomplot.cpp.
◆ ~QCPBarsGroup()
|
virtual |
Definition at line 24038 of file qcustomplot.cpp.
Member Function Documentation
◆ append()
void QCPBarsGroup::append | ( | QCPBars * | bars | ) |
Adds the specified bars plottable to this group. Alternatively, you can also use QCPBars::setBarsGroup on the bars instance.
Definition at line 24102 of file qcustomplot.cpp.
◆ bars() [1/2]
Returns all bars currently in this group.
- See also
- bars(int index)
Definition at line 5749 of file qcustomplot.h.
◆ bars() [2/2]
QCPBars * QCPBarsGroup::bars | ( | int | index | ) | const |
◆ clear()
void QCPBarsGroup::clear | ( | ) |
Removes all QCPBars plottables from this group.
- See also
- isEmpty
Definition at line 24089 of file qcustomplot.cpp.
◆ contains()
|
inline |
Returns whether the specified bars plottable is part of this group.
Definition at line 5754 of file qcustomplot.h.
◆ getPixelSpacing()
|
protected |
Returns the spacing in pixels which is between this bars and the following one, both at the key coordinate keyCoord.
- Note
- Typically the returned value doesn't depend on bars or keyCoord. bars is only needed to get access to the key axis transformation and axis rect for the modes stAxisRectRatio and stPlotCoords. The keyCoord is only relevant for spacings given in stPlotCoords on a logarithmic axis.
Definition at line 24256 of file qcustomplot.cpp.
◆ insert()
void QCPBarsGroup::insert | ( | int | i, |
QCPBars * | bars ) |
Inserts the specified bars plottable into this group at the specified index position i. This gives you full control over the ordering of the bars.
bars may already be part of this group. In that case, bars is just moved to the new index position.
Definition at line 24125 of file qcustomplot.cpp.
◆ isEmpty()
|
inline |
Returns whether this bars group is empty.
- See also
- size
Definition at line 5752 of file qcustomplot.h.
◆ keyPixelOffset()
|
protected |
Returns the pixel offset in the key dimension the specified bars plottable should have at the given key coordinate keyCoord. The offset is relative to the pixel position of the key coordinate keyCoord.
Definition at line 24190 of file qcustomplot.cpp.
◆ registerBars()
|
protected |
Adds the specified bars to the internal mBars list of bars. This method does not change the barsGroup property on bars.
- See also
- unregisterBars
Definition at line 24166 of file qcustomplot.cpp.
◆ remove()
void QCPBarsGroup::remove | ( | QCPBars * | bars | ) |
Removes the specified bars plottable from this group.
Definition at line 24145 of file qcustomplot.cpp.
◆ setSpacing()
void QCPBarsGroup::setSpacing | ( | double | spacing | ) |
Sets the spacing between adjacent bars. What the number passed as spacing actually means, is defined by the current SpacingType, which can be set with setSpacingType.
- See also
- setSpacingType
Definition at line 24061 of file qcustomplot.cpp.
◆ setSpacingType()
void QCPBarsGroup::setSpacingType | ( | SpacingType | spacingType | ) |
Sets how the spacing between adjacent bars is interpreted. See SpacingType.
The actual spacing can then be specified with setSpacing.
- See also
- setSpacing
Definition at line 24050 of file qcustomplot.cpp.
◆ size()
|
inline |
Returns the number of QCPBars plottables that are part of this group.
Definition at line 5751 of file qcustomplot.h.
◆ spacing()
|
inline |
Definition at line 5742 of file qcustomplot.h.
◆ spacingType()
|
inline |
Definition at line 5741 of file qcustomplot.h.
◆ unregisterBars()
|
protected |
Removes the specified bars from the internal mBars list of bars. This method does not change the barsGroup property on bars.
- See also
- registerBars
Definition at line 24179 of file qcustomplot.cpp.
Member Data Documentation
◆ mBars
Definition at line 5764 of file qcustomplot.h.
◆ mParentPlot
|
protected |
Definition at line 5761 of file qcustomplot.h.
◆ mSpacing
|
protected |
Definition at line 5763 of file qcustomplot.h.
◆ mSpacingType
|
protected |
Definition at line 5762 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.