Created
May 23, 2012 11:22
-
-
Save empr/2774676 to your computer and use it in GitHub Desktop.
PySide QWebView disable context menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import sys | |
import site | |
site.addsitedir('/usr/local/lib/python2.7/site-packages') | |
from PySide import QtCore, QtGui, QtWebKit | |
class WebView(QtWebKit.QWebView): | |
def __init__(self, parent=None): | |
QtWebKit.QWebView.__init__(self, parent) | |
def contextMenuEvent(self, event): | |
# override this method and do nothing. | |
pass | |
app = QtGui.QApplication(sys.argv) | |
view = WebView() | |
view.setHtml('hello world') | |
view.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment