1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01: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 * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -80,6 +80,11 @@ void PopupWebView::closeView()
parentWidget()->close(); parentWidget()->close();
} }
void PopupWebView::inspectElement()
{
triggerPageAction(QWebPage::InspectElement);
}
void PopupWebView::contextMenuEvent(QContextMenuEvent* event) void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
{ {
m_menu->clear(); m_menu->clear();
@ -88,8 +93,11 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
createContextMenu(m_menu, hitTest, event->pos()); createContextMenu(m_menu, hitTest, event->pos());
m_menu->addSeparator();
m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (!m_menu->isEmpty()) { if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick // Prevent choosing first option with double rightclick
const QPoint &pos = event->globalPos(); const QPoint &pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p); m_menu->popup(p);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -40,6 +40,7 @@ signals:
public slots: public slots:
void closeView(); void closeView();
void inspectElement();
private: private:
void contextMenuEvent(QContextMenuEvent* event); void contextMenuEvent(QContextMenuEvent* event);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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())); m_menu->addAction(tr("Inspect Element"), this, SLOT(inspectElement()));
if (!m_menu->isEmpty()) { if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick // Prevent choosing first option with double rightclick
const QPoint &pos = event->globalPos(); const QPoint &pos = event->globalPos();
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);