KDReports icon indicating copy to clipboard operation
KDReports copied to clipboard

clickable text

Open ghost opened this issue 7 years ago • 2 comments

whether kdreport can take action to click on a particular section of text, so that we could listen on signal handler to trigger another form report view?

thanks

ghost avatar Jul 14 '16 21:07 ghost

You can use KDReports::HtmlElement to insert a <a href="...."> link, for instance to an HTTP URL, which will be opened with QDesktopServices::openUrl. You can see an example in the "ReferenceReport" example.

Links to anchors, i.e. other sections of the same document aren't supported.

It sounds like you want to catch this before it's sent to QDesktopServices though. At first sight, it looks like this would require a change in Qt (adding setOpenExternalLinks(bool) and a linkActivated() signal in QTextDocument, on top of the internal QTextControl which has this logic) and in KDReports (to call that API). This isn't on my immediate todo list for KDReports, but I can be hired to implement it :). Otherwise I'll be happy to review patches.

dfaure avatar Jul 18 '16 08:07 dfaure

Yeah may be like that, but my point was looked like what fast-report already did here https://www.fast-report.com/en/documentation/frx3progr/Working%20with%20TfrxReport%20component/Interactive%20reports.htm, when user click some text in preview dialog he could show messagebox or popping up another view report section. Hence, QTextDocument information would be lost, if I'm not wrong because QPrintPreviewWidget drawing stack was using qpainter drawXXX. Im not sure if re-implementing QPrintPreviewWidget using Graphicsview framework would be good idea.

ghost avatar Jul 19 '16 21:07 ghost