Diffstat (limited to 'noncore/graphics/opie-eye/gui/imagescrollview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.cpp b/noncore/graphics/opie-eye/gui/imagescrollview.cpp index 0d35354..7d83e29 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.cpp +++ b/noncore/graphics/opie-eye/gui/imagescrollview.cpp | |||
@@ -4,12 +4,19 @@ | |||
4 | 4 | ||
5 | using namespace Opie::Core; | 5 | using namespace Opie::Core; |
6 | 6 | ||
7 | #include <qimage.h> | 7 | #include <qimage.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | 9 | ||
10 | ImageScrollView::ImageScrollView( QWidget* parent, const char* name, WFlags f ) | ||
11 | :QScrollView(parent,name,f|Qt::WRepaintNoErase ),_image_data(),_original_data(),scale_to_fit(true), | ||
12 | rotate_to_fit(true),first_resize_done(false) | ||
13 | { | ||
14 | init(); | ||
15 | } | ||
16 | |||
10 | ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) | 17 | ImageScrollView::ImageScrollView (const QImage&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) |
11 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img),scale_to_fit(always_scale), | 18 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(img),scale_to_fit(always_scale), |
12 | rotate_to_fit(rfit),first_resize_done(false) | 19 | rotate_to_fit(rfit),first_resize_done(false) |
13 | { | 20 | { |
14 | init(); | 21 | init(); |
15 | } | 22 | } |
@@ -26,12 +33,16 @@ void ImageScrollView::setImage(const QImage&img) | |||
26 | _image_data = QImage(); | 33 | _image_data = QImage(); |
27 | _original_data=img; | 34 | _original_data=img; |
28 | first_resize_done = false; | 35 | first_resize_done = false; |
29 | init(); | 36 | init(); |
30 | } | 37 | } |
31 | 38 | ||
39 | void ImageScrollView::setImage( const QString& path ) { | ||
40 | |||
41 | } | ||
42 | |||
32 | /* should be called every time the QImage changed it content */ | 43 | /* should be called every time the QImage changed it content */ |
33 | void ImageScrollView::init() | 44 | void ImageScrollView::init() |
34 | { | 45 | { |
35 | viewport()->setBackgroundColor(white); | 46 | viewport()->setBackgroundColor(white); |
36 | if (_original_data.size().isValid()) { | 47 | if (_original_data.size().isValid()) { |
37 | resizeContents(_original_data.width(),_original_data.height()); | 48 | resizeContents(_original_data.width(),_original_data.height()); |
@@ -256,12 +267,21 @@ void ImageScrollView::contentsMouseReleaseEvent ( QMouseEvent * e) | |||
256 | void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e) | 267 | void ImageScrollView::contentsMousePressEvent ( QMouseEvent * e) |
257 | { | 268 | { |
258 | _mouseStartPosX = e->x(); | 269 | _mouseStartPosX = e->x(); |
259 | _mouseStartPosY = e->y(); | 270 | _mouseStartPosY = e->y(); |
260 | } | 271 | } |
261 | 272 | ||
273 | void ImageScrollView::setDestructiveClose() { | ||
274 | WFlags fl = getWFlags(); | ||
275 | /* clear it just in case */ | ||
276 | fl &= ~WDestructiveClose; | ||
277 | fl |= WDestructiveClose; | ||
278 | setWFlags( fl ); | ||
279 | } | ||
280 | |||
281 | |||
262 | /* for testing */ | 282 | /* for testing */ |
263 | ImageDlg::ImageDlg(const QString&fname,QWidget * parent, const char * name) | 283 | ImageDlg::ImageDlg(const QString&fname,QWidget * parent, const char * name) |
264 | :QDialog(parent,name,true,WStyle_ContextHelp) | 284 | :QDialog(parent,name,true,WStyle_ContextHelp) |
265 | { | 285 | { |
266 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 286 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
267 | dlglayout->setSpacing(2); | 287 | dlglayout->setSpacing(2); |