I have a basic c++ question and I cant find the answer, so I decided to ask you guys.
I am building a Qt Application with the following hierarchy:
1. MainWindow
2. SubWindow in mdiArea of MainWindow
3. Adding QTabWidget to the SubWindow
4. UserInputWidget as first Tab
Now in the UserInputWidget I am calling a function that computes a QVector. With the QVector I am building a QwtPlotCurve... from here on I want to add a Tab to the QTabWidget calling a Function in the UserInput.cpp that is declared in the SubWindow.cpp
But I have to set a reference to the SubWindow ... how can I do that ?
code till here:
Header
class SubWindow : public QMdiSubWindow
{
Q_OBJECT
public:
explicit SubWindow
(QWidget *parent,
int Form
);
signals:
public slots:
public:
class SubWindow : public QMdiSubWindow
{
Q_OBJECT
public:
explicit SubWindow(QWidget *parent, int Form);
signals:
public slots:
public:
void addCurve(QWidget *curve);
To copy to clipboard, switch view to plain text mode
CPP
void SubWindow
::addCurve(QWidget *curve
) {
subWindowTabWidget.addTab(curve, curve->windowTitle());
}
void SubWindow::addCurve(QWidget *curve)
{
subWindowTabWidget.addTab(curve, curve->windowTitle());
}
To copy to clipboard, switch view to plain text mode
UserInput calling the function
curvefhPlot = new curvefh;
curvefhPlot->fhPlotCurve->setSamples(calculationAlgoClass->fhCurvePointVector);
curvefhPlot->setWindowTitle(tr("F-h - Diagramm"));
SubWindow::addCurve(curvefhPlot); <---- SubWindow is not a declared Object...
curvefhPlot = new curvefh;
curvefhPlot->fhPlotCurve->setSamples(calculationAlgoClass->fhCurvePointVector);
curvefhPlot->setWindowTitle(tr("F-h - Diagramm"));
SubWindow::addCurve(curvefhPlot); <---- SubWindow is not a declared Object...
To copy to clipboard, switch view to plain text mode
I am building the subWindow over a function in the MainWindow...
SubWindow *MainWindow::createSubWindow()
{
SubWindow *subWindow = new SubWindow(this, 0);
mdiArea.addSubWindow(subWindow);
subWindow->showMaximized();
return subWindow;
}
SubWindow *MainWindow::createSubWindow()
{
SubWindow *subWindow = new SubWindow(this, 0);
mdiArea.addSubWindow(subWindow);
subWindow->showMaximized();
return subWindow;
}
To copy to clipboard, switch view to plain text mode
any suggestions ?
Bookmarks