Qt Charts and Data Visualization widgets

2019-03-16 09:44发布

I have installed Qt 5.7 in order to try Qt Charts and Qt Data Visualization but I cannot find new widgets neither in Qt Designer nor in Qt Creator. Any suggestions what should I do so new widgets appear in designer?

4条回答
forever°为你锁心
2楼-- · 2019-03-16 10:30

Just elaborating on Holger's answer for ubuntu, compile, in terminal using qmake and make (doesn't work in qt creator - you need qt chart development package installed, which I believe is not available at this point in time), the designer.pro file in /opt/Qt/5.7/Src/qtcharts/plugins/designer directory then, copy and paste the shared library into /opt/Qt/Tools/QtCreator/lib/Qt/plugins/designer directory, where /opt/Qt is the directory in which Qt is installed.

查看更多
Luminary・发光体
3楼-- · 2019-03-16 10:35

I was having exactly the same problem today. It looks like the QT Designer plugins of QT Charts are not part of the package by default. I ended up downloading the designer plugin sources from github https://github.com/qtproject/qtcharts/tree/5.7/plugins/designer This consists of just 5 files.

You should then be able to open the designer.pro project in Qt Creator and compile it. Place the resulting library in your designer plugin directory. This will make the QChartsView widget appear in the Qt Designer.

查看更多
唯我独甜
4楼-- · 2019-03-16 10:44

I also encountered this problem today, but Holger's way didn't work on my situation. After consulting other people via internet, I finally fixed it. And my solution is quiet simple, I just open the Maintenance Tool and choose add components, select Qt Charts and Qt Data Visualization, and click next, and then it works. This problem happens because by default Qt Charts is not selected while installing Qt, so we should add this component manually.

But I also should mention that maybe this way just work on Qt which was installed by Qt Online Installer, and if you installed Qt via offline Installer, maybe you should reinstall it.

查看更多
甜甜的少女心
5楼-- · 2019-03-16 10:45

I would like to add this as a comment to the accepted post:

If you are using python to build your project and process the .ui files with pyuic5 it might be the case that pyuic5 leaves you with an error message stating that QtChart.QChartview could not be found. This is the workaround:

Go to the site-packages/PyQt5/uic/widget-plugins directory, it should look something like this:

/widget-plugins/
  __pycache__/
  qaxcontainer.py
  qscintilla.py
  qtcharts.py  <- create this file by copying qtquickwidgets.py and renaming
  qtprintsupport.py
  qtquickwidgets.py
  qtwebkit.py

qtcharts.py looks like this (you have to edit the file):

# copyright information

pluginType = MODULE

def moduleInformation():
    return "PyQt5.QtChart", ("QChartView", )
查看更多
登录 后发表回答