Implemented object selection widgets in action dialogs
This commit is contained in:
1 parent
4046a5c044
commit
97a9da4030
41 files changed
+1283
-228
No files matched your search
@@ -1,31 +1,54 @@
|
||||
#include "executecodedialog.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "widgets/objectselectorwidget.h"
|
||||
|
||||
ExecuteCodeDialog::ExecuteCodeDialog(ExecuteCodeAction &action, QWidget *parent) :
|
||||
ExecuteCodeDialog::ExecuteCodeDialog(ExecuteCodeAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
CodeEditorDialog{tr("Execute Code"), parent},
|
||||
m_action{action},
|
||||
m_radioButtonSelf{new QRadioButton{tr("Self"), this}},
|
||||
m_radioButtonOther{new QRadioButton{tr("Other"), this}},
|
||||
m_radioButtonObject{new QRadioButton{tr("Object"), this}}
|
||||
m_radioButtonObject{new QRadioButton{tr("Object"), this}},
|
||||
m_objectSelector{new ObjectSelectorWidget{this}}
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window);
|
||||
#endif
|
||||
setWindowFlag(Qt::WindowCloseButtonHint);
|
||||
|
||||
m_objectSelector->setProjectModel(projectModel);
|
||||
|
||||
m_objectSelector->setEmptySelectionText(tr("self"));
|
||||
m_objectSelector->setShowClearObjectAction(false);
|
||||
|
||||
addToolbarWidget(new QLabel{tr("Applies to:"), this});
|
||||
addToolbarWidget(m_radioButtonSelf);
|
||||
addToolbarWidget(m_radioButtonOther);
|
||||
addToolbarWidget(m_radioButtonObject);
|
||||
auto action_ = addToolbarWidget(m_objectSelector);
|
||||
|
||||
m_radioButtonSelf->setChecked(m_action.appliesTo == ExecuteCodeAction::AppliesTo::Self);
|
||||
m_radioButtonOther->setChecked(m_action.appliesTo == ExecuteCodeAction::AppliesTo::Other);
|
||||
m_radioButtonObject->setChecked(m_action.appliesTo == ExecuteCodeAction::AppliesTo::Object);
|
||||
connect(m_radioButtonObject, &QRadioButton::toggled,
|
||||
m_objectSelector, &QWidget::setVisible);
|
||||
connect(m_radioButtonObject, &QRadioButton::toggled,
|
||||
action_, &QAction::setVisible);
|
||||
|
||||
m_radioButtonSelf->setChecked(std::holds_alternative<AppliesToSelf>(m_action.appliesTo));
|
||||
m_radioButtonOther->setChecked(std::holds_alternative<AppliesToOther>(m_action.appliesTo));
|
||||
{
|
||||
auto ptr = std::get_if<AppliesToObject>(&m_action.appliesTo);
|
||||
m_radioButtonObject->setChecked(ptr != nullptr);
|
||||
m_objectSelector->setVisible(ptr != nullptr);
|
||||
action_->setVisible(ptr != nullptr);
|
||||
if (ptr)
|
||||
m_objectSelector->setObject(ptr->objectName);
|
||||
else
|
||||
m_objectSelector->clearObject();
|
||||
}
|
||||
|
||||
setScript(m_action.script);
|
||||
|
||||
@@ -46,11 +69,11 @@ void ExecuteCodeDialog::accept()
|
||||
}
|
||||
|
||||
if (m_radioButtonSelf->isChecked())
|
||||
m_action.appliesTo = ExecuteCodeAction::AppliesTo::Self;
|
||||
m_action.appliesTo = AppliesToSelf{};
|
||||
else if (m_radioButtonOther->isChecked())
|
||||
m_action.appliesTo = ExecuteCodeAction::AppliesTo::Other;
|
||||
m_action.appliesTo = AppliesToOther{};
|
||||
else if (m_radioButtonObject->isChecked())
|
||||
m_action.appliesTo = ExecuteCodeAction::AppliesTo::Object;
|
||||
m_action.appliesTo = AppliesToObject{ .objectName = m_objectSelector->objectName() };
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("No Applies To selected!"), tr("No Applies To selected!"));
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
class QRadioButton;
|
||||
struct ExecuteCodeAction;
|
||||
class ProjectTreeModel;
|
||||
class ObjectSelectorWidget;
|
||||
|
||||
class ExecuteCodeDialog : public CodeEditorDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExecuteCodeDialog(ExecuteCodeAction &action, QWidget *parent = nullptr);
|
||||
explicit ExecuteCodeDialog(ExecuteCodeAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
|
||||
void accept() override;
|
||||
|
||||
@@ -20,4 +22,6 @@ private:
|
||||
QRadioButton * const m_radioButtonSelf;
|
||||
QRadioButton * const m_radioButtonOther;
|
||||
QRadioButton * const m_radioButtonObject;
|
||||
|
||||
ObjectSelectorWidget * const m_objectSelector;
|
||||
};
|
||||
@@ -3,13 +3,23 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
MoveFixedDialog::MoveFixedDialog(MoveFixedAction &action, QWidget *parent) :
|
||||
MoveFixedDialog::MoveFixedDialog(MoveFixedAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::MoveFixedDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace Ui { class MoveFixedDialog; }
|
||||
class MoveFixedAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class MoveFixedDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MoveFixedDialog(MoveFixedAction &action, QWidget *parent = nullptr);
|
||||
explicit MoveFixedDialog(MoveFixedAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~MoveFixedDialog() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
@@ -59,12 +59,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -285,6 +282,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
@@ -321,5 +326,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -3,13 +3,23 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
MoveFreeDialog::MoveFreeDialog(MoveFreeAction &action, QWidget *parent) :
|
||||
MoveFreeDialog::MoveFreeDialog(MoveFreeAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::MoveFreeDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace Ui { class MoveFreeDialog; }
|
||||
class MoveFreeAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class MoveFreeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MoveFreeDialog(MoveFreeAction &action, QWidget *parent = nullptr);
|
||||
explicit MoveFreeDialog(MoveFreeAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~MoveFreeDialog() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
@@ -59,12 +59,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -188,6 +185,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
@@ -224,5 +229,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -3,13 +3,23 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
MoveTowardsDialog::MoveTowardsDialog(MoveTowardsAction &action, QWidget *parent) :
|
||||
MoveTowardsDialog::MoveTowardsDialog(MoveTowardsAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::MoveTowardsDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace Ui { class MoveTowardsDialog; }
|
||||
class MoveTowardsAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class MoveTowardsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MoveTowardsDialog(MoveTowardsAction &action, QWidget *parent = nullptr);
|
||||
explicit MoveTowardsDialog(MoveTowardsAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~MoveTowardsDialog() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
@@ -59,12 +59,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -201,6 +198,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
@@ -237,5 +242,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "setgravitydialog.h"
|
||||
#include "ui_setgravitydialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
SetGravityDialog::SetGravityDialog(SetGravityAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::SetGravityDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
|
||||
}
|
||||
|
||||
SetGravityDialog::~SetGravityDialog() = default;
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Ui { class SetGravityDialog; }
|
||||
struct SetGravityAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class SetGravityDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SetGravityDialog(SetGravityAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~SetGravityDialog() override;
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::SetGravityDialog> m_ui;
|
||||
|
||||
SetGravityAction &m_action;
|
||||
};
|
||||
@@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SetGravityDialog</class>
|
||||
<widget class="QDialog" name="SetGravityDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>435</width>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Set Gravity</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../resources_editor.qrc">:/qtgameengine/icons/action-set-gravity.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Applies to</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonSelf">
|
||||
<property name="text">
|
||||
<string>Self</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonOther">
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
<string>Object:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelDirection">
|
||||
<property name="text">
|
||||
<string>direction:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxDirection</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxDirection"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelGravity">
|
||||
<property name="text">
|
||||
<string>gravity:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxGravity</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxGravity"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxRelative">
|
||||
<property name="text">
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SetGravityDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>257</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SetGravityDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>325</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -3,13 +3,23 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
SpeedHorizontalDialog::SpeedHorizontalDialog(SpeedHorizontalAction &action, QWidget *parent) :
|
||||
SpeedHorizontalDialog::SpeedHorizontalDialog(SpeedHorizontalAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::SpeedHorizontalDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace Ui { class SpeedHorizontalDialog; }
|
||||
struct SpeedHorizontalAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class SpeedHorizontalDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpeedHorizontalDialog(SpeedHorizontalAction &action, QWidget *parent = nullptr);
|
||||
explicit SpeedHorizontalDialog(SpeedHorizontalAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~SpeedHorizontalDialog() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,31 +6,183 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>435</width>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Speed Horizontal</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../resources_editor.qrc">:/qtgameengine/icons/action-speed-horizontal.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Applies to</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonSelf">
|
||||
<property name="text">
|
||||
<string>Self</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonOther">
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
<string>Object:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelHorSpeed">
|
||||
<property name="text">
|
||||
<string>hor. speed:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxHorSpeed</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxHorSpeed"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxRelative">
|
||||
<property name="text">
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
@@ -39,8 +191,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
@@ -55,8 +207,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
@@ -64,5 +216,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -3,13 +3,23 @@
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
SpeedVerticalDialog::SpeedVerticalDialog(SpeedVerticalAction &action, QWidget *parent) :
|
||||
SpeedVerticalDialog::SpeedVerticalDialog(SpeedVerticalAction &action, ProjectTreeModel *projectModel, QWidget *parent) :
|
||||
QDialog{parent},
|
||||
m_ui{std::make_unique<Ui::SpeedVerticalDialog>()},
|
||||
m_action{action}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
{
|
||||
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);
|
||||
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Ok))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/ok.png"});
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace Ui { class SpeedVerticalDialog; }
|
||||
struct SpeedVerticalAction;
|
||||
class ProjectTreeModel;
|
||||
|
||||
class SpeedVerticalDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpeedVerticalDialog(SpeedVerticalAction &action, QWidget *parent = nullptr);
|
||||
explicit SpeedVerticalDialog(SpeedVerticalAction &action, ProjectTreeModel *projectModel, QWidget *parent = nullptr);
|
||||
~SpeedVerticalDialog() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,31 +6,183 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>435</width>
|
||||
<height>429</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Speed Vertical</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../resources_editor.qrc">:/qtgameengine/icons/action-speed-vertical.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Applies to</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonSelf">
|
||||
<property name="text">
|
||||
<string>Self</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonOther">
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonObject">
|
||||
<property name="text">
|
||||
<string>Object:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ObjectSelectorWidget" name="widgetObject" native="true">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelVertSpeed">
|
||||
<property name="text">
|
||||
<string>vert. speed:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinBoxVertSpeed</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxVertSpeed"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxRelative">
|
||||
<property name="text">
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ObjectSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../resources_editor.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
@@ -39,8 +191,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
@@ -55,8 +207,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>419</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
@@ -64,5 +216,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButtonObject</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>widgetObject</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>127</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>289</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -115,9 +115,9 @@ void CodeEditorDialog::changed()
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditorDialog::addToolbarWidget(QWidget *widget)
|
||||
QAction *CodeEditorDialog::addToolbarWidget(QWidget *widget)
|
||||
{
|
||||
m_ui->toolBar->addWidget(widget);
|
||||
return m_ui->toolBar->addWidget(widget);
|
||||
}
|
||||
|
||||
void CodeEditorDialog::loadCode()
|
||||
|
||||
@@ -30,7 +30,7 @@ protected slots:
|
||||
protected:
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
void addToolbarWidget(QWidget *widget);
|
||||
QAction *addToolbarWidget(QWidget *widget);
|
||||
|
||||
private slots:
|
||||
void loadCode();
|
||||
|
||||
@@ -22,10 +22,8 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
m_collisionEvents{m_object.collisionEvents},
|
||||
m_eventsModel{std::make_unique<ObjectEventsModel>(m_events, m_collisionEvents)},
|
||||
m_menuSprites{new QMenu{this}},
|
||||
m_menuParents{new QMenu{this}},
|
||||
m_menuMaskSprites{new QMenu{this}},
|
||||
m_spriteName{object.spriteName},
|
||||
m_parentName{object.parentName},
|
||||
m_maskSpriteName{object.maskSpriteName}
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
@@ -37,13 +35,20 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
if (auto button = m_ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
button->setIcon(QIcon{":/qtgameengine/icons/delete.png"});
|
||||
|
||||
m_ui->widgetParent->setProjectModel(&m_projectModel);
|
||||
m_ui->widgetParent->setForbiddenObjectName(m_object.name);
|
||||
m_ui->actionsWidget->setProjectModel(&m_projectModel);
|
||||
|
||||
m_ui->lineEditName->setText(m_object.name);
|
||||
m_ui->lineEditSprite->setText(m_spriteName.isEmpty() ? tr("<no sprite>") : m_spriteName);
|
||||
m_ui->lineEditParent->setText(m_parentName.isEmpty() ? tr("<no parent>") : m_parentName);
|
||||
m_ui->widgetParent->setEmptySelectionText(tr("<no parent>"));
|
||||
if (QSignalBlocker blocker{m_ui->widgetParent}; object.parentName.isEmpty())
|
||||
m_ui->widgetParent->clearObject();
|
||||
else
|
||||
m_ui->widgetParent->setObject(object.parentName);
|
||||
m_ui->lineEditMask->setText(m_maskSpriteName.isEmpty() ? tr("<same as sprite>") : m_maskSpriteName);
|
||||
updateSpritePreview();
|
||||
m_ui->toolButtonSprite->setMenu(m_menuSprites);
|
||||
m_ui->toolButtonParent->setMenu(m_menuParents);
|
||||
m_ui->toolButtonMask->setMenu(m_menuMaskSprites);
|
||||
m_ui->checkBoxVisible->setChecked(m_object.visible);
|
||||
m_ui->checkBoxSolid->setChecked(m_object.solid);
|
||||
@@ -51,7 +56,6 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
m_ui->checkBoxPersistent->setChecked(m_object.persistent);
|
||||
|
||||
m_ui->lineEditSprite->setMenu(m_menuSprites);
|
||||
m_ui->lineEditParent->setMenu(m_menuParents);
|
||||
m_ui->lineEditMask->setMenu(m_menuMaskSprites);
|
||||
|
||||
m_ui->listViewEvents->setModel(m_eventsModel.get());
|
||||
@@ -104,11 +108,12 @@ ObjectPropertiesDialog::ObjectPropertiesDialog(Object &object, ProjectTreeModel
|
||||
|
||||
connect(m_menuSprites, &QMenu::aboutToShow,
|
||||
this, &ObjectPropertiesDialog::spritesMenuAboutToShow);
|
||||
connect(m_menuParents, &QMenu::aboutToShow,
|
||||
this, &ObjectPropertiesDialog::parentsMenuAboutToShow);
|
||||
connect(m_menuMaskSprites, &QMenu::aboutToShow,
|
||||
this, &ObjectPropertiesDialog::maskSpritesMenuAboutToShow);
|
||||
|
||||
connect(m_ui->widgetParent, &ObjectSelectorWidget::changed,
|
||||
this, &ObjectPropertiesDialog::changed);
|
||||
|
||||
connect(m_ui->listViewEvents->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &ObjectPropertiesDialog::currentEventChanged);
|
||||
|
||||
@@ -148,7 +153,7 @@ void ObjectPropertiesDialog::accept()
|
||||
m_object.solid = m_ui->checkBoxSolid->isChecked();
|
||||
m_object.depth = m_ui->spinBoxDepth->value();
|
||||
m_object.persistent = m_ui->checkBoxPersistent->isChecked();
|
||||
m_object.parentName = m_parentName;
|
||||
m_object.parentName = m_ui->widgetParent->objectName();
|
||||
m_object.maskSpriteName = m_maskSpriteName;
|
||||
m_object.events = std::move(m_events);
|
||||
m_object.collisionEvents = std::move(m_collisionEvents);
|
||||
@@ -283,11 +288,9 @@ void ObjectPropertiesDialog::objectNameChanged(const Object &object, const QStri
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
if (!m_parentName.isEmpty() && m_parentName == oldName)
|
||||
{
|
||||
m_parentName = object.name;
|
||||
m_ui->lineEditParent->setText(object.name);
|
||||
}
|
||||
if (QSignalBlocker blocker{m_ui->widgetParent};
|
||||
!m_ui->widgetParent->objectName().isEmpty() && m_ui->widgetParent->objectName() == oldName)
|
||||
m_ui->widgetParent->setObject(object.name);
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::spriteNameChanged(const Sprite &sprite, const QString &oldName)
|
||||
@@ -314,11 +317,9 @@ void ObjectPropertiesDialog::spriteNameChanged(const Sprite &sprite, const QStri
|
||||
|
||||
void ObjectPropertiesDialog::objectAboutToBeRemoved(const Object &object)
|
||||
{
|
||||
if (!m_parentName.isEmpty() && m_parentName == object.name)
|
||||
{
|
||||
m_parentName.clear();
|
||||
m_ui->lineEditParent->setText(tr("<no parent>"));
|
||||
}
|
||||
if (QSignalBlocker blocker{m_ui->widgetParent};
|
||||
!m_ui->widgetParent->objectName().isEmpty() && m_ui->widgetParent->objectName() == object.name)
|
||||
m_ui->widgetParent->clearObject();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::spriteAboutToBeRemoved(const Sprite &sprite)
|
||||
@@ -365,29 +366,6 @@ void ObjectPropertiesDialog::spritesMenuAboutToShow()
|
||||
[&sprite,this](){ setSprite(sprite); });
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::parentsMenuAboutToShow()
|
||||
{
|
||||
m_menuParents->clear();
|
||||
m_menuParents->addAction(tr("<no parent>"), this, &ObjectPropertiesDialog::clearParent);
|
||||
for (const Object &object : m_projectModel.project()->objects)
|
||||
{
|
||||
QIcon icon;
|
||||
if (!object.spriteName.isEmpty())
|
||||
{
|
||||
const auto &sprites = m_projectModel.project()->sprites;
|
||||
const auto iter = std::find_if(std::cbegin(sprites), std::cend(sprites),
|
||||
[&](const Sprite &sprite){ return sprite.name == object.spriteName; });
|
||||
if (iter != std::cend(sprites))
|
||||
{
|
||||
if (!iter->pixmaps.empty())
|
||||
icon = iter->pixmaps.front();
|
||||
}
|
||||
}
|
||||
m_menuParents->addAction(icon, object.name, this,
|
||||
[&object,this](){ setParent(object); });
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::maskSpritesMenuAboutToShow()
|
||||
{
|
||||
m_menuMaskSprites->clear();
|
||||
@@ -449,26 +427,6 @@ void ObjectPropertiesDialog::setSprite(const Sprite &sprite)
|
||||
changed();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::clearParent()
|
||||
{
|
||||
m_parentName.clear();
|
||||
m_ui->lineEditParent->setText(tr("<no parent>"));
|
||||
changed();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::setParent(const Object &object)
|
||||
{
|
||||
if (&m_object == &object)
|
||||
{
|
||||
QMessageBox::warning(this, tr("This will create a loop in parents."), tr("This will create a loop in parents."));
|
||||
return;
|
||||
}
|
||||
|
||||
m_parentName = object.name;
|
||||
m_ui->lineEditParent->setText(object.name);
|
||||
changed();
|
||||
}
|
||||
|
||||
void ObjectPropertiesDialog::clearMaskSprite()
|
||||
{
|
||||
m_maskSpriteName.clear();
|
||||
|
||||
@@ -42,7 +42,6 @@ private slots:
|
||||
void spritePixmapsChanged(const Sprite &sprite);
|
||||
|
||||
void spritesMenuAboutToShow();
|
||||
void parentsMenuAboutToShow();
|
||||
void maskSpritesMenuAboutToShow();
|
||||
void currentEventChanged(const QModelIndex &index);
|
||||
void eventsContextMenuRequested(const QPoint &pos);
|
||||
@@ -51,9 +50,6 @@ private slots:
|
||||
void clearSprite();
|
||||
void setSprite(const Sprite &sprite);
|
||||
|
||||
void clearParent();
|
||||
void setParent(const Object &object);
|
||||
|
||||
void clearMaskSprite();
|
||||
void setMaskSprite(const Sprite &sprite);
|
||||
|
||||
@@ -74,11 +70,9 @@ private:
|
||||
const std::unique_ptr<ObjectEventsModel> m_eventsModel;
|
||||
|
||||
QMenu * const m_menuSprites;
|
||||
QMenu * const m_menuParents;
|
||||
QMenu * const m_menuMaskSprites;
|
||||
|
||||
QString m_spriteName;
|
||||
QString m_parentName;
|
||||
QString m_maskSpriteName;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
@@ -204,42 +204,12 @@
|
||||
<string>Parent:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditParent</cstring>
|
||||
<cstring>widgetParent</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEditWithMenu" name="lineEditParent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The parent from which events and actions are</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><no parent></string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonParent">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::InstantPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="ObjectParentSelectorWidget" name="widgetParent" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
@@ -431,6 +401,12 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>widgets/qlineeditwithmenu.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ObjectParentSelectorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/objectparentselectorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources_editor.qrc"/>
|
||||
|
||||
Reference in new issue
Block a user