Commit 544ce414 authored by Augustin Degomme's avatar Augustin Degomme
Browse files

avoid the use of a magic value to determine font overlapping for containers

parent 73b4caa6
......@@ -375,9 +375,15 @@ void Render_opengl::paintGL(){
const QFontMetrics metric(arial_font);
//we calculate the height of the interline we want : max height of the font + 1 pixel to avoid overlapping (metric.height() returns a bigger value, a bit too much)
int height = metric.tightBoundingRect("fg").height()+1;
/* Draw container text */
const unsigned int texts_size = _texts.size();
std::map<Element_pos,Element_pos> previous_by_column;
//int skipped,displayed=0;
for (unsigned int i=0 ; i<texts_size ; i++){
......@@ -389,7 +395,7 @@ void Render_opengl::paintGL(){
std::map<Element_pos,Element_pos>::const_iterator it = previous_by_column.find(_texts[i].x);
const std::map<Element_pos,Element_pos>::const_iterator it_end = previous_by_column.end();
if (it==it_end || (trace_to_render_y(_texts[i].y) - trace_to_render_y((*it).second)>2)){
if (it==it_end || render_to_screen_y(trace_to_render_y(_texts[i].y)) - render_to_screen_y(trace_to_render_y((*it).second))> height ){
const QString text_elided = metric.elidedText(_texts[i].value.c_str(), Qt::ElideRight, _x_scale_container_state*Info::Screen::width/(Info::Trace::depth+1.));
renderText ( render_to_screen_x(_texts[i].x * _x_scale_container_state/0.20),
render_to_screen_y( trace_to_render_y(_texts[i].y) + 0.5),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment