Mercurial > hg > svcore
diff base/View.cpp @ 85:ea730e3f9ace
* Ensure consistent ordering of layer text labels
* Fix erroneous SR mismatch warning when adding a wave-file model when
no other wave-file model is present (only models that don't assert any
particular playback samplerate)
author | Chris Cannam |
---|---|
date | Thu, 27 Apr 2006 11:49:34 +0000 |
parents | c983dda79f72 |
children | 5b8392e80ed6 |
line wrap: on
line diff
--- a/base/View.cpp Wed Apr 26 16:27:34 2006 +0000 +++ b/base/View.cpp Thu Apr 27 11:49:34 2006 +0000 @@ -178,16 +178,21 @@ int View::getTextLabelHeight(const Layer *layer, QPainter &paint) const { - int y = 15 + paint.fontMetrics().ascent(); + std::map<int, Layer *> sortedLayers; for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + if ((*i)->needsTextLabelHeight()) { + sortedLayers[getObjectExportId(*i)] = *i; + } + } - if (*i == layer) return y; + int y = 15 + paint.fontMetrics().ascent(); - if ((*i)->needsTextLabelHeight()) { - y += paint.fontMetrics().height(); - } + for (std::map<int, Layer *>::const_iterator i = sortedLayers.begin(); + i != sortedLayers.end(); ++i) { + if (i->second == layer) return y; + y += paint.fontMetrics().height(); } return y;