mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
bookmarkPosition function
This commit is contained in:
parent
f59404ed02
commit
6de4500fd1
|
@ -220,6 +220,18 @@ void PageItem::goToBookmark(const QString &bookmark)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointF PageItem::bookmarkPosition(const QString &bookmark) const
|
||||||
|
{
|
||||||
|
Okular::DocumentViewport viewPort(KUrl(bookmark).htmlRef());
|
||||||
|
|
||||||
|
if (viewPort.pageNumber != m_viewPort.pageNumber) {
|
||||||
|
return QPointF(-1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QPointF(qMax((qreal)0, width() - m_flickable.data()->width()) * viewPort.rePos.normalizedX,
|
||||||
|
qMax((qreal)0, height() - m_flickable.data()->height()) * viewPort.rePos.normalizedY);
|
||||||
|
}
|
||||||
|
|
||||||
void PageItem::setBookmarkAtPos(qreal x, qreal y)
|
void PageItem::setBookmarkAtPos(qreal x, qreal y)
|
||||||
{
|
{
|
||||||
Okular::DocumentViewport viewPort(m_viewPort);
|
Okular::DocumentViewport viewPort(m_viewPort);
|
||||||
|
|
|
@ -111,6 +111,14 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void goToBookmark(const QString &bookmark);
|
Q_INVOKABLE void goToBookmark(const QString &bookmark);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the position in the page for a bookmark
|
||||||
|
* QPointF(-1,-1) if doesn't belong to this page
|
||||||
|
*
|
||||||
|
* @param bookmark Url for the bookmark
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QPointF bookmarkPosition(const QString &bookmark) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new bookmark ar a given position of the current page
|
* Add a new bookmark ar a given position of the current page
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue