[Kde-imaging] Can someone explain to me how to fix this?

Kåre Särs kare.sars at iki.fi
Fri Aug 28 08:16:05 CEST 2009


On Friday 28 August 2009, Angelo Naselli wrote:
> In data giovedì 27 agosto 2009 23:27:15, Angelo Naselli ha scritto:
> > pageSize is QSizeF as well as size.
> >
> > size is 8.5"x11" multiplied by 25.4 (to get mm).
> > pageSize is got from QPrintDialog and it's letter page
> >
> > The test code is:
> > if (size.height() > pageSize.height() ||
> >     size.width()  > pageSize.width())
> > {
> >     kDebug(51000) << "skipping size " << size << " page size " <<
> > pageSize; }
> >
> > Output is
> > skipping size  QSizeF(215.9, 279.4)  page size  QSizeF(215.9, 279.4)
> >
> > Thanks
>
> Ehm, I mean that page should pass not be skipped.

Since they are float, there might be really small differences -> you could 
include an error margin something like 

static const float margin = 0.1;

if (size.height() > (pageSize.height() + margin) ||
    size.width()  > (pageSize.width() + margin))
{
    kDebug(51000) << "skipping size " << size << " page size " <<pageSize;
}



-- 
Kåre Särs


More information about the Kde-imaging mailing list