source: trunk/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h@ 802

Last change on this file since 802 was 769, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 4.8 KB
Line 
1/*
2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef QGraphicsWebView_h
21#define QGraphicsWebView_h
22
23#include "qwebkitglobal.h"
24#include "qwebpage.h"
25#include <QtCore/qurl.h>
26#include <QtGui/qevent.h>
27#include <QtGui/qgraphicswidget.h>
28#include <QtGui/qicon.h>
29#include <QtGui/qpainter.h>
30#include <QtNetwork/qnetworkaccessmanager.h>
31
32class QWebPage;
33class QWebHistory;
34class QWebSettings;
35
36class QGraphicsWebViewPrivate;
37
38class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
39 Q_OBJECT
40
41 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
42 Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
43 Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
44
45 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
46
47 Q_PROPERTY(bool modified READ isModified)
48
49public:
50 explicit QGraphicsWebView(QGraphicsItem* parent = 0);
51 ~QGraphicsWebView();
52
53 QWebPage* page() const;
54 void setPage(QWebPage*);
55
56 QUrl url() const;
57 void setUrl(const QUrl&);
58
59 QString title() const;
60 QIcon icon() const;
61
62 qreal zoomFactor() const;
63 void setZoomFactor(qreal);
64
65 bool isModified() const;
66
67 void load(const QUrl &url);
68 void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
69
70 void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
71 // FIXME: Consider rename to setHtml?
72 void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
73
74 QWebHistory* history() const;
75 QWebSettings* settings() const;
76
77 QAction* pageAction(QWebPage::WebAction action) const;
78 void triggerPageAction(QWebPage::WebAction action, bool checked = false);
79
80 bool findText(const QString& subString, QWebPage::FindFlags options = 0);
81
82 virtual void setGeometry(const QRectF& rect);
83 virtual void updateGeometry();
84 virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
85 virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
86 virtual bool event(QEvent*);
87
88 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const;
89
90 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
91
92public Q_SLOTS:
93 void stop();
94 void back();
95 void forward();
96 void reload();
97
98Q_SIGNALS:
99 void loadStarted();
100 void loadFinished(bool);
101
102 void loadProgress(int progress);
103 void urlChanged(const QUrl&);
104 void titleChanged(const QString&);
105 void iconChanged();
106 void statusBarMessage(const QString& message);
107 void linkClicked(const QUrl&);
108
109protected:
110 virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
111 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
112 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
113 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
114 virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
115 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
116#ifndef QT_NO_WHEELEVENT
117 virtual void wheelEvent(QGraphicsSceneWheelEvent*);
118#endif
119 virtual void keyPressEvent(QKeyEvent*);
120 virtual void keyReleaseEvent(QKeyEvent*);
121#ifndef QT_NO_CONTEXTMENU
122 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
123#endif
124 virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*);
125 virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
126 virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*);
127 virtual void dropEvent(QGraphicsSceneDragDropEvent*);
128 virtual void focusInEvent(QFocusEvent*);
129 virtual void focusOutEvent(QFocusEvent*);
130 virtual void inputMethodEvent(QInputMethodEvent*);
131 virtual bool focusNextPrevChild(bool next);
132
133 virtual bool sceneEvent(QEvent*);
134
135private:
136 Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
137 Q_PRIVATE_SLOT(d, void _q_updateMicroFocus())
138 Q_PRIVATE_SLOT(d, void _q_pageDestroyed())
139
140 QGraphicsWebViewPrivate* const d;
141 friend class QGraphicsWebViewPrivate;
142};
143
144#endif // QGraphicsWebView_h
Note: See TracBrowser for help on using the repository browser.