inherits documentation from base class */
| 21192 | |
| 21193 | /* inherits documentation from base class */ |
| 21194 | void QCPGraph::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const |
| 21195 | { |
| 21196 | // draw fill: |
| 21197 | if (mBrush.style() != Qt::NoBrush) |
| 21198 | { |
| 21199 | applyFillAntialiasingHint(painter); |
| 21200 | painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush); |
| 21201 | } |
| 21202 | // draw line vertically centered: |
| 21203 | if (mLineStyle != lsNone) |
| 21204 | { |
| 21205 | applyDefaultAntialiasingHint(painter); |
| 21206 | painter->setPen(mPen); |
| 21207 | painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens |
| 21208 | } |
| 21209 | // draw scatter symbol: |
| 21210 | if (!mScatterStyle.isNone()) |
| 21211 | { |
| 21212 | applyScattersAntialiasingHint(painter); |
| 21213 | // scale scatter pixmap if it's too large to fit in legend icon rect: |
| 21214 | if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height())) |
| 21215 | { |
| 21216 | QCPScatterStyle scaledStyle(mScatterStyle); |
| 21217 | scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 21218 | scaledStyle.applyTo(painter, mPen); |
| 21219 | scaledStyle.drawShape(painter, QRectF(rect).center()); |
| 21220 | } else |
| 21221 | { |
| 21222 | mScatterStyle.applyTo(painter, mPen); |
| 21223 | mScatterStyle.drawShape(painter, QRectF(rect).center()); |
| 21224 | } |
| 21225 | } |
| 21226 | } |
| 21227 | |
| 21228 | /*! \internal |
| 21229 |