Mercurial > hg > svgui
comparison view/View.cpp @ 270:61a704654497
...
author | Chris Cannam |
---|---|
date | Tue, 26 Jun 2007 14:57:29 +0000 |
parents | 7b58c5e91f20 |
children | 87e4c880b4c8 |
comparison
equal
deleted
inserted
replaced
269:7b58c5e91f20 | 270:61a704654497 |
---|---|
1636 | 1636 |
1637 paint.restore(); | 1637 paint.restore(); |
1638 } | 1638 } |
1639 | 1639 |
1640 void | 1640 void |
1641 View::drawMeasurementRect(QPainter &paint, const Layer *topLayer, QRect r) const | 1641 View::drawMeasurementRect(QPainter &paint, const Layer *topLayer, QRect r, |
1642 bool focus) const | |
1642 { | 1643 { |
1643 // std::cerr << "View::drawMeasurementRect(" << r.x() << "," << r.y() << " " | 1644 // std::cerr << "View::drawMeasurementRect(" << r.x() << "," << r.y() << " " |
1644 // << r.width() << "x" << r.height() << ")" << std::endl; | 1645 // << r.width() << "x" << r.height() << ")" << std::endl; |
1645 | 1646 |
1646 if (r.x() + r.width() < 0 || r.x() >= width()) return; | 1647 if (r.x() + r.width() < 0 || r.x() >= width()) return; |
1648 | |
1649 if (r.width() != 0 || r.height() != 0) { | |
1650 paint.save(); | |
1651 if (focus) { | |
1652 paint.setPen(Qt::NoPen); | |
1653 QColor brushColour(Qt::green); | |
1654 brushColour.setAlpha(30); | |
1655 paint.setBrush(brushColour); | |
1656 if (r.x() > 0) { | |
1657 paint.drawRect(0, 0, r.x(), height()); | |
1658 } | |
1659 if (r.x() + r.width() < width()) { | |
1660 paint.drawRect(r.x() + r.width(), 0, width()-r.x()-r.width(), height()); | |
1661 } | |
1662 if (r.y() > 0) { | |
1663 paint.drawRect(r.x(), 0, r.width(), r.y()); | |
1664 } | |
1665 if (r.y() + r.height() < height()) { | |
1666 paint.drawRect(r.x(), r.y() + r.height(), r.width(), height()-r.y()-r.height()); | |
1667 } | |
1668 paint.setBrush(Qt::NoBrush); | |
1669 } | |
1670 paint.setPen(Qt::green); | |
1671 paint.drawRect(r); | |
1672 paint.restore(); | |
1673 } else { | |
1674 paint.save(); | |
1675 paint.setPen(Qt::green); | |
1676 paint.drawPoint(r.x(), r.y()); | |
1677 paint.restore(); | |
1678 } | |
1679 | |
1680 if (!focus) return; | |
1647 | 1681 |
1648 int fontHeight = paint.fontMetrics().height(); | 1682 int fontHeight = paint.fontMetrics().height(); |
1649 int fontAscent = paint.fontMetrics().ascent(); | 1683 int fontAscent = paint.fontMetrics().ascent(); |
1650 | 1684 |
1651 float v0, v1; | 1685 float v0, v1; |
1782 | 1816 |
1783 if (dys != "") { | 1817 if (dys != "") { |
1784 drawVisibleText(paint, dxx, dxy, dys, OutlinedText); | 1818 drawVisibleText(paint, dxx, dxy, dys, OutlinedText); |
1785 dxy += fontHeight; | 1819 dxy += fontHeight; |
1786 } | 1820 } |
1787 | |
1788 if (r.width() != 0 || r.height() != 0) { | |
1789 paint.save(); | |
1790 paint.setPen(Qt::green); | |
1791 paint.drawRect(r); | |
1792 paint.restore(); | |
1793 } | |
1794 } | 1821 } |
1795 | 1822 |
1796 bool | 1823 bool |
1797 View::render(QPainter &paint, int xorigin, size_t f0, size_t f1) | 1824 View::render(QPainter &paint, int xorigin, size_t f0, size_t f1) |
1798 { | 1825 { |