Qt 4.8
Public Functions | Private Functions | Properties | List of all members
QMultiScreenCursor Class Reference
Inheritance diagram for QMultiScreenCursor:
QScreenCursor

Public Functions

void addCursor (QScreenCursor *cursor)
 
void hide ()
 Hides the cursor from the screen. More...
 
void move (int x, int y)
 Moves the mouse cursor to the given position, i.e., (x, y). More...
 
 QMultiScreenCursor ()
 
void set (const QImage &image, int hotx, int hoty)
 Sets the cursor's image to be the given image. More...
 
void show ()
 Shows the mouse cursor. More...
 
 ~QMultiScreenCursor ()
 
- Public Functions inherited from QScreenCursor
QRect boundingRect () const
 Returns the cursor's bounding rectangle. More...
 
QImage image () const
 Returns the cursor's image. More...
 
bool isAccelerated () const
 Returns true if the cursor is accelerated; otherwise false. More...
 
bool isVisible () const
 Returns true if the cursor is visible; otherwise false. More...
 
 QScreenCursor ()
 Constructs a screen cursor. More...
 
bool supportsAlphaCursor () const
 
virtual ~QScreenCursor ()
 Destroys the screen cursor. More...
 

Private Functions

void setCurrentCursor (QScreenCursor *newCursor)
 

Properties

QScreenCursorcurrentCursor
 
QList< QScreenCursor * > cursors
 

Additional Inherited Members

- Static Public Functions inherited from QScreenCursor
static bool enabled ()
 
static void initSoftwareCursor ()
 Initializes the screen cursor. More...
 
static QScreenCursorinstance ()
 
- Protected Variables inherited from QScreenCursor
QImage cursor
 
uint enable: 1
 
QPoint hotspot
 
uint hwaccel: 1
 
QPoint pos
 
QSize size
 
uint supportsAlpha: 1
 

Detailed Description

Definition at line 55 of file qscreenmulti_qws.cpp.

Constructors and Destructors

◆ QMultiScreenCursor()

QMultiScreenCursor::QMultiScreenCursor ( )
inline

Definition at line 58 of file qscreenmulti_qws.cpp.

58 : currentCursor(qt_screencursor) { enable = false; }
QScreenCursor * currentCursor
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67

◆ ~QMultiScreenCursor()

QMultiScreenCursor::~QMultiScreenCursor ( )
inline

Definition at line 59 of file qscreenmulti_qws.cpp.

59 { qt_screencursor = 0; }
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67

Functions

◆ addCursor()

void QMultiScreenCursor::addCursor ( QScreenCursor cursor)

Definition at line 135 of file qscreenmulti_qws.cpp.

Referenced by QMultiScreen::initDevice(), and ~QMultiScreenCursor().

136 {
137  cursors.append(cursor);
138 }
QList< QScreenCursor * > cursors
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507

◆ hide()

void QMultiScreenCursor::hide ( )
virtual

Hides the cursor from the screen.

See also
show()

Reimplemented from QScreenCursor.

Definition at line 129 of file qscreenmulti_qws.cpp.

Referenced by ~QMultiScreenCursor().

130 {
131  if (currentCursor)
132  currentCursor->hide();
133 }
QScreenCursor * currentCursor
virtual void hide()
Hides the cursor from the screen.

◆ move()

void QMultiScreenCursor::move ( int  x,
int  y 
)
virtual

Moves the mouse cursor to the given position, i.e., (x, y).

Note that the given position defines the top-left corner of the cursor's image, i.e., not the cursor's hot spot (the position of the associated mouse events).

See also
set()

Reimplemented from QScreenCursor.

Definition at line 89 of file qscreenmulti_qws.cpp.

Referenced by ~QMultiScreenCursor().

90 {
91  const int oldIndex = qt_screen->subScreenIndexAt(pos);
92  QScreenCursor::move(x, y); // updates pos
93  const int newIndex = qt_screen->subScreenIndexAt(pos);
94 
95  if (!currentCursor && oldIndex != -1)
96  setCurrentCursor(cursors.at(oldIndex));
97  QScreenCursor *oldCursor = currentCursor;
98 
99  if (oldIndex != -1) {
100  const QScreen *oldScreen = qt_screen->subScreens().at(oldIndex);
101  if (newIndex == -1 || oldScreen->region().contains(pos)) {
102  oldCursor->move(x, y);
103  return;
104  }
105  }
106 
107  if (newIndex != -1) {
108  QScreenCursor *newCursor = cursors.at(newIndex);
109  newCursor->set(cursor, hotspot.x(), hotspot.y());
110 
111  if (oldCursor) {
112  if (oldCursor->isVisible())
113  newCursor->show();
114  oldCursor->hide();
115  }
116 
117  newCursor->move(x, y);
118 
119  setCurrentCursor(newCursor);
120  }
121 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
The QScreenCursor class is a base class for screen cursors in Qt for Embedded Linux.
Definition: qscreen_qws.h:135
QScreenCursor * currentCursor
virtual void move(int x, int y)
Moves the mouse cursor to the given position, i.e., (x, y).
void setCurrentCursor(QScreenCursor *newCursor)
QPoint hotspot
Definition: qscreen_qws.h:163
QList< QScreenCursor * > cursors
virtual QRegion region() const
Returns the region covered by this screen driver.
Definition: qscreen_qws.h:284
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
Definition: qregion.cpp:4104
int subScreenIndexAt(const QPoint &p) const
Returns the index of the subscreen at the given position; returns -1 if no screen is found...
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
virtual void show()
Shows the mouse cursor.
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor&#39;s image to be the given image.

◆ set()

void QMultiScreenCursor::set ( const QImage image,
int  hotx,
int  hoty 
)
virtual

Sets the cursor's image to be the given image.

The hotx and hoty parameters define the cursor's hot spot, i.e., the point within the cursor's image that will be the position of the associated mouse events.

See also
move()

Reimplemented from QScreenCursor.

Definition at line 75 of file qscreenmulti_qws.cpp.

76 {
77  QScreenCursor::set(image, hotx, hoty);
78  if (currentCursor)
79  currentCursor->set(image, hotx, hoty);
80 }
QScreenCursor * currentCursor
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor&#39;s image to be the given image.

◆ setCurrentCursor()

void QMultiScreenCursor::setCurrentCursor ( QScreenCursor newCursor)
private

Definition at line 82 of file qscreenmulti_qws.cpp.

Referenced by move(), and ~QMultiScreenCursor().

83 {
84  *((QScreenCursor*)this) = *newCursor;
85  currentCursor = newCursor;
86 }
The QScreenCursor class is a base class for screen cursors in Qt for Embedded Linux.
Definition: qscreen_qws.h:135
QScreenCursor * currentCursor

◆ show()

void QMultiScreenCursor::show ( )
virtual

Shows the mouse cursor.

See also
hide()

Reimplemented from QScreenCursor.

Definition at line 123 of file qscreenmulti_qws.cpp.

Referenced by ~QMultiScreenCursor().

124 {
125  if (currentCursor)
126  currentCursor->show();
127 }
QScreenCursor * currentCursor
virtual void show()
Shows the mouse cursor.

Properties

◆ currentCursor

QScreenCursor* QMultiScreenCursor::currentCursor
private

Definition at line 71 of file qscreenmulti_qws.cpp.

Referenced by hide(), move(), set(), setCurrentCursor(), and show().

◆ cursors

QList<QScreenCursor*> QMultiScreenCursor::cursors
private

Definition at line 72 of file qscreenmulti_qws.cpp.

Referenced by addCursor(), and move().


The documentation for this class was generated from the following file: