Browse Source

Add basic drop-and-drop connection editing

Marcus Huderle 6 years ago
parent
commit
64007b5bae
7 changed files with 229 additions and 88 deletions
  1. 141
    1
      editor.cpp
  2. 35
    0
      editor.h
  3. 23
    9
      mainwindow.cpp
  4. 6
    0
      mainwindow.h
  5. 21
    78
      mainwindow.ui
  6. 2
    0
      map.h
  7. 1
    0
      project.cpp

+ 141
- 1
editor.cpp View File

40
         map_item->draw();
40
         map_item->draw();
41
         map_item->setVisible(true);
41
         map_item->setVisible(true);
42
         map_item->setEnabled(true);
42
         map_item->setEnabled(true);
43
+        setConnectionsVisibility(true);
43
     }
44
     }
44
     if (collision_item) {
45
     if (collision_item) {
45
         collision_item->setVisible(false);
46
         collision_item->setVisible(false);
52
 void Editor::setEditingCollision() {
53
 void Editor::setEditingCollision() {
53
     current_view = collision_item;
54
     current_view = collision_item;
54
     if (collision_item) {
55
     if (collision_item) {
55
-        collision_item->draw();
56
         collision_item->setVisible(true);
56
         collision_item->setVisible(true);
57
+        setConnectionsVisibility(true);
57
     }
58
     }
58
     if (map_item) {
59
     if (map_item) {
59
         map_item->setVisible(false);
60
         map_item->setVisible(false);
71
     if (map_item) {
72
     if (map_item) {
72
         map_item->setVisible(true);
73
         map_item->setVisible(true);
73
         map_item->setEnabled(false);
74
         map_item->setEnabled(false);
75
+        setConnectionsVisibility(true);
74
     }
76
     }
75
     if (collision_item) {
77
     if (collision_item) {
76
         collision_item->setVisible(false);
78
         collision_item->setVisible(false);
77
     }
79
     }
78
 }
80
 }
79
 
81
 
82
+void Editor::setEditingConnections(QString direction) {
83
+    current_view = map_item;
84
+    if (map_item) {
85
+        map_item->draw();
86
+        map_item->setVisible(true);
87
+        map_item->setEnabled(true);
88
+        setConnectionsVisibility(false);
89
+        showCurrentConnectionMap(direction);
90
+    }
91
+    if (collision_item) {
92
+        collision_item->setVisible(false);
93
+    }
94
+    if (objects_group) {
95
+        objects_group->setVisible(false);
96
+    }
97
+}
98
+
99
+void Editor::showCurrentConnectionMap(QString curDirection) {
100
+    bool connectionExists = false;
101
+    for (Connection* connection : map->connections) {
102
+        if (connection->direction != curDirection) continue;
103
+        if (connection_item) {
104
+            scene->removeItem(connection_item);
105
+            delete connection_item;
106
+            connection_item = NULL;
107
+        }
108
+
109
+        connectionExists = true;
110
+        Map *connected_map = project->getMap(connection->map_name);
111
+        QPixmap pixmap = connected_map->renderConnection(*connection);
112
+        int offset = connection->offset.toInt(nullptr, 0);
113
+        int x = 0, y = 0;
114
+        if (connection->direction == "up") {
115
+            x = offset * 16;
116
+            y = -pixmap.height();
117
+        } else if (connection->direction == "down") {
118
+            x = offset * 16;
119
+            y = map->getHeight() * 16;
120
+        } else if (connection->direction == "left") {
121
+            x = -pixmap.width();
122
+            y = offset * 16;
123
+        } else if (connection->direction == "right") {
124
+            x = map->getWidth() * 16;
125
+            y = offset * 16;
126
+        }
127
+        connection_item = new ConnectionPixmapItem(pixmap, connection, x, y);
128
+        connection_item->setX(x);
129
+        connection_item->setY(y);
130
+        connection_item->setZValue(21);
131
+        scene->addItem(connection_item);
132
+        scene->setSceneRect(0, 0, pixmap.width() + map_item->pixmap().width(), pixmap.height() + map_item->pixmap().height());
133
+
134
+        connect(connection_item, SIGNAL(connectionMoved(int)), this, SLOT(onConnectionOffsetChanged(int)));
135
+        onConnectionOffsetChanged(connection->offset.toInt());
136
+        break;
137
+    }
138
+
139
+    if (!connectionExists && connection_item) {
140
+        scene->removeItem(connection_item);
141
+        delete connection_item;
142
+        connection_item = NULL;
143
+    }
144
+}
145
+
146
+void Editor::onConnectionOffsetChanged(int newOffset) {
147
+    emit connectionOffsetChanged(newOffset);
148
+}
149
+
150
+void Editor::setConnectionsVisibility(bool visible) {
151
+    for (QGraphicsPixmapItem* item : map->connection_items) {
152
+        item->setVisible(visible);
153
+        item->setActive(visible);
154
+    }
155
+}
156
+
80
 void Editor::setMap(QString map_name) {
157
 void Editor::setMap(QString map_name) {
81
     if (map_name.isNull()) {
158
     if (map_name.isNull()) {
82
         return;
159
         return;
231
         item->setX(x);
308
         item->setX(x);
232
         item->setY(y);
309
         item->setY(y);
233
         scene->addItem(item);
310
         scene->addItem(item);
311
+        map->connection_items.insert(connection->direction, item);
234
     }
312
     }
235
 }
313
 }
236
 
314
 
263
     }
341
     }
264
 }
342
 }
