View unanswered posts | View active topics It is currently Sat Jul 04, 2020 10:04 pm

This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Centering Screen 
Author Message
ZSNES Developer
ZSNES Developer
User avatar

Joined: Tue Jul 27, 2004 10:54 pm
Posts: 3902
Location: Solar powered park bench
Reply with quote
Post Centering Screen
byuu, see this:
QDesktopWidget * QApplication::desktop () [static]

Returns the desktop widget (also called the root window).

Note that the desktop may be composed of multiple screens, so it would be incorrect, for example, to attempt to center some widget in the desktop's geometry. QDesktopWidget has various functions for obtaining useful geometries upon the desktop, such as QDesktopWidget::screenGeometry() and QDesktopWidget::availableGeometry().

Not sure if you know this already or not.

May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
Insane Coding

Sun Apr 05, 2009 2:17 am
Profile WWW
Reply with quote
Yeah, but thanks anyway.

//show specified window in the center of the screen.
void Utility::showCentered(QWidget *window) {
  QRect deskRect = QApplication::desktop()->availableGeometry(window);


  window->move( - (window->frameSize().width()  / 2), - (window->frameSize().height() / 2)

Sun Apr 05, 2009 10:38 am
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.