Brief description of class still missing. More...
#include <XMLItem.h>
Signals | |
| void | includeChanged (const QModelIndex &index) |
Public Member Functions | |
| virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| virtual QVariant | data (const QModelIndex &index, int role) const |
| virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
| QList< XMLGenericItem * > | getSelection (const QItemSelectionModel &sm) |
| virtual QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
| virtual QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
| QModelIndex | index (XMLGenericItem *o) |
| virtual QModelIndex | parent (const QModelIndex &index) const |
| XMLGenericItem * | rootItem () |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| QByteArray | saveByteArray () |
| void | saveFile (QString fileName) |
| QString | saveString () |
| virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) |
| void | setText (QString xml) |
| XMLItem (QObject *parent=0) | |
| XMLGenericItem * | xmlItem (const QModelIndex &index) const |
| ~XMLItem () | |
Brief description of class still missing.
Full description of class still missing
| QGpGuiTools::XMLItem::XMLItem | ( | QObject * | parent = 0 | ) |
| QGpGuiTools::XMLItem::~XMLItem | ( | ) | [inline] |
{}
| int QGpGuiTools::XMLItem::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
| QVariant QGpGuiTools::XMLItem::data | ( | const QModelIndex & | index, |
| int | role | ||
| ) | const [virtual] |
References QGpCoreTools::XMLGenericItem::isEnabled(), QGpCoreTools::XMLSaveAttributes::toString(), TRACE, QGpCoreTools::XMLGenericItem::value(), QGpCoreTools::XMLGenericItem::xml_attributes(), QGpCoreTools::XMLGenericItem::xml_tagName(), and xmlItem().
{
TRACE;
if (!index.isValid()) return QVariant();
XMLGenericItem * o=xmlItem(index);
switch (role) {
case Qt::DisplayRole:
switch(index.column()) {
case 0:
return o->xml_tagName();
case 1:
return o->value();
default:
break;
}
break;
case Qt::EditRole:
switch(index.column()) {
case 1:
return o->value();
default:
break;
}
break;
case Qt::ToolTipRole: {
XMLSaveAttributes attributes;
o->xml_attributes(attributes, 0);
return attributes.toString();
}
case Qt::CheckStateRole:
if(index.column()==2) {
return o->isEnabled() ? Qt::Checked : Qt::Unchecked;
}
break;
default:
break;
}
return QVariant();
}
| Qt::ItemFlags QGpGuiTools::XMLItem::flags | ( | const QModelIndex & | index | ) | const [virtual] |
References QGpCoreTools::TreeContainer::childrenCount(), QGpCoreTools::XMLGenericItem::isParentEnabled(), and xmlItem().
{
Qt::ItemFlags f=Qt::ItemIsSelectable;
// Editable or not?
XMLGenericItem * o=xmlItem(index);
switch(index.column()) {
case 1:
if(o->childrenCount()==0) {
f|=Qt::ItemIsEditable;
}
break;
case 2:
if(index.parent().isValid()) {
f|=Qt::ItemIsUserCheckable;
}
break;
default:
break;
}
// Enabled or not
// 20130904: fixed that item are disabled when not included.
// it was impossible to include them again
if(o->isParentEnabled()) {
f|=Qt::ItemIsEnabled;
}
return f;
}
| QList< XMLGenericItem * > QGpGuiTools::XMLItem::getSelection | ( | const QItemSelectionModel & | sm | ) |
| QVariant QGpGuiTools::XMLItem::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role | ||
| ) | const [virtual] |
| void QGpGuiTools::XMLItem::includeChanged | ( | const QModelIndex & | index | ) | [signal] |
Referenced by setData().
| QModelIndex QGpGuiTools::XMLItem::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) | const [virtual] |
References QGpCoreTools::TreeContainer::containerAt(), TRACE, and xmlItem().
Referenced by QGpGuiTools::XMLEditor::setEnabled().
{
TRACE;
if( !parent.isValid()) return createIndex(row, column, (void *)&_rootItem);
XMLGenericItem * o=xmlItem(parent);
XMLGenericItem * oi=static_cast<XMLGenericItem *>(o->containerAt(row));
if(oi)
return createIndex(row, column, oi);
else
return QModelIndex();
}
| QModelIndex QGpGuiTools::XMLItem::index | ( | XMLGenericItem * | o | ) |
References QGpCoreTools::XMLGenericItem::parent(), QGpCoreTools::TreeContainer::rank(), and TRACE.
| QModelIndex QGpGuiTools::XMLItem::parent | ( | const QModelIndex & | index | ) | const [virtual] |
References QGpCoreTools::TreeContainer::containerIndex(), QGpCoreTools::XMLGenericItem::parent(), TRACE, and xmlItem().
{
TRACE;
if(!index.isValid()) return QModelIndex();
XMLGenericItem * o=xmlItem(index);
XMLGenericItem * parent=o->parent();
if(parent) {
return createIndex(parent->containerIndex(), 0, parent);
} else
return QModelIndex();
}
| XMLGenericItem* QGpGuiTools::XMLItem::rootItem | ( | ) | [inline] |
Referenced by SciFigs::SciFigsXMLEditor::SciFigsXMLEditor(), SciFigs::SciFigsXMLEditor::setAxisProperty(), SciFigs::SciFigsXMLEditor::setAxisWindowProperty(), and SciFigs::SciFigsXMLEditor::setLayers().
{return &_rootItem;}
| int QGpGuiTools::XMLItem::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
References QGpCoreTools::TreeContainer::childrenCount(), TRACE, and xmlItem().
{
TRACE;
if(!parent.isValid()) return 1;
const XMLGenericItem * oParent=xmlItem(parent);
return oParent->childrenCount();
}
| QByteArray QGpGuiTools::XMLItem::saveByteArray | ( | ) |
References TRACE, and QGpCoreTools::XMLHeader::xml_saveByteArray().
| void QGpGuiTools::XMLItem::saveFile | ( | QString | fileName | ) |
References TRACE, and QGpCoreTools::XMLHeader::xml_saveFile().
| QString QGpGuiTools::XMLItem::saveString | ( | ) |
References TRACE, and QGpCoreTools::XMLHeader::xml_saveString().
| bool QGpGuiTools::XMLItem::setData | ( | const QModelIndex & | index, |
| const QVariant & | value, | ||
| int | role | ||
| ) | [virtual] |
References includeChanged(), QGpCoreTools::XMLGenericItem::setEnabled(), QGpCoreTools::XMLGenericItem::setValue(), TRACE, and xmlItem().
{
TRACE;
if (!index.isValid()) return false;
XMLGenericItem * o=xmlItem(index);
switch (role) {
case Qt::EditRole:
if(index.column()==1) {
o->setValue(value);
return true;
}
break;
case Qt::CheckStateRole:
if(index.column()==2) {
o->setEnabled(value==Qt::Checked);
emit(includeChanged(index));
return true;
}
break;
default:
break;
}
return false;
}
| void QGpGuiTools::XMLItem::setText | ( | QString | xml | ) |
References TRACE, and QGpCoreTools::XMLHeader::xml_restoreString().
| XMLGenericItem * QGpGuiTools::XMLItem::xmlItem | ( | const QModelIndex & | index | ) | const |
References TRACE.
Referenced by data(), flags(), getSelection(), index(), parent(), rowCount(), and setData().
{
TRACE;
return static_cast<XMLGenericItem *>(index.internalPointer());
}