1 Star 1 Fork 1

chsinx/ImageQt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dialog_power_grey.cpp 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
jiangjinteng 提交于 2017-05-08 13:46 . 调整了部分逻辑
#include "dialog_power_grey.h"
#include "ui_dialog_power_grey.h"
DialogPowerGrey::DialogPowerGrey(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogPowerGrey)
{
ui->setupUi(this);
paintFunctionImage(ui->cDoubleSpinBox->value(), ui->rDoubleSpinBox->value(), ui->bDoubleSpinBox->value());
}
DialogPowerGrey::~DialogPowerGrey()
{
delete ui;
}
void DialogPowerGrey::on_buttonBox_accepted()
{
emit sendData(ui->cDoubleSpinBox->value(), ui->rDoubleSpinBox->value(), ui->bDoubleSpinBox->value());
}
void DialogPowerGrey::paintFunctionImage(double c, double r, double b)
{
// generate some data:
QVector<double> x(1001), y(1001); // initialize with entries 0..100
for (int i=0; i<1001; ++i)
{
x[i] = i/50.0 - 10; // x goes from 0 to 20
y[i] = c*qPow(x[i], r) + b;
}
// create graph and assign data to it:
ui->customPlot->addGraph();
ui->customPlot->graph(0)->setData(x, y);
// give the axes some labels:
ui->customPlot->xAxis->setLabel("x");
ui->customPlot->yAxis->setLabel("y");
// set axes ranges, so we see all data:
ui->customPlot->xAxis->setRange(-10, 10);
ui->customPlot->yAxis->setRange(-10, 10);
ui->customPlot->replot();
}
void DialogPowerGrey::on_cDoubleSpinBox_valueChanged(double c)
{
paintFunctionImage(c, ui->rDoubleSpinBox->value(), ui->bDoubleSpinBox->value());
}
void DialogPowerGrey::on_rDoubleSpinBox_valueChanged(double r)
{
paintFunctionImage(ui->cDoubleSpinBox->value(), r, ui->bDoubleSpinBox->value());
}
void DialogPowerGrey::on_bDoubleSpinBox_valueChanged(double b)
{
paintFunctionImage(ui->cDoubleSpinBox->value(), ui->rDoubleSpinBox->value(), b);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/chsinx/ImageQt.git
git@gitee.com:chsinx/ImageQt.git
chsinx
ImageQt
ImageQt
master

搜索帮助