QCPBarsGroup

Search for usage in LXR

Inheritance diagram for QCPBarsGroup:

Public Types

enum  SpacingType { stAbsolute , stAxisRectRatio , stPlotCoords }
 

Public Member Functions

 QCPBarsGroup (QCustomPlot *parentPlot)
 
void append (QCPBars *bars)
 
QList< QCPBars * > bars () const
 
QCPBarsbars (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< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
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 QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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
 
qobject_cast (const QObject *object)
 
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)
 
QThreadthread () 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
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

QList< QCPBars * > mBars
 
QCustomPlotmParentPlot
 
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)
 
- Public Attributes inherited from QObject
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
Enumerator
stAbsolute 

Bar spacing is in absolute pixels.

stAxisRectRatio 

Bar spacing is given by a fraction of the axis rect size.

stPlotCoords 

Bar spacing is in key coordinates and thus scales with the key axis range.

Definition at line 5673 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPBarsGroup()

QCPBarsGroup::QCPBarsGroup ( QCustomPlot * parentPlot)
explicit

Constructs a new bars group for the specified QCustomPlot instance.

Definition at line 24008 of file qcustomplot.cpp.

◆ ~QCPBarsGroup()

QCPBarsGroup::~QCPBarsGroup ( )
virtual

Definition at line 24016 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.

See also
insert, remove

Definition at line 24080 of file qcustomplot.cpp.

◆ bars() [1/2]

QList< QCPBars * > QCPBarsGroup::bars ( ) const
inline

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

Returns the QCPBars instance with the specified index in this group. If no such QCPBars exists, returns nullptr.

See also
bars(), size

Definition at line 24050 of file qcustomplot.cpp.

◆ clear()

void QCPBarsGroup::clear ( )

Removes all QCPBars plottables from this group.

See also
isEmpty

Definition at line 24067 of file qcustomplot.cpp.

◆ contains()

bool QCPBarsGroup::contains ( QCPBars * bars) const
inline

Returns whether the specified bars plottable is part of this group.

Definition at line 5696 of file qcustomplot.h.

◆ getPixelSpacing()

double QCPBarsGroup::getPixelSpacing ( const QCPBars * bars,
double keyCoord )
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.

See also
append, remove

Definition at line 24103 of file qcustomplot.cpp.

◆ isEmpty()

bool QCPBarsGroup::isEmpty ( ) const
inline

Returns whether this bars group is empty.

See also
size

Definition at line 5694 of file qcustomplot.h.

◆ keyPixelOffset()

double QCPBarsGroup::keyPixelOffset ( const QCPBars * bars,
double keyCoord )
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()

void QCPBarsGroup::registerBars ( QCPBars * bars)
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.

See also
contains, clear

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()

int QCPBarsGroup::size ( ) const
inline

Returns the number of QCPBars plottables that are part of this group.

Definition at line 5693 of file qcustomplot.h.

◆ spacing()

double QCPBarsGroup::spacing ( ) const
inline

Definition at line 5684 of file qcustomplot.h.

◆ spacingType()

SpacingType QCPBarsGroup::spacingType ( ) const
inline

Definition at line 5683 of file qcustomplot.h.

◆ unregisterBars()

void QCPBarsGroup::unregisterBars ( QCPBars * bars)
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.

Member Data Documentation

◆ mBars

QList<QCPBars*> QCPBarsGroup::mBars
protected

Definition at line 5706 of file qcustomplot.h.

◆ mParentPlot

QCustomPlot* QCPBarsGroup::mParentPlot
protected

Definition at line 5703 of file qcustomplot.h.

◆ mSpacing

double QCPBarsGroup::mSpacing
protected

Definition at line 5705 of file qcustomplot.h.

◆ mSpacingType

SpacingType QCPBarsGroup::mSpacingType
protected

Definition at line 5704 of file qcustomplot.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.