From 3f616b330d4eb43cb23616dd8fd5835e0a58ddbe Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 25 Jan 2013 20:00:37 +0100 Subject: [PATCH] Added Inspect Element action into popup window's context menu. --- src/lib/popupwindow/popupwebview.cpp | 12 ++++++++++-- src/lib/popupwindow/popupwebview.h | 3 ++- src/lib/webview/tabbedwebview.cpp | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/popupwindow/popupwebview.cpp b/src/lib/popupwindow/popupwebview.cpp index 260ac55a9..af7d97389 100644 --- a/src/lib/popupwindow/popupwebview.cpp +++ b/src/lib/popupwindow/popupwebview.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * 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); diff --git a/src/lib/popupwindow/popupwebview.h b/src/lib/popupwindow/popupwebview.h index c6483a71d..cf62a5b81 100644 --- a/src/lib/popupwindow/popupwebview.h +++ b/src/lib/popupwindow/popupwebview.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * 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); diff --git a/src/lib/webview/tabbedwebview.cpp b/src/lib/webview/tabbedwebview.cpp index 7b1e93f83..2bc6badcf 100644 --- a/src/lib/webview/tabbedwebview.cpp +++ b/src/lib/webview/tabbedwebview.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * 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);