mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
qet graphics table item : to/from xml change
The font, alignment and margins is not saved by the table anymore but by the model.
This commit is contained in:
49
sources/utils/qetutils.cpp
Normal file
49
sources/utils/qetutils.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2006-2020 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "qetutils.h"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
QString QETUtils::marginsToString(const QMargins &margins)
|
||||
{
|
||||
QString str;
|
||||
str += QString::number(margins.left());
|
||||
str += ";";
|
||||
str += QString::number(margins.top());
|
||||
str += ";";
|
||||
str += QString::number(margins.right());
|
||||
str += ";";
|
||||
str += QString::number(margins.bottom());
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
QMargins QETUtils::marginsFromString(const QString &string)
|
||||
{
|
||||
QMargins margins;
|
||||
auto split = string.split(";");
|
||||
if (split.size() != 4)
|
||||
return margins;
|
||||
|
||||
margins.setLeft (split.at(0).toInt());
|
||||
margins.setTop (split.at(1).toInt());
|
||||
margins.setRight (split.at(2).toInt());
|
||||
margins.setBottom(split.at(3).toInt());
|
||||
|
||||
return margins;
|
||||
}
|
||||
Reference in New Issue
Block a user