D10792: Raise annotation window when clicking on annotation
Simone Gaiarin
noreply at phabricator.kde.org
Sat Apr 7 07:16:31 UTC 2018
simgunz added a comment.
In D10792#241504 <https://phabricator.kde.org/D10792#241504>, @aacid wrote:
> In D10792#241405 <https://phabricator.kde.org/D10792#241405>, @simgunz wrote:
>
> > Thanks to your suggestions I made some progresses.
> >
> > My current autotest looks as in the block below.
> >
> > Problems:
> >
> > 1. If I do not export `AnnotWindow` and call `QVERIFY( part.m_pageView->findChildren<QFrame *>().size() == 1 )` it fails, while calling `QVERIFY( part.m_pageView->findChildren<AnnotWindow *>().size() == 1 )` would succeed.
> > 2. The value returned by ` annot1->boundingRectangle().center(); ` is wrong. Moreover if I I pass to `mouseMove` a point within the coordinates I specify when I construct the annotation the mouse moves to the wrong position. In particular the mouse moves to a Y position way below the annotation. So either I am missing something or there is a bug.
>
>
> There's a "bug" in the test, you're opening a two page file, so the height variable is the height of the two pages, and then all the math fails when trying to find the proper y, changing to open file1.pdf makes it better.
Thanks for the explanation. I'm slowly understanding how this coordinate system works.
> https://paste.kde.org/phoqbec1x "WORKS" in my computer, you still need to add more stuff to the end of the test, right? at least a verify :)
Yes. I have added a check on the number of rects composing the visible region, which should be four for a fully visible window ( if I am not wrong it is because the KTextEdit is on top of the parent widget of the AnnotWindow, so that this last one is never fully visible). Actually also for a partially visible window they can be four, I think, but for the particular position where I moved window 1 they are three. I hope this is enough as a test.
>> 3. How do I click on the annotation window?
>>
>> These two commands both fail ``` QTest::mouseClick(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); // The window is under the mouse QTest::mouseClick(win2, Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); // win2 is the annotation window widget (under the mouse again)
>>
>> ```
>>
>> Isn't it possible to call mouseClick without specifying the target widget, as if I would click manually so that the top widget is the target of the click?
>
> It's a bit tricky, check what i did on the paste. Probably there's a better way to do it, but it's a bit late now so this works for me.
Ok. Understood it.
I have left two qWait after adding the annotations because without those the test was failing some times.
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/20180407/94662e8d/attachment-0001.html>
More information about the Okular-devel
mailing list