Choreonoid  1.8
ItemSelectionModel.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_ITEM_SELECTION_MODEL_H
6 #define CNOID_BASE_ITEM_SELECTION_MODEL_H
7 
8 #include <cnoid/Signal>
9 #include <QItemSelectionModel>
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class CNOID_EXPORT ItemSelectionModel : public QItemSelectionModel
15 {
16  Q_OBJECT
17 
18 public:
19  ItemSelectionModel(QAbstractItemModel* model);
20  ItemSelectionModel(QAbstractItemModel* model, QObject* parent);
21 
22  SignalProxy<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentChanged() {
23  return sigCurrentChanged_;
24  }
25  SignalProxy<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentColumnChanged() {
26  return sigCurrentColumnChanged_;
27  }
28  SignalProxy<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentRowChanged() {
29  return sigCurrentRowChanged_;
30  }
31  SignalProxy<void(const QItemSelection& selected, const QItemSelection& deselected)> sigSelectionChanged() {
32  return sigSelectionChanged_;
33  }
34 
35 private Q_SLOTS:
36  void onCurrentChanged(const QModelIndex& index, const QModelIndex& previous);
37  void onCurrentColumnChanged(const QModelIndex& index, const QModelIndex& previous);
38  void onCurrentRowChanged(const QModelIndex& index, const QModelIndex& previous);
39  void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
40 
41 private:
42  Signal<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentChanged_;
43  Signal<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentColumnChanged_;
44  Signal<void(const QModelIndex& index, const QModelIndex& previous)> sigCurrentRowChanged_;
45  Signal<void(const QItemSelection& selected, const QItemSelection& deselected)> sigSelectionChanged_;
46 
47  void initialize();
48 };
49 
50 }
51 
52 #endif
53 
cnoid::ItemSelectionModel
Definition: ItemSelectionModel.h:14
cnoid::ItemSelectionModel::sigCurrentRowChanged
SignalProxy< void(const QModelIndex &index, const QModelIndex &previous)> sigCurrentRowChanged()
Definition: ItemSelectionModel.h:28
cnoid::ItemSelectionModel::sigCurrentColumnChanged
SignalProxy< void(const QModelIndex &index, const QModelIndex &previous)> sigCurrentColumnChanged()
Definition: ItemSelectionModel.h:25
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::ItemSelectionModel::sigSelectionChanged
SignalProxy< void(const QItemSelection &selected, const QItemSelection &deselected)> sigSelectionChanged()
Definition: ItemSelectionModel.h:31
cnoid::Signal
Definition: Signal.h:165
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::ItemSelectionModel::sigCurrentChanged
SignalProxy< void(const QModelIndex &index, const QModelIndex &previous)> sigCurrentChanged()
Definition: ItemSelectionModel.h:22