Plasma
webview.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_WEBVIEW_H
00021 #define PLASMA_WEBVIEW_H
00022
00023 #include <plasma/plasma_export.h>
00024 #include <QtGui/QGraphicsWidget>
00025
00026 #include <kurl.h>
00027
00028 class QWebPage;
00029 class QWebFrame;
00030 class QKeyEvent;
00031 class QGraphicsSceneDragDropEvent;
00032 class QGraphicsSceneMouseEvent;
00033 class QGraphicsSceneWheelEvent;
00034 class QRect;
00035
00036 namespace Plasma
00037 {
00038
00039 class WebViewPrivate;
00040
00046 class PLASMA_EXPORT WebView : public QGraphicsWidget
00047 {
00048 Q_OBJECT
00049
00050 Q_PROPERTY(KUrl url READ url WRITE setUrl)
00051 Q_PROPERTY(QString html READ html WRITE setHtml)
00052 Q_PROPERTY(bool dragToScroll READ dragToScroll WRITE setDragToScroll)
00053
00054 public:
00055 explicit WebView(QGraphicsItem *parent = 0);
00056 ~WebView();
00057
00063 void setUrl(const KUrl &url);
00064
00068 KUrl url() const;
00069
00077 void setHtml(const QByteArray &html, const KUrl &baseUrl = KUrl());
00078
00082 QString html() const;
00083
00091 void setHtml(const QString &html, const KUrl &baseUrl = KUrl());
00092
00096 QRectF geometry() const;
00097
00105 void setPage(QWebPage *page);
00106
00111 QWebPage *page() const;
00112
00116 QWebFrame *mainFrame() const;
00117
00122 void setDragToScroll(bool drag);
00123
00128 bool dragToScroll();
00129
00133 void setGeometry(const QRectF &geometry);
00134
00135 Q_SIGNALS:
00142 void loadProgress(int percent);
00143
00150 void loadFinished(bool success);
00151
00152 protected:
00156 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
00157 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00158 void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
00159 void mousePressEvent(QGraphicsSceneMouseEvent *event);
00160 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
00161 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00162 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
00163 void wheelEvent(QGraphicsSceneWheelEvent *event);
00164 void keyPressEvent(QKeyEvent * event);
00165 void keyReleaseEvent(QKeyEvent * event);
00166 void focusInEvent(QFocusEvent * event);
00167 void focusOutEvent(QFocusEvent * event);
00168 void dragEnterEvent(QGraphicsSceneDragDropEvent * event);
00169 void dragLeaveEvent(QGraphicsSceneDragDropEvent * event);
00170 void dragMoveEvent(QGraphicsSceneDragDropEvent * event);
00171 void dropEvent(QGraphicsSceneDragDropEvent * event);
00172
00173 private:
00174 Q_PRIVATE_SLOT(d, void loadingFinished(bool success))
00175 Q_PRIVATE_SLOT(d, void updateRequested(const QRect& dirtyRect))
00176 Q_PRIVATE_SLOT(d, void scrollRequested(int dx, int dy, const QRect &scrollRect))
00177 Q_PRIVATE_SLOT(d, void dragTimeoutExpired())
00178
00179 WebViewPrivate * const d;
00180 friend class WebViewPrivate;
00181 };
00182
00183 }
00184
00185 #endif // Multiple incluson guard
00186