save/load QetGraphicsTableItem to/from .qet file

This commit is contained in:
Claveau Joshua
2020-04-17 18:40:28 +02:00
parent 851265844f
commit 908d79925c
16 changed files with 600 additions and 117 deletions

View File

@@ -17,6 +17,7 @@
*/
#include "qetgraphicsheaderitem.h"
#include "qabstractitemmodel.h"
#include "qetxml.h"
#include <QFontMetrics>
#include <QPainter>
@@ -209,6 +210,34 @@ void QetGraphicsHeaderItem::setMargins(const QMargins &margins)
headerDataChanged(Qt::Horizontal, 0,1);
}
/**
* @brief QetGraphicsHeaderItem::toXml
* save the header to xml
* @param document
* @return
*/
QDomElement QetGraphicsHeaderItem::toXml(QDomDocument &document) const
{
auto dom_element = document.createElement(xmlTagName());
dom_element.appendChild(QETXML::marginsToXml(document, m_margin));
return dom_element;
}
/**
* @brief QetGraphicsHeaderItem::fromXml
* Restore the header from xml
* @param element
*/
void QetGraphicsHeaderItem::fromXml(const QDomElement &element)
{
if (element.tagName() != xmlTagName()) {
return;
}
m_margin = QETXML::marginsFromXml(element.firstChildElement("margins"));
}
/**
* @brief QetGraphicsHeaderItem::setUpMinimumSectionsSize
* Setup the minimum section size and height of the item.