int main(int argc, char *argv[]) { QApplication app(argc, argv); TextWidget w; //w.setWindowFlags(Qt::ToolTip | Qt::CustomizeWindowHint); w.show(); return app.exec(); }
int main( int argc, char **argv ) { int i; QString m1,n1,o1; struct args pargs; QApplication *a; InitWidget *b; ScreenWidget *c; TextWidget *textOut; QProgressDialog *qProg; QPixmap *qpxMeshIcon=NULL; struct model_error model1,model2; int rcode; struct outbuf *log; struct prog_reporter pr; /* Initialize application */ a = NULL; b = NULL; c = NULL; qProg = NULL; memset(&model1,0,sizeof(model1)); memset(&model2,0,sizeof(model2)); memset(&pr,0,sizeof(pr)); log = NULL; i = 0; while (i<argc) { if (strcmp(argv[i],"-t") == 0) /* text version requested */ break; if (strcmp(argv[i],"-h") == 0) /* just asked for command line help */ break; i++; } if (i == argc) { /* no text version requested, initialize QT */ a = new QApplication( argc, argv ); /* Load pixmap for icon */ qpxMeshIcon = new QPixmap((const char**)meshIcon); if (a != NULL) a->connect( a, SIGNAL(lastWindowClosed()), a, SLOT(quit()) ); } else { a = NULL; /* No QT app needed */ } /* Parse arguments */ parse_args(argc,argv,&pargs); /* Display starting dialog if insufficient arguments */ if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) { if (pargs.m1_fname == NULL || pargs.m2_fname == NULL) { fprintf(stderr,"ERROR: missing file name(s) in command line\n"); exit(1); } if (!pargs.do_wlog) { log = outbuf_new(stdio_puts,stdout); } else { textOut = new TextWidget(); textOut->setIcon(*qpxMeshIcon); log = outbuf_new(TextWidget_puts,textOut); textOut->show(); } if (pargs.no_gui) { pr.prog = stdio_prog; pr.cb_out = stdout; } else { qProg = new QProgressDialog("Calculating distance",0,100); qProg->setIcon(*qpxMeshIcon); qProg->setMinimumDuration(1500); pr.prog = QT_prog; pr.cb_out = qProg; } mesh_run(&pargs, &model1, &model2, log, &pr); } else { b = new InitWidget(pargs, &model1, &model2); b->setIcon(*qpxMeshIcon); b->show(); } if (a != NULL) { if (pargs.m1_fname != NULL || pargs.m2_fname != NULL) { c = new ScreenWidget(&model1, &model2, &pargs); c->setIcon(*qpxMeshIcon); a->setMainWidget(c); c->show(); } rcode = a->exec(); } else { rcode = 0; } /* Free widgets */ outbuf_delete(log); delete qProg; delete qpxMeshIcon; delete b; delete c; delete a; // QApplication must be last QT thing to delete /* Free model data */ if (model1.mesh != NULL) __free_raw_model(model1.mesh); free(model1.verror); free(model1.info); free_face_error(model1.fe); if (model2.mesh != NULL) __free_raw_model(model2.mesh); free(model2.verror); free(model2.info); /* Return exit code */ return rcode; }