summaryrefslogtreecommitdiffstats
path: root/src/part/toolbar.cpp
blob: 8939074af827b958af8cc5aabbbb1db59d07fea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// (C) 2005 Max Howell ([email protected])
// See COPYING file for licensing information

#include <kpushbutton.h>
#include <qapplication.h>
#include <qevent.h>
#include "toolbar.h"


MouseOverToolBar::MouseOverToolBar( QWidget *parent )
      : KToolBar( parent )
{
   parent->installEventFilter( this );
   move( 0, 0 ); //TODO necessary?
   hide();

   setPalette( QApplication::palette() ); //videoWindow palette has a black background
}

bool
MouseOverToolBar::eventFilter( QObject *o, QEvent *e )
{
   Q_ASSERT( o == parent() );

   switch( e->type() )
   {
   case QEvent::Resize:
      resize( static_cast<QResizeEvent*>(e)->size().width(), sizeHint().height() );
      break;

   case QEvent::Enter:
      show();
      break;

   case QEvent::Leave:
      hide();
      break;

   default:
      ;
   }

   return false;
}