6 #include <QColorDialog>
8 #include <QInputDialog>
11 #include <QXmlStreamWriter>
15 #include "XmlStackedHandlerReader.h"
46 xmlReader->pushContentHandler(
new XmlHandler(
this));
97 emit supportAdded(prop);
134 while(red + green + blue < 300) {
136 green = rand() % 256;
140 return QColor(red, green, blue, 60);
144 void ControlDisplayProperties::save(QXmlStreamWriter &stream,
const Project *project,
146 stream.writeStartElement(
"displayProperties");
148 stream.writeAttribute(
"displayName",
displayName());
152 dataBuffer.open(QIODevice::ReadWrite);
153 QDataStream propsStream(&dataBuffer);
157 stream.writeCharacters(dataBuffer.data().toHex());
159 stream.writeEndElement();
199 foreach(display, displays) {
206 m_displayProperties = displayProperties;
210 bool ControlDisplayProperties::XmlHandler::startElement(
const QString &namespaceURI,
211 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
212 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
213 if (localName ==
"displayProperties") {
216 if (!displayName.isEmpty()) {
217 m_displayProperties->setDisplayName(displayName);
226 bool ControlDisplayProperties::XmlHandler::characters(
const QString &ch) {
229 return XmlStackedHandler::characters(ch);
233 bool ControlDisplayProperties::XmlHandler::endElement(
const QString &namespaceURI,
234 const QString &localName,
const QString &qName) {
235 if (localName ==
"displayProperties") {
236 QByteArray hexValues(m_hexData.toLatin1());
237 QDataStream valuesStream(QByteArray::fromHex(hexValues));
238 valuesStream >> *m_displayProperties->m_propertyValues;
241 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
250 if ((*m_propertyValues)[prop] != value) {
251 (*m_propertyValues)[prop] = value;
254 emit propertyChanged(
this);
270 QVariant callerData = caller->data();
void setSelected(bool)
Change the selected state associated with this cube.
ControlDisplayProperties(QString displayName, QObject *parent=NULL)
ControlDisplayProperties constructor.
Property
This is a list of properties and actions that are possible.
This class is designed to serialize QColor in a human-readable form.
The main project for cnetsuite.
File name manipulation and expansion.
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 Q...
void addSupport(Property prop)
Convert to Pvl for project files.
static QColor randomColor()
Creates and returns a random color for the intial color of the footprint polygon. ...
True if the control net should show its display name (bool)
bool supports(Property prop)
Support may come later, please make sure you are connected to the supportAdded signal.
QVariant getValue(Property prop) const
Get a property's associated data.
This is the GUI communication mechanism for cubes.
void toggleShowLabel()
Change the visibility of the display name.
QString displayName() const
Returns the display name.
void setShowLabel(bool)
Change the visibility of the display name associated with this cube.
static QList< ControlDisplayProperties * > senderToData(QObject *sender)
This is for the slots that have a list of display properties as associated data.
Null display property for bit-flag purposes.
Property m_propertiesUsed
This indicated whether any widgets with this DisplayProperties is using a particular property...
The selection state of this control net (bool)
virtual ~ControlDisplayProperties()
destructor
void setColor(QColor newColor)
Change the color associated with this cube.
his enables stack-based XML parsing of XML files.
void setValue(Property prop, QVariant value)
This is the generic mutator for properties.