繁体   English   中英

Qt5.12.1未知类型名称QChart / QWidget / QEvent /

[英]Qt5.12.1 Unknown type name QChart / QWidget / QEvent /

我已经安装了Qt5.12.1并尝试打开一个正在运行的项目,但是它给了我错误。 我既没有Qt的经验,也没有C ++的经验,但是我需要修复该项目中的一些错误。 这样会出现很多错误,我正在使用Qt Creator,因为我无法从工作计算机访问Internet。

给出错误的代码是这样的:

#include "chartview.h"
#include <QMouseEvent>
#include <qdebug.h>
#include <QtCharts/qxyseries.h>
#include "configvalues.h"
#include "qmath.h"

ChartView::ChartView(QChart *chart , QWidget *parent):
    QChartView(chart,parent), m_isTouching(false), delta(20) {
int rubberBand = ConfigValues::instance()->settings->value(Chart/"RubberBand").toInt();
    QColor c1 = ConfigValues::instance()->settings->value("Chart/TooltipColor").value<QColor>();
    setRubberBand((QChartView::RubberBands) rubberBand);

在这段代码中,QChart和QWidget给出了错误,并且由于它们,ChartView也给出了错误。 为什么我有这些错误?

编辑:

In ChartView.h file 

#ifndef CHARTVIEW_H
#define CHARTVIEW_H

#include <QchartView>
#include <qrubberband.h>
#include <QDateTime>

存在。 但是只有QDateTime没有给出任何错误。 其他人给“找不到文件”

嗯,嗨,如果您还提供错误日志,它将更加容易。 但据我所知,这些错误是由于编译器在编译时找不到所提到的软件包而引起的。 如果您遇到类似未知类型的错误:QWidget,QChart,QEvent,则将QtCore和QtCharts的包导入到项目中可能会得到解决,并且可以这样进行:转到项目qmake文件,例如:project.pro add这些行:

QT += core widgets charts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM