Changed cursor
This commit is contained in:
parent
526ab00c33
commit
61afefa6b5
6 changed files with 57 additions and 3 deletions
|
@ -82,6 +82,12 @@ void MainWindow::OnYChanged(double y)
|
||||||
activePlanet->position.ry() = y;
|
activePlanet->position.ry() = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::OnDelete()
|
||||||
|
{
|
||||||
|
ui.screen->DeletePlanet(activePlanet);
|
||||||
|
ClosePlanetDialog();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::OnToggle()
|
void MainWindow::OnToggle()
|
||||||
{
|
{
|
||||||
isSimulating = !isSimulating;
|
isSimulating = !isSimulating;
|
||||||
|
|
|
@ -23,6 +23,7 @@ public slots:
|
||||||
void OnColourChanged(const QColor& color);
|
void OnColourChanged(const QColor& color);
|
||||||
void OnXChanged(double x);
|
void OnXChanged(double x);
|
||||||
void OnYChanged(double y);
|
void OnYChanged(double y);
|
||||||
|
void OnDelete();
|
||||||
void OnToggle();
|
void OnToggle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -27,6 +27,9 @@ PlanetConfig::PlanetConfig(QWidget* parent) :
|
||||||
connect(ui.yPos, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui.yPos, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
instance, [instance](double d) { instance->OnYChanged(d); });
|
instance, [instance](double d) { instance->OnYChanged(d); });
|
||||||
|
|
||||||
|
connect(ui.remove, SIGNAL(clicked()),
|
||||||
|
instance, SLOT(OnDelete()));
|
||||||
|
|
||||||
connect(ui.toggle, SIGNAL(clicked()),
|
connect(ui.toggle, SIGNAL(clicked()),
|
||||||
instance, SLOT(OnToggle()));
|
instance, SLOT(OnToggle()));
|
||||||
|
|
||||||
|
@ -38,6 +41,7 @@ void PlanetConfig::Disable()
|
||||||
ui.colour->setDisabled(true);
|
ui.colour->setDisabled(true);
|
||||||
ui.xPos->setDisabled(true);
|
ui.xPos->setDisabled(true);
|
||||||
ui.yPos->setDisabled(true);
|
ui.yPos->setDisabled(true);
|
||||||
|
ui.remove->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlanetConfig::Enable()
|
void PlanetConfig::Enable()
|
||||||
|
@ -46,6 +50,7 @@ void PlanetConfig::Enable()
|
||||||
ui.colour->setDisabled(false);
|
ui.colour->setDisabled(false);
|
||||||
ui.xPos->setDisabled(false);
|
ui.xPos->setDisabled(false);
|
||||||
ui.yPos->setDisabled(false);
|
ui.yPos->setDisabled(false);
|
||||||
|
ui.remove->setDisabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlanetConfig::SetTitle(const QString& title)
|
void PlanetConfig::SetTitle(const QString& title)
|
||||||
|
|
|
@ -45,7 +45,7 @@ void Screen::mouseMoveEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (planets[i]->IsInside(event->localPos()))
|
if (planets[i]->IsInside(event->localPos()))
|
||||||
{
|
{
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
BIND_LMB(lmb_SelectPlanet);
|
BIND_LMB(lmb_SelectPlanet);
|
||||||
hovered = planets[i];
|
hovered = planets[i];
|
||||||
break;
|
break;
|
||||||
|
@ -84,6 +84,21 @@ void Screen::mouseReleaseEvent(QMouseEvent* event)
|
||||||
mouseDown = false;
|
mouseDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Screen::DeletePlanet(Planet* planet)
|
||||||
|
{
|
||||||
|
for (std::vector<Planet*>::iterator it = planets.begin(); it != planets.end(); it++)
|
||||||
|
{
|
||||||
|
if ((*it) == planet)
|
||||||
|
{
|
||||||
|
planets.erase(it);
|
||||||
|
delete planet;
|
||||||
|
hovered = nullptr;
|
||||||
|
selected = nullptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::Render()
|
void Screen::Render()
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -18,6 +18,8 @@ public:
|
||||||
void mousePressEvent(QMouseEvent* event) override;
|
void mousePressEvent(QMouseEvent* event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent* event) override;
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
||||||
|
|
||||||
|
void DeletePlanet(Planet* planet);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,9 @@
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="stepType">
|
||||||
|
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -125,6 +128,9 @@
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="stepType">
|
||||||
|
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
@ -138,6 +144,9 @@
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="stepType">
|
||||||
|
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
@ -175,14 +184,30 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="toggle">
|
<widget class="QPushButton" name="remove">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 58, 58);</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Start Simulation</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="toggle">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start Simulation</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue