#include <QApplication>
#include "hellodialog.h"
#include <QDesktopWidget>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// QDesktopWidget * desktop=QApplication::desktop();
QDesktopWidget * desktop=qApp->desktop();//qApp=QApplication *
HelloDialog w;
w.move(desktop->width()/2 - w.width()/2, desktop->height()/2 - w.height()/2);//w.move(left, top)
w.show();
return a.exec();
}
```
网友评论