! Constructs an Axis instance of Type \a type for the axis rect \a parent. Usually it isn't necessary to instantiate axes directly, because you can let QCustomPlot create them for you with \ref QCPAxisRect::addAxis. If you want to use own QCPAxis-subclasses however, create them manually and then inject them also via \ref QCPAxisRect::addAxis. */
| 8198 | create them manually and then inject them also via \ref QCPAxisRect::addAxis. |
| 8199 | */ |
| 8200 | QCPAxis::QCPAxis(QCPAxisRect *parent, AxisType type) : |
| 8201 | QCPLayerable(parent->parentPlot(), QString(), parent), |
| 8202 | // axis base: |
| 8203 | mAxisType(type), |
| 8204 | mAxisRect(parent), |
| 8205 | mPadding(5), |
| 8206 | mOrientation(orientation(type)), |
| 8207 | mSelectableParts(spAxis | spTickLabels | spAxisLabel), |
| 8208 | mSelectedParts(spNone), |
| 8209 | mBasePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), |
| 8210 | mSelectedBasePen(QPen(Qt::blue, 2)), |
| 8211 | // axis label: |
| 8212 | mLabel(), |
| 8213 | mLabelFont(mParentPlot->font()), |
| 8214 | mSelectedLabelFont(QFont(mLabelFont.family(), mLabelFont.pointSize(), QFont::Bold)), |
| 8215 | mLabelColor(Qt::black), |
| 8216 | mSelectedLabelColor(Qt::blue), |
| 8217 | // tick labels: |
| 8218 | mTickLabels(true), |
| 8219 | mTickLabelFont(mParentPlot->font()), |
| 8220 | mSelectedTickLabelFont(QFont(mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold)), |
| 8221 | mTickLabelColor(Qt::black), |
| 8222 | mSelectedTickLabelColor(Qt::blue), |
| 8223 | mNumberPrecision(6), |
| 8224 | mNumberFormatChar('g'), |
| 8225 | mNumberBeautifulPowers(true), |
| 8226 | // ticks and subticks: |
| 8227 | mTicks(true), |
| 8228 | mSubTicks(true), |
| 8229 | mTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), |
| 8230 | mSelectedTickPen(QPen(Qt::blue, 2)), |
| 8231 | mSubTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), |
| 8232 | mSelectedSubTickPen(QPen(Qt::blue, 2)), |
| 8233 | // scale and range: |
| 8234 | mRange(0, 5), |
| 8235 | mRangeReversed(false), |
| 8236 | mScaleType(stLinear), |
| 8237 | // internal members: |
| 8238 | mGrid(new QCPGrid(this)), |
| 8239 | mAxisPainter(new QCPAxisPainterPrivate(parent->parentPlot())), |
| 8240 | mTicker(new QCPAxisTicker), |
| 8241 | mCachedMarginValid(false), |
| 8242 | mCachedMargin(0), |
| 8243 | mDragging(false) |
| 8244 | { |
| 8245 | setParent(parent); |
| 8246 | mGrid->setVisible(false); |
| 8247 | setAntialiased(false); |
| 8248 | setLayer(mParentPlot->currentLayer()); // it's actually on that layer already, but we want it in front of the grid, so we place it on there again |
| 8249 | |
| 8250 | if (type == atTop) |
| 8251 | { |
| 8252 | setTickLabelPadding(3); |
| 8253 | setLabelPadding(6); |
| 8254 | } else if (type == atRight) |
| 8255 | { |
| 8256 | setTickLabelPadding(7); |
| 8257 | setLabelPadding(12); |
nothing calls this directly
no test coverage detected