diff --git a/part.cpp b/part.cpp index adc4dbe23..d95fe0ada 100644 --- a/part.cpp +++ b/part.cpp @@ -742,7 +742,7 @@ void Part::slotShowProperties() void Part::slotShowPresentation() { if ( !m_presentationWidget ) - m_presentationWidget = new PresentationWidget( m_document ); + m_presentationWidget = new PresentationWidget( widget(), m_document ); } void Part::slotPrint() diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index 04e86e0fe..2d29515e2 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -20,6 +20,7 @@ #include #include #include +#include // system includes #include @@ -46,9 +47,8 @@ struct PresentationFrame }; -PresentationWidget::PresentationWidget( KPDFDocument * doc ) - : QWidget( 0, "presentationWidget", WDestructiveClose | WStyle_NoBorder | - WStyle_StaysOnTop | WShowModal ), m_document( doc ), m_frameIndex( -1 ) +PresentationWidget::PresentationWidget( QWidget * parent, KPDFDocument * doc ) + : QDialog( parent, "presentationWidget", true, WDestructiveClose | WStyle_NoBorder), m_document( doc ), m_frameIndex( -1 ) { // set look and geometry setBackgroundMode( Qt::NoBackground ); @@ -168,6 +168,13 @@ bool PresentationWidget::canUnloadPixmap( int pageNumber ) // +bool PresentationWidget::event ( QEvent * e ) +{ + if (e -> type() == QEvent::WindowDeactivate) KWin::clearState(winId(), NET::StaysOnTop); + else if (e -> type() == QEvent::WindowActivate) KWin::setState(winId(), NET::StaysOnTop); + return QDialog::event(e); +} + void PresentationWidget::keyPressEvent( QKeyEvent * e ) { if (m_width == -1) return; diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h index 48c87b355..fd59855fa 100644 --- a/ui/presentationwidget.h +++ b/ui/presentationwidget.h @@ -10,7 +10,7 @@ #ifndef _KPDF_PRESENTATIONWIDGET_H_ #define _KPDF_PRESENTATIONWIDGET_H_ -#include +#include #include #include #include @@ -29,11 +29,11 @@ class PresentationFrame; * * This is a fullscreen widget that displays */ -class PresentationWidget : public QWidget, public DocumentObserver +class PresentationWidget : public QDialog, public DocumentObserver { Q_OBJECT public: - PresentationWidget( KPDFDocument * doc ); + PresentationWidget( QWidget * parent, KPDFDocument * doc ); ~PresentationWidget(); // inherited from DocumentObserver @@ -45,6 +45,7 @@ class PresentationWidget : public QWidget, public DocumentObserver protected: // widget events + bool event( QEvent * e ); void keyPressEvent( QKeyEvent * e ); void wheelEvent( QWheelEvent * e ); void mousePressEvent( QMouseEvent * e );