void MainWindow::centerOnDesktop() { quint16 screenWidth, width, screenHeight, height, x, y; QSize windowSize;
screenWidth = QApplication::desktop()->width(); screenHeight = QApplication::desktop()->height(); windowSize = size(); width = windowSize.width(); height = windowSize.height(); x = (screenWidth - width) / 2; y = (screenHeight - height) / 2; y -= 100; move(x, y); }
|