Ich habe 2 Qt-Fenster, nämlich MainWindow
und GraphWindow
; Die GraphWindow
Klasse hat einen Bereich von QCustomPlot
Widgets, in denen Daten aus anderen Klassen geplottet werden. In der MainWindow
Implementierungsdatei instanziiere ich ein GraphWindow
Objekt und übergebe seine Adresse an andere Klassen, so dass alle Plots im selben Fenster generiert werden. Aber mein Problem ist, wenn ich versuche, die Adresse der GraphWindow
Objekte zu übergeben, wirft Qt den folgenden Fehler;Unbekannter Typ Name Fehler Qt C++
Unknown type name GraphWindow
Ich habe graphwindow.h
in allen dort Klassen enthalten, die die GraphWindow
Objekt verwendet.
Dies ist GraphWindow
Klassendeklaration;
#ifndef GRAPHWINDOW_H
#define GRAPHWINDOW_H
#include <QDialog>
#include <mainwindow.h>
#include <incomestatement.h>
#include <balancesheet.h>
#include <cashflow.h>
#include <dcf.h>
#include <QList>
#include <QStringList>
#include <QString>
#include <qcustomplot.h>
#include <QSharedPointer>
#include <QHash>
namespace Ui
{
class GraphWindow;
}
class GraphWindow : public QDialog
{
Q_OBJECT
public:
explicit GraphWindow(QWidget *parent = 0);
~GraphWindow();
void plotData(QStringList labels, QList<double> yData,QString xLabel, QString yLabel, QString slot);
private:
Ui::GraphWindow *ui;
QHash<QString, QCustomPlot* > dynamicWidgetHash;
QStringList widgetStringList;
QVector<double> setupXAxis(QStringList labels, QString slot, QString xLabel);
void setupYAxis(QVector<double> yData, QString slot, QString yLabel);
void setupLegend(QString slot);
void setHash(QStringList widgetStringList);
};
#endif // GRAPHWINDOW_H
Dies ist mainwindow.cpp
wo GrapWindow Objekt erstellt wird;
void MainWindow::on_runButton_clicked()
{
//Create grapher object and pass the address to all sub-classes to plot on the same widget
GraphWindow graphWindow;
if(globalPath.isEmpty() == false)
{
//Create input QXlsx::Document Object
QXlsx::Document inputDoc(globalPath);
// QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
// "/home/jana/untitled.png",
// tr("Images (*.png *.xpm *.jpg)"));
//Create financial statement objects and compute values
IncomeStatement incState(inputDoc,graphWindow);
incState.computePoints(MainWindow::pointsListINC_ST,MainWindow::incSettingList,
MainWindow::incItemList,inputDoc);
}
}
Dies ist incomestatement.h
, ein, wenn die Klassen GraphWindow
Objekt.
#ifndef INCOMESTATEMENT_H
#define INCOMESTATEMENT_H
#include <QString>
#include <xlsxdocument.h>
#include <xlsxformat.h>
#include <QVector>
#include <QList>
#include <pointssystem.h>
#include <graphwindow.h>
class IncomeStatement
{
//Declare PointsSystem as FRIEND of IncomeStatement to access private members
friend class PointsSystem;
public:
IncomeStatement(QXlsx::Document& inputDoc, GraphWindow& grapher);
//Public member function to be called from mainwindow.cpp
double computePoints(QList<QList<bool> > userSettings, QList<QStringList> itemStringList,
QStringList comboBoxItems, QXlsx::Document& inputDoc);
private:
int cursorRow;
int cursorCol;
double scoredPoints;
double totalPoints;
QStringList timelineList;
QList<double> revenueGrowthArr;
QList<double>costOfRevenGrowthArr;
QList<double>operIncGrowthArr;
QList<double>netIncGrowthArr;
QList<double>totOperExpGrowthArr;
QList<double>grossMarginArr;
QList<double>opIncMarginArr;
QList<double>netIncMarginArr;
QXlsx::Format format(QXlsx::Document& inputDoc, int mode);
bool setSheetName(QXlsx::Document& inputDoc);
void process(QXlsx::Document& inputDoc, GraphWindow& grapher);
int searchKey(QString key,QXlsx::Document& inputDoc);
int findCursorPointRow(QXlsx::Document& inputDoc);
int findCursorPointCol(QXlsx::Document& inputDoc);
void revenueGrowth(QXlsx::Document& inputDoc);
void growthComputation(QXlsx::Document& inputDoc, QString criterion, QList<double>&storageList);
void marginComputation(QXlsx::Document& inputDoc, QString criterion, QList<double>&storageList);
QStringList extractTimeline(QXlsx::Document& inputDoc);
void writeStockAnalysis(QXlsx::Document& inputDoc, QList<QList<QVariant> > data);
void writeStockAnalysisHeader(QXlsx::Document& inputDoc);
void writePointsSumData(QXlsx::Document& inputDoc);
#endif // INCOMESTATEMENT_H
Was ist hier falsch?
Sie haben einen kreisförmigen Kopf Abhängigkeit .. – drescherjm
Mein Gott kann ich nicht so dumm sein:/Danke bro :) – Vino
Als ich anfing zu lernen C++ vor 25 bis 30 Jahren Ich bin mir sicher, dass ich das Dutzende Male gemacht habe. In diesen Tagen passiert es mir nie. – drescherjm