src/gldraw.cc

changeset 620
ce4f42dcf0c3
parent 619
8bfe34c6ab1a
child 622
622c49e60348
equal deleted inserted replaced
619:8bfe34c6ab1a 620:ce4f42dcf0c3
611 paint.drawImage (targRect, *overlay.img, srcRect); 611 paint.drawImage (targRect, *overlay.img, srcRect);
612 } 612 }
613 613
614 // Paint the coordinates onto the screen. 614 // Paint the coordinates onto the screen.
615 QString text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); 615 QString text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]);
616
617 QFontMetrics metrics = QFontMetrics (font()); 616 QFontMetrics metrics = QFontMetrics (font());
618 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); 617 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text);
619
620 paint.setPen (textpen); 618 paint.setPen (textpen);
621 paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(), 619 paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(),
622 textSize.height(), Qt::AlignCenter, text); 620 textSize.height(), Qt::AlignCenter, text);
623 621
624 QPen linepen = m_thinBorderPen; 622 QPen linepen = m_thinBorderPen;
662 poly[i] = coordconv3_2 (poly3d[i]); 660 poly[i] = coordconv3_2 (poly3d[i]);
663 661
664 if (numverts > 0) 662 if (numverts > 0)
665 { 663 {
666 // Draw the polygon-to-be 664 // Draw the polygon-to-be
667 paint.setPen (linepen);
668 paint.setBrush (polybrush); 665 paint.setBrush (polybrush);
669 paint.drawPolygon (poly, numverts); 666 paint.drawPolygon (poly, numverts);
670 667
671 // Draw vertex blips 668 // Draw vertex blips
672 for (int i = 0; i < numverts; ++i) 669 for (int i = 0; i < numverts; ++i)
673 { 670 {
674 QPoint& blip = poly[i]; 671 QPoint& blip = poly[i];
672 paint.setPen (linepen);
675 drawBlip (paint, blip); 673 drawBlip (paint, blip);
676 674
677 // Draw their coordinates 675 // Draw their coordinates
676 paint.setPen (textpen);
678 paint.drawText (blip.x(), blip.y() - 8, poly3d[i].stringRep (true)); 677 paint.drawText (blip.x(), blip.y() - 8, poly3d[i].stringRep (true));
679 } 678 }
680 679
681 // Draw line lenghts and angle info if appropriate 680 // Draw line lenghts and angle info if appropriate
682 if (numverts >= 2) 681 if (numverts >= 2)

mercurial