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