QtDialogTest
::QtDialogTest(QWidget* parent
){
ui.setupUi(this);
Populate();
ui.
plot->setAxisAutoScale
(QwtPlot::xBottom);
connect(ui.enableFloatingAttributecheckBox, &QCheckBox::stateChanged, this, &QtDialogTest::EnableFloatingAttribute);
}
void QtDialogTest::EnableFloatingAttribute(int state)
{
bool enable = (state == Qt::Checked);
ui.plot->replot();
}
void QtDialogTest::Populate()
{
curve->setSamples(samples);
curve->setPen(pen);
curve->attach(ui.plot);
}
QtDialogTest::QtDialogTest(QWidget* parent)
: QDialog(parent)
{
ui.setupUi(this);
Populate();
ui.plot->setAxisAutoScale(QwtPlot::xBottom);
connect(ui.enableFloatingAttributecheckBox, &QCheckBox::stateChanged, this, &QtDialogTest::EnableFloatingAttribute);
}
void QtDialogTest::EnableFloatingAttribute(int state)
{
bool enable = (state == Qt::Checked);
ui.plot->axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating, enable);
ui.plot->replot();
}
void QtDialogTest::Populate()
{
QVector<QPointF> samples{ QPointF(1000.4, 1.0), QPointF(1001.4, 1.5), QPointF(1001.7, 2.0), QPointF(1001.9, 1.5), QPointF(1002.05, 1.0) };
auto curve = new QwtPlotCurve;
curve->setSamples(samples);
QBrush brush(QColor::fromRgb(255, 0, 0));
QPen pen(QColor::fromRgb(128, 0, 0));
curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, brush, pen, QSize(8, 8)));
curve->setPen(pen);
curve->attach(ui.plot);
}
To copy to clipboard, switch view to plain text mode
Bookmarks