Presentation is now a dialog child of part so that get get only 1 entry on taskbar

To fix presentationwidget wanting to be always on top, even when it does not has the focus, we drop the staysontop on windowdeactivation and get it again on actiovation
BUGS: 103718

svn path=/trunk/kdegraphics/kpdf/; revision=405195
remotes/origin/kpdf-kde4
Albert Astals Cid 21 years ago
parent 19e41ac483
commit b3ea24bb0d
  1. 2
      part.cpp
  2. 13
      ui/presentationwidget.cpp
  3. 7
      ui/presentationwidget.h

@ -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()

@ -20,6 +20,7 @@
#include <klocale.h>
#include <kiconloader.h>
#include <kimageeffect.h>
#include <kwin.h>
// system includes
#include <stdlib.h>
@ -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 )
// <widget events>
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;

@ -10,7 +10,7 @@
#ifndef _KPDF_PRESENTATIONWIDGET_H_
#define _KPDF_PRESENTATIONWIDGET_H_
#include <qwidget.h>
#include <qdialog.h>
#include <qpixmap.h>
#include <qstringlist.h>
#include <qvaluevector.h>
@ -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 );

Loading…
Cancel
Save