Qt Charts and Data Visualization widgets

后端 未结 4 2061
臣服心动
臣服心动 2021-02-09 15: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

相关标签:
4条回答
  • 2021-02-09 16:25

    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", )
    
    0 讨论(0)
  • 2021-02-09 16:42

    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.

    0 讨论(0)
  • 2021-02-09 16:44

    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.

    0 讨论(0)
  • 2021-02-09 16:50

    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.

    0 讨论(0)
提交回复
热议问题