mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:33:23 +00:00
maplocationmodel: use READ method selectedUuid
Also emit the selectedUuidChanged signal. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
2dea6f5146
commit
0955a5b36a
2 changed files with 9 additions and 1 deletions
|
@ -117,10 +117,16 @@ void MapLocationModel::setSelectedUuid(QVariant uuid, QVariant fromClick)
|
||||||
{
|
{
|
||||||
m_selectedUuid = qvariant_cast<quint32>(uuid);
|
m_selectedUuid = qvariant_cast<quint32>(uuid);
|
||||||
const bool fromClickBool = qvariant_cast<bool>(fromClick);
|
const bool fromClickBool = qvariant_cast<bool>(fromClick);
|
||||||
|
emit selectedUuidChanged();
|
||||||
if (fromClickBool)
|
if (fromClickBool)
|
||||||
emit selectedLocationChanged(getMapLocationForUuid(m_selectedUuid));
|
emit selectedLocationChanged(getMapLocationForUuid(m_selectedUuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 MapLocationModel::selectedUuid()
|
||||||
|
{
|
||||||
|
return m_selectedUuid;
|
||||||
|
}
|
||||||
|
|
||||||
MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid)
|
MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid)
|
||||||
{
|
{
|
||||||
MapLocation *location = NULL;
|
MapLocation *location = NULL;
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MapLocationModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int count READ count NOTIFY countChanged)
|
Q_PROPERTY(int count READ count NOTIFY countChanged)
|
||||||
Q_PROPERTY(quint32 selectedUuid MEMBER m_selectedUuid NOTIFY selectedLocationChanged)
|
Q_PROPERTY(quint32 selectedUuid READ selectedUuid NOTIFY selectedUuidChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MapLocationModel(QObject *parent = NULL);
|
MapLocationModel(QObject *parent = NULL);
|
||||||
|
@ -64,6 +64,7 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
MapLocation *getMapLocationForUuid(quint32 uuid);
|
MapLocation *getMapLocationForUuid(quint32 uuid);
|
||||||
Q_INVOKABLE void setSelectedUuid(QVariant uuid, QVariant fromClick = true);
|
Q_INVOKABLE void setSelectedUuid(QVariant uuid, QVariant fromClick = true);
|
||||||
|
quint32 selectedUuid();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
|
@ -75,6 +76,7 @@ private:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countChanged(int c);
|
void countChanged(int c);
|
||||||
|
void selectedUuidChanged();
|
||||||
void selectedLocationChanged(MapLocation *);
|
void selectedLocationChanged(MapLocation *);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue