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

KDEWebKit

  • sources
  • kde-4.14
  • kdelibs
  • kdewebkit
kgraphicswebview.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the KDE project.
3  *
4  * Copyright (C) 2007 Trolltech ASA
5  * Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
6  * Copyright (C) 2008 Laurent Montel <montel@kde.org>
7  * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
8  * Copyright (C) 2009 Dawit Alemayehu <adawit @ kde.org>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public License
21  * along with this library; see the file COPYING.LIB. If not, write to
22  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  *
25  */
26 
27 #include "kgraphicswebview.h"
28 #include "kwebpage.h"
29 #include "kwebview_p.h"
30 
31 #include <QtGui/QGraphicsSceneWheelEvent>
32 #include <QtGui/QGraphicsSceneMouseEvent>
33 
34 
35 KGraphicsWebView::KGraphicsWebView(QGraphicsItem *parent, bool createCustomPage)
36  :QGraphicsWebView(parent),
37  d(new KWebViewPrivate<KGraphicsWebView>(this))
38 {
39  if (createCustomPage)
40  setPage(new KWebPage(this));
41 }
42 
43 KGraphicsWebView::~KGraphicsWebView()
44 {
45  delete d;
46 }
47 
48 bool KGraphicsWebView::isExternalContentAllowed() const
49 {
50  return d->isExternalContentAllowed();
51 }
52 
53 void KGraphicsWebView::setAllowExternalContent(bool allow)
54 {
55  d->setAllowExternalContent(allow);
56 }
57 
58 void KGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent *event)
59 {
60  if (d->wheelEvent(event->delta())) {
61  event->accept();
62  } else {
63  QGraphicsWebView::wheelEvent(event);
64  }
65 }
66 
67 
68 void KGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
69 {
70  d->pressedButtons = event->buttons();
71  d->keyboardModifiers = event->modifiers();
72  QGraphicsWebView::mousePressEvent(event);
73 }
74 
75 void KGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
76 {
77  if (d->mouseReleased(event->pos().toPoint()) || d->handleUrlPasteFromClipboard(event)) {
78  event->accept();
79  return;
80  }
81 
82  QGraphicsWebView::mouseReleaseEvent(event);
83 }
84 
85 #include "kgraphicswebview.moc"
KGraphicsWebView::setAllowExternalContent
void setAllowExternalContent(bool allow)
Set allow to false if you want to prevent access to remote content.
Definition: kgraphicswebview.cpp:53
QGraphicsWebView::wheelEvent
virtual void wheelEvent(QGraphicsSceneWheelEvent *ev)
QGraphicsWebView::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *ev)
kwebpage.h
KGraphicsWebView::KGraphicsWebView
KGraphicsWebView(QGraphicsItem *parent=0, bool createCustomPage=true)
Constructs a KGraphicsWebView object with parent parent.
Definition: kgraphicswebview.cpp:35
KWebViewPrivate::mouseReleased
bool mouseReleased(const QPoint &pos)
Definition: kwebview_p.h:84
QGraphicsSceneWheelEvent
KGraphicsWebView::wheelEvent
void wheelEvent(QGraphicsSceneWheelEvent *event)
Definition: kgraphicswebview.cpp:58
KWebViewPrivate::setAllowExternalContent
void setAllowExternalContent(bool allow)
Definition: kwebview_p.h:64
QGraphicsItem
KWebViewPrivate::handleUrlPasteFromClipboard
bool handleUrlPasteFromClipboard(QEvent *event)
Definition: kwebview_p.h:105
KGraphicsWebView::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: kgraphicswebview.cpp:68
QGraphicsWebView::setPage
void setPage(QWebPage *page)
KWebViewPrivate
Definition: kgraphicswebview.h:34
kgraphicswebview.h
QGraphicsWebView
QGraphicsSceneMouseEvent
kwebview_p.h
KGraphicsWebView::isExternalContentAllowed
bool isExternalContentAllowed() const
Returns true if access to remote content is allowed.
Definition: kgraphicswebview.cpp:48
KWebViewPrivate::isExternalContentAllowed
bool isExternalContentAllowed()
Definition: kwebview_p.h:54
QPointF::toPoint
QPoint toPoint() const
KWebViewPrivate::pressedButtons
Qt::MouseButtons pressedButtons
Definition: kwebview_p.h:152
KGraphicsWebView::~KGraphicsWebView
~KGraphicsWebView()
Destroys the KGraphicsWebView.
Definition: kgraphicswebview.cpp:43
KGraphicsWebView
A re-implementation of QGraphicsWebView that provides KDE integration.
Definition: kgraphicswebview.h:55
KWebPage
An enhanced QWebPage that provides integration into the KDE environment.
Definition: kwebpage.h:75
KWebViewPrivate::keyboardModifiers
Qt::KeyboardModifiers keyboardModifiers
Definition: kwebview_p.h:151
QGraphicsWebView::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *ev)
KWebViewPrivate::wheelEvent
bool wheelEvent(int delta)
Definition: kwebview_p.h:72
QGraphicsSceneMouseEvent::pos
QPointF pos() const
QGraphicsSceneWheelEvent::delta
int delta() const
KGraphicsWebView::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: kgraphicswebview.cpp:75
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEWebKit

Skip menu "KDEWebKit"
  • Main Page
  • 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • 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