It's an app that I made through an online course in which I learned the basics of the Qt framework and GUI building. https://git.thepra.dev/thepra/QtCurvesCpp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

135 lines
2.9 KiB

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPainter>
#include <QColorDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
UpdateUi();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::UpdateUi()
{
this->ui->scaleInput->setValue(this->ui->renderArea->scale());
this->ui->intervalInput->setValue(this->ui->renderArea->intervalLenght());
this->ui->stepInput->setValue(this->ui->renderArea->stepCount());
}
void MainWindow::paintEvent(QPaintEvent* event)
{
QPainter painter{this};
painter.setBrush(QColor{26,25,25});
}
void MainWindow::on_btnAstroid_clicked()
{
this->ui->renderArea->setShape(RenderArea::Astroid);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnCicloid_clicked()
{
this->ui->renderArea->setShape(RenderArea::Cycloid);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnHuygens_clicked()
{
this->ui->renderArea->setShape(RenderArea::HuygensCycloid);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnHypo_clicked()
{
this->ui->renderArea->setShape(RenderArea::HypoCycloid);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnLine_clicked()
{
this->ui->renderArea->setShape(RenderArea::Line);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnCircle_clicked()
{
this->ui->renderArea->setShape(RenderArea::Circle);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnEllipse_clicked()
{
this->ui->renderArea->setShape(RenderArea::Ellipse);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnFancy_clicked()
{
this->ui->renderArea->setShape(RenderArea::Fancy);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnStarfish_clicked()
{
this->ui->renderArea->setShape(RenderArea::Starfish);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnCloud_clicked()
{
this->ui->renderArea->setShape(RenderArea::Cloud1);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_btnInverseCloud_clicked()
{
this->ui->renderArea->setShape(RenderArea::Cloud2);
this->ui->renderArea->repaint();
UpdateUi();
}
void MainWindow::on_intervalInput_valueChanged(double interval)
{
this->ui->renderArea->setInternalLenght(interval);
}
void MainWindow::on_scaleInput_valueChanged(double scale)
{
this->ui->renderArea->setScale(scale);
}
void MainWindow::on_stepInput_valueChanged(int count)
{
this->ui->renderArea->setStepCount(count);
}
void MainWindow::on_btnBackgroundColor_clicked()
{
auto color{QColorDialog::getColor(this->ui->renderArea->backgroundColor(),this,"Select Color")};
ui->renderArea->setBackgroundColor(color);
}
void MainWindow::on_btnLineColor_clicked()
{
auto color{QColorDialog::getColor(this->ui->renderArea->shapeColor(),this,"Select Color")};
ui->renderArea->setShapeColor(color);
}