#include <QtGui/QApplication>#include "mainwindow.h"#include "mainy.h"int main(int argc, char *argv[]){ QApplication a(argc, argv); MainWindow w; w.show(); mainy *mn = new mainy(&a); return a.exec();}
#ifndef MAINY_H#define MAINY_H#include <QObject>#include <QDebug>class mainy : public QObject{ Q_OBJECTpublic: explicit mainy(QObject *parent = 0); ~mainy();public slots:};#endif // MAINY_H
#include "mainy.h"mainy::mainy(QObject *parent) : QObject(parent){}mainy::~mainy() { // qDebug() << "DESTROYED";}
mainy *mn = new mainy(&w);
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ Mainy *May = new Mainy(this);}
class Mainy : public QObject{ Q_OBJECTpublic: explicit Mainy(QObject *parent = 0); ~Mainy();signals:public slots:};