source: pacpusframework/branches/2.0-beta1/include/extlib/qwtplot3d/qwt3d_portability.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#ifndef qwt3d_portability_h__2005_07_02_11_55_begin_guarded_code
2#define qwt3d_portability_h__2005_07_02_11_55_begin_guarded_code
3
4//! Portability classes providing transparent Qt3/4 support
5
6#include <qnamespace.h>
7#include "qwt3d_global.h"
8
9#if QT_VERSION < 0x040000
10
11namespace Qwt3D
12{
13 #define QWT3DLOCAL8BIT(qstring) \
14 ((const char*)(qstring.local8Bit()))
15
16 typedef int MouseState;
17 typedef int KeyboardState;
18 const Qt::TextFlags SingleLine = Qt::SingleLine;
19} // ns
20
21
22#else // Qt4
23
24#include <QMouseEvent>
25
26namespace Qwt3D
27{
28
29 #define QWT3DLOCAL8BIT(qstring) \
30 ((const char*)(qstring.toLocal8Bit()))
31
32 const Qt::TextFlag SingleLine = Qt::TextSingleLine;
33
34 //! This class creates a (mouse-button,modifier) pair (ordinary typedef for int if Qt3 is used)
35 class MouseState
36 {
37 public:
38 MouseState(Qt::MouseButtons mb = Qt::NoButton, Qt::KeyboardModifiers km = Qt::NoModifier)
39 : mb_(mb), km_(km)
40 {
41 }
42
43 MouseState(Qt::MouseButton mb, Qt::KeyboardModifiers km = Qt::NoModifier)
44 : mb_(mb), km_(km)
45 {
46 }
47
48 bool operator==(const MouseState& ms)
49 {
50 return mb_ == ms.mb_ && km_ == ms.km_;
51 }
52
53 bool operator!=(const MouseState& ms)
54 {
55 return !operator==(ms);
56 }
57
58 private:
59 Qt::MouseButtons mb_;
60 Qt::KeyboardModifiers km_;
61 };
62
63 //! This class creates a (key-button,modifier) pair (ordinary typedef for int if Qt3 is used)
64 class KeyboardState
65 {
66 public:
67 KeyboardState(int key = Qt::Key_unknown, Qt::KeyboardModifiers km = Qt::NoModifier)
68 : key_(key), km_(km)
69 {
70 }
71
72 bool operator==(const KeyboardState& ms)
73 {
74 return key_ == ms.key_ && km_ == ms.km_;
75 }
76
77 bool operator!=(const KeyboardState& ms)
78 {
79 return !operator==(ms);
80 }
81
82 private:
83 int key_;
84 Qt::KeyboardModifiers km_;
85 };
86} // ns
87
88#endif
89
90
91#endif
Note: See TracBrowser for help on using the repository browser.