1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
10 #include <QApplication>
11 #include <QDesktopWidget>
17 void centerWidget (QWidget
*w
) {
18 QDesktopWidget
*desktop
= QApplication::desktop();
19 QRect geometry
= desktop
->availableGeometry();
21 int newX
= geometry
.left()+((geometry
.right()-geometry
.left())-sz
.width())/2;
22 int newY
= geometry
.top()+((geometry
.bottom()-geometry
.top())-sz
.height())/2;