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"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!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> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@ -282,14 +282,17 @@
<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">-1</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">QtCurvesCpp</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">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="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

@ -49,3 +49,21 @@ void MainWindow::on_btnLine_clicked()
this->ui->renderArea->setShape(RenderArea::Line); this->ui->renderArea->setShape(RenderArea::Line);
this->ui->renderArea->repaint(); 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_btnLine_clicked();
void on_intervalInput_valueChanged(double arg1);
void on_scaleInput_valueChanged(double arg1);
void on_stepInput_valueChanged(double arg1);
private: private:
constexpr static QWidget* root = 0; constexpr static QWidget* root = 0;
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>690</width> <width>670</width>
<height>602</height> <height>612</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
@ -141,28 +141,29 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(16, 15, 15);</string> <string notr="true">background-color: rgb(16, 15, 15);</string>
</property> </property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>671</width>
<height>540</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="RenderArea" name="renderArea" native="true"> <widget class="RenderArea" name="renderArea" native="true">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="geometry">
<rect>
<x>11</x>
<y>11</y>
<width>561</width>
<height>538</height>
</rect>
</property>
<zorder>splitter</zorder> <zorder>splitter</zorder>
</widget> </widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="btnAstroid"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -181,9 +182,15 @@ border-color: rgb(255, 255, 255);</string>
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QPushButton" name="btnCicloid"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -199,9 +206,15 @@ border-color: rgb(255, 255, 255);</string>
<string>Cicloid</string> <string>Cicloid</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QPushButton" name="btnHuygens"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -217,9 +230,15 @@ border-color: rgb(255, 255, 255);</string>
<string>Huygens</string> <string>Huygens</string>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QPushButton" name="btnHypo"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -235,9 +254,165 @@ border-color: rgb(255, 255, 255);</string>
<string>Hypo Cycloid</string> <string>Hypo Cycloid</string>
</property> </property>
</widget> </widget>
</item> <widget class="QDoubleSpinBox" name="scaleInput">
<item> <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>560</y>
<width>101</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>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> Line colour</string>
</property>
</widget>
<widget class="QPushButton" name="btnLine"> <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"> <property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255); <string notr="true">color: rgb(255, 255, 255);
background-color: rgb(36, 35, 35); background-color: rgb(36, 35, 35);
@ -247,24 +422,6 @@ border-color: rgb(255, 255, 255);</string>
<string>Line</string> <string>Line</string>
</property> </property>
</widget> </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>
</widget>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
</widget> </widget>

View File

@ -56,6 +56,21 @@ QSize RenderArea::sizeHint() const
return QSize(400,200); 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) void RenderArea::paintEvent(QPaintEvent* event)
{ {
QPainter painter{this}; QPainter painter{this};

View File

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