PSQt/src/center.cpp

Go to the documentation of this file.
00001 //---------------------------------------------------------------------
00002 // File and Version Information:
00003 //   $Id: center.cpp 9841 2015-03-26 18:35:44Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author: Mikhail S. Dubrovin
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 } // namespace PSQt

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7