Make plasma libs build.
[amarok.git] / src / popupdropper / PopupDropperView.cpp
blob6da23e2ab90991d4f8ab48927ae837eac943116d
1 /*
2 * Copyright (c) 2007 Jeff Mitchell <kde-dev@emailgoeshere.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "PopupDropperView.h"
21 #include "debug.h"
23 #include <QGraphicsScene>
24 #include <QGraphicsView>
25 #include <QMouseEvent>
26 #include <QPainter>
27 #include <QRectF>
29 using namespace PopupDropperNS;
31 PopupDropperView::PopupDropperView( QGraphicsScene* scene, QWidget* parent )
32 : QGraphicsView( scene, parent )
34 DEBUG_BLOCK
35 setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
36 setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
37 resize( parent->size() + QSize(2, 2) );
38 setInteractive( true );
39 setAcceptDrops( true );
40 setBackgroundRole( QPalette::Base );
41 QPalette p = palette();
42 p.setColor( QPalette::Base, QColor(0, 0, 0, 0) );
43 setPalette( p );
46 PopupDropperView::~PopupDropperView()
48 DEBUG_BLOCK
51 //SLOT
52 void PopupDropperView::setTransInValue( int value )
54 //DEBUG_BLOCK
55 //debug() << "value: " << value;
56 QPalette p = palette();
57 p.setColor( QPalette::Base, QColor(0, 0, 0, value*12 ) );
58 setPalette( p );
61 //SLOT
62 void PopupDropperView::setTransOutValue( int value )
64 //DEBUG_BLOCK
65 //debug() << "value: " << value;
66 QPalette p = palette();
67 p.setColor( QPalette::Base, QColor(0, 0, 0, 120 - value*12) );
68 setPalette( p );
71 void PopupDropperView::mouseMoveEvent( QMouseEvent *e )
73 //DEBUG_BLOCK
74 if( !( e->buttons() & Qt::LeftButton) )
75 emit destroyMe();
76 QGraphicsView::mouseMoveEvent( e );
79 void PopupDropperView::mouseReleaseEvent( QMouseEvent *e )
81 //DEBUG_BLOCK
82 QGraphicsView::mouseReleaseEvent( e );
85 #include "PopupDropperView.moc"