// main.cpp #include #include #include "ui_interface.h" #include "fecha.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow *widget = new QMainWindow(); Ui::MainWindow form; form.setupUi(widget); FechaApp::fechar(form.pushButton,&app); widget->show(); return app.exec(); } // fecha.cpp #include #include "fecha.h" FecharApp::FechaApp { public: static void fechar( QObject *elemento ,QObject *app){ QObject::connect(elemento, SIGNAL(clicked()), app, SLOT(quit())); } }; // fecha.h #include class FechaApp { public: static void fechar( QObject,QObject ); };