Mercurial > hg > svgui
comparison widgets/PropertyStack.cpp @ 723:d1c0abfb11be tonioni
Fix bug in choosing which layer to bring to the front when asked programmatically
| author | Chris Cannam |
|---|---|
| date | Tue, 04 Feb 2014 14:35:59 +0000 |
| parents | 4806715f7a19 |
| children | 596414d20ef0 |
comparison
equal
deleted
inserted
replaced
| 722:dd64efa0dac8 | 723:d1c0abfb11be |
|---|---|
| 151 } | 151 } |
| 152 | 152 |
| 153 int | 153 int |
| 154 PropertyStack::getContainerIndex(PropertyContainer *pc) const | 154 PropertyStack::getContainerIndex(PropertyContainer *pc) const |
| 155 { | 155 { |
| 156 for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) { | 156 // This is used to obtain an index to be passed to setCurrentIndex |
| 157 PropertyContainer *container = m_client->getPropertyContainer(i); | 157 // -- which is the index of the property container's box in our |
| 158 if (pc == container) return i; | 158 // stack of boxes. That is not the same thing as the index of the |
| 159 // container (i.e. the layer) in the view: the view reorders its | |
| 160 // containers whenever one is raised to the top, while our boxes | |
| 161 // remain in the same order. So we must find this container in the | |
| 162 // box list, not in the view. | |
| 163 | |
| 164 for (size_t i = 0; i < m_boxes.size(); ++i) { | |
| 165 PropertyContainer *container = m_boxes[i]->getContainer(); | |
| 166 if (pc == container) { | |
| 167 return i; | |
| 168 } | |
| 159 } | 169 } |
| 160 | 170 |
| 161 return false; | 171 return false; |
| 162 } | 172 } |
| 163 | 173 |