265
 
343
 
344
+void Editor::updateConnectionOffset(int offset) {
345
+    connection_item->blockSignals(true);
346
+    connection_item->connection->offset = QString::number(offset);
347
+    if (connection_item->connection->direction == "up" || connection_item->connection->direction == "down") {
348
+        connection_item->setX(connection_item->initialX + (offset - connection_item->initialOffset) * 16);
349
+    } else {
350
+        connection_item->setY(connection_item->initialY + (offset - connection_item->initialOffset) * 16);
351
+    }
352
+    connection_item->blockSignals(false);
353
+}
354
+
266
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
355
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
267
     draw();
356
     draw();
268
 }
357
 }
345
     }
434
     }
346
 }
435
 }
347
 
436
 
437
+QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVariant &value)
438
+{
439
+    if (change == ItemPositionChange) {
440
+        QPointF newPos = value.toPointF();
441
+
442
+        qreal x, y;
443
+        int newOffset = initialOffset;
444
+        if (connection->direction == "up" || connection->direction == "down") {
445
+            x = round(newPos.x() / 16) * 16;
446
+            newOffset += (x - initialX) / 16;
447
+        }
448
+        else {
449
+            x = initialX;
450
+        }
451
+
452
+        if (connection->direction == "right" || connection->direction == "left") {
453
+            y = round(newPos.y() / 16) * 16;
454
+            newOffset += (y - initialY) / 16;
455
+        }
456
+        else {
457
+            y = initialY;
458
+        }
459
+
460
+        emit connectionMoved(newOffset);
461
+        connection->offset = QString::number(newOffset);
462
+        return QPointF(x, y);
463
+    }
464
+    else {
465
+        return QGraphicsItem::itemChange(change, value);
466
+    }
467
+}
468
+void ConnectionPixmapItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
469
+    QPointF pos = event->pos();
470
+    qDebug() << "enter: " << pos.x() << ", " << pos.y();
471
+}
472
+void ConnectionPixmapItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) {
473
+    QPointF pos = event->pos();
474
+    qDebug() << "drag: " << pos.x() << ", " << pos.y();
475
+}
476
+void ConnectionPixmapItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) {
477
+    QPointF pos = event->pos();
478
+    qDebug() << "leave: " << pos.x() << ", " << pos.y();
479
+}
480
+void ConnectionPixmapItem::dropEvent(QGraphicsSceneDragDropEvent *event) {
481
+    QPointF pos = event->pos();
482
+    qDebug() << "drop: " << pos.x() << ", " << pos.y();
483
+}
484
+void ConnectionPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent* event) {
485
+    QPointF pos = event->pos();
486
+}
487
+
348
 void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
