当前位置: 首页>>代码示例>>C++>>正文


C++ QwtLegend::setFrameStyle方法代码示例

本文整理汇总了C++中QwtLegend::setFrameStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLegend::setFrameStyle方法的具体用法?C++ QwtLegend::setFrameStyle怎么用?C++ QwtLegend::setFrameStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QwtLegend的用法示例。


在下文中一共展示了QwtLegend::setFrameStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: curve

/*
void MyPlot2D::toggleCurve(long curveId) {
    QwtPlotCurve *c = curve(curveId);
    if ( c ) {
        c->setEnabled(!c->enabled());
        replot();
    }
}
*/
void MyPlot2D::enableLegend(bool value) {
    if (value) {
         // legend
         QwtLegend *legend = new QwtLegend;
         legend->setFrameStyle(QFrame::Box|QFrame::Sunken);
         this->insertLegend(legend, QwtPlot::RightLegend);
    }
    else {
         this->insertLegend(NULL);
    }
    replot();
}
开发者ID:bell5kim,项目名称:WaterFit,代码行数:21,代码来源:myplot2d.cpp

示例2: createDataTabWidget

QTabWidget* ResultsPage::createDataTabWidget()
{
    QTabWidget *tabWidget = new QTabWidget;

    // Plot
    m_plot = new QwtPlot(tabWidget);
    m_plot->setCanvasBackground(Qt::white);
    m_plot->setContextMenuPolicy(Qt::CustomContextMenu);
    m_plot->setAutoReplot(false);

    connect(m_plot, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showPlotContextMenu(QPoint)));
    
    // Picker to allow for selection of the closest curve and displays curve
    // coordinates with a cross rubber band.
    QwtPlotPicker *picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                              QwtPicker::CrossRubberBand, QwtPicker::ActiveOnly,
                                              m_plot->canvas());
    picker->setStateMachine(new QwtPickerDragPointMachine());

    connect(picker, SIGNAL(appended(QPoint)), this, SLOT(pointSelected(QPoint)));

    // Legend
    QwtLegend* legend = new QwtLegend;
    legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
    m_plot->insertLegend(legend, QwtPlot::BottomLegend);
#if QWT_VERSION >= 0x060100
    connect(m_plot,
            SIGNAL(legendDataChanged(QVariant,QList<QwtLegendData>)),
            legend,
            SLOT(updateLegend(QVariant,QList<QwtLegendData>)));
#endif

    // Add the generic curves to the legend
    QList<QPair<QString, Qt::GlobalColor> > pairs;
    pairs << qMakePair(tr("Unselected Realization"), Qt::darkGray)
          << qMakePair(tr("Selected and Enabled Realization"), Qt::darkGreen)
          << qMakePair(tr("Selected and Disabled Realization"), Qt::darkRed);

    QPair<QString, Qt::GlobalColor> pair;
    foreach (pair, pairs) {
        QwtPlotCurve *curve = new QwtPlotCurve(pair.first);

        curve->setLegendIconSize(QSize(32, 8));
        curve->setPen(QPen(QBrush(pair.second), 2));
        curve->setLegendAttribute(QwtPlotCurve::LegendShowLine);
#if QWT_VERSION < 0x060100
        curve->updateLegend(legend);
#else
        m_plot->updateLegend(curve);
#endif
    }
开发者ID:arkottke,项目名称:strata,代码行数:52,代码来源:ResultsPage.cpp

示例3: QWidget

PowerBarHistoryPlot::PowerBarHistoryPlot(double defaultTime, double defaultPowerLevel, QWidget* parent)
	: QWidget(parent)
	, m_overalTime(0.0)
	, m_lastSampleTime(0.0)
	, m_firstTime(true)
	, m_defaultTime(defaultTime)
	, m_defaultPowerLevel(defaultPowerLevel)
	, m_powerAxisMax(defaultPowerLevel)
	, m_powerAxisMin(-1*defaultPowerLevel)
	, m_timeAxisMax(defaultTime)
{
	m_plot = new QwtPlot();
	m_plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	m_plot->setAxisScale(QwtPlot::xBottom, 0, defaultTime, defaultTime/20.0);
	m_plot->setAxisScale(QwtPlot::yLeft, -1 * defaultPowerLevel, defaultPowerLevel, defaultPowerLevel/2.0);
	m_plot->setAxisAutoScale(QwtPlot::xBottom, false);
	m_plot->setCanvasBackground(QBrush(Qt::white));
	m_plot->setAxisTitle(QwtPlot::xBottom, tr(TIME_AXIS_NAME));
	m_plot->setAxisTitle(QwtPlot::yLeft, tr(POWER_AXIS_NAME));
	
	// legend
	QwtLegend *legend = new QwtLegend;
	legend->setFrameStyle(QFrame::Box|QFrame::Sunken);
	m_plot->insertLegend(legend, QwtPlot::BottomLegend);

	QwtPlotGrid *grid = new QwtPlotGrid;
	grid->enableX(false);
	grid->enableYMin(true);
	grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
	grid->setMinPen(QPen(Qt::transparent, 0 , Qt::NoPen));
	grid->attach(m_plot);

	setupCurves();

	QHBoxLayout* historyPlotlayout = new QHBoxLayout;
	historyPlotlayout->addWidget(m_plot);
	historyPlotlayout->setSpacing(0);

	setColors(Qt::blue, Qt::red);

	setLayout(historyPlotlayout);
}
开发者ID:CBRUhelsinki,项目名称:CENTplatform,代码行数:42,代码来源:PowerBarHistoryPlot.cpp


注:本文中的QwtLegend::setFrameStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。