summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/lib
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/lib') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
index 178fbd4..ffa3c0c 100644
--- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
+++ b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
@@ -23,12 +23,16 @@ OImageZoomer::OImageZoomer( const QPixmap& pix, QWidget* par, const char* name,
23OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par, 23OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par,
24 const char* name, WFlags fl ) 24 const char* name, WFlags fl )
25 : QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) { 25 : QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) {
26 init(); 26 init();
27} 27}
28 28
29OImageZoomer::~OImageZoomer() {
30
31}
32
29void OImageZoomer::init() { 33void OImageZoomer::init() {
30 setFrameStyle( Panel | Sunken ); 34 setFrameStyle( Panel | Sunken );
31} 35}
32 36
33void OImageZoomer::setImageSize( const QSize& size ) { 37void OImageZoomer::setImageSize( const QSize& size ) {
34 m_imgSize = size; 38 m_imgSize = size;
@@ -90,25 +94,25 @@ void OImageZoomer::drawContents( QPainter* p ) {
90 if ( h > c.height() ) h = c.height(); 94 if ( h > c.height() ) h = c.height();
91 95
92 p->drawRect( x, y, w, h ); 96 p->drawRect( x, y, w, h );
93} 97}
94 98
95void OImageZoomer::mousePressEvent( QMouseEvent* ) { 99void OImageZoomer::mousePressEvent( QMouseEvent* ) {
96 100 m_mouseX = m_mouseY = -1;
97} 101}
98 102
99void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) { 103void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) {
100 int mx, my; 104 int mx, my;
101 mx = ev->x(); 105 mx = ev->x();
102 my = ev->y(); 106 my = ev->y();
103 107
104 if ( m_mouseX != -1 && m_mouseY != -1 ) { 108 if ( m_mouseX != -1 && m_mouseY != -1 ) {
105 int diffx = m_mouseX-mx; 109 int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width();
106 int diffy = m_mouseY-my; 110 int diffy = ( my - m_mouseY ) * m_imgSize.height() / height();
107// emit zoomAreaRel( diffx, diffy ); 111 emit zoomAreaRel( diffx, diffy );
108// emit zoomArea( 112 emit zoomArea(m_visPt.x()+diffx, m_visPt.y()+diffy );
109 } 113 }
110 m_mouseX = mx; 114 m_mouseX = mx;
111 m_mouseY = my; 115 m_mouseY = my;
112} 116}
113 117
114 118