~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to src/tools/advwidget/movetest/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QApplication>
 
2
#include <QDesktopWidget>
 
3
#include <QMoveEvent>
 
4
#include <QMouseEvent>
 
5
#include "../advwidget.h"
 
6
 
 
7
class MyWidget : public AdvancedWidget<QWidget>
 
8
{
 
9
        Q_OBJECT
 
10
public:
 
11
        MyWidget()
 
12
        {
 
13
                mouseDown = false;
 
14
        }
 
15
 
 
16
        void mousePressEvent(QMouseEvent *e)
 
17
        {
 
18
                mouseDown = true;
 
19
                oldPos = e->globalPos();
 
20
        }
 
21
        
 
22
        void mouseReleaseEvent(QMouseEvent *)
 
23
        {
 
24
                mouseDown = false;
 
25
        }
 
26
 
 
27
        void mouseMoveEvent(QMouseEvent *e)
 
28
        {
 
29
                if (mouseDown) {
 
30
                        QPoint dp = e->globalPos() - oldPos;
 
31
                        oldPos = e->globalPos();
 
32
                        move(pos() + dp);
 
33
                }
 
34
        }
 
35
 
 
36
        QPoint oldPos;
 
37
        bool mouseDown;
 
38
};
 
39
 
 
40
int main (int argc, char *argv[])
 
41
{
 
42
        QApplication app(argc, argv);
 
43
        MyWidget mw;
 
44
        mw.show();
 
45
        return app.exec();
 
46
}
 
47
 
 
48
#include "main.moc"
 
 
b'\\ No newline at end of file'