painter fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5259 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-09-11 03:05:19 +00:00
parent b2e770a640
commit befc233488
4 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2002-09-11 John Levon <levon@movementarian.org>
* qfont_metrics.C: fix button metrics
* QLPainter.C: fillPolygon() should actually fill
2002-09-10 John Levon <levon@movementarian.org> 2002-09-10 John Levon <levon@movementarian.org>
* Menubar_pimpl.C: * Menubar_pimpl.C:

View File

@ -138,6 +138,7 @@ Painter & QLPainter::rectangle(int x, int y,
line_style ls, line_style ls,
line_width lw) line_width lw)
{ {
//lyxerr << "rectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
setPen(col, ls, lw).drawRect(x, y, w, h); setPen(col, ls, lw).drawRect(x, y, w, h);
return *this; return *this;
} }
@ -147,6 +148,7 @@ Painter & QLPainter::fillRectangle(int x, int y,
int w, int h, int w, int h,
LColor::color col) LColor::color col)
{ {
//lyxerr << "fillRectangle " << x<<","<<y << " " <<w<<","<<h<<endl;
qp_->fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str())); qp_->fillRect(x, y, w, h, QColor(lcolor.getX11Name(col).c_str()));
return *this; return *this;
} }
@ -155,11 +157,10 @@ Painter & QLPainter::fillRectangle(int x, int y,
Painter & QLPainter::fillPolygon(int const * xp, int const * yp, Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
int np, LColor::color col) int np, LColor::color col)
{ {
// FIXME ?
// Must use new as np is not known at compile time. // Must use new as np is not known at compile time.
boost::scoped_array<QCOORD> points(new QCOORD[np * 2]); boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
//if (1) return *this;
int j = 0; int j = 0;
for (int i = 0; i < np; ++i) { for (int i = 0; i < np; ++i) {
@ -167,7 +168,10 @@ Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
points[j++] = yp[i]; points[j++] = yp[i];
} }
setPen(col).drawPolygon(QPointArray(np, points.get())); setPen(col);
qp_->setBrush(lcolor.getX11Name(col).c_str());
qp_->drawPolygon(QPointArray(np, points.get()));
qp_->setBrush(Qt::NoBrush);
return *this; return *this;
} }

View File

@ -50,7 +50,6 @@ QLImage
QLPainter QLPainter
- work out why buttons look ugly and fix
- check ::arc() works - check ::arc() works
QLyXKeySym QLyXKeySym

View File

@ -112,9 +112,11 @@ void rectText(string const & str, LyXFont const & f,
{ {
QFontMetrics const & m(metrics(f)); QFontMetrics const & m(metrics(f));
w = width(str, f); static int const d = 2;
ascent = m.ascent();
descent = m.descent(); w = width(str, f) + d * 2 + 2;
ascent = m.ascent() + d;
descent = m.descent() + d;
} }