Add basic drop-and-drop connection editing
This commit is contained in:
parent
e2933fc801
commit
64007b5bae
7 changed files with 229 additions and 88 deletions
142
editor.cpp
142
editor.cpp
|
@ -40,6 +40,7 @@ void Editor::setEditingMap() {
|
||||||
map_item->draw();
|
map_item->draw();
|
||||||
map_item->setVisible(true);
|
map_item->setVisible(true);
|
||||||
map_item->setEnabled(true);
|
map_item->setEnabled(true);
|
||||||
|
setConnectionsVisibility(true);
|
||||||
}
|
}
|
||||||
if (collision_item) {
|
if (collision_item) {
|
||||||
collision_item->setVisible(false);
|
collision_item->setVisible(false);
|
||||||
|
@ -52,8 +53,8 @@ void Editor::setEditingMap() {
|
||||||
void Editor::setEditingCollision() {
|
void Editor::setEditingCollision() {
|
||||||
current_view = collision_item;
|
current_view = collision_item;
|
||||||
if (collision_item) {
|
if (collision_item) {
|
||||||
collision_item->draw();
|
|
||||||
collision_item->setVisible(true);
|
collision_item->setVisible(true);
|
||||||
|
setConnectionsVisibility(true);
|
||||||
}
|
}
|
||||||
if (map_item) {
|
if (map_item) {
|
||||||
map_item->setVisible(false);
|
map_item->setVisible(false);
|
||||||
|
@ -71,12 +72,88 @@ void Editor::setEditingObjects() {
|
||||||
if (map_item) {
|
if (map_item) {
|
||||||
map_item->setVisible(true);
|
map_item->setVisible(true);
|
||||||
map_item->setEnabled(false);
|
map_item->setEnabled(false);
|
||||||
|
setConnectionsVisibility(true);
|
||||||
}
|
}
|
||||||
if (collision_item) {
|
if (collision_item) {
|
||||||
collision_item->setVisible(false);
|
collision_item->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::setEditingConnections(QString direction) {
|
||||||
|
current_view = map_item;
|
||||||
|
if (map_item) {
|
||||||
|
map_item->draw();
|
||||||
|
map_item->setVisible(true);
|
||||||
|
map_item->setEnabled(true);
|
||||||
|
setConnectionsVisibility(false);
|
||||||
|
showCurrentConnectionMap(direction);
|
||||||
|
}
|
||||||
|
if (collision_item) {
|
||||||
|
collision_item->setVisible(false);
|
||||||
|
}
|
||||||
|
if (objects_group) {
|
||||||
|
objects_group->setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::showCurrentConnectionMap(QString curDirection) {
|
||||||
|
bool connectionExists = false;
|
||||||
|
for (Connection* connection : map->connections) {
|
||||||
|
if (connection->direction != curDirection) continue;
|
||||||
|
if (connection_item) {
|
||||||
|
scene->removeItem(connection_item);
|
||||||
|
delete connection_item;
|
||||||
|
connection_item = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
connectionExists = true;
|
||||||
|
Map *connected_map = project->getMap(connection->map_name);
|
||||||
|
QPixmap pixmap = connected_map->renderConnection(*connection);
|
||||||
|
int offset = connection->offset.toInt(nullptr, 0);
|
||||||
|
int x = 0, y = 0;
|
||||||
|
if (connection->direction == "up") {
|
||||||
|
x = offset * 16;
|
||||||
|
y = -pixmap.height();
|
||||||
|
} else if (connection->direction == "down") {
|
||||||
|
x = offset * 16;
|
||||||
|
y = map->getHeight() * 16;
|
||||||
|
} else if (connection->direction == "left") {
|
||||||
|
x = -pixmap.width();
|
||||||
|
y = offset * 16;
|
||||||
|
} else if (connection->direction == "right") {
|
||||||
|
x = map->getWidth() * 16;
|
||||||
|
y = offset * 16;
|
||||||
|
}
|
||||||
|
connection_item = new ConnectionPixmapItem(pixmap, connection, x, y);
|
||||||
|
connection_item->setX(x);
|
||||||
|
connection_item->setY(y);
|
||||||
|
connection_item->setZValue(21);
|
||||||
|
scene->addItem(connection_item);
|
||||||
|
scene->setSceneRect(0, 0, pixmap.width() + map_item->pixmap().width(), pixmap.height() + map_item->pixmap().height());
|
||||||
|
|
||||||
|
connect(connection_item, SIGNAL(connectionMoved(int)), this, SLOT(onConnectionOffsetChanged(int)));
|
||||||
|
onConnectionOffsetChanged(connection->offset.toInt());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!connectionExists && connection_item) {
|
||||||
|
scene->removeItem(connection_item);
|
||||||
|
delete connection_item;
|
||||||
|
connection_item = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::onConnectionOffsetChanged(int newOffset) {
|
||||||
|
emit connectionOffsetChanged(newOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::setConnectionsVisibility(bool visible) {
|
||||||
|
for (QGraphicsPixmapItem* item : map->connection_items) {
|
||||||
|
item->setVisible(visible);
|
||||||
|
item->setActive(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::setMap(QString map_name) {
|
void Editor::setMap(QString map_name) {
|
||||||
if (map_name.isNull()) {
|
if (map_name.isNull()) {
|
||||||
return;
|
return;
|
||||||
|
@ -231,6 +308,7 @@ void Editor::displayMapConnections() {
|
||||||
item->setX(x);
|
item->setX(x);
|
||||||
item->setY(y);
|
item->setY(y);
|
||||||
scene->addItem(item);
|
scene->addItem(item);
|
||||||
|
map->connection_items.insert(connection->direction, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +341,17 @@ void Editor::displayMapGrid() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::updateConnectionOffset(int offset) {
|
||||||
|
connection_item->blockSignals(true);
|
||||||
|
connection_item->connection->offset = QString::number(offset);
|
||||||
|
if (connection_item->connection->direction == "up" || connection_item->connection->direction == "down") {
|
||||||
|
connection_item->setX(connection_item->initialX + (offset - connection_item->initialOffset) * 16);
|
||||||
|
} else {
|
||||||
|
connection_item->setY(connection_item->initialY + (offset - connection_item->initialOffset) * 16);
|
||||||
|
}
|
||||||
|
connection_item->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
||||||
void MetatilesPixmapItem::paintTileChanged(Map *map) {
|
void MetatilesPixmapItem::paintTileChanged(Map *map) {
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -345,6 +434,57 @@ void CollisionMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
|
{
|
||||||
|
if (change == ItemPositionChange) {
|
||||||
|
QPointF newPos = value.toPointF();
|
||||||
|
|
||||||
|
qreal x, y;
|
||||||
|
int newOffset = initialOffset;
|
||||||
|
if (connection->direction == "up" || connection->direction == "down") {
|
||||||
|
x = round(newPos.x() / 16) * 16;
|
||||||
|
newOffset += (x - initialX) / 16;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x = initialX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connection->direction == "right" || connection->direction == "left") {
|
||||||
|
y = round(newPos.y() / 16) * 16;
|
||||||
|
newOffset += (y - initialY) / 16;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
y = initialY;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit connectionMoved(newOffset);
|
||||||
|
connection->offset = QString::number(newOffset);
|
||||||
|
return QPointF(x, y);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QGraphicsItem::itemChange(change, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void ConnectionPixmapItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
qDebug() << "enter: " << pos.x() << ", " << pos.y();
|
||||||
|
}
|
||||||
|
void ConnectionPixmapItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
qDebug() << "drag: " << pos.x() << ", " << pos.y();
|
||||||
|
}
|
||||||
|
void ConnectionPixmapItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
qDebug() << "leave: " << pos.x() << ", " << pos.y();
|
||||||
|
}
|
||||||
|
void ConnectionPixmapItem::dropEvent(QGraphicsSceneDragDropEvent *event) {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
qDebug() << "drop: " << pos.x() << ", " << pos.y();
|
||||||
|
}
|
||||||
|
void ConnectionPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent* event) {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
}
|
||||||
|
|
||||||
void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
|
void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
|
||||||
int x = ((int)pos.x()) / 16;
|
int x = ((int)pos.x()) / 16;
|
||||||
int y = ((int)pos.y()) / 16;
|
int y = ((int)pos.y()) / 16;
|
||||||
|
|
35
editor.h
35
editor.h
|
@ -13,6 +13,7 @@
|
||||||
class DraggablePixmapItem;
|
class DraggablePixmapItem;
|
||||||
class MapPixmapItem;
|
class MapPixmapItem;
|
||||||
class CollisionPixmapItem;
|
class CollisionPixmapItem;
|
||||||
|
class ConnectionPixmapItem;
|
||||||
class MetatilesPixmapItem;
|
class MetatilesPixmapItem;
|
||||||
class CollisionMetatilesPixmapItem;
|
class CollisionMetatilesPixmapItem;
|
||||||
class ElevationMetatilesPixmapItem;
|
class ElevationMetatilesPixmapItem;
|
||||||
|
@ -44,6 +45,10 @@ public:
|
||||||
void setEditingMap();
|
void setEditingMap();
|
||||||
void setEditingCollision();
|
void setEditingCollision();
|
||||||
void setEditingObjects();
|
void setEditingObjects();
|
||||||
|
void setEditingConnections(QString direction);
|
||||||
|
void showCurrentConnectionMap(QString curDirection);
|
||||||
|
void setConnectionsVisibility(bool visible);
|
||||||
|
void updateConnectionOffset(int offset);
|
||||||
|
|
||||||
DraggablePixmapItem *addMapObject(Event *event);
|
DraggablePixmapItem *addMapObject(Event *event);
|
||||||
void selectMapObject(DraggablePixmapItem *object);
|
void selectMapObject(DraggablePixmapItem *object);
|
||||||
|
@ -58,6 +63,7 @@ public:
|
||||||
QGraphicsScene *scene = NULL;
|
QGraphicsScene *scene = NULL;
|
||||||
QGraphicsPixmapItem *current_view = NULL;
|
QGraphicsPixmapItem *current_view = NULL;
|
||||||
MapPixmapItem *map_item = NULL;
|
MapPixmapItem *map_item = NULL;
|
||||||
|
ConnectionPixmapItem *connection_item = NULL;
|
||||||
CollisionPixmapItem *collision_item = NULL;
|
CollisionPixmapItem *collision_item = NULL;
|
||||||
QGraphicsItemGroup *objects_group = NULL;
|
QGraphicsItemGroup *objects_group = NULL;
|
||||||
|
|
||||||
|
@ -80,10 +86,12 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
|
void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
|
||||||
void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
|
void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
|
||||||
|
void onConnectionOffsetChanged(int newOffset);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void objectsChanged();
|
void objectsChanged();
|
||||||
void selectedObjectsChanged();
|
void selectedObjectsChanged();
|
||||||
|
void connectionOffsetChanged(int newOffset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -240,6 +248,33 @@ protected:
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ConnectionPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ConnectionPixmapItem(QPixmap pixmap, Connection* connection, int x, int y): QGraphicsPixmapItem(pixmap) {
|
||||||
|
this->connection = connection;
|
||||||
|
setFlag(ItemIsMovable);
|
||||||
|
setFlag(ItemIsSelectable);
|
||||||
|
setFlag(ItemSendsGeometryChanges);
|
||||||
|
this->initialX = x;
|
||||||
|
this->initialY = y;
|
||||||
|
this->initialOffset = connection->offset.toInt();
|
||||||
|
}
|
||||||
|
Connection* connection;
|
||||||
|
int initialX;
|
||||||
|
int initialY;
|
||||||
|
int initialOffset;
|
||||||
|
protected:
|
||||||
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||||
|
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
void dropEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
|
||||||
|
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||||
|
signals:
|
||||||
|
void connectionMoved(int offset);
|
||||||
|
};
|
||||||
|
|
||||||
class MetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
|
class MetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -30,6 +30,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
editor->gridToggleCheckbox = ui->checkBox_ToggleGrid;
|
editor->gridToggleCheckbox = ui->checkBox_ToggleGrid;
|
||||||
connect(editor, SIGNAL(objectsChanged()), this, SLOT(updateSelectedObjects()));
|
connect(editor, SIGNAL(objectsChanged()), this, SLOT(updateSelectedObjects()));
|
||||||
connect(editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
|
connect(editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
|
||||||
|
connect(editor, SIGNAL(connectionOffsetChanged(int)), this, SLOT(onConnectionOffsetChanged(int)));
|
||||||
|
|
||||||
on_toolButton_Paint_clicked();
|
on_toolButton_Paint_clicked();
|
||||||
|
|
||||||
|
@ -143,15 +144,7 @@ void MainWindow::setMap(QString map_name) {
|
||||||
}
|
}
|
||||||
editor->setMap(map_name);
|
editor->setMap(map_name);
|
||||||
|
|
||||||
if (ui->tabWidget->currentIndex() == 1) {
|
on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
|
||||||
editor->setEditingObjects();
|
|
||||||
} else {
|
|
||||||
if (ui->tabWidget_2->currentIndex() == 1) {
|
|
||||||
editor->setEditingCollision();
|
|
||||||
} else {
|
|
||||||
editor->setEditingMap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->graphicsView_Map->setScene(editor->scene);
|
ui->graphicsView_Map->setScene(editor->scene);
|
||||||
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
||||||
|
@ -162,6 +155,8 @@ void MainWindow::setMap(QString map_name) {
|
||||||
ui->graphicsView_Objects_Map->setFixedSize(editor->scene->width() + 2, editor->scene->height() + 2);
|
ui->graphicsView_Objects_Map->setFixedSize(editor->scene->width() + 2, editor->scene->height() + 2);
|
||||||
ui->graphicsView_Objects_Map->editor = editor;
|
ui->graphicsView_Objects_Map->editor = editor;
|
||||||
|
|
||||||
|
ui->graphicsView_Connections->setScene(editor->scene);
|
||||||
|
|
||||||
ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
|
ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
|
||||||
//ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
|
//ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
|
||||||
ui->graphicsView_Metatiles->setFixedSize(editor->metatiles_item->pixmap().width() + 2, editor->metatiles_item->pixmap().height() + 2);
|
ui->graphicsView_Metatiles->setFixedSize(editor->metatiles_item->pixmap().width() + 2, editor->metatiles_item->pixmap().height() + 2);
|
||||||
|
@ -491,6 +486,8 @@ void MainWindow::on_tabWidget_currentChanged(int index)
|
||||||
on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
|
on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
editor->setEditingObjects();
|
editor->setEditingObjects();
|
||||||
|
} else if (index == 3) {
|
||||||
|
editor->setEditingConnections(ui->comboBox_ConnectionDirection->currentText().toLower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,3 +765,20 @@ void MainWindow::on_action_Export_Map_Image_triggered()
|
||||||
editor->map_item->pixmap().save(filepath);
|
editor->map_item->pixmap().save(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_comboBox_ConnectionDirection_currentIndexChanged(const QString &direction)
|
||||||
|
{
|
||||||
|
editor->showCurrentConnectionMap(direction.toLower());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_spinBox_ConnectionOffset_valueChanged(int offset)
|
||||||
|
{
|
||||||
|
editor->updateConnectionOffset(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onConnectionOffsetChanged(int offset)
|
||||||
|
{
|
||||||
|
ui->spinBox_ConnectionOffset->blockSignals(true);
|
||||||
|
ui->spinBox_ConnectionOffset->setValue(offset);
|
||||||
|
ui->spinBox_ConnectionOffset->blockSignals(false);
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,12 @@ private slots:
|
||||||
|
|
||||||
void on_action_Export_Map_Image_triggered();
|
void on_action_Export_Map_Image_triggered();
|
||||||
|
|
||||||
|
void on_comboBox_ConnectionDirection_currentIndexChanged(const QString &arg1);
|
||||||
|
|
||||||
|
void on_spinBox_ConnectionOffset_valueChanged(int offset);
|
||||||
|
|
||||||
|
void onConnectionOffsetChanged(int offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QStandardItemModel *mapListModel;
|
QStandardItemModel *mapListModel;
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="tabsClosable">
|
<property name="tabsClosable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -1266,7 +1266,7 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0,0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1286,22 +1286,22 @@
|
||||||
<widget class="QComboBox" name="comboBox_ConnectionDirection">
|
<widget class="QComboBox" name="comboBox_ConnectionDirection">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>North</string>
|
<string>Up</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>East</string>
|
<string>Right</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>South</string>
|
<string>Down</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>West</string>
|
<string>Left</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -1336,6 +1336,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Offset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_ConnectionOffset">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-99</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_6">
|
<spacer name="horizontalSpacer_6">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -1377,78 +1391,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QScrollArea" name="scrollArea_5">
|
<widget class="QGraphicsView" name="graphicsView_Connections"/>
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_3">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>826</width>
|
|
||||||
<height>621</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_15">
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QGraphicsView" name="graphicsView"/>
|
|
||||||
</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_7">
|
|
||||||
<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="2">
|
|
||||||
<spacer name="horizontalSpacer_8">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
2
map.h
2
map.h
|
@ -8,6 +8,7 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QGraphicsPixmapItem>
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -179,6 +180,7 @@ public:
|
||||||
QMap<QString, QList<Event*>> events;
|
QMap<QString, QList<Event*>> events;
|
||||||
|
|
||||||
QList<Connection*> connections;
|
QList<Connection*> connections;
|
||||||
|
QMap<QString, QGraphicsPixmapItem*> connection_items;
|
||||||
QPixmap renderConnection(Connection);
|
QPixmap renderConnection(Connection);
|
||||||
|
|
||||||
QImage border_image;
|
QImage border_image;
|
||||||
|
|
|
@ -67,6 +67,7 @@ void Project::loadMapConnections(Map *map) {
|
||||||
}
|
}
|
||||||
|
|
||||||
map->connections.clear();
|
map->connections.clear();
|
||||||
|
map->connection_items.clear();
|
||||||
if (!map->connections_label.isNull()) {
|
if (!map->connections_label.isNull()) {
|
||||||
QString path = root + QString("/data/maps/%1/connections.inc").arg(map->name);
|
QString path = root + QString("/data/maps/%1/connections.inc").arg(map->name);
|
||||||
QString text = readTextFile(path);
|
QString text = readTextFile(path);
|
||||||
|
|
Loading…
Reference in a new issue