~ubuntu-branches/ubuntu/karmic/digikam/karmic-backports

« back to all changes in this revision

Viewing changes to libs/widgets/common/paniconwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ubuntu Archive Auto-Backport
  • Date: 2009-12-07 19:03:53 UTC
  • mfrom: (54.1.4 lucid)
  • Revision ID: james.westby@ubuntu.com-20091207190353-oara3lenjxymto3i
Tags: 2:1.0.0~rc-1ubuntu1~karmic1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 *
23
23
 * ============================================================ */
24
24
 
25
 
#include "paniconwidget.h"
26
25
#include "paniconwidget.moc"
27
26
 
28
27
// C++ includes
39
38
#include <QPaintEvent>
40
39
#include <QMouseEvent>
41
40
#include <QHideEvent>
 
41
#include <QToolButton>
42
42
 
43
43
// KDE includes
44
44
 
45
 
 
46
45
#include <kcursor.h>
 
46
#include <kiconloader.h>
 
47
#include <klocale.h>
47
48
 
48
49
namespace Digikam
49
50
{
53
54
 
54
55
public:
55
56
 
56
 
    PanIconWidgetPriv()
57
 
    {
58
 
        moveSelection = false;
59
 
    }
60
 
 
61
 
    bool    moveSelection;
62
 
 
63
 
    int     xpos;
64
 
    int     ypos;
65
 
 
66
 
    QRect   regionSelection;         // Original size image selection.
67
 
 
68
 
    QTimer *timer;
 
57
    PanIconWidgetPriv() :
 
58
        moveSelection(false),
 
59
        xpos(0),
 
60
        ypos(0),
 
61
        timer(0)
 
62
    {}
 
63
 
 
64
    bool         moveSelection;
 
65
 
 
66
    int          xpos;
 
67
    int          ypos;
 
68
 
 
69
    QRect        regionSelection;         // Original size image selection.
 
70
    QTimer*      timer;
69
71
};
70
72
 
71
73
PanIconWidget::PanIconWidget(QWidget *parent, Qt::WidgetAttribute attribute)
89
91
    delete d;
90
92
}
91
93
 
 
94
QToolButton* PanIconWidget::button()
 
95
{
 
96
    QToolButton* btn = new QToolButton;
 
97
    btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
 
98
    btn->setIcon(SmallIcon("transform-move"));
 
99
    btn->hide();
 
100
    btn->setToolTip( i18n("Pan the image to a region"));
 
101
    return btn;
 
102
}
 
103
 
92
104
void PanIconWidget::setImage(int previewWidth, int previewHeight, const QImage& image)
93
105
{
94
106
    QSize sz(image.width(), image.height());