FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
indexed_selection_model.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "gui.h"
19 #include <QtCore/QObject>
20 #include <QtCore/QSet>
21 
22 namespace qtgui {
23 
25 {
26  Q_OBJECT
27 
28 public:
29  IndexedSelectionModel(QObject* parent = NULL);
30 
31  const QSet<int>& selectedItems() const;
32 
33  virtual bool hasSelection() const;
34  virtual bool isValidIndex(int id) const;
35 
36 public slots:
37  virtual void clear();
38  void toggleItem(int id);
39 
40 signals:
41  void selectionCleared();
42  void itemToggled(int id, bool on);
43  void selectionChanged();
44 
45 protected:
46  void beginClear();
47  void clearItems();
48  void endClear();
49 
50 private:
51  QSet<int> m_selectedItems;
52  bool m_hadSelection;
53 };
54 
55 } // namespace qtgui
Helper that keeps track of selected items in any kind of view (not specific to Qt) ...
Definition: indexed_selection_model.h:24
Definition: abstract_length_editor.cpp:20
#define QTTOOLS_GUI_EXPORT
Definition: gui.h:27