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

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
  • widgets
webview.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (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 Library 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 PLASMA_WEBVIEW_H
21 #define PLASMA_WEBVIEW_H
22 
23 #include <plasma/plasma_export.h>
24 #include <QtGui/QGraphicsWidget>
25 
26 #include <kurl.h>
27 
28 class QWebPage;
29 class QWebFrame;
30 class QKeyEvent;
31 class QGraphicsSceneDragDropEvent;
32 class QGraphicsSceneMouseEvent;
33 class QGraphicsSceneWheelEvent;
34 class QRect;
35 
36 namespace Plasma
37 {
38 
39 class WebViewPrivate;
40 
46 class PLASMA_EXPORT WebView : public QGraphicsWidget
47 {
48  Q_OBJECT
49 
50  Q_PROPERTY(KUrl url READ url WRITE setUrl)
51  Q_PROPERTY(QString html READ html WRITE setHtml)
52  Q_PROPERTY(bool dragToScroll READ dragToScroll WRITE setDragToScroll)
53  Q_PROPERTY(QPointF scrollPosition READ scrollPosition WRITE setScrollPosition)
54  Q_PROPERTY(QSizeF contentsSize READ contentsSize)
55  Q_PROPERTY(QRectF viewportGeometry READ viewportGeometry)
56  Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
57 
58  public:
59  explicit WebView(QGraphicsItem *parent = 0);
60  ~WebView();
61 
67  void setUrl(const KUrl &url);
68 
72  KUrl url() const;
73 
81  void setHtml(const QByteArray &html, const KUrl &baseUrl = KUrl());
82 
86  QString html() const;
87 
95  void setHtml(const QString &html, const KUrl &baseUrl = KUrl());
96 
100  QRectF geometry() const;
101 
106  QSizeF contentsSize() const;
107 
112  void setScrollPosition(const QPointF &position);
113 
118  QPointF scrollPosition() const;
119 
124  QRectF viewportGeometry() const;
125 
131  qreal zoomFactor() const;
132 
138  void setZoomFactor(const qreal zoom);
139 
147  void setPage(QWebPage *page);
148 
153  QWebPage *page() const;
154 
158  QWebFrame *mainFrame() const;
159 
164  void setDragToScroll(bool drag);
165 
170  bool dragToScroll();
171 
175  void setGeometry(const QRectF &geometry);
176 
177  public Q_SLOTS:
182  void back();
183 
188  void forward();
189 
194  void reload();
195 
200  void stop();
201 
202  Q_SIGNALS:
209  void loadProgress(int percent);
210 
217  void loadFinished(bool success);
218 
223  void urlChanged(const QUrl &url);
224 
225  protected:
229  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
230  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
231  void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
232  void mousePressEvent(QGraphicsSceneMouseEvent *event);
233  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
234  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
235  void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
236  void wheelEvent(QGraphicsSceneWheelEvent *event);
237  void keyPressEvent(QKeyEvent * event);
238  void keyReleaseEvent(QKeyEvent * event);
239  void focusInEvent(QFocusEvent * event);
240  void focusOutEvent(QFocusEvent * event);
241  void dragEnterEvent(QGraphicsSceneDragDropEvent * event);
242  void dragLeaveEvent(QGraphicsSceneDragDropEvent * event);
243  void dragMoveEvent(QGraphicsSceneDragDropEvent * event);
244  void dropEvent(QGraphicsSceneDragDropEvent * event);
245  QVariant itemChange(GraphicsItemChange change, const QVariant &value);
246  QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
247 
248  private:
249  Q_PRIVATE_SLOT(d, void loadingFinished(bool success))
250 
251  WebViewPrivate * const d;
252  friend class WebViewPrivate;
253 };
254 
255 } // namespace Plasma
256 
257 #endif // Multiple incluson guard
258 
QWidget
Plasma::WebView
Provides a widget to display html content in Plasma.
Definition: webview.h:46
QStyleOptionGraphicsItem
plasma_export.h
QGraphicsWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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