Mercurial > hg > forks > UniversalIndentGUI
changeset 510:3422fa516978
- Made the animated about dialog behave correctly on systems with multiple screens. Before only the first screen was grabbed.
- Removed the window title bar from the about dialog.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@750 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Tue, 22 Jul 2008 14:49:07 +0000 |
parents | 27ae52dd6e87 |
children | a810d1346256 |
files | src/AboutDialogGraphicsView.cpp src/AboutDialogGraphicsView.h |
diffstat | 2 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/AboutDialogGraphicsView.cpp Tue Jul 22 13:42:31 2008 +0000 +++ b/src/AboutDialogGraphicsView.cpp Tue Jul 22 14:49:07 2008 +0000 @@ -24,6 +24,8 @@ AboutDialogGraphicsView::AboutDialogGraphicsView(AboutDialog *aboutDialog, QWidget *parent) : QGraphicsView(parent) { this->parent = parent; setWindowFlags(Qt::SplashScreen); + //QRect geometryOfDesktopWhereUiGUIIs = QApplication::desktop()->availableGeometry( parent ); + //QRect newGeometry = QRect( -1, -1, geometryOfDesktopWhereUiGUIIs.width()+2, geometryOfDesktopWhereUiGUIIs.height()+2 ); QRect newGeometry = QRect( -1, -1, QApplication::desktop()->rect().width()+2, QApplication::desktop()->rect().height()+2 ); setGeometry( newGeometry ); //setTransform(QTransform() @@ -36,12 +38,10 @@ scene = new QGraphicsScene(this); setSceneRect( newGeometry ); - aboutDialogAsLabel = new QLabel(this, Qt::SplashScreen); - aboutDialogAsLabel->setPixmap( QPixmap::grabWidget(aboutDialog) ); - graphicsProxyWidget = scene->addWidget(aboutDialogAsLabel, Qt::SplashScreen); - //graphicsProxyWidget->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - //graphicsProxyWidget->setGeometry(newGeometry); - //graphicsProxyWidget->setWindowTitle( aboutDialog->windowTitle() ); + aboutDialogAsSplashScreen = new QSplashScreen(this); + aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) ); + graphicsProxyWidget = scene->addWidget(aboutDialogAsSplashScreen); + graphicsProxyWidget->setWindowFlags( Qt::ToolTip ); setScene( scene ); setRenderHint(QPainter::Antialiasing); @@ -64,9 +64,6 @@ windowBorderWidth = 0; windowTitleBarWidth = parent->geometry().y() - parent->y(); - - originalPixmap = QPixmap::grabWindow(QApplication::desktop()->screen()->winId()); - qDebug("pixmap width %d, numScreens = %d", originalPixmap.size().width(), QApplication::desktop()->availableGeometry().width()); } AboutDialogGraphicsView::~AboutDialogGraphicsView(void) { @@ -74,10 +71,10 @@ void AboutDialogGraphicsView::show() { - QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); + QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), 0, 0, geometry().width(), geometry().height() ); setBackgroundBrush(originalPixmap); - aboutDialogAsLabel->setPixmap( QPixmap::grabWidget(aboutDialog) ); + aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) ); graphicsProxyWidget->setGeometry( aboutDialog->geometry() ); if ( firstRunOfAnimation ) { graphicsProxyWidget->setPos( parent->geometry().x()+(parent->geometry().width()-graphicsProxyWidget->geometry().width()) / 2, parent->y()+windowTitleBarWidth); @@ -96,7 +93,7 @@ .translate(-r.width() / 2, windowTitleBarWidth)); graphicsProxyWidget->show(); - //aboutDialogAsLabel->show(); + //aboutDialogAsSplashScreen->show(); QGraphicsView::show(); connect(timeLine, SIGNAL(finished()), this, SLOT(showAboutDialog())); @@ -129,7 +126,7 @@ void AboutDialogGraphicsView::hide() { - aboutDialogAsLabel->setPixmap( QPixmap::grabWidget(aboutDialog) ); + aboutDialogAsSplashScreen->setPixmap( QPixmap::grabWidget(aboutDialog) ); graphicsProxyWidget->setGeometry( aboutDialog->geometry() ); //if ( firstRunOfAnimation ) { firstRunOfAnimation = false; @@ -149,7 +146,7 @@ .translate(-r.width() / 2, windowTitleBarWidth)); graphicsProxyWidget->show(); - //aboutDialogAsLabel->show(); + //aboutDialogAsSplashScreen->show(); QGraphicsView::show(); connect(timeLine, SIGNAL(finished()), this, SLOT(hideReally()));
--- a/src/AboutDialogGraphicsView.h Tue Jul 22 13:42:31 2008 +0000 +++ b/src/AboutDialogGraphicsView.h Tue Jul 22 14:49:07 2008 +0000 @@ -25,6 +25,7 @@ #include <QDate> #include <QTimeLine> #include <QPixmap> +#include <QSplashScreen> //Can't use this test, because MOC doesn't understand that code line //#if QT_VERSION >= 0x040400 @@ -49,7 +50,7 @@ QGraphicsScene *scene; QWidget *parent; QTimeLine *timeLine; - QLabel *aboutDialogAsLabel; + QSplashScreen *aboutDialogAsSplashScreen; int windowBorderWidth; int windowTitleBarWidth; bool firstRunOfAnimation;