RoomEditorWidget improvements
This commit is contained in:
1 parent
77e7e18c26
commit
e5406ed0ce
16 files changed
+335
-79
No files matched your search
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "projectcontainer.h"
|
||||
#include "models/projecttreemodel.h"
|
||||
#include "roomscene.h"
|
||||
#include "editorguiutils.h"
|
||||
#include "genericcodeeditordialog.h"
|
||||
|
||||
RoomPropertiesDialog::RoomPropertiesDialog(Room &room, ProjectTreeModel &projectModel, QWidget *parent) :
|
||||
@@ -17,6 +19,7 @@ RoomPropertiesDialog::RoomPropertiesDialog(Room &room, ProjectTreeModel &project
|
||||
m_ui{std::make_unique<Ui::RoomPropertiesDialog>()},
|
||||
m_room{room},
|
||||
m_projectModel{projectModel},
|
||||
m_scene{std::make_unique<RoomScene>(this)},
|
||||
m_creationCode{m_room.creationCode},
|
||||
m_spinBoxSnapX{new QSpinBox{this}},
|
||||
m_spinBoxSnapY{new QSpinBox{this}},
|
||||
@@ -34,6 +37,10 @@ RoomPropertiesDialog::RoomPropertiesDialog(Room &room, ProjectTreeModel &project
|
||||
m_ui->roomEditWidget->setSnapY(m_room.snapY);
|
||||
m_ui->roomEditWidget->setGridEnabled(m_room.gridEnabled);
|
||||
m_ui->roomEditWidget->setIsometricGrid(m_room.isometricGrid);
|
||||
m_ui->roomEditWidget->setProjectTreeModel(&m_projectModel);
|
||||
|
||||
m_ui->graphicsView->setScene(m_scene.get());
|
||||
m_ui->graphicsView->setBackgroundBrush(makeGridBrush(16, 16, QPen{Qt::black}, Qt::white));
|
||||
|
||||
{
|
||||
int index{11};
|
||||
@@ -352,6 +359,7 @@ void RoomPropertiesDialog::objectAboutToBeRemoved(const Object &object)
|
||||
m_selectedObject = nullptr;
|
||||
m_ui->lineEditObject->clear();
|
||||
m_ui->labelObjectPreview->setPixmap({});
|
||||
m_ui->roomEditWidget->setSelectedObject(nullptr);
|
||||
}
|
||||
|
||||
void RoomPropertiesDialog::objectSpriteNameChanged(const Object &object)
|
||||
@@ -416,6 +424,7 @@ void RoomPropertiesDialog::setObject(const Object &object)
|
||||
}
|
||||
m_ui->labelObjectPreview->setPixmap(std::move(pixmap));
|
||||
m_ui->lineEditObject->setText(object.name);
|
||||
m_ui->roomEditWidget->setSelectedObject(&object);
|
||||
}
|
||||
|
||||
void RoomPropertiesDialog::updateTitle()
|
||||
|
||||
@@ -12,6 +12,7 @@ struct Room;
|
||||
struct Sprite;
|
||||
struct Object;
|
||||
class ProjectTreeModel;
|
||||
class RoomScene;
|
||||
|
||||
class RoomPropertiesDialog : public QDialog
|
||||
{
|
||||
@@ -55,6 +56,8 @@ private:
|
||||
Room &m_room;
|
||||
ProjectTreeModel &m_projectModel;
|
||||
|
||||
const std::unique_ptr<RoomScene> m_scene;
|
||||
|
||||
QString m_creationCode;
|
||||
|
||||
bool m_unsavedChanges{};
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>683</width>
|
||||
<width>419</width>
|
||||
<height>333</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -383,19 +383,35 @@
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollAreaRoom">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<widget class="QTabWidget" name="tabWidget_2">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="RoomEditWidget" name="roomEditWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</rect>
|
||||
<widget class="QScrollArea" name="scrollAreaRoom">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Custom Widget</string>
|
||||
</attribute>
|
||||
<widget class="RoomEditWidget" name="roomEditWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>459</width>
|
||||
<height>482</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGraphicsView" name="graphicsView">
|
||||
<attribute name="title">
|
||||
<string>QGraphicsView</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in new issue
Block a user