D10792: Raise annotation window when clicking on annotation

Albert Astals Cid noreply at phabricator.kde.org
Thu Mar 15 23:42:02 UTC 2018


aacid added a comment.


  In D10792#226357 <https://phabricator.kde.org/D10792#226357>, @simgunz wrote:
  
  > I'm adding a new test to `parttest.cpp` because is the only test where there is the `part` component that allows me to access the `m_pageView`.
  >
  > I'm trying to call the public qslot:
  >
  > `part.m_pageView->openAnnotationWindow(annot1, 0);`
  >
  > but I get this error:
  >
  > `parttest.cpp:(.text+0x14d8d): undefined reference to PageView::openAnnotationWindow(Okular::Annotation*, int)`
  >
  > I've also cleaned the build dir and rerun cmake, and make but it still happens.
  >
  > Any idea?
  
  
  Yes, pageview is not an exported class so you can't really call it's methods because "they don't exist" for the linker.
  
  You have three posibilities:
  
  - Export the class, easiest, but i'd really like to avoid that
  - Since openAnnotationWindow is a slot, you should be able to use QMetaObject::invokeMethod to call it
  - instead of calling the method, just do what the user would do, i.e. simulate a click/double click in the correct places
  
  
  
  > Moreover, then I don't know how to access the opened annotation window. The reference is stored in `part->d->m_annowindows`, in the private class of PageView, which is not accessible from the tester I think.
  
  Right, but you can use QObject::findChild[ren] to look for AnnotWindow childs of m_pageView, that should be enough to get the pointer to the AnnotWindow.

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D10792

To: simgunz, #okular, aacid
Cc: ngraham, #okular, michaelweghorn, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20180315/8d6f5431/attachment.html>


More information about the Okular-devel mailing list