comparison view/Pane.cpp @ 300:0824a754a8eb

* Ensure labels and their pixmaps get redrawn properly
author Chris Cannam
date Thu, 06 Sep 2007 15:17:35 +0000
parents 5c59c433b358
children 5636eeacc467
comparison
equal deleted inserted replaced
299:5c59c433b358 300:0824a754a8eb
709 Pane::drawLayerNames(QRect r, QPainter &paint) 709 Pane::drawLayerNames(QRect r, QPainter &paint)
710 { 710 {
711 int fontHeight = paint.fontMetrics().height(); 711 int fontHeight = paint.fontMetrics().height();
712 int fontAscent = paint.fontMetrics().ascent(); 712 int fontAscent = paint.fontMetrics().ascent();
713 713
714 if (r.y() + r.height() < height() - int(m_layers.size()) * fontHeight - 6) { 714 int lly = height() - 6;
715 if (m_manager->getZoomWheelsEnabled()) {
716 lly -= 20;
717 }
718
719 if (r.y() + r.height() < lly - int(m_layers.size()) * fontHeight) {
715 return; 720 return;
716 } 721 }
717 722
718 QStringList texts; 723 QStringList texts;
719 std::vector<QPixmap> pixmaps; 724 std::vector<QPixmap> pixmaps;
726 } 731 }
727 732
728 int maxTextWidth = width() / 3; 733 int maxTextWidth = width() / 3;
729 texts = TextAbbrev::abbreviate(texts, paint.fontMetrics(), maxTextWidth); 734 texts = TextAbbrev::abbreviate(texts, paint.fontMetrics(), maxTextWidth);
730 735
731 int lly = height() - 6;
732 int llx = width() - maxTextWidth - 5; 736 int llx = width() - maxTextWidth - 5;
733
734 if (m_manager->getZoomWheelsEnabled()) { 737 if (m_manager->getZoomWheelsEnabled()) {
735 lly -= 20;
736 llx -= 36; 738 llx -= 36;
737 } 739 }
738 740
739 if (r.x() + r.width() >= llx) { 741 if (r.x() + r.width() >= llx - fontAscent - 3) {
740 742
741 for (size_t i = 0; i < texts.size(); ++i) { 743 for (size_t i = 0; i < texts.size(); ++i) {
742 744
743 // std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i].toStdString() << std::endl; 745 // std::cerr << "Pane "<< this << ": text " << i << ": " << texts[i].toStdString() << std::endl;
744 746