summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.project8
-rw-r--r--Swift/QtUI/QtWebView.cpp30
-rw-r--r--Swift/QtUI/QtWebView.h4
3 files changed, 30 insertions, 12 deletions
diff --git a/.project b/.project
index 17363c7..fcdfcdc 100644
--- a/.project
+++ b/.project
@@ -18,7 +18,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
- <value>check=1 QA</value>
+ <value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
@@ -29,10 +29,6 @@
<value>python</value>
</dictionary>
<dictionary>
- <key>org.eclipse.cdt.make.core.buildLocation</key>
- <value></value>
- </dictionary>
- <dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>-c</value>
</dictionary>
@@ -54,7 +50,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
- <value>check=1 QA</value>
+ <value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index 553ac56..3aab88b 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -14,6 +14,9 @@
namespace Swift {
QtWebView::QtWebView(QWidget* parent) : QWebView(parent) {
setRenderHint(QPainter::SmoothPixmapTransform);
+ filteredActions.push_back(QWebPage::CopyLinkToClipboard);
+ filteredActions.push_back(QWebPage::CopyImageToClipboard);
+ filteredActions.push_back(QWebPage::Copy);
}
void QtWebView::keyPressEvent(QKeyEvent* event) {
@@ -37,13 +40,28 @@ void QtWebView::dragEnterEvent(QDragEnterEvent*) {
}
void QtWebView::contextMenuEvent(QContextMenuEvent* ev) {
- QMenu menu(this);
- QAction* copyLinkAction = pageAction(QWebPage::CopyLinkToClipboard);
- if (copyLinkAction) {
- menu.addAction(copyLinkAction);
+ // Filter out the relevant actions from the standard actions
+ QMenu* menu = page()->createStandardContextMenu();
+ QList<QAction*> actions(menu->actions());
+ for (int i = 0; i < actions.size(); ++i) {
+ QAction* action = actions.at(i);
+ bool removeAction = true;
+ for(size_t j = 0; j < filteredActions.size(); ++j) {
+ if (action == pageAction(filteredActions[j])) {
+ removeAction = false;
+ break;
+ }
+ }
+ if (removeAction) {
+ menu->removeAction(action);
+ }
}
- menu.addAction("Clear", this, SIGNAL(clearRequested()));
- menu.exec(ev->globalPos());
+
+ // Add our own custom actions
+ menu->addAction("Clear", this, SIGNAL(clearRequested()));
+
+ menu->exec(ev->globalPos());
+ delete menu;
}
void QtWebView::focusInEvent(QFocusEvent* event) {
diff --git a/Swift/QtUI/QtWebView.h b/Swift/QtUI/QtWebView.h
index f60e5ef..fbd31e3 100644
--- a/Swift/QtUI/QtWebView.h
+++ b/Swift/QtUI/QtWebView.h
@@ -8,6 +8,7 @@
#pragma once
#include <QWebView>
+#include <vector>
namespace Swift {
class QtWebView : public QWebView {
@@ -24,5 +25,8 @@ namespace Swift {
protected:
void focusInEvent(QFocusEvent* event);
+
+ private:
+ std::vector<QWebPage::WebAction> filteredActions;
};
}