mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-13 18:14:13 +02:00
PLC Fix scroll sync, data persistence, font defaults, copy/paste, and layout fixes
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "element.h"
|
||||
#include "../qetapp.h"
|
||||
#include "../qetproject.h"
|
||||
#include "../PropertiesEditor/propertieseditordialog.h"
|
||||
#include "../autoNum/assignvariables.h"
|
||||
@@ -860,6 +861,15 @@ bool Element::fromXml(QDomElement &e,
|
||||
}
|
||||
}
|
||||
|
||||
//Load PLC master data override from diagram XML
|
||||
if (m_data.m_type == ElementData::Master &&
|
||||
m_data.m_master_type == ElementData::PLC)
|
||||
{
|
||||
auto xml_plc = e.firstChildElement(QStringLiteral("plcMasterData"));
|
||||
if (!xml_plc.isNull())
|
||||
m_data.plcMasterDataFromXml(xml_plc);
|
||||
}
|
||||
|
||||
//We must block the update of the alignment when loading the information
|
||||
//otherwise the pos of the text will not be the same as it was at save time.
|
||||
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
||||
@@ -993,6 +1003,15 @@ QDomElement Element::toXml(
|
||||
element.appendChild(properties);
|
||||
}
|
||||
|
||||
//Save PLC master data override for elements on diagram
|
||||
if (m_data.m_type == ElementData::Master &&
|
||||
m_data.m_master_type == ElementData::PLC)
|
||||
{
|
||||
auto xml_plc = m_data.plcMasterDataToXml(document);
|
||||
if (!xml_plc.isNull())
|
||||
element.appendChild(xml_plc);
|
||||
}
|
||||
|
||||
//Dynamic texts
|
||||
QDomElement dyn_text = document.createElement(QStringLiteral("dynamic_texts"));
|
||||
for (DynamicElementTextItem *deti : m_dynamic_text_list)
|
||||
@@ -1876,12 +1895,12 @@ void Element::drawPlcTable(QPainter *painter)
|
||||
// Fonts
|
||||
QFont header_font = plc_data.headerFont;
|
||||
if (header_font.family().isEmpty()) {
|
||||
header_font = painter->font();
|
||||
header_font = QETApp::diagramTextsFont();
|
||||
header_font.setBold(true);
|
||||
}
|
||||
QFont cell_font = plc_data.cellFont;
|
||||
if (cell_font.family().isEmpty()) {
|
||||
cell_font = painter->font();
|
||||
cell_font = QETApp::diagramTextsFont();
|
||||
}
|
||||
|
||||
for (const QPointF &pos : positions) {
|
||||
|
||||
Reference in New Issue
Block a user