本文整理汇总了C++中QCustomPlot::viewport方法的典型用法代码示例。如果您正苦于以下问题:C++ QCustomPlot::viewport方法的具体用法?C++ QCustomPlot::viewport怎么用?C++ QCustomPlot::viewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCustomPlot
的用法示例。
在下文中一共展示了QCustomPlot::viewport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetAxes
void SequenceDialog::resetAxes(bool keep_lower)
{
if (!info_->sainfo()) return;
QCustomPlot *sp = ui->sequencePlot;
// Allow space for labels on the top and port numbers on the left.
double top_pos = min_top_, left_pos = min_left_;
if (keep_lower) {
top_pos = sp->yAxis->range().lower;
left_pos = sp->xAxis2->range().lower;
}
double range_span = sp->viewport().width() / sequence_w_;
sp->xAxis2->setRange(left_pos, range_span + left_pos);
range_span = sp->axisRect()->height() / (one_em_ * 1.5);
sp->yAxis->setRange(top_pos, range_span + top_pos);
double rmin = sp->xAxis2->range().size() / 2;
ui->horizontalScrollBar->setRange((rmin - 0.5) * 100, (info_->sainfo()->num_nodes - 0.5 - rmin) * 100);
xAxisChanged(sp->xAxis2->range());
ui->horizontalScrollBar->setValue(ui->horizontalScrollBar->minimum()); // Shouldn't be needed.
rmin = (sp->yAxis->range().size() / 2);
ui->verticalScrollBar->setRange((rmin - 1.0) * 100, (num_items_ - 0.5 - rmin) * 100);
yAxisChanged(sp->yAxis->range());
// It would be exceedingly handy if we could do one or both of the
// following:
// - Position an axis label above its axis inline with the tick labels.
// - Anchor a QCPItemText to one of the corners of a QCPAxis.
// Neither of those appear to be possible, so we first call replot in
// order to lay out our X axes, place our labels, the call replot again.
sp->replot(QCustomPlot::rpQueued);
QRect axis_rect = sp->axisRect()->rect();
key_text_->position->setCoords(axis_rect.left()
- sp->yAxis->padding()
- sp->yAxis->tickLabelPadding()
- sp->yAxis->offset(),
axis_rect.top() / 2);
comment_text_->position->setCoords(axis_rect.right()
+ sp->yAxis2->padding()
+ sp->yAxis2->tickLabelPadding()
+ sp->yAxis2->offset(),
axis_rect.top() / 2);
sp->replot(QCustomPlot::rpHint);
}