This commit is contained in:
thepra 2017-08-29 17:25:16 +02:00
parent b9d0a0a272
commit e8c2ec4add
6 changed files with 323 additions and 121 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.3.1, 2017-08-28T10:09:40. -->
<!-- Written by QtCreator 4.3.1, 2017-08-28T19:37:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -282,14 +282,17 @@
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QtCurvesCpp</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/DEVEL/QtCurvesCpp/QtCurvesCpp.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">QtCurvesCpp.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/DEVEL/build-QtCurvesCpp-Desktop_Qt_5_9_1_MinGW_32bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

View File

@ -49,3 +49,21 @@ void MainWindow::on_btnLine_clicked()
this->ui->renderArea->setShape(RenderArea::Line);
this->ui->renderArea->repaint();
}
void MainWindow::on_intervalInput_valueChanged(double arg1)
{
this->ui->renderArea->setInternalLenght(arg1);
this->ui->renderArea->repaint();
}
void MainWindow::on_scaleInput_valueChanged(double arg1)
{
this->ui->renderArea->setScale(arg1);
this->ui->renderArea->repaint();
}
void MainWindow::on_stepInput_valueChanged(double arg1)
{
this->ui->renderArea->setStepCount(arg1);
this->ui->renderArea->repaint();
}

View File

@ -29,6 +29,12 @@ class MainWindow : public QMainWindow
void on_btnLine_clicked();
void on_intervalInput_valueChanged(double arg1);
void on_scaleInput_valueChanged(double arg1);
void on_stepInput_valueChanged(double arg1);
private:
constexpr static QWidget* root = 0;
Ui::MainWindow *ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>690</width>
<height>602</height>
<width>670</width>
<height>612</height>
</rect>
</property>
<property name="palette">
@ -141,129 +141,286 @@
<property name="styleSheet">
<string notr="true">background-color: rgb(16, 15, 15);</string>
</property>
<widget class="QWidget" name="">
<widget class="RenderArea" name="renderArea" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>11</x>
<y>11</y>
<width>561</width>
<height>538</height>
</rect>
</property>
<zorder>splitter</zorder>
</widget>
<widget class="QPushButton" name="btnAstroid">
<property name="geometry">
<rect>
<x>580</x>
<y>12</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Astroid</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="btnCicloid">
<property name="geometry">
<rect>
<x>580</x>
<y>39</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Cicloid</string>
</property>
</widget>
<widget class="QPushButton" name="btnHuygens">
<property name="geometry">
<rect>
<x>580</x>
<y>66</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Huygens</string>
</property>
</widget>
<widget class="QPushButton" name="btnHypo">
<property name="geometry">
<rect>
<x>580</x>
<y>93</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Hypo Cycloid</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="scaleInput">
<property name="geometry">
<rect>
<x>580</x>
<y>170</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="intervalInput">
<property name="geometry">
<rect>
<x>580</x>
<y>220</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>580</x>
<y>150</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Scale</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>580</x>
<y>200</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Interval lenght</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>580</x>
<y>240</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Step count</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QDoubleSpinBox" name="stepInput">
<property name="geometry">
<rect>
<x>580</x>
<y>260</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
</widget>
<widget class="QPushButton" name="btnLine_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>671</width>
<height>540</height>
<y>560</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="RenderArea" name="renderArea" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<zorder>splitter</zorder>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="btnAstroid">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Astroid</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCicloid">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
</property>
<property name="text">
<string>Background colour</string>
</property>
</widget>
<widget class="QPushButton" name="btnLine_3">
<property name="geometry">
<rect>
<x>120</x>
<y>560</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Cicloid</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnHuygens">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
</property>
<property name="text">
<string> Line colour</string>
</property>
</widget>
<widget class="QPushButton" name="btnLine">
<property name="geometry">
<rect>
<x>580</x>
<y>120</y>
<width>80</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Huygens</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnHypo">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Hypo Cycloid</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnLine">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35);
border-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Line</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>77</width>
<height>428</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</property>
<property name="text">
<string>Line</string>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusBar"/>

View File

@ -56,6 +56,21 @@ QSize RenderArea::sizeHint() const
return QSize(400,200);
}
void RenderArea::setInternalLenght(double l)
{
mIntervalLenght = l;
}
void RenderArea::setScale(double s)
{
mScale = s;
}
void RenderArea::setStepCount(double s)
{
mStepCount = s;
}
void RenderArea::paintEvent(QPaintEvent* event)
{
QPainter painter{this};

View File

@ -24,6 +24,9 @@ class RenderArea : public QWidget
QColor backgroundColor() const { return mBackgroundColour; }
void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); }
ShapesType shape() const { return mShape; }
void setInternalLenght(double l);
void setScale(double s);
void setStepCount(double s);
signals: