• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • active
  • components
pageitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 by Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef QPAGEITEM_H
21 #define QPAGEITEM_H
22 
23 #include <QDeclarativeItem>
24 
25 #include <core/document.h>
26 #include <core/view.h>
27 
28 class QTimer;
29 
30 class DocumentItem;
31 
32 namespace Okular {
33  class Document;
34  class Page;
35 }
36 
37 class PageItem : public QDeclarativeItem, public Okular::View
38 {
39  Q_OBJECT
40 
44  Q_PROPERTY(QDeclarativeItem *flickable READ flickable WRITE setFlickable NOTIFY flickableChanged)
45 
46 
49  Q_PROPERTY(DocumentItem *document READ document WRITE setDocument NOTIFY documentChanged)
50 
54  Q_PROPERTY(int pageNumber READ pageNumber WRITE setPageNumber NOTIFY pageNumberChanged)
55 
59  Q_PROPERTY(bool smooth READ smooth WRITE setSmooth)
60 
64  Q_PROPERTY(int implicitWidth READ implicitWidth NOTIFY implicitWidthChanged)
65 
69  Q_PROPERTY(int implicitHeight READ implicitHeight NOTIFY implicitHeightChanged)
70 
76  Q_PROPERTY(bool bookmarked READ isBookmarked WRITE setBookmarked NOTIFY bookmarkedChanged)
77 
81  Q_PROPERTY(QStringList bookmarks READ bookmarks NOTIFY bookmarksChanged)
82 
83 public:
84 
85  PageItem(QDeclarativeItem *parent=0);
86  ~PageItem();
87 
88  void setFlickable(QDeclarativeItem *flickable);
89  QDeclarativeItem *flickable() const;
90 
91  int implicitWidth() const;
92  int implicitHeight() const;
93 
94  DocumentItem *document() const;
95  void setDocument(DocumentItem *doc);
96 
97  int pageNumber() const;
98  void setPageNumber(int number);
99 
100  bool smooth() const;
101  void setSmooth(bool smooth);
102 
103  bool isBookmarked();
104  void setBookmarked(bool bookmarked);
105 
106  QStringList bookmarks() const;
107 
112  Q_INVOKABLE void goToBookmark(const QString &bookmark);
113 
120  Q_INVOKABLE QPointF bookmarkPosition(const QString &bookmark) const;
121 
125  Q_INVOKABLE void setBookmarkAtPos(qreal x, qreal y);
126 
130  Q_INVOKABLE void removeBookmarkAtPos(qreal x, qreal y);
131 
135  Q_INVOKABLE void removeBookmark(const QString &bookmark);
136 
137  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
138 
139  void geometryChanged(const QRectF &newGeometry,
140  const QRectF &oldGeometry);
141 
142 Q_SIGNALS:
143  void flickableChanged();
144  void implicitWidthChanged();
145  void implicitHeightChanged();
146  void documentChanged();
147  void pageNumberChanged();
148  void bookmarkedChanged();
149  void bookmarksChanged();
150 
151 protected:
152  void setIsThumbnail(bool thumbnail);
153 
154 private Q_SLOTS:
155  void delayedRedraw();
156  void pageHasChanged(int page, int flags);
157  void checkBookmarksChanged();
158  void contentXChanged();
159  void contentYChanged();
160 
161 private:
162  const Okular::Page *m_page;
163  bool m_smooth;
164  bool m_intentionalDraw;
165  bool m_bookmarked;
166  bool m_isThumbnail;
167  QWeakPointer<DocumentItem> m_documentItem;
168  QTimer *m_redrawTimer;
169  QWeakPointer <QDeclarativeItem> m_flickable;
170  Okular::DocumentViewport m_viewPort;
171 };
172 
173 #endif
PageItem::goToBookmark
Q_INVOKABLE void goToBookmark(const QString &bookmark)
loads a page bookmark and tries to ensure the bookmarked position is visible
Definition: pageitem.cpp:211
PageItem::bookmarkedChanged
void bookmarkedChanged()
PageItem::pageNumberChanged
void pageNumberChanged()
PageItem::removeBookmark
Q_INVOKABLE void removeBookmark(const QString &bookmark)
Remove a bookmark at a given position, if any.
Definition: pageitem.cpp:270
PageItem::geometryChanged
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
Definition: pageitem.cpp:277
PageItem::implicitHeight
int implicitHeight() const
PageItem::removeBookmarkAtPos
Q_INVOKABLE void removeBookmarkAtPos(qreal x, qreal y)
Remove a bookmark ar a given position of the current page (if present)
Definition: pageitem.cpp:253
Okular::View
View on the document.
Definition: view.h:32
QWidget
PageItem::setSmooth
void setSmooth(bool smooth)
Definition: pageitem.cpp:164
DocumentItem
Definition: documentitem.h:37
PageItem::setDocument
void setDocument(DocumentItem *doc)
Definition: pageitem.cpp:105
PageItem::flickableChanged
void flickableChanged()
PageItem::documentChanged
void documentChanged()
view.h
QDeclarativeItem
PageItem::bookmarked
bool bookmarked
True if the page contains at least a bookmark.
Definition: pageitem.h:76
PageItem::pageNumber
int pageNumber() const
PageItem::flickable
QDeclarativeItem * flickable() const
document.h
PageItem::setPageNumber
void setPageNumber(int number)
Definition: pageitem.cpp:128
PageItem::implicitHeightChanged
void implicitHeightChanged()
PageItem::bookmarkPosition
Q_INVOKABLE QPointF bookmarkPosition(const QString &bookmark) const
Returns the position in the page for a bookmark QPointF(-1,-1) if doesn't belong to this page...
Definition: pageitem.cpp:225
PageItem::setIsThumbnail
void setIsThumbnail(bool thumbnail)
Definition: pageitem.cpp:383
PageItem::implicitWidth
int implicitWidth() const
PageItem::setFlickable
void setFlickable(QDeclarativeItem *flickable)
Definition: pageitem.cpp:62
PageItem::document
DocumentItem * document() const
PageItem::setBookmarked
void setBookmarked(bool bookmarked)
Definition: pageitem.cpp:183
PageItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: pageitem.cpp:294
PageItem::isBookmarked
bool isBookmarked()
Definition: pageitem.cpp:178
PageItem::bookmarks
QStringList bookmarks() const
PageItem::setBookmarkAtPos
Q_INVOKABLE void setBookmarkAtPos(qreal x, qreal y)
Add a new bookmark ar a given position of the current page.
Definition: pageitem.cpp:237
PageItem::bookmarksChanged
void bookmarksChanged()
PageItem
Definition: pageitem.h:37
PageItem::smooth
bool smooth() const
PageItem::implicitWidthChanged
void implicitWidthChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal