fw4spl
t/src/fwGuiQt/Cursor.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include <QApplication>
8 
9 #include <fwGui/registry/macros.hpp>
10 
11 #include "fwGuiQt/Cursor.hpp"
12 
13 
14 fwGuiRegisterMacro( ::fwGuiQt::Cursor, ::fwGui::ICursor::REGISTRY_KEY );
15 
16 namespace fwGuiQt
17 {
18 //-----------------------------------------------------------------------------
19 
20 Cursor::Cursor(::fwGui::GuiBaseObject::Key key)
21 {
22 }
23 
24 //-----------------------------------------------------------------------------
25 
26 Cursor::~Cursor()
27 {
28 }
29 
30 //-----------------------------------------------------------------------------
31 
33 {
34 
35  QCursor qtCursor(Qt::ArrowCursor);
36  switch (cursor)
37  {
38  case ICursor::BUSY:
39  qtCursor.setShape(Qt::BusyCursor);
40  break;
41  case ICursor::WAIT:
42  qtCursor.setShape(Qt::WaitCursor);
43  break;
44  case ICursor::CROSS:
45  qtCursor.setShape(Qt::CrossCursor);
46  break;
47  case ICursor::DEFAULT:
48  qtCursor.setShape(Qt::BusyCursor);
49  break;
50  }
51 
52  qApp->setOverrideCursor(qtCursor);
53 
54 }
55 
56 //-----------------------------------------------------------------------------
57 
59 {
60  qApp->restoreOverrideCursor();
61 }
62 
63 //-----------------------------------------------------------------------------
64 
65 } // namespace fwGuiQt
66 
67 
68 
Defines the generic cursor for IHM.
CursorType
Cursor type.
Definition: ICursor.hpp:29
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
Definition: WindowLevel.hpp:32
virtual FWGUIQT_API void setDefaultCursor() override
Set the default cursor.
virtual FWGUIQT_API void setCursor(::fwGui::ICursor::CursorType cursor) override
Set the cursor.