本文整理汇总了C++中QwtPlotItemList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotItemList::at方法的具体用法?C++ QwtPlotItemList::at怎么用?C++ QwtPlotItemList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotItemList
的用法示例。
在下文中一共展示了QwtPlotItemList::at方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateChartView
/*!
* \brief Update chart waveforms visibility (ChartView)
*
* This method updates the chart waveforms visibility according to the
* user input.
*/
void SidebarChartsBrowser::updateChartView()
{
// Get the current view
DocumentViewManager *manager = DocumentViewManager::instance();
ChartView *view = static_cast<ChartView*>(manager->currentView()->toWidget());
// Set waveforms visibility
QwtPlotItemList list = view->itemList(QwtPlotItem::Rtti_PlotCurve);
for(int i=0; i<list.size(); ++i) {
list.at(i)->setVisible(m_model->m_chartSeriesMap[list.at(i)->title().text()]);
}
view->replot();
}
示例2: updateChartSeriesMap
/*!
* \brief Update ChartSeries map
*
* This method updates the waveforms list given a ChartView. This is
* usually used when changing between views to keep the list of available
* waveforms synchronized with the currently selected chart.
*/
void SidebarChartsBrowser::updateChartSeriesMap()
{
// Get the current view
DocumentViewManager *manager = DocumentViewManager::instance();
ChartView *view = static_cast<ChartView*>(manager->currentView()->toWidget());
// Populate the waveforms list
QwtPlotItemList list = view->itemList(QwtPlotItem::Rtti_PlotCurve);
m_chartSeriesMap.clear();
for(int i=0; i<list.size(); ++i) {
m_chartSeriesMap.insert(list.at(i)->title().text(),
list.at(i)->isVisible());
}
// Create a new table model
m_model = new SidebarChartsModel(m_chartSeriesMap, this); //! \todo What happens with the old pointer??? Should we destroy it first?
m_proxyModel->setSourceModel(m_model);
// Resize the table columns to fit the contents. This must be done
// here instead of the constructor because the columns are created
// here when filling the model (in the constructor the columns do
// not yet exist, resulting in a crash if resized there).
m_tableView->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
}
示例3: drawRubberBand
void QwtCustomPlotPicker::drawRubberBand(QPainter* painter) const
{
if ( rubberBand() < UserRubberBand )
QwtPlotPicker::drawRubberBand( painter );
else
{
if ( !isActive() || rubberBandPen().style() == Qt::NoPen )
return;
QPolygon p = selection();
if ( p.count() != 1 )
return;
const QPoint& pt1 = p[0];
const double x_val = plot()->invTransform(QwtPlot::xBottom,pt1.x()); // determine x value (time or dist)
// Draw vertical line where curser is
const int bot = 400;
const int top = 0;
painter->drawLine(pt1.x(), bot, pt1.x(), top);
// Set pen and fond for all coming text
painter->setPen(QColor(Qt::black));
painter->setFont(QFont("Helvetica", 8, QFont::Bold));
// Compute the index based on the x value
int idx;
if (_x_axis_units == TimeAxis)
{
painter->drawText(QPoint(pt1.x()-65, 10), "time: " + DataProcessing::minsFromSecs(x_val));
idx = _data_log->indexFromTime(x_val);
}
else if (_x_axis_units == DistAxis)
{
painter->drawText(QPoint(pt1.x()-60, 10), "dist: " + DataProcessing::kmFromMeters(x_val,2));
idx = _data_log->indexFromDist(x_val);
}
// Using the index, determine the curve values
const double hr = (int)_data_log->heartRateFltd(idx);
const QPoint pt1_hr(pt1.x(),plot()->transform(QwtPlot::yLeft,hr));
const double speed = _data_log->speedFltd(idx);
const QPoint pt1_speed(pt1.x(),plot()->transform(QwtPlot::yLeft,speed));
const double alt = (int)_data_log->altFltd(idx);
const QPoint pt1_alt(pt1.x(),plot()->transform(QwtPlot::yRight,alt));
const double cadence = (int)_data_log->cadenceFltd(idx);
const QPoint pt1_cadence(pt1.x(),plot()->transform(QwtPlot::yLeft,cadence));
const double power = _data_log->powerFltd(idx);
const QPoint pt1_power(pt1.x(),plot()->transform(QwtPlot::yLeft,power));
const double temp = _data_log->temp(idx);
const QPoint pt1_temp(pt1.x(),plot()->transform(QwtPlot::yLeft,temp));
// Draw highlights on all curves
const QPoint offset(8,-5);
const QwtPlotItemList item_list = plot()->itemList(QwtPlotCurve::Rtti_PlotCurve);
for (int i = 0; i < item_list.size(); ++i)
{
if (item_list.at(i)->title().text() == "Heart Rate" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_hr.x(), pt1_hr.y(), pt1_hr.x()+6, pt1_hr.y());
painter->drawText(pt1_hr + offset, QString::number(hr,'g',3));
}
if (item_list.at(i)->title().text() == "Speed" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_speed.x(), pt1_speed.y(), pt1_speed.x()+6, pt1_speed.y());
painter->drawText(pt1_speed + offset, QString::number(speed,'g',3));
}
if (item_list.at(i)->title().text() == "Elevation" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_alt.x(), pt1_alt.y(), pt1_alt.x()+6, pt1_alt.y());
painter->drawText(pt1_alt + offset, QString::number(alt,'g',4));
}
if (item_list.at(i)->title().text() == "Cadence" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_cadence.x(), pt1_cadence.y(), pt1_cadence.x()+6, pt1_cadence.y());
painter->drawText(pt1_cadence + offset, QString::number(cadence,'g',3));
}
if (item_list.at(i)->title().text() == "Power" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_power.x(), pt1_power.y(), pt1_power.x()+6, pt1_power.y());
painter->drawText(pt1_power + offset, QString::number(power,'g',3));
}
if (item_list.at(i)->title().text() == "Temp" && item_list.at(i)->isVisible())
{
painter->drawLine(pt1_temp.x(), pt1_temp.y(), pt1_temp.x()+6, pt1_temp.y());
painter->drawText(pt1_temp + offset, QString::number(temp,'g',3));
}
// Draw current values on graph labels
if (_hr_cb->isChecked())
_hr_cb->setText("Heart Rate " + QString::number(hr,'g',3).leftJustified(3,' ') + " bpm");
else
_hr_cb->setText("Heart Rate");
if (_speed_cb->isChecked())
_speed_cb->setText("Speed " + QString::number(speed,'g',3) + " km/h");
else
_speed_cb->setText("Speed");
if (_alt_cb->isChecked())
_alt_cb->setText("Elevation " + QString::number(alt,'g',4).leftJustified(4,' ') + " m");
//.........这里部分代码省略.........