1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Added Inspect Element action into popup window's context menu.

This commit is contained in:
nowrep 2013-01-25 20:00:37 +01:00
parent b7cc728d63
commit 3f616b330d
3 changed files with 14 additions and 5 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,6 +80,11 @@ void PopupWebView::closeView()
parentWidget()->close();
}
void PopupWebView::inspectElement()
{
triggerPageAction(QWebPage::InspectElement);
}
void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
{
m_menu->clear();
@ -88,8 +93,11 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
createContextMenu(m_menu, hitTest, event->pos());
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick
// Prevent choosing first option with double rightclick
const QPoint &pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -40,6 +40,7 @@ signals:
public slots:
void closeView();
void inspectElement();
private:
void contextMenuEvent(QContextMenuEvent* event);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -270,7 +270,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick
// Prevent choosing first option with double rightclick
const QPoint &pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1);