inherits documentation from base class */
| 21173 | |
| 21174 | /* inherits documentation from base class */ |
| 21175 | void QCPGraph::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const |
| 21176 | { |
| 21177 | // draw fill: |
| 21178 | if (mBrush.style() != Qt::NoBrush) |
| 21179 | { |
| 21180 | applyFillAntialiasingHint(painter); |
| 21181 | painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush); |
| 21182 | } |
| 21183 | // draw line vertically centered: |
| 21184 | if (mLineStyle != lsNone) |
| 21185 | { |
| 21186 | applyDefaultAntialiasingHint(painter); |
| 21187 | painter->setPen(mPen); |
| 21188 | 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 |
| 21189 | } |
| 21190 | // draw scatter symbol: |
| 21191 | if (!mScatterStyle.isNone()) |
| 21192 | { |
| 21193 | applyScattersAntialiasingHint(painter); |
| 21194 | // scale scatter pixmap if it's too large to fit in legend icon rect: |
| 21195 | if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height())) |
| 21196 | { |
| 21197 | QCPScatterStyle scaledStyle(mScatterStyle); |
| 21198 | scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); |
| 21199 | scaledStyle.applyTo(painter, mPen); |
| 21200 | scaledStyle.drawShape(painter, QRectF(rect).center()); |
| 21201 | } else |
| 21202 | { |
| 21203 | mScatterStyle.applyTo(painter, mPen); |
| 21204 | mScatterStyle.drawShape(painter, QRectF(rect).center()); |
| 21205 | } |
| 21206 | } |
| 21207 | } |
| 21208 | |
| 21209 | /*! \internal |
| 21210 |