488
 void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
349
     int x = ((int)pos.x()) / 16;
489
     int x = ((int)pos.x()) / 16;
350
     int y = ((int)pos.y()) / 16;
490
     int y = ((int)pos.y()) / 16;

+ 35
- 0
editor.h View File

13
 class DraggablePixmapItem;
13
 class DraggablePixmapItem;
14
 class MapPixmapItem;
14
 class MapPixmapItem;
15
 class CollisionPixmapItem;
15
 class CollisionPixmapItem;
16
+class ConnectionPixmapItem;
16
 class MetatilesPixmapItem;
17
 class MetatilesPixmapItem;
17
 class CollisionMetatilesPixmapItem;
18
 class CollisionMetatilesPixmapItem;
18
 class ElevationMetatilesPixmapItem;
19
 class ElevationMetatilesPixmapItem;
44
     void setEditingMap();
45
     void setEditingMap();
45
     void setEditingCollision();
46
     void setEditingCollision();
46
     void setEditingObjects();
47
     void setEditingObjects();
48
+    void setEditingConnections(QString direction);
49
+    void showCurrentConnectionMap(QString curDirection);
50
+    void setConnectionsVisibility(bool visible);
51
+    void updateConnectionOffset(int offset);
47
 
52
 
48
     DraggablePixmapItem *addMapObject(Event *event);
53
     DraggablePixmapItem *addMapObject(Event *event);
49
     void selectMapObject(DraggablePixmapItem *object);
54
     void selectMapObject(DraggablePixmapItem *object);
58
     QGraphicsScene *scene = NULL;
63
     QGraphicsScene *scene = NULL;
59
     QGraphicsPixmapItem *current_view = NULL;
64
     QGraphicsPixmapItem *current_view = NULL;
60
     MapPixmapItem *map_item = NULL;
65
     MapPixmapItem *map_item = NULL;
66
+    ConnectionPixmapItem *connection_item = NULL;
61
     CollisionPixmapItem *collision_item = NULL;
67
     CollisionPixmapItem *collision_item = NULL;
62
     QGraphicsItemGroup *objects_group = NULL;
68
     QGraphicsItemGroup *objects_group = NULL;
63
 
69
 
80
 private slots:
86
 private slots:
81
     void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
87
     void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
82
     void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
88
     void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
89
+    void onConnectionOffsetChanged(int newOffset);
83
 
90
 
84
 signals:
91
 signals:
85
     void objectsChanged();
92
     void objectsChanged();
86
     void selectedObjectsChanged();
93
     void selectedObjectsChanged();
94
+    void connectionOffsetChanged(int newOffset);
87
 };
95
 };
88
 
96
 
89
 
97
 
240
     void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
248
     void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
241
 };
249
 };
242
 
250
 
251
+class ConnectionPixmapItem : public QObject, public QGraphicsPixmapItem {
252
+    Q_OBJECT
253
+public:
254
+    ConnectionPixmapItem(QPixmap pixmap, Connection* connection, int x, int y): QGraphicsPixmapItem(pixmap) {
255
+        this->connection = connection;
256
+        setFlag(ItemIsMovable);
257
+        setFlag(ItemIsSelectable);
258
+        setFlag(ItemSendsGeometryChanges);
259
+        this->initialX = x;
260
+        this->initialY = y;
261
+        this->initialOffset = connection->offset.toInt();
262
+    }
263
+    Connection* connection;
264
+    int initialX;
265
+    int initialY;
266
+    int initialOffset;
267
+protected:
268
+    QVariant itemChange(GraphicsItemChange change, const QVariant &value);
269
+    void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
270
+    void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
271
+    void dropEvent(QGraphicsSceneDragDropEvent *event) override;
272
+    void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
273
+    void mousePressEvent(QGraphicsSceneMouseEvent*);
274
+signals:
275
+    void connectionMoved(int offset);
276
+};
277
+
243
 class MetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
278
 class MetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
244
     Q_OBJECT
279
     Q_OBJECT
245
 public:
280
 public:

+ 23
- 9
mainwindow.cpp View File

30
     editor->gridToggleCheckbox = ui->checkBox_ToggleGrid;
30
     editor->gridToggleCheckbox = ui->checkBox_ToggleGrid;
31
     connect(editor, SIGNAL(objectsChanged()), this, SLOT(updateSelectedObjects()));
31
     connect(editor, SIGNAL(objectsChanged()), this, SLOT(updateSelectedObjects()));
32
     connect(editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
32
     connect(editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
33
+    connect(editor, SIGNAL(connectionOffsetChanged(int)), this, SLOT(onConnectionOffsetChanged(int)));
33
 
34
 
34
     on_toolButton_Paint_clicked();
35
     on_toolButton_Paint_clicked();
35
 
36
 
143
     }
144
     }
144
     editor->setMap(map_name);
145
     editor->setMap(map_name);
145
 
146
 
146
-    if (ui->tabWidget->currentIndex() == 1) {
147
-        editor->setEditingObjects();
148
-    } else {
149
-        if (ui->tabWidget_2->currentIndex() == 1) {
150
-            editor->setEditingCollision();
151
-        } else {
152
-            editor->setEditingMap();
153
-        }
154
-    }
147
+    on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
155
 
148
 
156
     ui->graphicsView_Map->setScene(editor->scene);
149
     ui->graphicsView_Map->setScene(editor->scene);
157
     ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
150
     ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
162
     ui->graphicsView_Objects_Map->setFixedSize(editor->scene->width() + 2, editor->scene->height() + 2);
155
     ui->graphicsView_Objects_Map->setFixedSize(editor->scene->width() + 2, editor->scene->height() + 2);
163
     ui->graphicsView_Objects_Map->editor = editor;
156
     ui->graphicsView_Objects_Map->editor = editor;
164
 
157
 
158
+    ui->graphicsView_Connections->setScene(editor->scene);
159
+
165
     ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
160
     ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
166
     //ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
161
     //ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
167
     ui->graphicsView_Metatiles->setFixedSize(editor->metatiles_item->pixmap().width() + 2, editor->metatiles_item->pixmap().height() + 2);
162
     ui->graphicsView_Metatiles->setFixedSize(editor->metatiles_item->pixmap().width() + 2, editor->metatiles_item->pixmap().height() + 2);
491
         on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
486
         on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
492
     } else if (index == 1) {
487
     } else if (index == 1) {
493
         editor->setEditingObjects();
488
         editor->setEditingObjects();
489
+    } else if (index == 3) {
490
+        editor->setEditingConnections(ui->comboBox_ConnectionDirection->currentText().toLower());
494
     }
491
     }
495
 }
492
 }
496
 
493
 
768
         editor->map_item->pixmap().save(filepath);
765
         editor->map_item->pixmap().save(filepath);
769
     }
766
     }
770
 }
767
 }
768
+
769
+void MainWindow::on_comboBox_ConnectionDirection_currentIndexChanged(const QString &direction)
770
+{
771
+    editor->showCurrentConnectionMap(direction.toLower());
772
+}
773
+
774
+void MainWindow::on_spinBox_ConnectionOffset_valueChanged(int offset)
775
+{
776
+    editor->updateConnectionOffset(offset);
777
+}
778
+
779
+void MainWindow::onConnectionOffsetChanged(int offset)
780
+{
781
+    ui->spinBox_ConnectionOffset->blockSignals(true);
782
+    ui->spinBox_ConnectionOffset->setValue(offset);
783
+    ui->spinBox_ConnectionOffset->blockSignals(false);
784
+}

+ 6
- 0
mainwindow.h View File

74
 
74
 
75
     void on_action_Export_Map_Image_triggered();
75
     void on_action_Export_Map_Image_triggered();
76
 
76
 
77
+    void on_comboBox_ConnectionDirection_currentIndexChanged(const QString &arg1);
78
+
79
+    void on_spinBox_ConnectionOffset_valueChanged(int offset);
80
+
81
+    void onConnectionOffsetChanged(int offset);
82
+
77
 private:
83
 private:
78
     Ui::MainWindow *ui;
84
     Ui::MainWindow *ui;
79
     QStandardItemModel *mapListModel;
85
     QStandardItemModel *mapListModel;

+ 21
- 78
mainwindow.ui View File

60
         </sizepolicy>
60
         </sizepolicy>
61
        </property>
61
        </property>
62
        <property name="currentIndex">
62
        <property name="currentIndex">
63
-        <number>0</number>
63
+        <number>3</number>
64
        </property>
64
        </property>
65
        <property name="tabsClosable">
65
        <property name="tabsClosable">
66
         <bool>false</bool>
66
         <bool>false</bool>
1266
               <property name="frameShadow">
1266
               <property name="frameShadow">
1267
                <enum>QFrame::Raised</enum>
1267
                <enum>QFrame::Raised</enum>
1268
               </property>
1268
               </property>
1269
-              <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0">
1269
+              <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0,0,0">
1270
                <property name="spacing">
1270
                <property name="spacing">
1271
                 <number>4</number>
1271
                 <number>4</number>
1272
                </property>
1272
                </property>
1286
                 <widget class="QComboBox" name="comboBox_ConnectionDirection">
1286
                 <widget class="QComboBox" name="comboBox_ConnectionDirection">
1287
                  <item>
1287
                  <item>
1288
                   <property name="text">
1288
                   <property name="text">
1289
-                   <string>North</string>
1289
+                   <string>Up</string>
1290
                   </property>
1290
                   </property>
1291
                  </item>
1291
                  </item>
1292
                  <item>
1292
                  <item>
1293
                   <property name="text">
1293
                   <property name="text">
1294
-                   <string>East</string>
1294
+                   <string>Right</string>
1295
                   </property>
1295
                   </property>
1296
                  </item>
1296
                  </item>
1297
                  <item>
1297
                  <item>
1298
                   <property name="text">
1298
                   <property name="text">
1299
-                   <string>South</string>
1299
+                   <string>Down</string>
1300
                   </property>
1300
                   </property>
1301
                  </item>
1301
                  </item>
1302
                  <item>
1302
                  <item>
1303
                   <property name="text">
1303
                   <property name="text">
1304
-                   <string>West</string>
1304
+                   <string>Left</string>
1305
                   </property>
1305
                   </property>
1306
                  </item>
1306
                  </item>
1307
                 </widget>
1307
                 </widget>
1337
                 </widget>
1337
                 </widget>
1338
                </item>
1338
                </item>
1339
                <item>
1339
                <item>
1340
+                <widget class="QLabel" name="label_12">
1341
+                 <property name="text">
1342
+                  <string>Offset</string>
1343
+                 </property>
1344
+                </widget>
1345
+               </item>
1346
+               <item>
1347
+                <widget class="QSpinBox" name="spinBox_ConnectionOffset">
1348
+                 <property name="minimum">
1349
+                  <number>-99</number>
1350
+                 </property>
1351
+                </widget>
1352
+               </item>
1353
+               <item>
1340
                 <spacer name="horizontalSpacer_6">
1354
                 <spacer name="horizontalSpacer_6">
1341
                  <property name="orientation">
1355
                  <property name="orientation">
1342
                   <enum>Qt::Horizontal</enum>
1356
                   <enum>Qt::Horizontal</enum>
1377
                 <number>0</number>
1391
                 <number>0</number>
1378
                </property>
1392
                </property>
1379
                <item row="0" column="0">
1393
                <item row="0" column="0">
