2024-01-11 22:27:02 +01:00
|
|
|
#include "movetowardsdialog.h"
|
|
|
|
|
#include "ui_movetowardsdialog.h"
|
|
|
|
|
|
2024-01-12 21:53:29 +01:00
|
|
|
#include <QPushButton>
|
|
|
|
|
|
2025-11-29 22:53:12 +01:00
|
|
|
#include "editorguiutils.h"
|
2026-11-14 12:02:51 +01:00
|
|
|
#include "actiondialogutils.h"
|
2025-11-29 22:53:12 +01:00
|
|
|
|
2024-01-14 15:31:47 +01:00
|
|
|
MoveTowardsDialog::MoveTowardsDialog(MoveTowardsAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
2024-01-11 22:27:02 +01:00
|
|
|
QDialog{parent},
|
|
|
|
|
m_ui{std::make_unique<Ui::MoveTowardsDialog>()},
|
|
|
|
|
m_action{action}
|
|
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2024-01-12 21:53:29 +01:00
|
|
|
|
2024-01-14 15:31:47 +01:00
|
|
|
{
|
|
|
|
|
QSizePolicy sp_retain = m_ui->widgetObject->sizePolicy();
|
|
|
|
|
sp_retain.setRetainSizeWhenHidden(true);
|
|
|
|
|
m_ui->widgetObject->setSizePolicy(sp_retain);
|
|
|
|
|
}
|
|
|
|
|
m_ui->widgetObject->setProjectModel(projectModel);
|
|
|
|
|
|
|
|
|
|
m_ui->widgetObject->setEmptySelectionText(tr("self"));
|
|
|
|
|
m_ui->widgetObject->setShowClearObjectAction(false);
|
|
|
|
|
|
2025-11-29 22:53:12 +01:00
|
|
|
improveButtonBox(m_ui->buttonBox);
|
2026-11-14 12:02:51 +01:00
|
|
|
loadActionTarget(*m_ui, m_action.appliesTo);
|
|
|
|
|
m_ui->spinBoxX->setValue(m_action.x);
|
|
|
|
|
m_ui->spinBoxY->setValue(m_action.y);
|
|
|
|
|
m_ui->spinBoxSpeed->setValue(m_action.speed);
|
|
|
|
|
m_ui->checkBoxRelative->setChecked(m_action.relative);
|
2024-01-11 22:27:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MoveTowardsDialog::~MoveTowardsDialog() = default;
|
2026-11-14 12:02:51 +01:00
|
|
|
|
|
|
|
|
void MoveTowardsDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
if (!saveActionTarget(*m_ui, m_action.appliesTo, this))
|
|
|
|
|
return;
|
|
|
|
|
m_action.x = m_ui->spinBoxX->value();
|
|
|
|
|
m_action.y = m_ui->spinBoxY->value();
|
|
|
|
|
m_action.speed = m_ui->spinBoxSpeed->value();
|
|
|
|
|
m_action.relative = m_ui->checkBoxRelative->isChecked();
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
}
|