QCPItemPixmap
Public Attributes | |
QCPItemAnchor *const | bottom |
QCPItemAnchor *const | bottomLeft |
QCPItemPosition *const | bottomRight |
QCPItemAnchor *const | left |
QCPItemAnchor *const | right |
QCPItemAnchor *const | top |
QCPItemPosition *const | topLeft |
QCPItemAnchor *const | topRight |
Public Attributes inherited from QObject | |
typedef | QObjectList |
Protected Types | |
enum | AnchorIndex { aiTop , aiTopRight , aiRight , aiBottom , aiBottomLeft , aiLeft } |
Protected Attributes | |
Qt::AspectRatioMode | mAspectRatioMode |
QPen | mPen |
QPixmap | mPixmap |
bool | mScaled |
QPixmap | mScaledPixmap |
bool | mScaledPixmapInvalidated |
QPen | mSelectedPen |
Qt::TransformationMode | mTransformationMode |
Protected Attributes inherited from QCPAbstractItem | |
QList< QCPItemAnchor * > | mAnchors |
QPointer< QCPAxisRect > | mClipAxisRect |
bool | mClipToAxisRect |
QList< QCPItemPosition * > | mPositions |
bool | mSelectable |
bool | mSelected |
Protected Attributes inherited from QCPLayerable | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
Detailed Description
An arbitrary pixmap.
It has two positions, topLeft and bottomRight, which define the rectangle the pixmap will be drawn in. Depending on the scale setting (setScaled), the pixmap will be either scaled to fit the rectangle or be drawn aligned to the topLeft position.
If scaling is enabled and topLeft is further to the bottom/right than bottomRight (as shown on the right side of the example image), the pixmap will be flipped in the respective orientations.
Definition at line 6726 of file qcustomplot.h.
Member Enumeration Documentation
◆ AnchorIndex
|
protected |
Definition at line 6768 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPItemPixmap()
|
explicit |
Creates a rectangle item and sets default values.
The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
Definition at line 30136 of file qcustomplot.cpp.
◆ ~QCPItemPixmap()
|
overridevirtual |
Definition at line 30158 of file qcustomplot.cpp.
Member Function Documentation
◆ anchorPixelPosition()
|
overrideprotectedvirtual |
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
- See also
- createAnchor
Reimplemented from QCPAbstractItem.
Definition at line 30238 of file qcustomplot.cpp.
◆ aspectRatioMode()
|
inline |
Definition at line 6744 of file qcustomplot.h.
◆ draw()
|
overrideprotectedvirtual |
Draws this item with the provided painter.
The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
Implements QCPAbstractItem.
Definition at line 30216 of file qcustomplot.cpp.
◆ getFinalRect()
|
protected |
Returns the final (tight) rect the pixmap is drawn in, depending on the current item positions and scaling settings.
The output parameters flippedHorz and flippedVert return whether the pixmap should be drawn flipped horizontally or vertically in the returned rect. (The returned rect itself is always normalized, i.e. the top left corner of the rect is actually further to the top/left than the bottom right corner). This is the case when the item position topLeft is further to the bottom/right than bottomRight.
If scaling is disabled, returns a rect with size of the original pixmap and the top left corner aligned with the item position topLeft. The position bottomRight is ignored.
Definition at line 30319 of file qcustomplot.cpp.
◆ mainPen()
|
protected |
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
Definition at line 30372 of file qcustomplot.cpp.
◆ pen()
|
inline |
Definition at line 6746 of file qcustomplot.h.
◆ pixmap()
|
inline |
Definition at line 6742 of file qcustomplot.h.
◆ scaled()
|
inline |
Definition at line 6743 of file qcustomplot.h.
◆ selectedPen()
|
inline |
Definition at line 6747 of file qcustomplot.h.
◆ selectTest()
|
overridevirtual |
This function is used to decide whether a click hits a layerable object or not.
pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/ deselectEvent methods.
details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
You may pass nullptr
as details to indicate that you are not interested in those selection details.
- See also
- selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions, QCPAbstractPlottable1D::selectTestRect
Implements QCPAbstractItem.
Definition at line 30206 of file qcustomplot.cpp.
◆ setPen()
Sets the pen that will be used to draw a border around the pixmap.
- See also
- setSelectedPen, setBrush
Definition at line 30190 of file qcustomplot.cpp.
◆ setPixmap()
Sets the pixmap that will be displayed.
Definition at line 30165 of file qcustomplot.cpp.
◆ setScaled()
void QCPItemPixmap::setScaled | ( | bool | scaled, |
Qt::AspectRatioMode | aspectRatioMode = Qt::KeepAspectRatio, | ||
Qt::TransformationMode | transformationMode = Qt::SmoothTransformation ) |
Sets whether the pixmap will be scaled to fit the rectangle defined by the topLeft and bottomRight positions.
Definition at line 30177 of file qcustomplot.cpp.
◆ setSelectedPen()
Sets the pen that will be used to draw a border around the pixmap when selected
- See also
- setPen, setSelected
Definition at line 30200 of file qcustomplot.cpp.
◆ transformationMode()
|
inline |
Definition at line 6745 of file qcustomplot.h.
◆ updateScaledPixmap()
|
protected |
Creates the buffered scaled image (mScaledPixmap) to fit the specified finalRect. The parameters flipHorz and flipVert control whether the resulting image shall be flipped horizontally or vertically. (This is used when topLeft is further to the bottom/right than bottomRight.)
This function only creates the scaled pixmap when the buffered pixmap has a different size than the expected result, so calling this function repeatedly, e.g. in the draw function, does not cause expensive rescaling every time.
If scaling is disabled, sets mScaledPixmap to a null QPixmap.
Definition at line 30277 of file qcustomplot.cpp.
Member Data Documentation
◆ bottom
QCPItemAnchor* const QCPItemPixmap::bottom |
Definition at line 6763 of file qcustomplot.h.
◆ bottomLeft
QCPItemAnchor* const QCPItemPixmap::bottomLeft |
Definition at line 6764 of file qcustomplot.h.
◆ bottomRight
QCPItemPosition* const QCPItemPixmap::bottomRight |
Definition at line 6759 of file qcustomplot.h.
◆ left
QCPItemAnchor* const QCPItemPixmap::left |
Definition at line 6765 of file qcustomplot.h.
◆ mAspectRatioMode
|
protected |
Definition at line 6775 of file qcustomplot.h.
◆ mPen
|
protected |
Definition at line 6777 of file qcustomplot.h.
◆ mPixmap
|
protected |
Definition at line 6771 of file qcustomplot.h.
◆ mScaled
|
protected |
Definition at line 6773 of file qcustomplot.h.
◆ mScaledPixmap
|
protected |
Definition at line 6772 of file qcustomplot.h.
◆ mScaledPixmapInvalidated
|
protected |
Definition at line 6774 of file qcustomplot.h.
◆ mSelectedPen
|
protected |
Definition at line 6777 of file qcustomplot.h.
◆ mTransformationMode
|
protected |
Definition at line 6776 of file qcustomplot.h.
◆ right
QCPItemAnchor* const QCPItemPixmap::right |
Definition at line 6762 of file qcustomplot.h.
◆ top
QCPItemAnchor* const QCPItemPixmap::top |
Definition at line 6760 of file qcustomplot.h.
◆ topLeft
QCPItemPosition* const QCPItemPixmap::topLeft |
Definition at line 6758 of file qcustomplot.h.
◆ topRight
QCPItemAnchor* const QCPItemPixmap::topRight |
Definition at line 6761 of file qcustomplot.h.
The documentation for this class was generated from the following files:
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.