KDEWebKit
kwebview.cpp
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * 00004 * Copyright (C) 2007 Trolltech ASA 00005 * Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org> 00006 * Copyright (C) 2008 Laurent Montel <montel@kde.org> 00007 * Copyright (C) 2008 Michael Howell <mhowell123@gmail.com> 00008 * Copyright (C) 2009 Dawit Alemayehu <adawit @ kde.org> 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Library General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Library General Public License 00021 * along with this library; see the file COPYING.LIB. If not, write to 00022 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00023 * Boston, MA 02110-1301, USA. 00024 * 00025 */ 00026 00027 #include "kwebview.h" 00028 #include "kwebpage.h" 00029 #include "kwebview_p.h" 00030 00031 #include <QtGui/QMouseEvent> 00032 00033 00034 KWebView::KWebView(QWidget *parent, bool createCustomPage) 00035 :QWebView(parent), d(new KWebViewPrivate<KWebView>(this)) 00036 { 00037 if (createCustomPage) 00038 setPage(new KWebPage(this)); 00039 } 00040 00041 KWebView::~KWebView() 00042 { 00043 delete d; 00044 } 00045 00046 bool KWebView::isExternalContentAllowed() const 00047 { 00048 return d->isExternalContentAllowed(); 00049 } 00050 00051 void KWebView::setAllowExternalContent(bool allow) 00052 { 00053 d->setAllowExternalContent(allow); 00054 } 00055 00056 void KWebView::wheelEvent(QWheelEvent *event) 00057 { 00058 if (d->wheelEvent(event->delta())) { 00059 event->accept(); 00060 } else { 00061 QWebView::wheelEvent(event); 00062 } 00063 } 00064 00065 00066 void KWebView::mousePressEvent(QMouseEvent *event) 00067 { 00068 d->pressedButtons = event->buttons(); 00069 d->keyboardModifiers = event->modifiers(); 00070 QWebView::mousePressEvent(event); 00071 } 00072 00073 void KWebView::mouseReleaseEvent(QMouseEvent *event) 00074 { 00075 if (d->mouseReleased(event->pos()) || d->handleUrlPasteFromClipboard(event)) { 00076 event->accept(); 00077 return; 00078 } 00079 00080 QWebView::mouseReleaseEvent(event); 00081 } 00082 00083 #include "kwebview.moc"
KDE 4.6 API Reference