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;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue