Преглед изворни кода

Support multiple connections in same direction, and darken non-selected connections

Marcus Huderle пре 6 година
родитељ
комит
9a6132314c
5 измењених фајлова са 206 додато и 143 уклоњено
  1. 158
    127
      editor.cpp
  2. 26
    7
      editor.h
  3. 2
    2
      mainwindow.cpp
  4. 19
    6
      mainwindow.ui
  5. 1
    1
      map.h

+ 158
- 127
editor.cpp Прегледај датотеку

@@ -50,10 +50,8 @@ void Editor::setEditingMap() {
50 50
     if (objects_group) {
51 51
         objects_group->setVisible(false);
52 52
     }
53
-    if (connection_item) {
54
-        connection_item->setVisible(false);
55
-        connection_item->setEnabled(false);
56
-    }
53
+    setBorderItemsVisible(true);
54
+    setConnectionItemsVisible(false);
57 55
 }
58 56
 
59 57
 void Editor::setEditingCollision() {
@@ -68,10 +66,8 @@ void Editor::setEditingCollision() {
68 66
     if (objects_group) {
69 67
         objects_group->setVisible(false);
70 68
     }
71
-    if (connection_item) {
72
-        connection_item->setVisible(false);
73
-        connection_item->setEnabled(false);
74
-    }
69
+    setBorderItemsVisible(true);
70
+    setConnectionItemsVisible(false);
75 71
 }
76 72
 
77 73
 void Editor::setEditingObjects() {
@@ -87,13 +83,11 @@ void Editor::setEditingObjects() {
87 83
     if (collision_item) {
88 84
         collision_item->setVisible(false);
89 85
     }
90
-    if (connection_item) {
91
-        connection_item->setVisible(false);
92
-        connection_item->setEnabled(false);
93
-    }
86
+    setBorderItemsVisible(true);
87
+    setConnectionItemsVisible(false);
94 88
 }
95 89
 
96
-void Editor::setEditingConnections(QString direction) {
90
+void Editor::setEditingConnections() {
97 91
     current_view = map_item;
98 92
     if (map_item) {
99 93
         map_item->draw();
@@ -104,7 +98,10 @@ void Editor::setEditingConnections(QString direction) {
104 98
         ui->comboBox_ConnectedMap->addItems(*project->mapNames);
105 99
         ui->comboBox_ConnectedMap->blockSignals(false);
106 100
         setConnectionsVisibility(false);
107
-        showCurrentConnectionMap(direction);
101
+        if (current_connection_edit_item) {
102
+            onConnectionOffsetChanged(current_connection_edit_item->connection->offset.toInt());
103
+            updateConnectionMap(current_connection_edit_item->connection->map_name, current_connection_edit_item->connection->direction);
104
+        }
108 105
     }
109 106
     if (collision_item) {
110 107
         collision_item->setVisible(false);
@@ -112,71 +109,63 @@ void Editor::setEditingConnections(QString direction) {
112 109
     if (objects_group) {
113 110
         objects_group->setVisible(false);
114 111
     }
112
+    setBorderItemsVisible(true, 0.4);
113
+    setConnectionItemsVisible(true);
115 114
 }
116 115
 
117
-void Editor::showCurrentConnectionMap(QString curDirection) {
118
-    bool connectionExists = false;
119
-    for (Connection* connection : map->connections) {
120
-        if (connection->direction != curDirection) continue;
121
-        if (connection_item) {
122
-            scene->removeItem(connection_item);
123
-            delete connection_item;
124
-            connection_item = NULL;
125
-        }
126
-
127
-        connectionExists = true;
128
-        Map *connected_map = project->getMap(connection->map_name);
129
-        QPixmap pixmap = connected_map->renderConnection(*connection);
130
-        int offset = connection->offset.toInt(nullptr, 0);
131
-        int x = 0, y = 0;
132
-        if (connection->direction == "up") {
133
-            x = offset * 16;
134
-            y = -pixmap.height();
135
-        } else if (connection->direction == "down") {
136
-            x = offset * 16;
137
-            y = map->getHeight() * 16;
138
-        } else if (connection->direction == "left") {
139
-            x = -pixmap.width();
140
-            y = offset * 16;
141
-        } else if (connection->direction == "right") {
142
-            x = map->getWidth() * 16;
143
-            y = offset * 16;
144
-        }
145
-
146
-        QPainter painter(&pixmap);
147
-        painter.setPen(QColor(255, 0, 255));
148
-        painter.drawRect(0, 0, pixmap.width() - 1, pixmap.height() - 1);
149
-        painter.end();
150
-        connection_item = new ConnectionPixmapItem(pixmap, connection, x, y);
151
-        connection_item->setX(x);
152
-        connection_item->setY(y);
153
-        connection_item->setZValue(21);
154
-        scene->addItem(connection_item);
155
-
156
-        connect(connection_item, SIGNAL(connectionMoved(int)), this, SLOT(onConnectionOffsetChanged(int)));
157
-        onConnectionOffsetChanged(connection->offset.toInt());
158
-
159
-        ui->comboBox_ConnectedMap->setCurrentText(connection->map_name);
160
-        break;
116
+void Editor::setConnectionItemsVisible(bool visible) {
117
+    for (ConnectionPixmapItem* item : connection_edit_items) {
118
+        item->setVisible(visible);
119
+        item->setEnabled(visible);
161 120
     }
121
+}
162 122
 
163
-    if (!connectionExists) {
164
-        if (connection_item) {
165
-            delete connection_item;
166
-            connection_item = NULL;
123
+void Editor::setBorderItemsVisible(bool visible, qreal opacity) {
124
+    for (QGraphicsPixmapItem* item : borderItems) {
125
+        item->setVisible(visible);
126
+        item->setOpacity(opacity);
127
+    }
128
+}
167 129
 
168
-            if (map->connection_items.contains(curDirection)) {
169
-                delete map->connection_items.value(curDirection);
170
-                map->connection_items.remove(curDirection);
171
-            }
172
-        }
130
+void Editor::setCurrentConnectionDirection(QString curDirection) {
131
+    if (!current_connection_edit_item)
132
+        return;
173 133
 
174
-        ui->comboBox_ConnectedMap->setCurrentText("");
175
-        ui->spinBox_ConnectionOffset->setDisabled(true);
176
-        ui->spinBox_ConnectionOffset->setValue(0);
177
-    } else {
178
-        ui->spinBox_ConnectionOffset->setDisabled(false);
179
-    }
134
+    current_connection_edit_item->connection->direction = curDirection;
135
+    Map *connected_map = project->getMap(current_connection_edit_item->connection->map_name);
136
+    QPixmap pixmap = connected_map->renderConnection(*current_connection_edit_item->connection);
137
+    int offset = current_connection_edit_item->connection->offset.toInt(nullptr, 0);
138
+    current_connection_edit_item->initialOffset = offset;
139
+    int x = 0, y = 0;
140
+    if (current_connection_edit_item->connection->direction == "up") {
141
+        x = offset * 16;
142
+        y = -pixmap.height();
143
+    } else if (current_connection_edit_item->connection->direction == "down") {
144
+        x = offset * 16;
145
+        y = map->getHeight() * 16;
146
+    } else if (current_connection_edit_item->connection->direction == "left") {
147
+        x = -pixmap.width();
148
+        y = offset * 16;
149
+    } else if (current_connection_edit_item->connection->direction == "right") {
150
+        x = map->getWidth() * 16;
151
+        y = offset * 16;
152
+    }
153
+
154
+    current_connection_edit_item->basePixmap = pixmap;
155
+    QPainter painter(&pixmap);
156
+    painter.setPen(QColor(255, 0, 255));
157
+    painter.drawRect(0, 0, pixmap.width() - 1, pixmap.height() - 1);
158
+    painter.end();
159
+    current_connection_edit_item->setPixmap(pixmap);
160
+    current_connection_edit_item->initialX = x;
161
+    current_connection_edit_item->initialY = y;
162
+    current_connection_edit_item->blockSignals(true);
163
+    current_connection_edit_item->setX(x);
164
+    current_connection_edit_item->setY(y);
165
+    current_connection_edit_item->setZValue(-1);
166
+    current_connection_edit_item->blockSignals(false);
167
+
168
+    setConnectionEditControlValues(current_connection_edit_item->connection);
180 169
 }
181 170
 
182 171
 void Editor::onConnectionOffsetChanged(int newOffset) {
@@ -185,6 +174,54 @@ void Editor::onConnectionOffsetChanged(int newOffset) {
185 174
     ui->spinBox_ConnectionOffset->blockSignals(false);
186 175
 }
187 176
 
177
+void Editor::setConnectionEditControlValues(Connection* connection) {
178
+    ui->comboBox_ConnectedMap->blockSignals(true);
179
+    ui->comboBox_ConnectionDirection->blockSignals(true);
180
+    ui->spinBox_ConnectionOffset->blockSignals(true);
181
+
182
+    ui->comboBox_ConnectedMap->setCurrentText(connection->map_name);
183
+    ui->comboBox_ConnectionDirection->setCurrentText(connection->direction);
184
+    ui->spinBox_ConnectionOffset->setValue(connection->offset.toInt());
185
+
186
+    ui->comboBox_ConnectedMap->blockSignals(false);
187
+    ui->comboBox_ConnectionDirection->blockSignals(false);
188
+    ui->spinBox_ConnectionOffset->blockSignals(false);
189
+}
190
+
191
+void Editor::setConnectionEditControlsEnabled(bool enabled) {
192
+    ui->comboBox_ConnectionDirection->setEnabled(enabled);
193
+    ui->comboBox_ConnectedMap->setEnabled(enabled);
194
+    ui->spinBox_ConnectionOffset->setEnabled(enabled);
195
+}
196
+
197
+void Editor::onConnectionItemSelected(ConnectionPixmapItem* connectionItem) {
198
+    for (ConnectionPixmapItem* item : connection_edit_items) {
199
+        bool isSelectedItem = item == connectionItem;
200
+        int zValue = isSelectedItem ? 0 : -1;
201
+        qreal opacity = isSelectedItem ? 1 : 0.75;
202
+        item->setZValue(zValue);
203
+        item->render(opacity);
204
+        if (isSelectedItem) {
205
+            QPixmap pixmap = item->pixmap();
206
+            QPainter painter(&pixmap);
207
+            painter.setPen(QColor(255, 0, 255));
208
+            painter.drawRect(0, 0, pixmap.width() - 1, pixmap.height() - 1);
209
+            painter.end();
210
+            item->setPixmap(pixmap);
211
+        }
212
+    }
213
+    current_connection_edit_item = connectionItem;
214
+    current_connection_edit_item->setZValue(0);
215
+    setConnectionEditControlsEnabled(true);
216
+    setConnectionEditControlValues(current_connection_edit_item->connection);
217
+}
218
+
219
+void Editor::onConnectionDirectionChanged(QString newDirection) {
220
+    ui->comboBox_ConnectionDirection->blockSignals(true);
221
+    ui->comboBox_ConnectionDirection->setCurrentText(newDirection);
222
+    ui->comboBox_ConnectionDirection->blockSignals(false);
223
+}
224
+
188 225
 void Editor::setConnectionsVisibility(bool visible) {
189 226
     for (QGraphicsPixmapItem* item : map->connection_items) {
190 227
         item->setVisible(visible);
@@ -320,10 +357,16 @@ DraggablePixmapItem *Editor::addMapObject(Event *event) {
320 357
 }
321 358
 
322 359
 void Editor::displayMapConnections() {
323
-    for (QString key : map->connection_items.keys()) {
324
-        scene->removeItem(map->connection_items.value(key));
325
-        delete map->connection_items.value(key);
360
+    for (QGraphicsPixmapItem* item : map->connection_items) {
361
+        scene->removeItem(item);
362
+        delete item;
326 363
     }
364
+    map->connection_items.clear();
365
+
366
+    for (ConnectionPixmapItem* item : connection_edit_items) {
367
+        delete item;
368
+    }
369
+    connection_edit_items.clear();
327 370
 
328 371
     for (Connection *connection : map->connections) {
329 372
         if (connection->direction == "dive" || connection->direction == "emerge") {
@@ -346,12 +389,26 @@ void Editor::displayMapConnections() {
346 389
             x = map->getWidth() * 16;
347 390
             y = offset * 16;
348 391
         }
392
+
349 393
         QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);
350 394
         item->setZValue(-1);
351 395
         item->setX(x);
352 396
         item->setY(y);
353 397
         scene->addItem(item);
354
-        map->connection_items.insert(connection->direction, item);
398
+        map->connection_items.append(item);
399
+
400
+        ConnectionPixmapItem *connection_edit_item = new ConnectionPixmapItem(pixmap, connection, x, y);
401
+        connection_edit_item->setX(x);
402
+        connection_edit_item->setY(y);
403
+        connection_edit_item->setZValue(-1);
404
+        scene->addItem(connection_edit_item);
405
+        connect(connection_edit_item, SIGNAL(connectionMoved(int)), this, SLOT(onConnectionOffsetChanged(int)));
406
+        connect(connection_edit_item, SIGNAL(connectionItemSelected(ConnectionPixmapItem*)), this, SLOT(onConnectionItemSelected(ConnectionPixmapItem*)));
407
+        connection_edit_items.append(connection_edit_item);
408
+    }
409
+
410
+    if (!connection_edit_items.empty()) {
411
+        onConnectionItemSelected(connection_edit_items.first());
355 412
     }
356 413
 }
357 414
 
@@ -364,6 +421,7 @@ void Editor::displayMapBorder() {
364 421
         item->setY(y * 16);
365 422
         item->setZValue(-2);
366 423
         scene->addItem(item);
424
+        borderItems.append(item);
367 425
     }
368 426
 }
369 427
 
@@ -385,17 +443,17 @@ void Editor::displayMapGrid() {
385 443
 }
386 444
 
387 445
 void Editor::updateConnectionOffset(int offset) {
388
-    if (!connection_item)
446
+    if (!current_connection_edit_item)
389 447
         return;
390 448
 
391
-    connection_item->blockSignals(true);
392
-    connection_item->connection->offset = QString::number(offset);
393
-    if (connection_item->connection->direction == "up" || connection_item->connection->direction == "down") {
394
-        connection_item->setX(connection_item->initialX + (offset - connection_item->initialOffset) * 16);
449
+    current_connection_edit_item->blockSignals(true);
450
+    current_connection_edit_item->connection->offset = QString::number(offset);
451
+    if (current_connection_edit_item->connection->direction == "up" || current_connection_edit_item->connection->direction == "down") {
452
+        current_connection_edit_item->setX(current_connection_edit_item->initialX + (offset - current_connection_edit_item->initialOffset) * 16);
395 453
     } else {
396
-        connection_item->setY(connection_item->initialY + (offset - connection_item->initialOffset) * 16);
454
+        current_connection_edit_item->setY(current_connection_edit_item->initialY + (offset - current_connection_edit_item->initialOffset) * 16);
397 455
     }
398
-    connection_item->blockSignals(false);
456
+    current_connection_edit_item->blockSignals(false);
399 457
 }
400 458
 
401 459
 void Editor::updateConnectionMap(QString mapName, QString direction) {
@@ -403,31 +461,24 @@ void Editor::updateConnectionMap(QString mapName, QString direction) {
403 461
         qDebug() << "Invalid map name " << mapName << " specified for connection.";
404 462
         return;
405 463
     }
464
+    if (!current_connection_edit_item)
465
+        return;
406 466
 
407
-    if (connection_item) {
408
-        // Find the connection we are updating.
409
-        bool foundConnection = false;
410
-        for (Connection* connection : map->connections) {
411
-            if (connection->direction == direction) {
412
-                foundConnection = true;
413
-                if (mapName.isEmpty()) {
414
-                    map->connections.removeOne(connection);
415
-                } else {
416
-                    connection->map_name = mapName;
417
-                }
418
-                break;
419
-            }
420
-        }
421
-    } else if (!mapName.isEmpty()) {
422
-        // Create a brand new connection.
423
-        Connection* newConnection = new Connection;
424
-        newConnection->direction = direction;
425
-        newConnection->offset = "0";
426
-        newConnection->map_name = mapName;
427
-        map->connections.append(newConnection);
467
+    if (mapName.isEmpty()) {
468
+        map->connections.removeOne(current_connection_edit_item->connection);
469
+        connection_edit_items.removeOne(current_connection_edit_item);
470
+        scene->removeItem(current_connection_edit_item);
471
+        delete current_connection_edit_item;
472
+        current_connection_edit_item = NULL;
473
+        setConnectionEditControlsEnabled(false);
474
+        ui->spinBox_ConnectionOffset->setValue(0);
475
+        return;
476
+    } else {
477
+        setConnectionEditControlsEnabled(true);
428 478
     }
429 479
 
430
-    showCurrentConnectionMap(direction);
480
+    current_connection_edit_item->connection->map_name = mapName;
481
+    setCurrentConnectionDirection(direction);
431 482
 }
432 483
 
433 484
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
@@ -543,24 +594,8 @@ QVariant ConnectionPixmapItem::itemChange(GraphicsItemChange change, const QVari
543 594
         return QGraphicsItem::itemChange(change, value);
544 595
     }
545 596
 }
546
-void ConnectionPixmapItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
547
-    QPointF pos = event->pos();
548
-    qDebug() << "enter: " << pos.x() << ", " << pos.y();
549
-}
550
-void ConnectionPixmapItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event) {
551
-    QPointF pos = event->pos();
552
-    qDebug() << "drag: " << pos.x() << ", " << pos.y();
553
-}
554
-void ConnectionPixmapItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) {
555
-    QPointF pos = event->pos();
556
-    qDebug() << "leave: " << pos.x() << ", " << pos.y();
557
-}
558
-void ConnectionPixmapItem::dropEvent(QGraphicsSceneDragDropEvent *event) {
559
-    QPointF pos = event->pos();
560
-    qDebug() << "drop: " << pos.x() << ", " << pos.y();
561
-}
562 597
 void ConnectionPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent* event) {
563
-    QPointF pos = event->pos();
598
+    emit connectionItemSelected(this);
564 599
 }
565 600
 
566 601
 void ElevationMetatilesPixmapItem::updateCurHoveredMetatile(QPointF pos) {
@@ -694,10 +729,6 @@ void MapPixmapItem::paintSmartPath(int x, int y) {
694 729
         if (left && IS_SMART_PATH_TILE(left))
695 730
             id += 8;
696 731
 
697
-        if (block) {
698
-            qDebug() << "tile: " << block->tile << "base: " << map->paint_tile << "id: " << id;
699
-        }
700
-
701 732
         block->tile = map->paint_tile + smartPathTable[id];;
702 733
         map->_setBlock(actualX, actualY, *block);
703 734
     }

+ 26
- 7
editor.h Прегледај датотеку

@@ -46,8 +46,8 @@ public:
46 46
     void setEditingMap();
47 47
     void setEditingCollision();
48 48
     void setEditingObjects();
49
-    void setEditingConnections(QString direction);
50
-    void showCurrentConnectionMap(QString curDirection);
49
+    void setEditingConnections();
50
+    void setCurrentConnectionDirection(QString curDirection);
51 51
     void setConnectionsVisibility(bool visible);
52 52
     void updateConnectionOffset(int offset);
53 53
     void updateConnectionMap(QString mapName, QString direction);
@@ -65,9 +65,11 @@ public:
65 65
     QGraphicsScene *scene = NULL;
66 66
     QGraphicsPixmapItem *current_view = NULL;
67 67
     MapPixmapItem *map_item = NULL;
68
-    ConnectionPixmapItem *connection_item = NULL;
68
+    ConnectionPixmapItem* current_connection_edit_item = NULL;
69
+    QList<ConnectionPixmapItem*> connection_edit_items;
69 70
     CollisionPixmapItem *collision_item = NULL;
70 71
     QGraphicsItemGroup *objects_group = NULL;
72
+    QList<QGraphicsPixmapItem*> borderItems;
71 73
 
72 74
     QGraphicsScene *scene_metatiles = NULL;
73 75
     QGraphicsScene *scene_collision_metatiles = NULL;
@@ -85,10 +87,18 @@ public:
85 87
     void objectsView_onMouseMove(QMouseEvent *event);
86 88
     void objectsView_onMouseRelease(QMouseEvent *event);
87 89
 
90
+private:
91
+    void setConnectionItemsVisible(bool);
92
+    void setBorderItemsVisible(bool, qreal = 1);
93
+    void setConnectionEditControlValues(Connection*);
94
+    void setConnectionEditControlsEnabled(bool);
95
+
88 96
 private slots:
89 97
     void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
90 98
     void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
91 99
     void onConnectionOffsetChanged(int newOffset);
100
+    void onConnectionItemSelected(ConnectionPixmapItem* connectionItem);
101
+    void onConnectionDirectionChanged(QString newDirection);
92 102
 
93 103
 signals:
94 104
     void objectsChanged();
@@ -253,6 +263,7 @@ class ConnectionPixmapItem : public QObject, public QGraphicsPixmapItem {
253 263
     Q_OBJECT
254 264
 public:
255 265
     ConnectionPixmapItem(QPixmap pixmap, Connection* connection, int x, int y): QGraphicsPixmapItem(pixmap) {
266
+        this->basePixmap = pixmap;
256 267
         this->connection = connection;
257 268
         setFlag(ItemIsMovable);
258 269
         setFlag(ItemSendsGeometryChanges);
@@ -260,18 +271,26 @@ public:
260 271
         this->initialY = y;
261 272
         this->initialOffset = connection->offset.toInt();
262 273
     }
274
+    void render(qreal opacity = 1) {
275
+        QPixmap newPixmap = basePixmap.copy(0, 0, basePixmap.width(), basePixmap.height());
276
+        if (opacity < 1) {
277
+            QPainter painter(&newPixmap);
278
+            int alpha = (int)(255 * (1 - opacity));
279
+            painter.fillRect(0, 0, newPixmap.width(), newPixmap.height(), QColor(0, 0, 0, alpha));
280
+            painter.end();
281
+        }
282
+        this->setPixmap(newPixmap);
283
+    }
284
+    QPixmap basePixmap;
263 285
     Connection* connection;
264 286
     int initialX;
265 287
     int initialY;
266 288
     int initialOffset;
267 289
 protected:
268 290
     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 291
     void mousePressEvent(QGraphicsSceneMouseEvent*);
274 292
 signals:
293
+    void connectionItemSelected(ConnectionPixmapItem* connectionItem);
275 294
     void connectionMoved(int offset);
276 295
 };
277 296
 

+ 2
- 2
mainwindow.cpp Прегледај датотеку

@@ -487,7 +487,7 @@ void MainWindow::on_tabWidget_currentChanged(int index)
487 487
     } else if (index == 1) {
488 488
         editor->setEditingObjects();
489 489
     } else if (index == 3) {
490
-        editor->setEditingConnections(ui->comboBox_ConnectionDirection->currentText().toLower());
490
+        editor->setEditingConnections();
491 491
     }
492 492
 }
493 493
 
@@ -768,7 +768,7 @@ void MainWindow::on_action_Export_Map_Image_triggered()
768 768
 
769 769
 void MainWindow::on_comboBox_ConnectionDirection_currentIndexChanged(const QString &direction)
770 770
 {
771
-    editor->showCurrentConnectionMap(direction.toLower());
771
+    editor->setCurrentConnectionDirection(direction);
772 772
 }
773 773
 
774 774
 void MainWindow::on_spinBox_ConnectionOffset_valueChanged(int offset)

+ 19
- 6
mainwindow.ui Прегледај датотеку

@@ -1286,22 +1286,22 @@
1286 1286
                 <widget class="QComboBox" name="comboBox_ConnectionDirection">
1287 1287
                  <item>
1288 1288
                   <property name="text">
1289
-                   <string>Up</string>
1289
+                   <string>up</string>
1290 1290
                   </property>
1291 1291
                  </item>
1292 1292
                  <item>
1293 1293
                   <property name="text">
1294
-                   <string>Right</string>
1294
+                   <string>right</string>
1295 1295
                   </property>
1296 1296
                  </item>
1297 1297
                  <item>
1298 1298
                   <property name="text">
1299
-                   <string>Down</string>
1299
+                   <string>down</string>
1300 1300
                   </property>
1301 1301
                  </item>
1302 1302
                  <item>
1303 1303
                   <property name="text">
1304
-                   <string>Left</string>
1304
+                   <string>left</string>
1305 1305
                   </property>
1306 1306
                  </item>
1307 1307
                 </widget>
@@ -1346,7 +1346,10 @@
1346 1346
                <item>
1347 1347
                 <widget class="QSpinBox" name="spinBox_ConnectionOffset">
1348 1348
                  <property name="minimum">
1349
-                  <number>-99</number>
1349
+                  <number>-999</number>
1350
+                 </property>
1351
+                 <property name="maximum">
1352
+                  <number>999</number>
1350 1353
                  </property>
1351 1354
                 </widget>
1352 1355
                </item>
@@ -1412,7 +1415,17 @@
1412 1415
                   </property>
1413 1416
                   <layout class="QGridLayout" name="gridLayout_14">
1414 1417
                    <item row="1" column="1">
1415
-                    <widget class="QGraphicsView" name="graphicsView_Connections"/>
1418
+                    <widget class="QGraphicsView" name="graphicsView_Connections">
1419
+                     <property name="backgroundBrush">
1420
+                      <brush brushstyle="SolidPattern">
1421
+                       <color alpha="255">
1422
+                        <red>0</red>
1423
+                        <green>0</green>
1424
+                        <blue>0</blue>
1425
+                       </color>
1426
+                      </brush>
1427
+                     </property>
1428
+                    </widget>
1416 1429
                    </item>
1417 1430
                    <item row="1" column="0">
1418 1431
                     <spacer name="horizontalSpacer_7">

+ 1
- 1
map.h Прегледај датотеку

@@ -180,7 +180,7 @@ public:
180 180
     QMap<QString, QList<Event*>> events;
181 181
 
182 182
     QList<Connection*> connections;
183
-    QMap<QString, QGraphicsPixmapItem*> connection_items;
183
+    QList<QGraphicsPixmapItem*> connection_items;
184 184
     QPixmap renderConnection(Connection);
185 185
 
186 186
     QImage border_image;