00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "PSQt/center.h"
00010 #include <QDesktopWidget>
00011 #include <QApplication>
00012
00013 namespace PSQt {
00014
00015 void center(QWidget &widget)
00016 {
00017 int x, y;
00018 int screenWidth;
00019 int screenHeight;
00020
00021 int WIDTH = 350;
00022 int HEIGHT = 280;
00023
00024 QDesktopWidget *desktop = QApplication::desktop();
00025
00026 screenWidth = desktop->width();
00027 screenHeight = desktop->height();
00028
00029 x = (screenWidth - WIDTH) / 10;
00030 y = (screenHeight - HEIGHT) / 10;
00031
00032 widget.setGeometry(x, y, WIDTH, HEIGHT);
00033 }
00034
00035 }