OpenWalnut  1.5.0dev
WTransferFunctionBackground.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <iostream>
26 
27 #include "QPainter"
28 #include "QStyleOption"
29 #include "QGraphicsSceneMouseEvent"
30 
31 #include "WTransferFunctionBackground.h"
32 #include "WTransferFunctionWidget.h"
33 
35 {
36  //this->setFlag( ItemIsMovable );
37  setOpacity( 1.0 );
38  setZValue( -1 );
39 
40  setPos( QPointF( 0, 0 ) );
41 }
42 
43 void WTransferFunctionBackground::setMyPixmap( const QPixmap& newpixmap )
44 {
45  if( newpixmap.width() > 0 && newpixmap.height() > 0 )
46  {
47  // std::cout << "SET MY PIXMAP" << std::endl;
48  QTransform m( scene()->sceneRect().width()/( double )newpixmap.width(), 0, 0,
49  0, scene()->sceneRect().height()/( double )newpixmap.height(), 0,
50  0, 0, 1 );
51  setTransform( m );
52  }
53  BaseClass::setPixmap( newpixmap );
54 }
55 
57 {
58 }
59 
61 {
62  return scene()->sceneRect();
63 }
64 
WTransferFunctionBackground(WTransferFunctionWidget *parent=0x0)
Default constructor.
void setMyPixmap(const QPixmap &pixmap)
Set the background pixmap that will be displayed.
QRectF boundingRect() const
Get the bounding rectangle.
virtual ~WTransferFunctionBackground()
Default destructor.
A widget that holds a scene to display and modify the transfer function.