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"
23 #include <QGraphicsScene>
24 #include <QGraphicsView>
25 #include <QMouseEvent>
29 using namespace PopupDropperNS
;
31 PopupDropperView::PopupDropperView( QGraphicsScene
* scene
, QWidget
* parent
)
32 : QGraphicsView( scene
, parent
)
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) );
46 PopupDropperView::~PopupDropperView()
52 void PopupDropperView::setTransInValue( int value
)
55 //debug() << "value: " << value;
56 QPalette p
= palette();
57 p
.setColor( QPalette::Base
, QColor(0, 0, 0, value
*12 ) );
62 void PopupDropperView::setTransOutValue( int value
)
65 //debug() << "value: " << value;
66 QPalette p
= palette();
67 p
.setColor( QPalette::Base
, QColor(0, 0, 0, 120 - value
*12) );
71 void PopupDropperView::mouseMoveEvent( QMouseEvent
*e
)
74 if( !( e
->buttons() & Qt::LeftButton
) )
76 QGraphicsView::mouseMoveEvent( e
);
79 void PopupDropperView::mouseReleaseEvent( QMouseEvent
*e
)
82 QGraphicsView::mouseReleaseEvent( e
);
85 #include "PopupDropperView.moc"