Isis 3 Programmer Reference
DisplayProperties.h
1 #ifndef DisplayProperties_H
2 #define DisplayProperties_H
3 
4 #include <QObject>
5 
6 // This is required since QColor is in a slot
7 #include <QColor>
8 
9 #include "XmlStackedHandler.h"
10 
11 class QAction;
12 class QBitArray;
13 class QXmlStreamWriter;
14 
15 namespace Isis {
16  class FileName;
17  class Project;
18  class Pvl;
19  class PvlObject;
20 
26  class DisplayProperties : public QObject {
27  Q_OBJECT
28  public:
29  DisplayProperties(QString displayName, QObject *parent = NULL);
30  DisplayProperties(XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
31  virtual ~DisplayProperties();
32 
33  void fromPvl(const PvlObject &pvl);
34  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
35  PvlObject toPvl() const;
36 
37  void addSupport(int property);
38  bool supports(int property);
39 
40  QVariant getValue(int property) const;
41 
42  void setDisplayName(QString displayName);
43  QString displayName() const;
44 
45  static QColor randomColor();
46 
47  signals:
48  void propertyChanged(DisplayProperties *);
49  void supportAdded(int);
50 
51  protected:
52  void setValue(int prop, QVariant value);
53 
54  private:
55  Q_DISABLE_COPY(DisplayProperties);
56 
62  class XmlHandler : public XmlStackedHandler {
63  public:
64  XmlHandler(DisplayProperties *displayProperties);
65 
66  virtual bool startElement(const QString &namespaceURI, const QString &localName,
67  const QString &qName, const QXmlAttributes &atts);
68 
69  virtual bool characters(const QString &ch);
70 
71  virtual bool endElement(const QString &namespaceURI, const QString &localName,
72  const QString &qName);
73 
74  private:
75  Q_DISABLE_COPY(XmlHandler);
76 
77  DisplayProperties *m_displayProperties;
78  QString m_hexData;
79  };
80 
81 
82  private:
83 
87  QString m_displayName;
88 
95 
101  };
102 }
103 
104 #endif
105 
bool supports(int property)
Support may come later, please make sure you are connected to the supportAdded signal.
The main project for ipce.
Definition: Project.h:289
File name manipulation and expansion.
Definition: FileName.h:116
QString m_displayName
This is the display name.
PvlObject toPvl() const
Convert to Pvl for project files.
QVariant getValue(int property) const
Get a property&#39;s associated data.
QString displayName() const
Returns the display name.
void setDisplayName(QString displayName)
Sets display name.
virtual ~DisplayProperties()
destructor
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Output format:
QMap< int, QVariant > * m_propertyValues
This is a map from Property to value – the reason I use an int is so Qt knows how to serialize this ...
XML Handler that parses XMLs in a stack-oriented way.
void setValue(int prop, QVariant value)
This is the generic mutator for properties.
DisplayProperties(QString displayName, QObject *parent=NULL)
DisplayProperties constructor.
void addSupport(int property)
Call this with every property you support, otherwise they will not communicate properly between widge...
int m_propertiesUsed
This indicated whether any widgets with this DisplayProperties is using a particulay property...
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
Manage a stack of content handlers for reading XML files.