qwebengineview

How to print from QWebEngineView

孤街醉人 提交于 2020-11-29 17:56:29
问题 I am trying to print a report from within my application, which involves both text and tables. Since QTextDocument won't be sufficient, I've decided to go with QWebEngineView and more sophisticated HTML/CSS which is not supported by the Qt rich text engine. I am able to create a PDF from the view, however I am having some general misconceptions, because at times its crashing, and also printing instead of PDF creation crashes. Here is my attempts: Approach 1: PDF creation This is the only

How to print from QWebEngineView

梦想与她 提交于 2020-11-29 17:54:47
问题 I am trying to print a report from within my application, which involves both text and tables. Since QTextDocument won't be sufficient, I've decided to go with QWebEngineView and more sophisticated HTML/CSS which is not supported by the Qt rich text engine. I am able to create a PDF from the view, however I am having some general misconceptions, because at times its crashing, and also printing instead of PDF creation crashes. Here is my attempts: Approach 1: PDF creation This is the only

How to add static(html, css, js) files in pyinstaller to create standalone exe file?

拥有回忆 提交于 2020-06-09 05:39:27
问题 I'm using QtWebEngineWidgets , QtWebChannel to create PyQt5 application, which uses HTML, CSS, JavaScript. It's working fine, when we run in general way i.e., python main.py Importing HTML as below, current_dir = os.path.dirname(os.path.realpath(__file__)) filename = os.path.join(current_dir, "index.html") url = QtCore.QUrl.fromLocalFile(filename) Importing CSS, JavaScript files as below, # in index.html <link rel="stylesheet" href="styles.css"> <script type="text/javascript" src="jquery.js">

How to add static(html, css, js) files in pyinstaller to create standalone exe file?

ⅰ亾dé卋堺 提交于 2020-05-23 06:55:10
问题 I'm using QtWebEngineWidgets , QtWebChannel to create PyQt5 application, which uses HTML, CSS, JavaScript. It's working fine, when we run in general way i.e., python main.py Importing HTML as below, current_dir = os.path.dirname(os.path.realpath(__file__)) filename = os.path.join(current_dir, "index.html") url = QtCore.QUrl.fromLocalFile(filename) Importing CSS, JavaScript files as below, # in index.html <link rel="stylesheet" href="styles.css"> <script type="text/javascript" src="jquery.js">

Is there any way to get class of the page in Pyqt5 in browser?

夙愿已清 提交于 2020-03-18 10:06:26
问题 I am working with pyqt5. I want the user to click on the browser which should be embeded on my pyqt5 application to get the Class of the element which he/she is clicking on it. I just found on stack overflow that it's doable by combining javascript code with python. Any idea how to extract the class of the element? 回答1: The solution is to add an "event listener" that makes possible communication between the DOM objects and (Py)Qt. The following solution is based on this answer. from PyQt5

Using a local file in html for a PyQt5 webengine

拈花ヽ惹草 提交于 2020-03-15 05:51:09
问题 I am trying to embed a plotly graph into a PyQt5 webengine view. I was able to do so using the following: open plotly in qwebview in interactive mode If you read it, the article explains that you can't directly include the javascript in the HTML when using the webengine view (it has issues loading files above 2 MB). However, I'm trying to make it so that the source for the javascript is a local copy of plotly-min.js (saved in the project folder) so that anyone using the program doesn't need

Using a local file in html for a PyQt5 webengine

拟墨画扇 提交于 2020-03-15 05:50:15
问题 I am trying to embed a plotly graph into a PyQt5 webengine view. I was able to do so using the following: open plotly in qwebview in interactive mode If you read it, the article explains that you can't directly include the javascript in the HTML when using the webengine view (it has issues loading files above 2 MB). However, I'm trying to make it so that the source for the javascript is a local copy of plotly-min.js (saved in the project folder) so that anyone using the program doesn't need

Qt Event Propagation in QWebEngineView

夙愿已清 提交于 2020-02-16 05:49:30
问题 I have a function named generate_input_event . I'm trying to use this function to simulate a keypress within a QWebEngineView. def generate_input_event(window_id, key_code, modifiers, low_level_data, x, y): modifiers_flag = create_modifiers_flag(modifiers) logging.info("generate input, window: {} code: {}, modifiers {}".format( window_id, key_code, modifiers_flag)) event = QKeyEvent(QEvent.KeyPress, key_code, modifiers_flag) event.artificial = True event_window = window.get_window(window_id)