D10792: Raise annotation window when clicking on annotation

Albert Astals Cid noreply at phabricator.kde.org
Sat Mar 31 22:06:21 UTC 2018


aacid added a comment.


  In D10792#237792 <https://phabricator.kde.org/D10792#237792>, @simgunz wrote:
  
  > I have few questions regarding the internal structure of okular and how to write autotests:
  >
  > 1. To click on an annotation to open the annotation window I though to do the following (partially copied from other tests):
  >
  >   ``` const int width =  part.m_pageView->horizontalScrollBar()->maximum() + part.m_pageView->viewport()->width(); const int height = part.m_pageView->verticalScrollBar()->maximum() + part.m_pageView->viewport()->height();
  >
  >   NormalizedPoint pt = annot1->boundingRectangle().center();
  >
  >   QTest::mouseDClick(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * pt.x,  height * pt.y)); ```
  >
  >   but in this way I don't correctly click on the annotation. For now I manually set the QPoint to hit correctly the annotation.
  >
  >   I don't understand what the normalized area where a NormalizedPoint can be corresponds to. Can someone explain me better this mechanics?
  
  
  On a quick look i feel it should work.
  
  What you don't understand about NormalizedXXX, they are basically a 0 to 1 representation of the position of something on the page
  
  > Why is width equal to the maximum value of the scrollbar plus the viewport?
  
  So let's say your content is 1000 wide, and your viewport is 700 wide, what will be the maximum value of your scroll bar? 300
  
  So if you want to know the width of the content you add up 700 and 300
  
  Does this make sense?
  
  > 2. When I run an autotest I saw a window appearing showing the file opened in okular. I cannot interact with this window though.
  
  Sure you can
  
  > What is the purpose of that?
  
  That is the purpose of what?
  
  > How can I have a visual feedback on the code I am writing in the autotest?
  
  Not sure i understand the question, you mean you want to look at the window? 
  Add QTest::qWait(someseonds)

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/20180331/e7a552b7/attachment-0001.html>


More information about the Okular-devel mailing list