Sorry, The code is:
main.c
#include <QApplication>
#include "mdiwindow.h"
#include "main.h"
int main(int argc, char *argv[])
{
MiMDI *ventana;
ventana = new MiMDI;
ventana->show();
return app.exec();
}
#include <QApplication>
#include "mdiwindow.h"
#include "main.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MiMDI *ventana;
ventana = new MiMDI;
ventana->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
mdiwindow.cpp
#include <QtGui>
#include <QMdiArea>
#include "mdiwindow.h"
#include "childwindow.h"
{
//setupUi(this);
mdiArea = new QMdiArea;
setCentralWidget(mdiArea);
setWindowTitle(tr("MDI Editor"));
connect( menuArchivo, SIGNAL(activated(int)), this, SLOT(actionSalir()) );
}
void MiMDI::actionSalir()
{
MdiChild *child = new MdiChild;
mdiArea.addSubWindow(child);
//child->show();
}
#include <QtGui>
#include <QMdiArea>
#include "mdiwindow.h"
#include "childwindow.h"
MiMDI::MiMDI(QWidget *parent)
{
//setupUi(this);
mdiArea = new QMdiArea;
setCentralWidget(mdiArea);
setWindowTitle(tr("MDI Editor"));
connect( menuArchivo, SIGNAL(activated(int)), this, SLOT(actionSalir()) );
}
void MiMDI::actionSalir()
{
MdiChild *child = new MdiChild;
mdiArea.addSubWindow(child);
//child->show();
}
To copy to clipboard, switch view to plain text mode
mdiwindow.h
#ifndef __MDIWINDOW_H__
#define __MDIWINDOW_H__
#include <QMdiArea>
#include "ui_mdi.h"
//class QMdiArea;
class MiMDI
: public QMainWindow,
private Ui
::VentanaPrincipal{
Q_OBJECT
public:
public slots:
void actionSalir();
private:
QMdiArea *mdiArea;
};
#endif // __MDIWINDOW_H__
#ifndef __MDIWINDOW_H__
#define __MDIWINDOW_H__
#include <QMdiArea>
#include "ui_mdi.h"
//class QMdiArea;
class MiMDI : public QMainWindow, private Ui::VentanaPrincipal
{
Q_OBJECT
public:
MiMDI(QWidget *parent = 0);
public slots:
void actionSalir();
private:
QMdiArea *mdiArea;
};
#endif // __MDIWINDOW_H__
To copy to clipboard, switch view to plain text mode
childwindow.cpp
#include <QtGui>
#include "childwindow.h"
MdiChild::MdiChild()
{
setAttribute(Qt::WA_DeleteOnClose);
isUntitled = true;
}
// place your code here
#include <QtGui>
#include "childwindow.h"
MdiChild::MdiChild()
{
setAttribute(Qt::WA_DeleteOnClose);
isUntitled = true;
}
// place your code here
To copy to clipboard, switch view to plain text mode
chilwindow.h
#ifndef __CHILDWINDOW_H__
#define __CHILDWINDOW_H__
class MdiChild
{
Q_OBJECT
public:
MdiChild();
};
#endif // __CHILDWINDOW_H__
#ifndef __CHILDWINDOW_H__
#define __CHILDWINDOW_H__
class MdiChild
{
Q_OBJECT
public:
MdiChild();
};
#endif // __CHILDWINDOW_H__
To copy to clipboard, switch view to plain text mode
It's all.
Im used -> but the error is:
no matching function for call to QMdiArea::addSubWindow(MdhChild*&)
Thz
Bookmarks