PDA

View Full Version : cannot open a subwindow!



cbarmpar
22nd September 2008, 02:15
Hi all,

I have created a class called parathiro which is a form. I need to display that form in the mdiArea of my central window (kentriko class). I nearly copied every line of an example taken from the book c++GUI programming with qt.
The problem is that the code below doesnt work althoush i think it should.

the main window where the mdiArea is placed (kentriko class). the implementation:

#include "kentriko.h"
#include <iostream>
#include <QString>
#include "../diafores_sinartisis/sinartisis.h"
#include <QMdiArea>

using namespace std;
kentriko::kentriko(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
connect(ui.sindesi, SIGNAL(triggered()), this, SLOT(anixe()));
}
void kentriko::anixe(){
// setCentralWidget(ui.mdiArea);
// para->show();
QMdiSubWindow *subwindow = ui.mdiArea->addSubWindow(&para);
subwindow->show(); // invalid use of incomplete type 'struct QMdiSubWindow'??????
//para.show();
}

the header file:


#ifndef KENTRIKO_H
#define KENTRIKO_H

#include <QtGui/QMainWindow>
#include "ui_kentriko.h"
#include "../database/database.h"
#include "../kentriko/parathiro/parathiro.h"

class kentriko : public QMainWindow
{
Q_OBJECT
public:
kentriko(QWidget *parent = 0);
~kentriko();
private slots:
void anixe();
void pare();
void alagi();
private:
Ui::kentrikoClass ui;
database d;
QString proto;
QString deytero;
QVariant variant;
parathiro para;

};

the class tha I want to make as a subwindow is the following(parathiro). The header file:


#ifndef PARATHIRO_H
#define PARATHIRO_H

#include <QtGui/QMainWindow>
#include "ui_parathiro.h"
#include "../database/database.h"

class parathiro : public QMainWindow
{
Q_OBJECT
public:
parathiro(QWidget *parent = 0);
~parathiro();
private slots:
void anixe();
void pare();
void alagi();
private:
Ui::parathiroClass ui;
database d;
QString proto;
QString deytero;
QVariant variant;
};

#endif // PARATHIRO_H

Many thanks in advance

fnmblot
22nd September 2008, 16:06
This is how I do the mdiArea subwindow.



void MainWindowImpl::newEntry()
{
entryForm *newEntry = new entryForm;
QMdiSubWindow *swNewEntry = new QMdiSubWindow;
swNewEntry->setWidget(newEntry);
MDIArea->addSubWindow(swNewEntry);
swNewEntry->setAttribute(Qt::WA_DeleteOnClose);
swNewEntry->setWindowFlags(Qt::WindowTitleHint);
swNewEntry->show();
swNewEntry->resize(300, 460);
connect(newEntry, SIGNAL(destroyed()), MDIArea, SLOT(closeActiveSubWindow()));
}