1380
-                <widget class="QScrollArea" name="scrollArea_5">
1381
-                 <property name="widgetResizable">
1382
-                  <bool>true</bool>
1383
-                 </property>
1384
-                 <widget class="QWidget" name="scrollAreaWidgetContents_3">
1385
-                  <property name="geometry">
1386
-                   <rect>
1387
-                    <x>0</x>
1388
-                    <y>0</y>
1389
-                    <width>826</width>
1390
-                    <height>621</height>
1391
-                   </rect>
1392
-                  </property>
1393
-                  <layout class="QGridLayout" name="gridLayout_15">
1394
-                   <item row="1" column="1">
1395
-                    <widget class="QGraphicsView" name="graphicsView"/>
1396
-                   </item>
1397
-                   <item row="0" column="1">
1398
-                    <spacer name="verticalSpacer">
1399
-                     <property name="orientation">
1400
-                      <enum>Qt::Vertical</enum>
1401
-                     </property>
1402
-                     <property name="sizeHint" stdset="0">
1403
-                      <size>
1404
-                       <width>20</width>
1405
-                       <height>40</height>
1406
-                      </size>
1407
-                     </property>
1408
-                    </spacer>
1409
-                   </item>
1410
-                   <item row="2" column="1">
1411
-                    <spacer name="verticalSpacer_2">
1412
-                     <property name="orientation">
1413
-                      <enum>Qt::Vertical</enum>
1414
-                     </property>
1415
-                     <property name="sizeHint" stdset="0">
1416
-                      <size>
1417
-                       <width>20</width>
1418
-                       <height>40</height>
1419
-                      </size>
1420
-                     </property>
1421
-                    </spacer>
1422
-                   </item>
1423
-                   <item row="1" column="0">
1424
-                    <spacer name="horizontalSpacer_7">
1425
-                     <property name="orientation">
1426
-                      <enum>Qt::Horizontal</enum>
1427
-                     </property>
1428
-                     <property name="sizeHint" stdset="0">
1429
-                      <size>
1430
-                       <width>40</width>
1431
-                       <height>20</height>
1432
-                      </size>
1433
-                     </property>
1434
-                    </spacer>
1435
-                   </item>
1436
-                   <item row="1" column="2">
1437
-                    <spacer name="horizontalSpacer_8">
1438
-                     <property name="orientation">
1439
-                      <enum>Qt::Horizontal</enum>
1440
-                     </property>
1441
-                     <property name="sizeHint" stdset="0">
1442
-                      <size>
1443
-                       <width>40</width>
1444
-                       <height>20</height>
1445
-                      </size>
1446
-                     </property>
1447
-                    </spacer>
1448
-                   </item>
1449
-                  </layout>
1450
-                 </widget>
1451
-                </widget>
1394
+                <widget class="QGraphicsView" name="graphicsView_Connections"/>
1452
                </item>
1395
                </item>
1453
               </layout>
1396
               </layout>
1454
              </widget>
1397
              </widget>

+ 2
- 0
map.h View File

8
 #include <QPixmap>
8
 #include <QPixmap>
9
 #include <QObject>
9
 #include <QObject>
10
 #include <QDebug>
10
 #include <QDebug>
11
+#include <QGraphicsPixmapItem>
11
 
12
 
12
 
13
 
13
 template <typename T>
14
 template <typename T>
179
     QMap<QString, QList<Event*>> events;
180
     QMap<QString, QList<Event*>> events;
180
 
181
 
181
     QList<Connection*> connections;
182
     QList<Connection*> connections;
183
+    QMap<QString, QGraphicsPixmapItem*> connection_items;
182
     QPixmap renderConnection(Connection);
184
     QPixmap renderConnection(Connection);
183
 
185
 
184
     QImage border_image;
186
     QImage border_image;

+ 1
- 0
project.cpp View File

67
     }
67
     }
68
 
68
 
69
     map->connections.clear();
69
     map->connections.clear();
70
+    map->connection_items.clear();
70
     if (!map->connections_label.isNull()) {
71
     if (!map->connections_label.isNull()) {
71
         QString path = root + QString("/data/maps/%1/connections.inc").arg(map->name);
72
         QString path = root + QString("/data/maps/%1/connections.inc").arg(map->name);
72
         QString text = readTextFile(path);
73
         QString text = readTextFile(path);