QCPBarsGroup

Public Types | |
enum | SpacingType { stAbsolute, stAxisRectRatio, stPlotCoords } |
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 |
![]() | |
QObject (QObject *parent) | |
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 () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
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 QRegExp ®Exp, 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 |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
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_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
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 | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
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 | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, 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) |
![]() | |
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 | |
![]() | |
objectName | |
![]() | |
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) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
![]() | |
typedef | QObjectList |
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 5659 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 5673 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPBarsGroup()
|
explicit |
Constructs a new bars group for the specified QCustomPlot instance.
Definition at line 24008 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 24080 of file qcustomplot.cpp.
◆ bars() [1/2]
Returns all bars currently in this group.
- See also
- bars(int index)
Definition at line 5691 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 24067 of file qcustomplot.cpp.
◆ contains()
|
inline |
Returns whether the specified bars plottable is part of this group.
Definition at line 5696 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 24234 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 24103 of file qcustomplot.cpp.
◆ isEmpty()
|
inline |
Returns whether this bars group is empty.
- See also
- size
Definition at line 5694 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 24168 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 24144 of file qcustomplot.cpp.
◆ remove()
void QCPBarsGroup::remove | ( | QCPBars * | bars | ) |
Removes the specified bars plottable from this group.
Definition at line 24123 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 24039 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 24028 of file qcustomplot.cpp.
◆ size()
|
inline |
Returns the number of QCPBars plottables that are part of this group.
Definition at line 5693 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 24157 of file qcustomplot.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 04:05:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.