本文整理汇总了C++中QwtText函数的典型用法代码示例。如果您正苦于以下问题:C++ QwtText函数的具体用法?C++ QwtText怎么用?C++ QwtText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QwtText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
ScopePanel::ScopePanel( const QString& name, double* sample_x, double* sample_y, int num_samples, QWidget* parent ) : QWidget(parent), name(name), plot(QwtText(name),this)
{
#if QWT_VERSION >= 0x60100
plot_curve.setPaintAttribute( QwtPlotCurve::PaintAttribute::FilterPoints );
#endif
plot_curve.setRawSamples( sample_x, sample_y, num_samples );
setXRange( 0, num_samples, false );
setYRange( -1, 1, true );
setPen(QPen(QColor("deeppink"), 2));
plot_curve.attach(&plot);
QSizePolicy sp(QSizePolicy::MinimumExpanding,QSizePolicy::Expanding);
plot.setSizePolicy(sp);
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(&plot);
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(0);
setLayout(layout);
}
示例2: QwtPolarItem
/*!
Constructor
\param title title of the curve
*/
QwtPolarCurve::QwtPolarCurve( const QString &title ):
QwtPolarItem( QwtText( title ) )
{
init();
}
示例3: dir
void
CpintPlot::calculate(RideItem *rideItem)
{
if (!rideItem) return;
QString fileName = rideItem->fileName;
QDateTime dateTime = rideItem->dateTime;
QDir dir(path);
QFileInfo file(fileName);
// get current ride statistics
current = new RideFileCache(mainWindow, mainWindow->home.absolutePath() + "/" + fileName);
// get aggregates - incase not initialised from date change
if (bests == NULL) bests = new RideFileCache(mainWindow, startDate, endDate, isFiltered, files);
//
// PLOT MODEL CURVE (DERIVED)
//
curveTitle.setLabel(QwtText("", QwtText::PlainText)); // default to no title
if (series == RideFile::xPower || series == RideFile::NP || series == RideFile::watts || series == RideFile::wattsKg || series == RideFile::none) {
if (bests->meanMaxArray(series).size() > 1) {
// calculate CP model from all-time best data
cp = tau = t0 = 0;
deriveCPParameters();
}
//
// CP curve only relevant for Energy or Watts (?)
//
if (series == RideFile::watts || series == RideFile::wattsKg || series == RideFile::none) {
if (!CPCurve) plot_CP_curve(this, cp, tau, t0);
else {
// make sure color reflects latest config
QPen pen(GColor(CCP));
pen.setWidth(2.0);
pen.setStyle(Qt::DashLine);
CPCurve->setPen(pen);
}
}
//
// PLOT ZONE (RAINBOW) AGGREGATED CURVE
//
if (bests->meanMaxArray(series).size()) {
int maxNonZero = 0;
for (int i = 0; i < bests->meanMaxArray(series).size(); ++i) {
if (bests->meanMaxArray(series)[i] > 0) maxNonZero = i;
}
plot_allCurve(this, maxNonZero, bests->meanMaxArray(series).constData() + 1);
}
} else {
//
// PLOT BESTS IN SERIES COLOR
//
if (allCurve) {
delete allCurve;
allCurve = NULL;
}
if (bests->meanMaxArray(series).size()) {
int maxNonZero = 0;
QVector<double> timeArray(bests->meanMaxArray(series).size());
for (int i = 0; i < bests->meanMaxArray(series).size(); ++i) {
timeArray[i] = i / 60.0;
if (bests->meanMaxArray(series)[i] > 0) maxNonZero = i;
}
if (maxNonZero > 1) {
allCurve = new QwtPlotCurve(dateTime.toString(tr("ddd MMM d, yyyy h:mm AP")));
allCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
QPen line;
QColor fill;
switch (series) {
case RideFile::kph:
line.setColor(GColor(CSPEED).darker(200));
fill = (GColor(CSPEED));
break;
case RideFile::cad:
line.setColor(GColor(CCADENCE).darker(200));
fill = (GColor(CCADENCE));
break;
case RideFile::nm:
line.setColor(GColor(CTORQUE).darker(200));
fill = (GColor(CTORQUE));
break;
case RideFile::hr:
line.setColor(GColor(CHEARTRATE).darker(200));
fill = (GColor(CHEARTRATE));
break;
case RideFile::vam:
//.........这里部分代码省略.........
示例4: QwtText
/*!
Constructor
\param title Title of the curve
*/
QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString &title ):
QwtPlotSeriesItem<QwtPoint3D>( QwtText( title ) )
{
init();
}
示例5: QwtPlotItem
//! Constructor
QwtPlotRasterItem::QwtPlotRasterItem( const QString& title ):
QwtPlotItem( QwtText( title ) )
{
init();
}
示例6: QwtPlotItem
/*!
Constructor
\param title Title of the curve
*/
QwtPlotCurve::QwtPlotCurve(const QString &title):
QwtPlotItem(QwtText(title))
{
init();
}
示例7: QMainWindow
RateStateSimWindow::RateStateSimWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) {
QWidget *main_widget;
QVBoxLayout *control_layout, *plot_layout;
QHBoxLayout *main_layout;
int i;
QwtSlider *a_param_slider, *ab_ratio_slider, *k_param_slider, *r_param_slider;
param_a = 0.0625;
param_b = 0.125;//param_a*2.84184246806358;//
param_k = 20;
param_r = 1e-5;
param_w = 0.5;
a_param_slider = new QwtSlider(0);
a_param_slider->setScale(-2, 0);
a_param_slider->setRange(-2, 0);
a_param_slider->setValue(log10(param_a));
a_param_slider->setScalePosition(QwtSlider::TopScale);
ab_ratio_slider = new QwtSlider(0);
ab_ratio_slider->setScale(0.001, 1.0);
ab_ratio_slider->setRange(0.001, 1.0);
ab_ratio_slider->setValue(param_a/param_b);
ab_ratio_slider->setScalePosition(QwtSlider::TopScale);
k_param_slider = new QwtSlider(0);
k_param_slider->setScale(15, 25);
k_param_slider->setRange(15, 25);
k_param_slider->setValue(param_k);
k_param_slider->setScalePosition(QwtSlider::TopScale);
r_param_slider = new QwtSlider(0);
r_param_slider->setScale(-7, 1);
r_param_slider->setRange(-7, 1);
r_param_slider->setValue(log10(param_r));
r_param_slider->setScalePosition(QwtSlider::TopScale);
connect(a_param_slider, SIGNAL(valueChanged(double)), this, SLOT(a_param_changed(double)));
connect(ab_ratio_slider, SIGNAL(valueChanged(double)), this, SLOT(ab_ratio_changed(double)));
connect(k_param_slider, SIGNAL(valueChanged(double)), this, SLOT(k_param_changed(double)));
connect(r_param_slider, SIGNAL(valueChanged(double)), this, SLOT(r_param_changed(double)));
control_layout = new QVBoxLayout;
control_layout->addWidget(a_param_slider);
control_layout->addWidget(ab_ratio_slider);
control_layout->addWidget(k_param_slider);
control_layout->addWidget(r_param_slider);
position_data = new QwtPlotCurve(QwtText("X"));
velocity_data = new QwtPlotCurve(QwtText("V"));
theta_data = new QwtPlotCurve(QwtText("Theta"));
force_data = new QwtPlotCurve(QwtText("Force"));
driver_data = new QwtPlotCurve(QwtText("Driver Plate"));
position_plot = new QwtPlot(QwtText("X"));
velocity_plot = new QwtPlot(QwtText("Velocity"));
velocity_plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine);
theta_plot = new QwtPlot(QwtText("Theta"));
force_plot = new QwtPlot(QwtText("Force"));
double min_t = 0, max_t = 160;
position_plot->setAxisScale(QwtPlot::xBottom, min_t, max_t, 0);
position_plot->setAxisScale(QwtPlot::yLeft, 100, 140, 0);
velocity_plot->setAxisScale(QwtPlot::xBottom, min_t, max_t, 0);
theta_plot->setAxisScale(QwtPlot::xBottom, min_t, max_t, 0);
force_plot->setAxisScale(QwtPlot::xBottom, min_t, max_t, 0);
position_data->attach(position_plot);
driver_data->attach(position_plot);
velocity_data->attach(velocity_plot);
theta_data->attach(theta_plot);
force_data->attach(force_plot);
plot_layout = new QVBoxLayout;
plot_layout->setContentsMargins(0, 0, 0, 0);
plot_layout->addWidget(position_plot, 0);
plot_layout->addWidget(velocity_plot, 0);
plot_layout->addWidget(theta_plot, 0);
plot_layout->addWidget(force_plot, 0);
main_layout = new QHBoxLayout;
main_layout->addLayout(control_layout);
main_layout->addLayout(plot_layout);
main_widget = new QWidget;
main_widget->setLayout(main_layout);
setCentralWidget(main_widget);
emit recalc();
};
示例8: mouseMoved
/** Called each time the mouse moves over the canvas */
QwtText CustomPicker::trackerText(const QwtDoublePoint &pos) const {
emit mouseMoved(pos.x(), pos.y());
return QwtText();
}
示例9: QwtPlotCurve
// create new AllPlotSlopeCurve
AllPlotSlopeCurve::AllPlotSlopeCurve( const QString &title ):
QwtPlotCurve( QwtText( title ) )
{
init();
}
示例10: QwtText
QwtText DateScaleDraw::label(double value) const
{
QDate t = t_origin.addDays( (int) value );
return QwtText(t.toString ( t_format ));
}
示例11: QwtPlotZoomer
LogPlotZoomer::LogPlotZoomer(QWidget *canvas) :
QwtPlotZoomer(canvas)
#else
LogPlotZoomer::LogPlotZoomer(QwtPlotCanvas *canvas):
QwtPlotZoomer(canvas)
#endif
{}
#if QWT_VERSION > 0x060000
QwtText LogPlotZoomer::trackerTextF(const QwtDoublePoint &pos) const
#else
QwtText LogPlotZoomer::trackerText(const QwtDoublePoint &pos) const
#endif
{
switch (rubberBand())
{
case HLineRubberBand:
return QString().sprintf("%.4g", pos.y());
case VLineRubberBand:
return QString().sprintf("%.4g", pos.x());
default:
return QString().sprintf("%.4g, %.4g", pos.x(), pos.y());
}
return QwtText(); // make some dumb compilers happy
}
/*void QwtPlotZoomer::move(double x, double y)
{
x = qwtMax(x, zoomBase().left());
x = qwtMin(x, zoomBase().right() - zoomRect().width());
y = qwtMax(y, zoomBase().top());
y = qwtMin(y, zoomBase().bottom() - zoomRect().height());
if (x != zoomRect().left() || y != zoomRect().top())
{
d_data->zoomStack[d_data->zoomRectIndex].moveTo(x, y);
rescale();
}
}*/
#if QWT_VERSION > 0x060000
void LogPlotZoomer::moveTo(const QPointF & pos)
{
double x = pos.x();
double y = pos.y();
#else
void LogPlotZoomer::move(double x, double y)
{
#endif
//QwtPlotZoomer::move(x,y);
x = qwtMax(x, (double)zoomBase().left());
x = qwtMin(x, (double)(zoomBase().right() - zoomRect().width()));
y = qwtMax(y, (double)zoomBase().top());
y = qwtMin(y, (double)(zoomBase().bottom() - zoomRect().height()));
if (x != zoomRect().left() || y != zoomRect().top())
{
//zoomStack()[zoomRectIndex()].moveTo(x, y);
QwtDoubleRect & rect = const_cast<QwtDoubleRect &>(zoomStack()[zoomRectIndex()]);
//handle x axis
const int xAxis = QwtPlotZoomer::xAxis();
const QwtScaleEngine *sex = plot()->axisScaleEngine(xAxis);
#if QWT_VERSION > 0x060000
if (dynamic_cast<const QwtLogScaleEngine*>(sex))
#else
if (dynamic_cast<const QwtLog10ScaleEngine*>(sex))
#endif
{
//logarithmic
double factor = rect.right() / rect.left();
rect.setRight(x * factor);
rect.setLeft(x);
}
else
{
rect.moveLeft(x);
}
const int yAxis = QwtPlotZoomer::yAxis();
const QwtScaleEngine *sey = plot()->axisScaleEngine(yAxis);
#if QWT_VERSION > 0x060000
if (dynamic_cast<const QwtLogScaleEngine*>(sey))
#else
if (dynamic_cast<const QwtLog10ScaleEngine*>(sey))
#endif
{
//logarithmic
double factor = rect.bottom() / rect.top();
//.........这里部分代码省略.........
示例12: if
//! Update the widget that represents the curve on the legend
void QwtPlotCurve::updateLegend(QwtLegend *legend) const
{
if ( !legend )
return;
QwtPlotItem::updateLegend(legend);
QWidget *widget = legend->find(this);
if ( !widget || !widget->inherits("QwtLegendItem") )
return;
QwtLegendItem *legendItem = (QwtLegendItem *)widget;
#if QT_VERSION < 0x040000
const bool doUpdate = legendItem->isUpdatesEnabled();
#else
const bool doUpdate = legendItem->updatesEnabled();
#endif
legendItem->setUpdatesEnabled(false);
const int policy = legend->displayPolicy();
if (policy == QwtLegend::FixedIdentifier)
{
int mode = legend->identifierMode();
if (mode & QwtLegendItem::ShowLine)
legendItem->setCurvePen(pen());
if (mode & QwtLegendItem::ShowSymbol)
legendItem->setSymbol(symbol());
if (mode & QwtLegendItem::ShowText)
legendItem->setText(title());
else
legendItem->setText(QwtText());
legendItem->setIdentifierMode(mode);
}
else if (policy == QwtLegend::AutoIdentifier)
{
int mode = 0;
if (QwtPlotCurve::NoCurve != style())
{
legendItem->setCurvePen(pen());
mode |= QwtLegendItem::ShowLine;
}
if (QwtSymbol::NoSymbol != symbol().style())
{
legendItem->setSymbol(symbol());
mode |= QwtLegendItem::ShowSymbol;
}
if ( !title().isEmpty() )
{
legendItem->setText(title());
mode |= QwtLegendItem::ShowText;
}
else
{
legendItem->setText(QwtText());
}
legendItem->setIdentifierMode(mode);
}
legendItem->setUpdatesEnabled(doUpdate);
legendItem->update();
}
示例13: QwtPlotItem
//! Enables major grid, disables minor grid
QwtPlotGrid::QwtPlotGrid():
QwtPlotItem( QwtText( "Grid" ) )
{
d_data = new PrivateData;
setZ( 10.0 );
}
示例14: QwtPlotItem
/*!
\brief Constructor
Sets the following item attributes:
- QwtPlotItem::AutoScale: true
- QwtPlotItem::Legend: false
\param title Title
*/
QwtPlotShapeItem::QwtPlotShapeItem( const QString& title ):
QwtPlotItem( QwtText( title ) )
{
init();
}
示例15: QwtText
/*!
Constructor
\param title Title of the curve
*/
QwtPlotCurve::QwtPlotCurve( const QString &title ):
QwtPlotSeriesItem<QPointF>( QwtText( title ) )
{
init();
}