Mercurial > hg > forks > UniversalIndentGUI
comparison src/AboutDialogGraphicsView.cpp @ 747:850c647d857d
AboutDialogGraphicsView: Improved the about dialog positioning on Linux.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1024 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Sat, 02 Oct 2010 11:56:10 +0000 |
parents | b30f03c1a40d |
children | ac165b6ae67e |
comparison
equal
deleted
inserted
replaced
746:ab871460c300 | 747:850c647d857d |
---|---|
36 setWindowFlags(Qt::SplashScreen); | 36 setWindowFlags(Qt::SplashScreen); |
37 | 37 |
38 #ifdef Q_OS_LINUX | 38 #ifdef Q_OS_LINUX |
39 QRect availableGeometry = QApplication::desktop()->availableGeometry(); | 39 QRect availableGeometry = QApplication::desktop()->availableGeometry(); |
40 QRect newGeometry = QRect( availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height() ); | 40 QRect newGeometry = QRect( availableGeometry.x(), availableGeometry.y(), availableGeometry.width(), availableGeometry.height() ); |
41 windowPosOffset = 27; | |
42 #else | 41 #else |
43 QRect newGeometry = QRect( -1,-1, QApplication::desktop()->rect().width()+2, QApplication::desktop()->rect().height()+2 ); | 42 QRect newGeometry = QRect( -1,-1, QApplication::desktop()->rect().width()+2, QApplication::desktop()->rect().height()+2 ); |
44 windowPosOffset = 0; | |
45 #endif | 43 #endif |
46 setGeometry( newGeometry ); | 44 setGeometry( newGeometry ); |
47 | 45 |
48 this->aboutDialog = aboutDialog; | 46 this->aboutDialog = aboutDialog; |
49 | 47 |
50 windowTitleBarWidth = 0; | 48 windowTitleBarWidth = 0; |
49 windowPosOffset = 0; | |
51 | 50 |
52 scene = new QGraphicsScene(this); | 51 scene = new QGraphicsScene(this); |
53 setSceneRect( newGeometry ); | 52 setSceneRect( newGeometry ); |
54 aboutDialogAsSplashScreen = new QSplashScreen(this); | 53 aboutDialogAsSplashScreen = new QSplashScreen(this); |
55 //aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) ); | 54 //aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) ); |
88 */ | 87 */ |
89 void AboutDialogGraphicsView::show() { | 88 void AboutDialogGraphicsView::show() { |
90 // Because on X11 system the window decoration is only available after a widget has been shown once, | 89 // Because on X11 system the window decoration is only available after a widget has been shown once, |
91 // we can detect windowTitleBarWidth here for the first time. | 90 // we can detect windowTitleBarWidth here for the first time. |
92 windowTitleBarWidth = parent->geometry().y() - parent->y(); | 91 windowTitleBarWidth = parent->geometry().y() - parent->y(); |
92 // If the windowTitleBarWidth could not be determined, try it a second way. Even the chances are low to get good results. | |
93 if ( windowTitleBarWidth == 0 ) | |
94 windowTitleBarWidth = parent->frameGeometry().height() - parent->geometry().height(); | |
95 #ifdef Q_OS_LINUX | |
96 if ( windowTitleBarWidth == 0 ) { | |
97 //TODO: 27 pixel is a fix value for the Ubuntu 10.4 default window theme and so just a workaround for that specific case. | |
98 windowPosOffset = 27; | |
99 windowTitleBarWidth = 27; | |
100 } | |
101 #endif | |
93 QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y(), geometry().width(), geometry().height() ); | 102 QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y(), geometry().width(), geometry().height() ); |
94 QBrush brush(originalPixmap); | 103 QBrush brush(originalPixmap); |
95 QTransform transform; | 104 QTransform transform; |
96 transform.translate(0, QApplication::desktop()->availableGeometry().y()); | 105 transform.translate(0, QApplication::desktop()->availableGeometry().y()); |
97 brush.setTransform(transform); | 106 brush.setTransform(transform); |