'hidden' contacts
[dyskinesia.git] / src / winutils.cpp
blob6669736c725f72f008912505a03e817d5ac16f3d
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.
9 */
10 #include <QApplication>
11 #include <QDesktopWidget>
12 #include <QWidget>
14 #include "winutils.h"
17 void centerWidget (QWidget *w) {
18 QDesktopWidget *desktop = QApplication::desktop();
19 QRect geometry = desktop->availableGeometry();
20 QSize sz = w->size();
21 int newX = geometry.left()+((geometry.right()-geometry.left())-sz.width())/2;
22 int newY = geometry.top()+((geometry.bottom()-geometry.top())-sz.height())/2;
23 w->move(newX, newY);