fw4spl
SListView.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2017-2018.
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 #pragma once
8 
9 #include "guiQt/config.hpp"
10 
11 #include <fwGui/editor/IEditor.hpp>
12 
13 #include <QListWidget>
14 #include <QPointer>
15 
16 namespace guiQt
17 {
18 
19 namespace editor
20 {
21 
40 class GUIQT_CLASS_API SListView : public QObject,
42 {
43 Q_OBJECT
44 
45 public:
46 
48 
50  GUIQT_API SListView() noexcept;
51 
53  GUIQT_API virtual ~SListView() noexcept;
54 
59  GUIQT_API static const ::fwCom::Signals::SignalKeyType s_ITEM_ADDED_SIG;
60  typedef ::fwCom::Signal<void (int)> ItemAddedSignalType;
61 
62  GUIQT_API static const ::fwCom::Signals::SignalKeyType s_ITEM_REMOVED_SIG;
63  typedef ::fwCom::Signal<void (int)> ItemRemovedSignalType;
64 
65  GUIQT_API static const ::fwCom::Signals::SignalKeyType s_ITEM_DOUBLE_CLICKED_SIG;
66  typedef ::fwCom::Signal<void (int)> ItemDoubleClickedSignalType;
67 
75  GUIQT_API static const ::fwCom::Slots::SlotKeyType s_INSERT_ITEM_SLOT;
76  GUIQT_API static const ::fwCom::Slots::SlotKeyType s_REMOVE_ITEM_SLOT;
77 
79  void insertItem( int index, std::string value );
80 
82  void removeItem(int index);
83 
85 
86 protected:
87 
89  bool eventFilter(QObject* watched, QEvent* event) override;
90 
91  typedef ::fwRuntime::ConfigurationElement::sptr Configuration;
92 
94  virtual void starting() override;
95 
97  virtual void stopping() override;
98 
100  virtual void updating() override;
101 
103  virtual void swapping() override;
104 
106  virtual void configuring() override;
107 
108 private:
109 
110  QPointer<QListWidget> m_listWidget;
111 
112 private Q_SLOTS:
113 
115  void onItemDoubleClicked(QListWidgetItem* item);
116 };
117 
118 }//namespace editor
119 }//namespace guiQt
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
STL namespace.
This editor allows to draw a list. The currently selected item can be deleted by pressing on "del" ke...
Definition: SListView.hpp:40
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace guiQt contains the basic services to build the application IHM with Qt...
Definition: Code.hpp:21