Commit df61a10f7165eccd8a96a620aede602744b1696f
1 parent
d7c679ac
expose LoadStore::distance for introspection
Showing
1 changed file
with
13 additions
and
3 deletions
openbr/plugins/core/loadstore.cpp
| ... | ... | @@ -173,17 +173,27 @@ class LoadStoreDistance : public Distance |
| 173 | 173 | Q_OBJECT |
| 174 | 174 | Q_PROPERTY(QString distanceString READ get_distanceString WRITE set_distanceString RESET reset_distanceString STORED false) |
| 175 | 175 | Q_PROPERTY(QString fileName READ get_fileName WRITE set_fileName RESET reset_fileName STORED false) |
| 176 | + Q_PROPERTY(br::Distance *distance READ get_distance WRITE set_distance RESET reset_distance STORED false) | |
| 176 | 177 | BR_PROPERTY(QString, distanceString, QString()) |
| 177 | 178 | BR_PROPERTY(QString, fileName, QString()) |
| 179 | + BR_PROPERTY(br::Distance*, distance, NULL) | |
| 178 | 180 | |
| 179 | - QSharedPointer<Distance> distance; | |
| 181 | +public: | |
| 182 | + ~LoadStoreDistance() | |
| 183 | + { | |
| 184 | + delete distance; | |
| 185 | + distance = NULL; | |
| 186 | + } | |
| 180 | 187 | |
| 181 | 188 | private: |
| 182 | 189 | void init() |
| 183 | 190 | { |
| 191 | + delete distance; | |
| 192 | + distance = NULL; | |
| 193 | + | |
| 184 | 194 | const QString resolvedFileName = getFileName(); |
| 185 | 195 | if (resolvedFileName.isEmpty()) { |
| 186 | - distance.reset(Distance::make(distanceString)); | |
| 196 | + distance = Distance::make(distanceString); | |
| 187 | 197 | return; |
| 188 | 198 | } |
| 189 | 199 | |
| ... | ... | @@ -195,7 +205,7 @@ private: |
| 195 | 205 | QDataStream stream(&file); |
| 196 | 206 | stream >> distanceString; |
| 197 | 207 | |
| 198 | - distance.reset(Distance::make(distanceString)); | |
| 208 | + distance = Distance::make(distanceString); | |
| 199 | 209 | distance->load(stream); |
| 200 | 210 | } |
| 201 | 211 | ... | ... |