0

I would like to add QwebEngineView, QtCharts, and Qwt Widgets in qt designer. Currently I am using QT Designer from SitePackages\PyQt5_tools\Qt\bin\Qt Designer.

I saw below post but in that mainly discussed to add widgets using c++.

How to insert QChartView in form with Qt Designer?

When I follow the steps mentioned in above post, I unable to find Qwebengineview and Qtcharts when I promote the widgets in python. Please help me to solve this.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

1

This is the procedure I use to add the QChartView and QWebEngineView plugins to pyqt5_tools in Linux.

Generate plugins:

In my case I use the following procedure:

git clone -b 5.15.0 https://github.com/qt/qtcharts.git
cd qtcharts/plugins/designer 
qmake 
make
git clone -b 5.15.0 https://github.com/qt/qtwebengine.git
cd qtwebengine/src/plugins/qwebengineview
qmake 
make

In folders "qtcharts/plugins/designer" and "qtwebengine/plugins/designer" the .so files were generated (in windows the .dll files should be generated).

Copy

As it is required to use QChartView and QWebEngineView it is assumed that you have pyqchart and pyqtwebengine installed (if you do not have it then run: python -m pip install PyQtChart PyQtWebEngine).

When pyqt5designer of pyqt5_tools is executed in the console the following log is obtained:

PYQTDESIGNERPATH: :
PYTHONPATH: /home/qt_user/venv/bin:/usr/lib/python38.zip:/usr/lib/python3.8:/usr/lib/python3.8/lib-dynload:/home/qt_user/venv/lib/python3.8/site-packages::
PATH: /home/qt_user/venv/bin:/usr/lib/python38.zip:/usr/lib/python3.8:/usr/lib/python3.8/lib-dynload:/home/qt_user/venv/lib/python3.8/site-packages:/home/qt_user/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
QT_DEBUG_PLUGINS is not set
QT_PLUGIN_PATH: :/home/qt_user/venv/lib/python3.8/site-packages/pyqt5_tools/Qt/plugins
PYQT5TOOLS_TEST_PATH is not set
LD_LIBRARY_PATH: ::/usr/lib

In that part the important thing is QT_PLUGIN_PATH, to generalize the process I will call PYQT5_TOOLS_QT to /home/qt_user/venv/lib/python3.8/site-packages/pyqt5_tools/Qt.

You also have to get the QT_PLUGIN_PATH from PyQt5 with the following command:

python -c "from PyQt5.QtCore import QLibraryInfo;  print('QT_PLUGIN_PATH=', QLibraryInfo.location(QLibraryInfo.PluginsPath))"

Output:

QT_PLUGIN_PATH= /home/qt_user/venv/lib/python3.8/site-packages/PyQt5/Qt/plugins

So I will call PYQT5_QT to /home/qt_user/venv/lib/python3.8/site-packages/PyQt5/Qt.

So using that information you should copy:

PYQT5_QT/translations                     ---> PYQT5_TOOLS_QT/translations
PYQT5_QT/lib/libQt5WebEngineWidgets.so.5  ---> PYQT5_TOOLS_QT/lib
PYQT5_QT/lib/libQt5WebEngineCore.so.5     ---> PYQT5_TOOLS_QT/lib
PYQT5_QT/lib/libQt5Positioning.so.5       ---> PYQT5_TOOLS_QT/lib
PYQT5_QT/lib/libQt5WebChannel.so.5        ---> PYQT5_TOOLS_QT/lib
PYQT5_QT/lib/libQt5QuickWidgets.so.5      ---> PYQT5_TOOLS_QT/lib
PYQT5_QT/libexec                          ---> PYQT5_TOOLS_QT/libexec
PYQT5_QT/resources                        ---> PYQT5_TOOLS_QT/resources

Also the plugins:

qtcharts/plugins/designer/libqtchartsdesigner.so  ---> PYQT5_TOOLS_QT/plugins/designer
qtwebengine/plugins/designer/libqwebengineview.so ---> PYQT5_TOOLS_QT/plugins/designer

If the plugins dialog is opened through: Help --> About Plugins

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241