pyside2

Set CullFace to Front and Back in Qt3D in Python via PySide2

梦想与她 提交于 2021-02-20 05:13:37
问题 I wanted to set QCullFace to FrontAndBack and that is why I wrote this: from PySide2.Qt3DRender import Qt3DRender cull_face = Qt3DRender.QCullFace() cull_face.setMode(Qt3DRender.QCullFace.FrontAndBack) render_pass = Qt3DRender.QRenderPass() render_pass.addRenderState(cull_face) The code above should set CullFace globally. But it does not. What did I do wrong? 回答1: I assume that the python binding does not change how Qt works in C++. So you probably have a Qt3DWindow somewhere (unless you

Set CullFace to Front and Back in Qt3D in Python via PySide2

风流意气都作罢 提交于 2021-02-20 05:13:07
问题 I wanted to set QCullFace to FrontAndBack and that is why I wrote this: from PySide2.Qt3DRender import Qt3DRender cull_face = Qt3DRender.QCullFace() cull_face.setMode(Qt3DRender.QCullFace.FrontAndBack) render_pass = Qt3DRender.QRenderPass() render_pass.addRenderState(cull_face) The code above should set CullFace globally. But it does not. What did I do wrong? 回答1: I assume that the python binding does not change how Qt works in C++. So you probably have a Qt3DWindow somewhere (unless you

Filter QTableView rows with QSortFilterProxyModel and ComboBox

只愿长相守 提交于 2021-02-17 06:36:05
问题 I'm using Pyside2, python 3.8, Qt 5. I have a QTableView with a QAbstractTableModel to it. I have a Combobox (ComboBoxColumns) that lists all my columns headers, and a second Combobox (ComboBoxValues) that lists all the distinct values in the column that is selected in the ComboBoxColumns. My two ComboBoxs are connected to two different QStringListModel. What I want is to only keep the rows where the Value(row, ComboboxColumns.currentIndex) == ComboBoxValues.currentIndex. I'm trying to

QML Charts causes crash on startup

雨燕双飞 提交于 2021-02-17 05:09:32
问题 I'm trying to make an application that uses QML QCharts to visualize data. The program is crashing at startup before a window even appears. I tried on both macOS and Windows 10 with the same results. I have included a minimally working example below. main.py : import sys from PySide2.QtGui import QGuiApplication from PySide2.QtQml import QQmlApplicationEngine from PySide2.QtCore import QUrl import qml_rc if __name__ == "__main__": app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine

QML Charts causes crash on startup

怎甘沉沦 提交于 2021-02-17 05:06:32
问题 I'm trying to make an application that uses QML QCharts to visualize data. The program is crashing at startup before a window even appears. I tried on both macOS and Windows 10 with the same results. I have included a minimally working example below. main.py : import sys from PySide2.QtGui import QGuiApplication from PySide2.QtQml import QQmlApplicationEngine from PySide2.QtCore import QUrl import qml_rc if __name__ == "__main__": app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine

Is it possible to get a list of objects from a PySide2 slot (service call) via QML?

给你一囗甜甜゛ 提交于 2021-02-17 03:50:29
问题 I am trying to convert an existing PySide2/QtWidgets application to PySide2/QML. I am trying to get a list of custom objects from a Python service call via a QML MouseArea click. I currently have a main script ( main.py ) that launches a QQuickView containing my QML (contained in main.qml ). It also registers a custom type for my model ( Role , defined in role.py ) and exposes an instance of my service class (contained in mock_role_service.py ) to the view's root context. My QML displays

PyQt5/PySide2 AdBlock

∥☆過路亽.° 提交于 2021-02-16 15:04:27
问题 I am trying to create a floating browser for youtube and other media. I found some old examples of adblock like for PyQt4/PySide but now they are deprecated and I can't translate them to PySide2 QWebEngineView. Any ideas of how insert the adblock inside a QWebEngineView? Older version link How would you adblock using Python? 回答1: To filter urls, a QWebEngineUrlRequestInterceptor must be implemented, and if you want to block the url you must call the block (True) function to the

QML Calendar and Google Calendar API in Python events integration

随声附和 提交于 2021-02-10 23:27:30
问题 I'm currently working on creating a QML Calendar that will ideally display events from a Google calendar. This is an example of what I'd like to emulate in python: https://doc.qt.io/qt-5.9/qtquickcontrols-calendar-example.html Right now, a python file is taking dates and event summaries from the Google Calendar API and returning them as a dictionary (the tenevents variable in the python code) of {date: event summary}. I have a very simple QML window displaying a calendar and a rectangle. I

No viewfinder available while trying to display webcam with PySide2

江枫思渺然 提交于 2021-02-10 18:44:08
问题 I am working on Ubuntu 20.04 with Python3 and PySide2, Qt is version 5. I wrote this simple Python script in order to test the ability to save webcam video for a larger project I will later work on. Basically, I would like that this demo script at first and simply displays the stream coming from the camera, in a widget I named "frame", but it seems I am missing something, because a message gets printed in the terminal: Starting camera without viewfinder available I made the GUI within

No viewfinder available while trying to display webcam with PySide2

你。 提交于 2021-02-10 18:39:09
问题 I am working on Ubuntu 20.04 with Python3 and PySide2, Qt is version 5. I wrote this simple Python script in order to test the ability to save webcam video for a larger project I will later work on. Basically, I would like that this demo script at first and simply displays the stream coming from the camera, in a widget I named "frame", but it seems I am missing something, because a message gets printed in the terminal: Starting camera without viewfinder available I made the GUI within