File: canvasview.cpp

package info (click to toggle)
kaquarium 1.0-beta-6.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,944 kB
  • ctags: 313
  • sloc: sh: 17,170; perl: 2,724; cpp: 1,340; makefile: 116
file content (53 lines) | stat: -rw-r--r-- 1,263 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
//#include <qapplication.h>
//#include <qwidget.h>
#include <qevent.h>
#include <qtimer.h>
#include <qwidget.h>
#include <qpopupmenu.h>
#include <qcanvas.h>
#include <qobject.h>

#include <klocale.h>
#include <kdebug.h>

#include "canvasview.h"
#include "pref.h"


kfishCanvasView::kfishCanvasView( QCanvas *canvas, QWidget *parent, const char *name )
                              : QCanvasView( canvas, parent, name )
{
    installEventFilter( this );
    
    menu = new QPopupMenu(this);
    menu->insertItem(i18n("Preferences"), parent, SLOT( slotPreferences() ) );
    menu->insertItem(i18n("About"), parent, SLOT( slotAbout() ) );
    
    setVScrollBarMode(AlwaysOff);
    setHScrollBarMode(AlwaysOff);
}


kfishCanvasView::~kfishCanvasView()
{
}

bool kfishCanvasView::eventFilter( QObject *o, QEvent *e )
{
    (void) o;
/*    if ( e->type() == QEvent::Enter )
    {
        emit signalMouseOverWidget();
    }
    if ( e->type() == QEvent::Leave )
    {
        emit signalMouseNotOverWidget();
    }*/
    if ( e->type() == QEvent::MouseButtonPress )
    {
        QMouseEvent *b = static_cast<QMouseEvent*>(e);
        if( b->button() == Qt::RightButton )
            menu -> popup(((QMouseEvent *)e)->globalPos());        
    }
    return FALSE;
}