This commit is contained in:
thepra 2017-08-28 13:08:42 +02:00
parent 7a0b812869
commit 2ba6957f93
6 changed files with 51 additions and 19 deletions

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.3.1, 2017-08-28T08:25:14. --> <!-- Written by QtCreator 4.3.1, 2017-08-28T10:09:40. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{9311c877-cd31-4d5b-986a-ff7eaf9ec7ed}</value> <value type="QByteArray">{cc43eb28-2519-4f1e-b7c4-4119ef119db4}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -282,17 +282,14 @@
<value type="int">13</value> <value type="int">13</value>
<value type="int">14</value> <value type="int">14</value>
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QtCurvesCpp</value> <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.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/DEVEL/QtCurvesCpp/QtCurvesCpp.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</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="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>

View File

@ -43,3 +43,9 @@ void MainWindow::on_btnHypo_clicked()
this->ui->renderArea->setShape(RenderArea::HypoCycloid); this->ui->renderArea->setShape(RenderArea::HypoCycloid);
this->ui->renderArea->repaint(); this->ui->renderArea->repaint();
} }
void MainWindow::on_btnLine_clicked()
{
this->ui->renderArea->setShape(RenderArea::Line);
this->ui->renderArea->repaint();
}

View File

@ -27,6 +27,8 @@ class MainWindow : public QMainWindow
void on_btnHypo_clicked(); void on_btnHypo_clicked();
void on_btnLine_clicked();
private: private:
constexpr static QWidget* root = 0; constexpr static QWidget* root = 0;
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@ -236,6 +236,18 @@ border-color: rgb(255, 255, 255);</string>
</property> </property>
</widget> </widget>
</item> </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> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -41,6 +41,11 @@ QPointF RenderArea::ComputeHypo(double t)
}; };
} }
QPointF RenderArea::ComputeLine(double t)
{
return QPointF{1-t,1-t};
}
QSize RenderArea::minimumSizeHint() const QSize RenderArea::minimumSizeHint() const
{ {
return QSize(100,100); return QSize(100,100);
@ -98,6 +103,11 @@ void RenderArea::OnShapeChanged()
mIntervalLenght=2*M_PI; mIntervalLenght=2*M_PI;
mStepCount=256; mStepCount=256;
break; break;
case Line:
mScale=50;
mIntervalLenght=1;
mStepCount=128;
break;
default: default:
break; break;
} }
@ -118,6 +128,9 @@ QPointF RenderArea::Compute(double t)
case HypoCycloid: case HypoCycloid:
return ComputeHypo(t); return ComputeHypo(t);
break; break;
case Line:
return ComputeLine(t);
break;
default: default:
break; break;
} }

View File

@ -16,7 +16,8 @@ class RenderArea : public QWidget
Astroid, Astroid,
Cycloid, Cycloid,
HuygensCycloid, HuygensCycloid,
HypoCycloid HypoCycloid,
Line
}; };
void setBackgroundColor(QColor color) { mBackgroundColour = color; } void setBackgroundColor(QColor color) { mBackgroundColour = color; }
@ -38,6 +39,7 @@ class RenderArea : public QWidget
QPointF ComputeCycloid(double t); QPointF ComputeCycloid(double t);
QPointF ComputeHuygens(double t); QPointF ComputeHuygens(double t);
QPointF ComputeHypo(double t); QPointF ComputeHypo(double t);
QPointF ComputeLine(double t);
QPointF Compute(double t); QPointF Compute(double t);
QColor mBackgroundColour,mShapeColour; QColor mBackgroundColour,mShapeColour;
ShapesType mShape; ShapesType mShape;