Mercurial > hg > svcore
comparison data/model/Model.cpp @ 1500:9d37c8cf9686 avoid-pointer-keys
Provide model id
author | Chris Cannam |
---|---|
date | Mon, 13 Aug 2018 16:45:29 +0100 |
parents | 48e9f538e6e9 |
children | d3814e07b8aa |
comparison
equal
deleted
inserted
replaced
1499:68a0abfe7263 | 1500:9d37c8cf9686 |
---|---|
38 m_alignment->aboutToDelete(); | 38 m_alignment->aboutToDelete(); |
39 delete m_alignment; | 39 delete m_alignment; |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 int | |
44 Model::getNextId() | |
45 { | |
46 static int nextId = 0; | |
47 static QMutex mutex; | |
48 QMutexLocker locker(&mutex); | |
49 int i = nextId; | |
50 if (nextId == INT_MAX) { | |
51 nextId = INT_MIN; | |
52 } | |
53 ++nextId; | |
54 return i; | |
55 } | |
56 | |
43 void | 57 void |
44 Model::setSourceModel(Model *model) | 58 Model::setSourceModel(Model *model) |
45 { | 59 { |
46 if (m_sourceModel) { | 60 if (m_sourceModel) { |
47 disconnect(m_sourceModel, SIGNAL(aboutToBeDeleted()), | 61 disconnect(m_sourceModel, SIGNAL(aboutToBeDeleted()), |