1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include <QtGui/QApplication> #include <QDesktopWidget> #include <QDir> #include "dialog.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog d; QDesktopWidget *deskt = a.desktop(); // deze regels zorgen ervoor dat het midden van het scherm wordt bepaald. QRect screenRect = deskt->availableGeometry(&d); QPoint p1 = d.frameGeometry().center(); d.move ( screenRect.center() - p1 ); d.show(); return a.exec(); } |