6 #include <QColorDialog> 8 #include <QInputDialog> 11 #include <QXmlStreamWriter> 15 #include "XmlStackedHandlerReader.h" 66 emit supportAdded(prop);
103 while(red + green + blue < 300) {
105 green = rand() % 256;
109 return QColor(red, green, blue, 60);
113 void ControlDisplayProperties::save(QXmlStreamWriter &stream,
const Project *project,
115 stream.writeStartElement(
"displayProperties");
117 stream.writeAttribute(
"displayName",
displayName());
121 dataBuffer.open(QIODevice::ReadWrite);
122 QDataStream propsStream(&dataBuffer);
126 stream.writeCharacters(dataBuffer.data().toHex());
128 stream.writeEndElement();
168 foreach(display, displays) {
175 m_displayProperties = displayProperties;
179 bool ControlDisplayProperties::XmlHandler::startElement(
const QString &namespaceURI,
180 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
181 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
182 if (localName ==
"displayProperties") {
195 bool ControlDisplayProperties::XmlHandler::characters(
const QString &ch) {
198 return XmlStackedHandler::characters(ch);
202 bool ControlDisplayProperties::XmlHandler::endElement(
const QString &namespaceURI,
203 const QString &localName,
const QString &qName) {
204 if (localName ==
"displayProperties") {
205 QByteArray hexValues(m_hexData.toLatin1());
206 QDataStream valuesStream(QByteArray::fromHex(hexValues));
207 valuesStream >> *m_displayProperties->m_propertyValues;
210 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
220 (*m_propertyValues)[prop] = value;
223 emit propertyChanged(
this);
239 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 ipce.
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 ...
void addSupport(Property prop)
Call this with every property you support, otherwise they will not communicate properly between widge...
QString displayName() const
Returns the display name.
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.
This is the GUI communication mechanism for cubes.
void toggleShowLabel()
Change the visibility of the display name.
void setShowLabel(bool)
Change the visibility of the display name associated with this cube.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
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...
QVariant getValue(Property prop) const
Get a property's associated data.
Namespace for ISIS/Bullet specific routines.
The selection state of this control net (bool)
virtual ~ControlDisplayProperties()
destructor
void setColor(QColor newColor)
Change the color associated with this cube.
Manage a stack of content handlers for reading XML files.
void setValue(Property prop, QVariant value)
This is the generic mutator for properties.