Add selection highlight to connections list

This commit is contained in:
GriffinR
2024-07-03 16:01:52 -04:00
parent 0aa7ddf27d
commit 7c6b33da1b
10 changed files with 92 additions and 42 deletions

View File

@@ -33,6 +33,9 @@ public:
bool getEditable();
void updateHighlight(bool selected);
private:
bool highlighted = false;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mousePressEvent(QGraphicsSceneMouseEvent*);
@@ -42,6 +45,7 @@ signals:
void connectionItemSelected(ConnectionPixmapItem* connectionItem);
void connectionItemDoubleClicked(ConnectionPixmapItem* connectionItem);
void connectionMoved(MapConnection*);
void highlightChanged(bool highlighted);
};
#endif // CONNECTIONPIXMAPITEM_H

View File

@@ -4,6 +4,7 @@
#include "mapconnection.h"
#include <QFrame>
#include <QMouseEvent>
namespace Ui {
class ConnectionsListItem;
@@ -22,14 +23,20 @@ public:
~ConnectionsListItem();
void updateUI();
void setSelected(bool selected);
private:
Ui::ConnectionsListItem *ui;
MapConnection * const connection;
bool isSelected = false;
protected:
void mousePressEvent(QMouseEvent *);
signals:
void edited();
void deleted();
void selected();
private slots:
void on_comboBox_Direction_currentTextChanged(const QString &direction);