mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
Sync changes between connection list and map
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
class ConnectionPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectionPixmapItem(QPixmap pixmap, MapConnection* connection, int x, int y, int baseMapWidth, int baseMapHeight): QGraphicsPixmapItem(pixmap) {
|
||||
ConnectionPixmapItem(QPixmap pixmap, MapConnection* connection, int x, int y, int baseMapWidth, int baseMapHeight)
|
||||
: QGraphicsPixmapItem(pixmap),
|
||||
connection(connection)
|
||||
{
|
||||
this->basePixmap = pixmap;
|
||||
this->connection = connection;
|
||||
setFlag(ItemIsMovable);
|
||||
setFlag(ItemSendsGeometryChanges);
|
||||
this->initialX = x;
|
||||
@@ -20,7 +22,7 @@ public:
|
||||
this->baseMapHeight = baseMapHeight;
|
||||
}
|
||||
QPixmap basePixmap;
|
||||
MapConnection* connection;
|
||||
MapConnection* const connection;
|
||||
int initialX;
|
||||
int initialY;
|
||||
int initialOffset;
|
||||
|
||||
@@ -9,18 +9,27 @@ namespace Ui {
|
||||
class ConnectionsListItem;
|
||||
}
|
||||
|
||||
// We show the data for each map connection in the panel on the right side of the Connections tab.
|
||||
// An instance of this class is used for each item in that list.
|
||||
// It communicates with the ConnectionPixmapItem on the map through a shared MapConnection pointer,
|
||||
// and the two classes should signal one another when they change this data.
|
||||
class ConnectionsListItem : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConnectionsListItem(QWidget *parent, const QStringList &mapNames);
|
||||
explicit ConnectionsListItem(QWidget *parent, MapConnection * connection, const QStringList &mapNames);
|
||||
~ConnectionsListItem();
|
||||
|
||||
void populate(const MapConnection * connection);
|
||||
void updateUI();
|
||||
|
||||
public:
|
||||
private:
|
||||
Ui::ConnectionsListItem *ui;
|
||||
MapConnection * const connection;
|
||||
|
||||
signals:
|
||||
void edited();
|
||||
void deleted();
|
||||
|
||||
private slots:
|
||||
void on_comboBox_Direction_currentTextChanged(const QString &direction);
|
||||
|
||||
Reference in New Issue
Block a user