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

Plasma

  • 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
28class QWebPage;
29class QWebFrame;
30class QKeyEvent;
31class QGraphicsSceneDragDropEvent;
32class QGraphicsSceneMouseEvent;
33class QGraphicsSceneWheelEvent;
34class QRect;
35
36namespace Plasma
37{
38
39class WebViewPrivate;
40
46class 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
Plasma::WebView::itemChange
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Definition webview.cpp:299
Plasma::WebView::contentsSize
QSizeF contentsSize
Definition webview.h:54
Plasma::WebView::html
QString html
Definition webview.h:51
Plasma::WebView::scrollPosition
QPointF scrollPosition
Definition webview.h:53
Plasma::WebView::setPage
void setPage(QWebPage *page)
Sets the page to use in this item.
Definition webview.cpp:165
Plasma::WebView::setScrollPosition
void setScrollPosition(const QPointF &position)
Sets the position of the webpage relative to this widget.
Definition webview.cpp:140
Plasma::WebView::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition webview.cpp:259
Plasma::WebView::setZoomFactor
void setZoomFactor(const qreal zoom)
Sets the zoom factor of the page.
Definition webview.cpp:160
Plasma::WebView::mainFrame
QWebFrame * mainFrame() const
The main web frame associated with this item.
Definition webview.cpp:175
Plasma::WebView::contextMenuEvent
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Definition webview.cpp:249
Plasma::WebView::url
KUrl url
Definition webview.h:50
Plasma::WebView::WebView
WebView(QGraphicsItem *parent=0)
Definition webview.cpp:63
Plasma::WebView::urlChanged
void urlChanged(const QUrl &url)
url displayed by the web page changed
Plasma::WebView::dragLeaveEvent
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
Definition webview.cpp:284
Plasma::WebView::viewportGeometry
QRectF viewportGeometry
Definition webview.h:55
Plasma::WebView::geometry
QRectF geometry() const
Reimplementation.
Definition webview.cpp:126
Plasma::WebView::dropEvent
void dropEvent(QGraphicsSceneDragDropEvent *event)
Definition webview.cpp:294
Plasma::WebView::WebViewPrivate
friend class WebViewPrivate
Definition webview.h:252
Plasma::WebView::zoomFactor
qreal zoomFactor
Definition webview.h:56
Plasma::WebView::setUrl
void setUrl(const KUrl &url)
Sets the URL to display.
Definition webview.cpp:98
Plasma::WebView::forward
void forward()
Loads the next document in the list of documents built by navigating links.
Definition webview.cpp:204
Plasma::WebView::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition webview.cpp:244
Plasma::WebView::dragToScroll
bool dragToScroll
Definition webview.h:52
Plasma::WebView::dragEnterEvent
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
Definition webview.cpp:279
Plasma::WebView::keyReleaseEvent
void keyReleaseEvent(QKeyEvent *event)
Definition webview.cpp:264
Plasma::WebView::focusInEvent
void focusInEvent(QFocusEvent *event)
Definition webview.cpp:269
Plasma::WebView::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition webview.cpp:224
Plasma::WebView::focusOutEvent
void focusOutEvent(QFocusEvent *event)
Definition webview.cpp:274
Plasma::WebView::back
void back()
Loads the previous document in the list of documents built by navigating links.
Definition webview.cpp:199
Plasma::WebView::loadProgress
void loadProgress(int percent)
During loading progress, this signal is emitted.
Plasma::WebView::setGeometry
void setGeometry(const QRectF &geometry)
Reimplementation.
Definition webview.cpp:310
Plasma::WebView::dragMoveEvent
void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
Definition webview.cpp:289
Plasma::WebView::reload
void reload()
Reloads the current document.
Definition webview.cpp:209
Plasma::WebView::setHtml
void setHtml(const QByteArray &html, const KUrl &baseUrl=KUrl())
Sets the html to be shown along with a base URL to be used to resolve relative references.
Definition webview.cpp:109
Plasma::WebView::sizeHint
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
Definition webview.cpp:317
Plasma::WebView::loadFinished
void loadFinished(bool success)
This signal is emitted when loading is completed.
Plasma::WebView::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition webview.cpp:234
Plasma::WebView::wheelEvent
void wheelEvent(QGraphicsSceneWheelEvent *event)
Definition webview.cpp:254
Plasma::WebView::setDragToScroll
void setDragToScroll(bool drag)
Sets if the page can be scrolled around by dragging the contents with the mouse.
Definition webview.cpp:180
Plasma::WebView::page
QWebPage * page() const
The QWebPage associated with this item.
Definition webview.cpp:170
Plasma::WebView::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Reimplementation.
Definition webview.cpp:219
Plasma::WebView::hoverMoveEvent
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Definition webview.cpp:229
Plasma::WebView::stop
void stop()
Stops loading the document.
Definition webview.cpp:214
Plasma::WebView::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition webview.cpp:239
QGraphicsWidget
QStyleOptionGraphicsItem
QWidget
Plasma
Namespace for everything in libplasma.
Definition abstractdialogmanager.cpp:25
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.13.2 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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