El Dimarts, 4 de juny de 2013, a les 20:00:51, Jaydeep Solanki va escriure: > On Mon, Jun 3, 2013 at 2:43 AM, Albert Astals Cid <aa...@kde.org> wrote: > > El Dilluns, 3 de juny de 2013, a les 01:52:04, Jaydeep Solanki va escriure: > > > Hi, > > > While working on getting text bounds work I discovered that > > > QWebFrame::hitTestContent(QPoint()) hits the outermost element, inside > > > > body. > > > > > Consider the below HTML, > > > > > > <section> > > > <p id="p1">some text...</p> > > > <div>...</div> > > > <p id="p2">some other text..</p> > > > </section> > > > > > > Now we have two QPoints; > > > QPoint pt1 => which points somewhere within p1 > > > QPoint pt2 => which points somewhere within p2 > > > > > > var ht1 = QWebFrame::hitTestContent(pt1); > > > var ht2 = QWebFrame::hitTestContent(pt2); > > > > Why are you using hitTestContent to get the data? Isn't there something > > better? What's your plan? call hitTestContent for all the points or? > > Yes, I agree traversing the DOM is a better idea. > > I googled a bit & found that we cannot get the bounding rect of text from > webkit > (source<http://comments.gmane.org/gmane.os.opendarwin.webkit.qt/1130>), but > we can get the bounding box of the HTML element. I don't get it, why it > isn't possible, because in QWebView when we select any text, it gets > highlighted, which is basically filling color in the bounding box of the > text, which indirectly means that Webview knows the bounding rects. Do I > make sense ? > Please comment on this.
What about the suggestion in that very same url of using qwebelement? Cheers, Albert > > & if everything fails, QFontMetrics may be of some use. We can get the font > metrics, & using it + the bounding box of the HTML element, we can predict > the bounding rects. > > Cheers, > Jaydeep > > > Cheers, > > > > Albert > > > > > Analysing ht1 & ht2 turns out that both of them point to the section > > > element, which seems to be a little problem. I'm searching for other > > > ways > > > to do it. If you have any idea to get it work, please share. > > > > > > Cheers, > > > Jaydeep > > > > _______________________________________________ > > Okular-devel mailing list > > Okular-devel@kde.org > > https://mail.kde.org/mailman/listinfo/okular-devel _______________________________________________ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel