aimsgui  5.1.2
qpython.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL license version 2 under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL license version 2 as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL license version 2 and that you accept its terms.
32  */
33 
34 #ifndef AIMS_LISTVIEW_QPYTHON_H
35 #define AIMS_LISTVIEW_QPYTHON_H
36 
39 #include <qglobal.h>
40 class QTreeWidget;
41 class QTreeWidgetItem;
42 class QString;
43 
44 
45 namespace aims
46 {
47 
48 namespace gui
49 {
50 
55  {
56  public:
57  typedef QTreeWidgetItem* (*Helper)( const carto::GenericObject & obj,
58  QTreeWidgetItem* parent,
59  QPythonPrinter & qp,
60  const QString & attname,
61  const QString & attype,
62  bool viewinternal );
63  typedef std::map<std::string, Helper> HelperSet;
64 
65  QPythonPrinter( QTreeWidgetItem* parent,
66  const carto::SyntaxSet & syntax = carto::SyntaxSet(),
67  const HelperSet & helpers = HelperSet() );
68  QPythonPrinter( QTreeWidget* parent,
69  const carto::SyntaxSet & syntax = carto::SyntaxSet(),
70  const HelperSet & helpers = HelperSet() );
71  virtual ~QPythonPrinter();
72 
73  virtual QTreeWidgetItem* write( const carto::GenericObject & object,
74  bool writeInternals = false );
75  virtual void write( const carto::GenericObject & object,
76  QTreeWidgetItem* parent, const std::string & syntax,
77  const std::string & semantic, bool writeInternals );
78  bool isInternal( const std::string & syntax,
79  const std::string & semantic );
80  int valueColumn() const { return( _valcol ); }
81  int attributeColumn() const { return( _attcol ); }
82  int typeColumn() const { return( _typcol ); }
83  void setValueColumn( int c ) { _valcol = c; }
84  void setPropertyColumn( int c ) { _attcol = c; }
85  void setTypeColumn( int c ) { _typcol = c; }
86 
87  protected:
88  virtual void initHelpers();
89 
92  QTreeWidget *_lview;
93  QTreeWidgetItem *_lvitem;
94  int _valcol;
95  int _attcol;
96  int _typcol;
97  };
98 
99 }
100 
101 }
102 
103 #endif
104 
Prints elements and attributes of a GenericObject (Python-like) object into a QTreeWidget tree.
Definition: qpython.h:55
virtual void initHelpers()
int typeColumn() const
Definition: qpython.h:82
void setPropertyColumn(int c)
Definition: qpython.h:84
void setValueColumn(int c)
Definition: qpython.h:83
int valueColumn() const
Definition: qpython.h:80
virtual QTreeWidgetItem * write(const carto::GenericObject &object, bool writeInternals=false)
carto::SyntaxSet _rules
Definition: qpython.h:90
int attributeColumn() const
Definition: qpython.h:81
bool isInternal(const std::string &syntax, const std::string &semantic)
virtual void write(const carto::GenericObject &object, QTreeWidgetItem *parent, const std::string &syntax, const std::string &semantic, bool writeInternals)
QTreeWidgetItem * _lvitem
Definition: qpython.h:93
QPythonPrinter(QTreeWidgetItem *parent, const carto::SyntaxSet &syntax=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
std::map< std::string, Helper > HelperSet
Definition: qpython.h:63
QTreeWidget * _lview
Definition: qpython.h:92
void setTypeColumn(int c)
Definition: qpython.h:85
QPythonPrinter(QTreeWidget *parent, const carto::SyntaxSet &syntax=carto::SyntaxSet(), const HelperSet &helpers=HelperSet())
std::map< std::string, Syntax > SyntaxSet