[poppler] Url links

Pino Toscano pino at kde.org
Fri Aug 6 04:17:33 PDT 2010


Hi,

Alle giovedì 5 agosto 2010, vidhyapria.arunkumar at nokia.com ha scritto:
> With NULL , I meant an empty list returned.

Then please be precise, NULL has a precise meaning in C/C++ :)

> Here's a code snippet of what  I do, shortTap is the slot invoked on
> tapping the page

Please note that getting the links of a page is not "cheap" and involves 
creating new Link* objects everytime, so you should better read them 
only once and cache them, iterating through them anytime.

>         QRectF widgetRect = rect;
>         QPointF widgetPoint = mapToItem(widget, rect.center());
>         widgetRect.moveCenter(widgetPoint);
> 
>         if (widget->linkTaped(widgetRect))    // func. definition
> below {

You are using coordinates of the widget/page item, while coordinates in 
Link are in the range 0..1 (ie (0,0) is the top-left corner and (1,1) 
the bottom-right).
(Maybe you are already taking care of that, but given that it is not in 
the snippet, I am giving you this note.)

> QList<Poppler::Link *> PdfLoader::getLinks(int pageIndex)

I don't see which values "pageIndex" can have, but in case remember it 
is in the range 0..N-1 (where N is the number of pages of the document).


>     QList<Poppler::Link *> list;
>     PdfLoaderPrivate *data = getPageData(pageIndex);
> 
>     if (0 != data) {
>         list = data->page->links();
>     }

Are you sure that 'data' is not 0?

What do you get if you read the links of the pages just after you load 
the document? Do you get the same with any document?

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20100806/d34751f1/attachment.pgp>


More information about the poppler mailing list