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>
* Menubar_pimpl.C:

View File

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

View File

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

View File

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