本文整理汇总了C++中QCPRange::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPRange::size方法的具体用法?C++ QCPRange::size怎么用?C++ QCPRange::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCPRange
的用法示例。
在下文中一共展示了QCPRange::size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scaleRulesForAxis
void RgbImageWindow::scaleRulesForAxis(QCPAxis *axis, double rangeUpper, QCPRange newRange, QCPRange oldRange)
{
QCPRange boundedRange = newRange;
double lowerRangeBound = 0;
double upperRangeBound = rangeUpper;
const int MAX_ZOOM = 4;
if((upperRangeBound - lowerRangeBound)/boundedRange.size() > MAX_ZOOM)
{
axis->setRange(oldRange);
return;
}
if (boundedRange.size() > upperRangeBound-lowerRangeBound)
{
boundedRange = QCPRange(lowerRangeBound, upperRangeBound);
} else
{
double oldSize = boundedRange.size();
if (boundedRange.lower < lowerRangeBound)
{
boundedRange.lower = lowerRangeBound;
boundedRange.upper = lowerRangeBound+oldSize;
}
if (boundedRange.upper > upperRangeBound)
{
boundedRange.lower = upperRangeBound-oldSize;
boundedRange.upper = upperRangeBound;
}
}
axis->setRange(boundedRange);
}
示例2: tickStep
double ProfilePlotView::tickStep(const QCPRange & range, int nSteps)
{
double step = range.size() / (double)(nSteps+1e-10);
double factor = qPow(10.0, qFloor(qLn(step) / qLn(10.0)));
double mantissa = step / factor;
if (mantissa >= 7)
{
factor *= 10.0;
step = 1;
}
else if (mantissa >= 5)
step = 5;
else if (mantissa >= 2)
step = 2;
else if (mantissa >= 1)
step = 1;
else
{
factor /= 10.0;
step = 5;
}
return step * factor;
}
示例3: onXRangeChanged
void MainWindow::onXRangeChanged(const QCPRange newRange, const QCPRange oldRange)
{
double newSize = newRange.size();
bool sizeToSmall = false;
/* Plot range can't be larger than the time elapsed */
if (newSize > (plotXAxis_maxRange - plotXAxis_minRange))
newSize = plotXAxis_maxRange - plotXAxis_minRange;
/* Don't want the plot to zoom to much */
else if (newSize < 0.5)
sizeToSmall = true;
for (int i = 0; i < controller->getNumSensors(); i++) {
/* Plot range can't go below the minimal value */
if (newRange.lower < plotXAxis_minRange) {
ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(plotXAxis_minRange, plotXAxis_minRange + newSize);
ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(plotXAxis_minRange, plotXAxis_minRange + newSize);
}
/* Plot range can't go above the maximal value */
else if (newRange.upper > plotXAxis_maxRange) {
ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(plotXAxis_maxRange - newSize, plotXAxis_maxRange);
ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(plotXAxis_maxRange - newSize, plotXAxis_maxRange);
}
/* Plot can't zoom infinitely */
else if (sizeToSmall) {
ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(oldRange.lower, oldRange.upper);
ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(oldRange.lower, oldRange.upper);
newSize = oldRange.size();
}
}
ui->plot_sensors->replot();
ui->plot_CoM->replot();
/* Adjust the horizontal drag sliders */
ui->plot_horizontalDrag->setRange(plotXAxis_minRange + newSize / 2, plotXAxis_maxRange - newSize / 2);
ui->plot_horizontalDrag->setValue(ui->plot_sensors->axisRect()->axis(QCPAxis::atBottom)->range().lower + newSize / 2);
ui->plotCoM_horizontalDrag->setRange(plotXAxis_minRange + newSize / 2, plotXAxis_maxRange - newSize / 2);
ui->plotCoM_horizontalDrag->setValue(ui->plot_sensors->axisRect()->axis(QCPAxis::atBottom)->range().lower + newSize / 2);
}
示例4: on_horizontalSlider_valueChanged
void Window::on_horizontalSlider_valueChanged(int value)
{
QCPRange range = ui->plot->xAxis->range();
double real_size = range.size() / old_x_slider_scale;
double new_size = real_size * value;
old_x_slider_scale = value;
ui->plot->xAxis->setRange(QCPRange(range.center() - new_size / 2, range.center() + new_size / 2));
ui->plot->xAxis2->setRange(QCPRange(range.center() - new_size / 2, range.center() + new_size / 2));
ui->plot->replot();
}
示例5: integerTickStepCase_yRangeChanged
void MainWindow::integerTickStepCase_yRangeChanged(QCPRange newRange)
{
// Generate tick positions according to linear scaling:
double mTickStep = newRange.size()/(double)(5+1e-10); // mAutoTickCount ticks on average, the small addition is to prevent jitter on exact integers
double magnitudeFactor = qPow(10.0, qFloor(qLn(mTickStep)/qLn(10.0))); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
double tickStepMantissa = mTickStep/magnitudeFactor;
if (tickStepMantissa < 5)
{
// round digit after decimal point to 0.5
mTickStep = (int)(tickStepMantissa*2)/2.0*magnitudeFactor;
} else
{
// round to first digit in multiples of 2
mTickStep = (int)((tickStepMantissa/10.0)*5)/5.0*10*magnitudeFactor;
}
mCustomPlot->yAxis->setTickStep(qCeil(mTickStep));
}
示例6: yAxisChanged
void MainWindow::yAxisChanged(QCPRange range)
{
ui->verticalScrollBar->setValue(qRound(-range.center()*100.0)); // adjust position of scroll bar slider
ui->verticalScrollBar->setPageStep(qRound(range.size()*100.0)); // adjust size of scroll bar slider
}
示例7:
void AP2DataPlot2D::xAxisChanged(QCPRange range)
{
ui.horizontalScrollBar->setValue(qRound(range.center())); // adjust position of scroll bar slider
ui.horizontalScrollBar->setPageStep(qRound(range.size())); // adjust size of scroll bar slider
}
示例8: yAxisChanged
void SequenceDialog::yAxisChanged(QCPRange range)
{
ui->verticalScrollBar->setValue(qRound(range.center()*100.0));
ui->verticalScrollBar->setPageStep(qRound(range.size()*100.0));
}
示例9: xAxisChanged
void ChartPage::xAxisChanged(QCPRange range)
{
ui->horizontalScrollBar->setValue(qRound(range.center()/1000000.0)); // adjust position of scroll bar slider
ui->horizontalScrollBar->setPageStep(qRound(range.size()*1000000.0)); // adjust size of scroll bar slider
}
示例10: yAxisChanged
void LBMUIMFlowDialog::yAxisChanged(QCPRange range)
{
m_ui->verticalScrollBar->setValue(qRound(range.center() * 100.0));
m_ui->verticalScrollBar->setPageStep(qRound(range.size() * 100.0));
}