summaryrefslogtreecommitdiffabout
path: root/microkde/ktextedit.cpp
Unidiff
Diffstat (limited to 'microkde/ktextedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/ktextedit.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/microkde/ktextedit.cpp b/microkde/ktextedit.cpp
index 4dd6875..d74706b 100644
--- a/microkde/ktextedit.cpp
+++ b/microkde/ktextedit.cpp
@@ -1,53 +1,55 @@
1 1
2#include <ktextedit.h> 2#include <ktextedit.h>
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5//Added by qt3to4:
6#include <QMouseEvent>
5#endif 7#endif
6 8
7 9
8KTextEdit::KTextEdit ( QWidget *parent ) : QMultiLineEdit( parent ) 10KTextEdit::KTextEdit ( QWidget *parent ) : Q3MultiLineEdit( parent )
9{ 11{
10 mAllowPopupMenu = false; 12 mAllowPopupMenu = false;
11 mMouseDown = false; 13 mMouseDown = false;
12 mIgnoreMark = false; 14 mIgnoreMark = false;
13#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
14 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 16 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
15#endif 17#endif
16} 18}
17 19
18void KTextEdit::mousePressEvent(QMouseEvent *e) 20void KTextEdit::mousePressEvent(QMouseEvent *e)
19{ 21{
20 if ( e->button() == LeftButton ) { 22 if ( e->button() == Qt::LeftButton ) {
21 mAllowPopupMenu = true; 23 mAllowPopupMenu = true;
22 mYMousePos = mapToGlobal( (e->pos())).y(); 24 mYMousePos = mapToGlobal( (e->pos())).y();
23 mXMousePos = mapToGlobal( (e->pos())).x(); 25 mXMousePos = mapToGlobal( (e->pos())).x();
24 } 26 }
25 if ( e->button() == RightButton && !mAllowPopupMenu ) 27 if ( e->button() == Qt::RightButton && !mAllowPopupMenu )
26 return; 28 return;
27 if ( e->button() == LeftButton ) { 29 if ( e->button() == Qt::LeftButton ) {
28 if ( hasMarkedText () ) 30 if ( hasMarkedText () )
29 mIgnoreMark = !mIgnoreMark; 31 mIgnoreMark = !mIgnoreMark;
30 if ( mIgnoreMark && hasMarkedText () ) { 32 if ( mIgnoreMark && hasMarkedText () ) {
31 mMouseDown = false; 33 mMouseDown = false;
32 return ; 34 return ;
33 } 35 }
34 } 36 }
35 QMultiLineEdit::mousePressEvent( e ); 37 Q3MultiLineEdit::mousePressEvent( e );
36} 38}
37 39
38void KTextEdit::mouseReleaseEvent(QMouseEvent *e) 40void KTextEdit::mouseReleaseEvent(QMouseEvent *e)
39{ 41{
40 QMultiLineEdit::mouseReleaseEvent(e); 42 Q3MultiLineEdit::mouseReleaseEvent(e);
41} 43}
42 44
43void KTextEdit::mouseMoveEvent(QMouseEvent *e) 45void KTextEdit::mouseMoveEvent(QMouseEvent *e)
44{ 46{
45 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 47 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
46 if ( diff < 0 ) diff = -diff; 48 if ( diff < 0 ) diff = -diff;
47 int diff2 = mXMousePos - mapToGlobal( (e->pos())).x(); 49 int diff2 = mXMousePos - mapToGlobal( (e->pos())).x();
48 if ( diff2 < 0 ) diff2 = -diff2; 50 if ( diff2 < 0 ) diff2 = -diff2;
49 if ( diff+ diff2 > 20 ) 51 if ( diff+ diff2 > 20 )
50 mAllowPopupMenu = false; 52 mAllowPopupMenu = false;
51 QMultiLineEdit::mouseMoveEvent(e); 53 Q3MultiLineEdit::mouseMoveEvent(e);
52} 54}
53 55