mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-21 20:49:59 +01:00
Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/qet/qet
This commit is contained in:
BIN
lang/qet_de.qm
BIN
lang/qet_de.qm
Binary file not shown.
415
lang/qet_de.ts
415
lang/qet_de.ts
File diff suppressed because it is too large
Load Diff
@@ -76,6 +76,7 @@ include(sources/QWidgetAnimation/QWidgetAnimation.pri)
|
|||||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
DEFINES += QAPPLICATION_CLASS=QApplication
|
||||||
DEFINES += QT_MESSAGELOGCONTEXT
|
DEFINES += QT_MESSAGELOGCONTEXT
|
||||||
DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""
|
DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""
|
||||||
|
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
DEPENDPATH += .
|
DEPENDPATH += .
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define ELEMENTSCOLLECTIONMODEL2_H
|
#define ELEMENTSCOLLECTIONMODEL2_H
|
||||||
|
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QHash>
|
||||||
#include "elementslocation.h"
|
#include "elementslocation.h"
|
||||||
|
|
||||||
class XmlProjectElementCollectionItem;
|
class XmlProjectElementCollectionItem;
|
||||||
|
|||||||
@@ -18,8 +18,10 @@
|
|||||||
#ifndef NAMELISTWIDGET_H
|
#ifndef NAMELISTWIDGET_H
|
||||||
#define NAMELISTWIDGET_H
|
#define NAMELISTWIDGET_H
|
||||||
|
|
||||||
#include "nameslist.h"
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
#include "nameslist.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class NameListWidget;
|
class NameListWidget;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
#include <QColor>
|
|
||||||
#include <QPolygonF>
|
#include <QPolygonF>
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
|||||||
@@ -16,9 +16,10 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "numerotationcontext.h"
|
#include "numerotationcontext.h"
|
||||||
|
#include "qet.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "qet.h"
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@@ -141,7 +142,7 @@ QString NumerotationContext::validRegExpNumber() const
|
|||||||
*/
|
*/
|
||||||
bool NumerotationContext::keyIsAcceptable(const QString &type) const
|
bool NumerotationContext::keyIsAcceptable(const QString &type) const
|
||||||
{
|
{
|
||||||
return (type.contains(QRegExp(validRegExpNum())));
|
return (type.contains(QRegularExpression(validRegExpNum())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,7 +151,7 @@ bool NumerotationContext::keyIsAcceptable(const QString &type) const
|
|||||||
*/
|
*/
|
||||||
bool NumerotationContext::keyIsNumber(const QString &type) const
|
bool NumerotationContext::keyIsNumber(const QString &type) const
|
||||||
{
|
{
|
||||||
return (type.contains(QRegExp(validRegExpNumber())));
|
return (type.contains(QRegularExpression(validRegExpNumber())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <QRegExp>
|
|
||||||
#include "numparteditorw.h"
|
#include "numparteditorw.h"
|
||||||
#include "ui_numparteditorw.h"
|
#include "ui_numparteditorw.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <QLocale>
|
||||||
|
|
||||||
#include "titleblocktemplate.h"
|
#include "titleblocktemplate.h"
|
||||||
#include "titleblocktemplaterenderer.h"
|
#include "titleblocktemplaterenderer.h"
|
||||||
#include "bordertitleblock.h"
|
#include "bordertitleblock.h"
|
||||||
@@ -51,9 +53,10 @@ BorderTitleBlock::BorderTitleBlock(QObject *parent) :
|
|||||||
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
m_titleblock_template_renderer -> setTitleBlockTemplate(QETApp::defaultTitleBlockTemplate());
|
||||||
|
|
||||||
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
|
// disable the QPicture-based cache from Qt 4.8 to avoid rendering errors and crashes
|
||||||
if (!QRegExp("4\\.[0-7]\\.").exactMatch(qVersion())) {
|
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) // ### Qt 6: remove
|
||||||
m_titleblock_template_renderer -> setUseCache(false);
|
#else
|
||||||
}
|
m_titleblock_template_renderer -> setUseCache(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
// dimensions par defaut du schema
|
// dimensions par defaut du schema
|
||||||
importBorder(BorderProperties());
|
importBorder(BorderProperties());
|
||||||
@@ -651,13 +654,13 @@ void BorderTitleBlock::drawDxf(
|
|||||||
// dessine la numerotation des colonnes
|
// dessine la numerotation des colonnes
|
||||||
if (display_border_ &&
|
if (display_border_ &&
|
||||||
display_columns_) {
|
display_columns_) {
|
||||||
int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0;
|
int offset = settings.value("border-columns_0", true).toBool() ? -1 : 0;
|
||||||
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
for (int i = 1 ; i <= columns_count_ ; ++ i) {
|
||||||
double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale +
|
double xCoord = diagram_rect_.topLeft().x() * Createdxf::xScale +
|
||||||
(rows_header_width_ + ((i - 1) *
|
(rows_header_width_ + ((i - 1) *
|
||||||
columns_width_));
|
columns_width_));
|
||||||
double yCoord = Createdxf::sheetHeight
|
double yCoord = Createdxf::sheetHeight
|
||||||
- diagram_rect_.topLeft().y()*Createdxf::yScale
|
- diagram_rect_.topLeft().y()*Createdxf::yScale
|
||||||
- columns_header_height_;
|
- columns_header_height_;
|
||||||
double recWidth = columns_width_;
|
double recWidth = columns_width_;
|
||||||
double recHeight = columns_header_height_;
|
double recHeight = columns_header_height_;
|
||||||
@@ -665,18 +668,18 @@ void BorderTitleBlock::drawDxf(
|
|||||||
recWidth, recHeight, color);
|
recWidth, recHeight, color);
|
||||||
|
|
||||||
Createdxf::drawTextAligned(file_path,
|
Createdxf::drawTextAligned(file_path,
|
||||||
QString::number(i + offset),
|
QString::number(i + offset),
|
||||||
xCoord+recWidth/4,
|
xCoord+recWidth/4,
|
||||||
yCoord + recHeight*0.5,
|
yCoord + recHeight*0.5,
|
||||||
recHeight*0.7,
|
recHeight*0.7,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
xCoord+recWidth/2,
|
xCoord+recWidth/2,
|
||||||
1,
|
1,
|
||||||
color);
|
color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw line numbering
|
// draw line numbering
|
||||||
@@ -686,8 +689,8 @@ void BorderTitleBlock::drawDxf(
|
|||||||
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
for (int i = 1 ; i <= rows_count_ ; ++ i) {
|
||||||
double xCoord = diagram_rect_.topLeft().x()
|
double xCoord = diagram_rect_.topLeft().x()
|
||||||
* Createdxf::xScale;
|
* Createdxf::xScale;
|
||||||
double yCoord = Createdxf::sheetHeight
|
double yCoord = Createdxf::sheetHeight
|
||||||
- diagram_rect_.topLeft().y()
|
- diagram_rect_.topLeft().y()
|
||||||
*Createdxf::yScale
|
*Createdxf::yScale
|
||||||
- (
|
- (
|
||||||
columns_header_height_
|
columns_header_height_
|
||||||
@@ -700,15 +703,15 @@ void BorderTitleBlock::drawDxf(
|
|||||||
recWidth, recHeight, color);
|
recWidth, recHeight, color);
|
||||||
Createdxf::drawTextAligned(file_path,
|
Createdxf::drawTextAligned(file_path,
|
||||||
row_string,
|
row_string,
|
||||||
xCoord+recWidth*0.1,
|
xCoord+recWidth*0.1,
|
||||||
yCoord + recHeight*0.4,
|
yCoord + recHeight*0.4,
|
||||||
recWidth*0.7,
|
recWidth*0.7,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
xCoord+recWidth/2,
|
xCoord+recWidth/2,
|
||||||
1,
|
1,
|
||||||
color);
|
color);
|
||||||
row_string = incrementLetters(row_string);
|
row_string = incrementLetters(row_string);
|
||||||
}
|
}
|
||||||
@@ -933,9 +936,12 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ... overridden by the historical and/or dynamically generated fields
|
// ... overridden by the historical and/or dynamically generated fields
|
||||||
|
QLocale var;
|
||||||
|
var.dateFormat(QLocale::ShortFormat);
|
||||||
context.addValue("author", btb_author_);
|
context.addValue("author", btb_author_);
|
||||||
context.addValue("date", btb_date_.toString(
|
context.addValue(
|
||||||
Qt::SystemLocaleShortDate));
|
"date",
|
||||||
|
QLocale::system().toString(btb_date_, QLocale::ShortFormat));
|
||||||
context.addValue("title", btb_title_);
|
context.addValue("title", btb_title_);
|
||||||
context.addValue("filename", btb_filename_);
|
context.addValue("filename", btb_filename_);
|
||||||
context.addValue("plant", btb_plant_);
|
context.addValue("plant", btb_plant_);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include "conductorproperties.h"
|
#include "conductorproperties.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
#include <QRegularExpression>
|
||||||
/**
|
/**
|
||||||
Constructeur par defaut
|
Constructeur par defaut
|
||||||
*/
|
*/
|
||||||
@@ -789,11 +789,12 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
|||||||
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
QStringList styles = style_string.split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
QRegularExpression Rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||||
foreach (QString style_str, styles) {
|
foreach (QString style_str, styles) {
|
||||||
if (rx.exactMatch(style_str)) {
|
if (Rx==QRegularExpression(style_str)) {
|
||||||
QString style_name = rx.cap(1);
|
|
||||||
QString style_value = rx.cap(2);
|
QString style_name = Rx.namedCaptureGroups().at(1);
|
||||||
|
QString style_value = Rx.namedCaptureGroups().at(2);
|
||||||
if (style_name == "line-style") {
|
if (style_name == "line-style") {
|
||||||
if (style_value == "dashed") style = Qt::DashLine;
|
if (style_value == "dashed") style = Qt::DashLine;
|
||||||
else if (style_value == "dashdotted") style = Qt::DashDotLine;
|
else if (style_value == "dashdotted") style = Qt::DashDotLine;
|
||||||
|
|||||||
@@ -15,6 +15,12 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QFontDialog>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QSizePolicy>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "configpages.h"
|
#include "configpages.h"
|
||||||
#include "borderpropertieswidget.h"
|
#include "borderpropertieswidget.h"
|
||||||
#include "conductorpropertieswidget.h"
|
#include "conductorpropertieswidget.h"
|
||||||
@@ -27,10 +33,7 @@
|
|||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "reportproperties.h"
|
#include "reportproperties.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include <QFontDialog>
|
#include "nameslist.h"
|
||||||
#include <QFont>
|
|
||||||
#include <QSizePolicy>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief NewDiagramPage::NewDiagramPage
|
@brief NewDiagramPage::NewDiagramPage
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ Createdxf::Createdxf()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Createdxf::~Createdxf()
|
Createdxf::~Createdxf()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -438,32 +437,15 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
|||||||
}
|
}
|
||||||
return minndx;
|
return minndx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Createdxf::dxfColor(QColor color) {
|
int Createdxf::dxfColor(QColor color) {
|
||||||
return Createdxf::getcolorCode(color.red(), color.green(), color.blue());
|
return Createdxf::getcolorCode(color.red(), color.green(), color.blue());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Createdxf::dxfColor(QPen pen) {
|
int Createdxf::dxfColor(QPen pen) {
|
||||||
return Createdxf::dxfColor(pen.color());
|
return Createdxf::dxfColor(pen.color());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Createdxf::drawLine
|
|
||||||
Conveniance function to draw line
|
|
||||||
@param filepath
|
|
||||||
@param line
|
|
||||||
@param colorcode
|
|
||||||
*/
|
|
||||||
void Createdxf::drawLine(
|
|
||||||
const QString &filepath,
|
|
||||||
const QLineF &line,
|
|
||||||
const int &colorcode)
|
|
||||||
{
|
|
||||||
drawLine(filepath, line.p1().x() * xScale,
|
|
||||||
sheetHeight - (line.p1().y() * yScale),
|
|
||||||
line.p2().x() * xScale,
|
|
||||||
sheetHeight - (line.p2().y() * yScale),
|
|
||||||
colorcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Createdxf::drawArcEllipse(
|
void Createdxf::drawArcEllipse(
|
||||||
const QString &file_path,
|
const QString &file_path,
|
||||||
qreal x,
|
qreal x,
|
||||||
@@ -611,26 +593,7 @@ void Createdxf::drawArcEllipse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Createdxf::drawEllipse
|
|
||||||
Conveniance function for draw ellipse
|
|
||||||
@param filepath
|
|
||||||
@param rect
|
|
||||||
@param colorcode
|
|
||||||
*/
|
|
||||||
void Createdxf::drawEllipse(
|
|
||||||
const QString &filepath,
|
|
||||||
const QRectF &rect,
|
|
||||||
const int &colorcode)
|
|
||||||
{
|
|
||||||
drawArcEllipse(
|
|
||||||
filepath,
|
|
||||||
rect.topLeft().x() * xScale,
|
|
||||||
sheetHeight - (rect.topLeft().y() * yScale),
|
|
||||||
rect.width() * xScale,
|
|
||||||
rect.height() * yScale,
|
|
||||||
0, 360, 0, 0, 0, colorcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Createdxf::drawRectangle
|
@brief Createdxf::drawRectangle
|
||||||
@@ -655,44 +618,11 @@ void Createdxf::drawRectangle (
|
|||||||
drawPolyline(fileName,poly,colour,true);
|
drawPolyline(fileName,poly,colour,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QRectF scaleRect(QRectF rect)
|
|
||||||
{
|
|
||||||
QRectF ro(rect.bottomLeft().x() * Createdxf::xScale,
|
|
||||||
Createdxf::sheetHeight - (rect.bottomLeft().y() * Createdxf::yScale),
|
|
||||||
rect.width() * Createdxf::xScale,
|
|
||||||
rect.height() * Createdxf::yScale);
|
|
||||||
return ro;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Createdxf::drawRectangle
|
|
||||||
Convenience function for draw rectangle
|
|
||||||
@param filepath
|
|
||||||
@param rect
|
|
||||||
@param colorcode
|
|
||||||
*/
|
|
||||||
void Createdxf::drawRectangle(
|
|
||||||
const QString &filepath,
|
|
||||||
const QRectF &rect,
|
|
||||||
const int &colorcode) {
|
|
||||||
QPolygonF poly(scaleRect(rect));
|
|
||||||
drawPolyline(filepath,poly,colorcode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief Createdxf::drawPolygon
|
|
||||||
Convenience function for draw polygon
|
|
||||||
@param filepath
|
|
||||||
@param poly
|
|
||||||
@param colorcode
|
|
||||||
*/
|
|
||||||
void Createdxf::drawPolygon(
|
|
||||||
const QString &filepath,
|
|
||||||
const QPolygonF &poly,
|
|
||||||
const int &colorcode)
|
|
||||||
{
|
|
||||||
drawPolyline(filepath,poly,colorcode);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
@brief Createdxf::drawArc
|
@brief Createdxf::drawArc
|
||||||
draw arc in dx format
|
draw arc in dx format
|
||||||
@@ -767,7 +697,7 @@ void Createdxf::drawText(
|
|||||||
double height,
|
double height,
|
||||||
double rotation,
|
double rotation,
|
||||||
int colour,
|
int colour,
|
||||||
double xScale)
|
double xScaleW)
|
||||||
{
|
{
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
@@ -779,7 +709,7 @@ void Createdxf::drawText(
|
|||||||
errorFileOpen.exec();
|
errorFileOpen.exec();
|
||||||
} else {
|
} else {
|
||||||
QTextStream To_Dxf(&file);
|
QTextStream To_Dxf(&file);
|
||||||
// Draw the circle
|
// Draw the text
|
||||||
To_Dxf << 0 << "\r\n";
|
To_Dxf << 0 << "\r\n";
|
||||||
To_Dxf << "TEXT" << "\r\n";
|
To_Dxf << "TEXT" << "\r\n";
|
||||||
To_Dxf << 8 << "\r\n";
|
To_Dxf << 8 << "\r\n";
|
||||||
@@ -795,7 +725,7 @@ void Createdxf::drawText(
|
|||||||
To_Dxf << 40 << "\r\n";
|
To_Dxf << 40 << "\r\n";
|
||||||
To_Dxf << height << "\r\n"; // Text Height
|
To_Dxf << height << "\r\n"; // Text Height
|
||||||
To_Dxf << 41 << "\r\n";
|
To_Dxf << 41 << "\r\n";
|
||||||
To_Dxf << xScale << "\r\n"; // X Scale
|
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||||
To_Dxf << 1 << "\r\n";
|
To_Dxf << 1 << "\r\n";
|
||||||
To_Dxf << text << "\r\n"; // Text Value
|
To_Dxf << text << "\r\n"; // Text Value
|
||||||
To_Dxf << 50 << "\r\n";
|
To_Dxf << 50 << "\r\n";
|
||||||
@@ -819,7 +749,7 @@ void Createdxf::drawTextAligned(
|
|||||||
int hAlign,
|
int hAlign,
|
||||||
int vAlign,
|
int vAlign,
|
||||||
double xAlign,
|
double xAlign,
|
||||||
double xScale,
|
double xScaleW,
|
||||||
int colour)
|
int colour)
|
||||||
{
|
{
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
@@ -848,7 +778,7 @@ void Createdxf::drawTextAligned(
|
|||||||
To_Dxf << 40 << "\r\n";
|
To_Dxf << 40 << "\r\n";
|
||||||
To_Dxf << height << "\r\n"; // Text Height
|
To_Dxf << height << "\r\n"; // Text Height
|
||||||
To_Dxf << 41 << "\r\n";
|
To_Dxf << 41 << "\r\n";
|
||||||
To_Dxf << xScale << "\r\n"; // X Scale
|
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||||
To_Dxf << 1 << "\r\n";
|
To_Dxf << 1 << "\r\n";
|
||||||
To_Dxf << text << "\r\n"; // Text Value
|
To_Dxf << text << "\r\n"; // Text Value
|
||||||
To_Dxf << 50 << "\r\n";
|
To_Dxf << 50 << "\r\n";
|
||||||
@@ -961,3 +891,158 @@ void Createdxf::drawPolyline(const QString &filepath,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================
|
||||||
|
* Majority of calls above here are must be passed
|
||||||
|
* parameters pre=scaled to DXF units
|
||||||
|
* Calls below use Qt scaling, and re-scale them to DXF
|
||||||
|
* ================================================
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawCircle
|
||||||
|
draw circle in qt format
|
||||||
|
@param fileName
|
||||||
|
@param center
|
||||||
|
@param radius
|
||||||
|
@param colour
|
||||||
|
*/
|
||||||
|
void Createdxf::drawCircle(
|
||||||
|
const QString& fileName,
|
||||||
|
QPointF centre,
|
||||||
|
double radius,
|
||||||
|
int colour)
|
||||||
|
{
|
||||||
|
qreal x = centre.x() * xScale;
|
||||||
|
qreal y = sheetHeight - centre.y() * yScale;
|
||||||
|
qreal r = radius * xScale;
|
||||||
|
drawCircle(fileName,r,x,y,colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawLine
|
||||||
|
Convenience function to draw line
|
||||||
|
@param filepath
|
||||||
|
@param line
|
||||||
|
@param colorcode
|
||||||
|
*/
|
||||||
|
void Createdxf::drawLine(
|
||||||
|
const QString &filepath,
|
||||||
|
const QLineF &line,
|
||||||
|
const int &colorcode)
|
||||||
|
{
|
||||||
|
drawLine(filepath, line.p1().x() * xScale,
|
||||||
|
sheetHeight - (line.p1().y() * yScale),
|
||||||
|
line.p2().x() * xScale,
|
||||||
|
sheetHeight - (line.p2().y() * yScale),
|
||||||
|
colorcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawEllipse
|
||||||
|
Conveniance function for draw ellipse
|
||||||
|
@param filepath
|
||||||
|
@param rect
|
||||||
|
@param colorcode
|
||||||
|
*/
|
||||||
|
void Createdxf::drawEllipse(
|
||||||
|
const QString &filepath,
|
||||||
|
const QRectF &rect,
|
||||||
|
const int &colorcode)
|
||||||
|
{
|
||||||
|
drawArcEllipse(
|
||||||
|
filepath,
|
||||||
|
rect.topLeft().x() * xScale,
|
||||||
|
sheetHeight - (rect.topLeft().y() * yScale),
|
||||||
|
rect.width() * xScale,
|
||||||
|
rect.height() * yScale,
|
||||||
|
0, 360, 0, 0, 0, colorcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawRectangle
|
||||||
|
Convenience function for draw rectangle
|
||||||
|
@param filepath
|
||||||
|
@param rect
|
||||||
|
@param colorcode
|
||||||
|
*/
|
||||||
|
void Createdxf::drawRectangle(
|
||||||
|
const QString &filepath,
|
||||||
|
const QRectF &rect,
|
||||||
|
const int &colorcode) {
|
||||||
|
//QPolygonF poly(scaleRect(rect));
|
||||||
|
QPolygonF poly(rect);
|
||||||
|
drawPolyline(filepath,poly,colorcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawPolygon
|
||||||
|
Convenience function for draw polygon
|
||||||
|
@param filepath
|
||||||
|
@param poly
|
||||||
|
@param colorcode
|
||||||
|
*/
|
||||||
|
void Createdxf::drawPolygon(
|
||||||
|
const QString &filepath,
|
||||||
|
const QPolygonF &poly,
|
||||||
|
const int &colorcode)
|
||||||
|
{
|
||||||
|
QPolygonF pg = poly;
|
||||||
|
if(!poly.isClosed()) {
|
||||||
|
pg << poly.at(0); // Close it
|
||||||
|
}
|
||||||
|
drawPolyline(filepath,pg,colorcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Createdxf::drawText
|
||||||
|
draw simple text in dxf format without any alignment specified
|
||||||
|
@param fileName
|
||||||
|
@param text
|
||||||
|
@param point
|
||||||
|
@param height
|
||||||
|
@param rotation
|
||||||
|
@param colour
|
||||||
|
@param xScaleW=1
|
||||||
|
*/
|
||||||
|
void Createdxf::drawText(
|
||||||
|
const QString& fileName,
|
||||||
|
const QString& text,
|
||||||
|
QPointF point,
|
||||||
|
double height,
|
||||||
|
double rotation,
|
||||||
|
int colour,
|
||||||
|
double xScaleW)
|
||||||
|
{
|
||||||
|
qreal x = point.x() * xScale;
|
||||||
|
qreal y = sheetHeight - (point.y() * yScale);
|
||||||
|
drawText(fileName,text,x,y,height * yScale,rotation,colour,xScaleW);
|
||||||
|
}
|
||||||
|
void Createdxf::drawArcEllipse(
|
||||||
|
const QString &file_path,
|
||||||
|
QRectF rect,
|
||||||
|
qreal startAngle,
|
||||||
|
qreal spanAngle,
|
||||||
|
QPointF hotspot,
|
||||||
|
qreal rotation_angle,
|
||||||
|
const int &colorcode)
|
||||||
|
{
|
||||||
|
qreal x = rect.x() * xScale;
|
||||||
|
qreal y = sheetHeight - rect.y() * yScale;
|
||||||
|
qreal w = rect.width() * xScale;
|
||||||
|
qreal h = rect.height() * yScale;
|
||||||
|
qreal hotspot_x = hotspot.x() * xScale;
|
||||||
|
qreal hotspot_y = sheetHeight - hotspot.y() * yScale;
|
||||||
|
drawArcEllipse(file_path,x,y,w,h,startAngle,spanAngle,hotspot_x,hotspot_y,rotation_angle,colorcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utility functions
|
||||||
|
*/
|
||||||
|
static QRectF scaleRect(QRectF rect)
|
||||||
|
{
|
||||||
|
QRectF ro(rect.bottomLeft().x() * Createdxf::xScale,
|
||||||
|
Createdxf::sheetHeight - (rect.bottomLeft().y() * Createdxf::yScale),
|
||||||
|
rect.width() * Createdxf::xScale,
|
||||||
|
rect.height() * Createdxf::yScale);
|
||||||
|
return ro;
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ class Createdxf
|
|||||||
double,
|
double,
|
||||||
double,
|
double,
|
||||||
int);
|
int);
|
||||||
|
|
||||||
|
static void drawCircle(
|
||||||
|
const QString& ,
|
||||||
|
QPointF,
|
||||||
|
double,
|
||||||
|
int );
|
||||||
|
|
||||||
static void drawArc(
|
static void drawArc(
|
||||||
const QString&,
|
const QString&,
|
||||||
double x,
|
double x,
|
||||||
@@ -62,6 +69,15 @@ class Createdxf
|
|||||||
qreal rotation_angle,
|
qreal rotation_angle,
|
||||||
const int &colorcode);
|
const int &colorcode);
|
||||||
|
|
||||||
|
static void drawArcEllipse(
|
||||||
|
const QString &file_path,
|
||||||
|
QRectF rect,
|
||||||
|
qreal startAngle,
|
||||||
|
qreal spanAngle,
|
||||||
|
QPointF hotspot,
|
||||||
|
qreal rotation_angle,
|
||||||
|
const int &colorcode);
|
||||||
|
|
||||||
static void drawEllipse (const QString &filepath,
|
static void drawEllipse (const QString &filepath,
|
||||||
const QRectF &rect,
|
const QRectF &rect,
|
||||||
const int &colorcode);
|
const int &colorcode);
|
||||||
@@ -103,6 +119,14 @@ class Createdxf
|
|||||||
double,
|
double,
|
||||||
int,
|
int,
|
||||||
double xScale=1.0);
|
double xScale=1.0);
|
||||||
|
static void drawText(
|
||||||
|
const QString&,
|
||||||
|
const QString&,
|
||||||
|
QPointF,
|
||||||
|
double,
|
||||||
|
double,
|
||||||
|
int,
|
||||||
|
double xScale=1.0);
|
||||||
static void drawTextAligned(
|
static void drawTextAligned(
|
||||||
const QString& fileName,
|
const QString& fileName,
|
||||||
const QString& text,
|
const QString& text,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "diagramposition.h"
|
#include "diagramposition.h"
|
||||||
|
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
|
#include <QLocale>
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS)
|
||||||
#include <QSqlDriver>
|
#include <QSqlDriver>
|
||||||
@@ -161,7 +162,11 @@ void projectDataBase::addDiagram(Diagram *diagram)
|
|||||||
for (auto key : QETApp::diagramInfoKeys())
|
for (auto key : QETApp::diagramInfoKeys())
|
||||||
{
|
{
|
||||||
if (key == "date") {
|
if (key == "date") {
|
||||||
m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate));
|
m_insert_diagram_info_query.bindValue(
|
||||||
|
":date",
|
||||||
|
QLocale::system().toString(
|
||||||
|
infos.value("date").toDate(),
|
||||||
|
QLocale::ShortFormat));
|
||||||
} else {
|
} else {
|
||||||
auto value = infos.value(key);
|
auto value = infos.value(key);
|
||||||
auto bind = key.prepend(":");
|
auto bind = key.prepend(":");
|
||||||
@@ -419,7 +424,11 @@ void projectDataBase::populateDiagramInfoTable()
|
|||||||
for (auto key : QETApp::diagramInfoKeys())
|
for (auto key : QETApp::diagramInfoKeys())
|
||||||
{
|
{
|
||||||
if (key == "date") {
|
if (key == "date") {
|
||||||
m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate));
|
m_insert_diagram_info_query.bindValue(
|
||||||
|
":date",
|
||||||
|
QLocale::system().toString(
|
||||||
|
infos.value("date").toDate(),
|
||||||
|
QLocale::ShortFormat));
|
||||||
} else {
|
} else {
|
||||||
auto value = infos.value(key);
|
auto value = infos.value(key);
|
||||||
auto bind = key.prepend(":");
|
auto bind = key.prepend(":");
|
||||||
@@ -521,7 +530,7 @@ sqlite3 *projectDataBase::sqliteHandle(QSqlDatabase *db)
|
|||||||
{
|
{
|
||||||
//sqlite 3 lib isn't availlable for the moment on macosx
|
//sqlite 3 lib isn't availlable for the moment on macosx
|
||||||
//need some help to add sqlite3 lib on macosx compilation
|
//need some help to add sqlite3 lib on macosx compilation
|
||||||
#if Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#else
|
#else
|
||||||
sqlite3 *handle = nullptr;
|
sqlite3 *handle = nullptr;
|
||||||
@@ -553,7 +562,9 @@ void projectDataBase::exportDb(projectDataBase *db,
|
|||||||
if (caption_.isEmpty()) {
|
if (caption_.isEmpty()) {
|
||||||
caption_ = tr("Exporter la base de données interne du projet");
|
caption_ = tr("Exporter la base de données interne du projet");
|
||||||
}
|
}
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
return;
|
||||||
|
#else
|
||||||
auto dir_ = dir;
|
auto dir_ = dir;
|
||||||
if(dir_.isEmpty()) {
|
if(dir_.isEmpty()) {
|
||||||
dir_ = db->project()->filePath();
|
dir_ = db->project()->filePath();
|
||||||
@@ -593,4 +604,5 @@ void projectDataBase::exportDb(projectDataBase *db,
|
|||||||
file_db.close();
|
file_db.close();
|
||||||
}
|
}
|
||||||
QSqlDatabase::removeDatabase(connection_name);
|
QSqlDatabase::removeDatabase(connection_name);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,10 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "diagramcontext.h"
|
#include "diagramcontext.h"
|
||||||
#include <QRegExp>
|
|
||||||
#include "qet.h"
|
#include "qet.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QRegularExpressionMatch>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief DiagramContext::add
|
@brief DiagramContext::add
|
||||||
@@ -241,8 +242,9 @@ bool DiagramContext::stringLongerThan(const QString &a, const QString &b) {
|
|||||||
*/
|
*/
|
||||||
bool DiagramContext::keyIsAcceptable(const QString &key) const
|
bool DiagramContext::keyIsAcceptable(const QString &key) const
|
||||||
{
|
{
|
||||||
QRegExp re(DiagramContext::validKeyRegExp());
|
QRegularExpression re(DiagramContext::validKeyRegExp());
|
||||||
return(re.exactMatch(key));
|
QRegularExpressionMatch match =re.match(key);
|
||||||
|
return match.hasMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
QDebug operator <<(QDebug debug, const DiagramContext &context)
|
QDebug operator <<(QDebug debug, const DiagramContext &context)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) {
|
DiagramPosition::DiagramPosition(const QString &letter, unsigned int number) {
|
||||||
// purifie les lettres
|
// purifie les lettres
|
||||||
letter_ = letter.toUpper();
|
letter_ = letter.toUpper();
|
||||||
letter_.remove(QRegExp("[^A-Z]"));
|
letter_.remove(QRegularExpression("[^A-Z]"));
|
||||||
number_ = number;
|
number_ = number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#define DIAGRAM_POSITION_H
|
#define DIAGRAM_POSITION_H
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QRegExp>
|
|
||||||
/**
|
/**
|
||||||
This class stores the position of an electrical element on its parent diagram.
|
This class stores the position of an electrical element on its parent diagram.
|
||||||
While exact coordinates can be stored for convenience, the concept of diagram
|
While exact coordinates can be stored for convenience, the concept of diagram
|
||||||
|
|||||||
@@ -299,7 +299,9 @@ void DiagramPrintDialog::updatePrintTypeDialog()
|
|||||||
{
|
{
|
||||||
if (pdf_choice_ -> isChecked() && filepath.endsWith(".ps"))
|
if (pdf_choice_ -> isChecked() && filepath.endsWith(".ps"))
|
||||||
{
|
{
|
||||||
QRegExp re("\\.ps$", Qt::CaseInsensitive);
|
QRegularExpression re
|
||||||
|
("\\.ps$",
|
||||||
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
filepath.replace(re, ".pdf");
|
filepath.replace(re, ".pdf");
|
||||||
filepath_field_ -> setText(filepath);
|
filepath_field_ -> setText(filepath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include "elementscene.h"
|
#include "elementscene.h"
|
||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief CustomElementGraphicPart::CustomElementGraphicPart
|
@brief CustomElementGraphicPart::CustomElementGraphicPart
|
||||||
Default constructor.
|
Default constructor.
|
||||||
@@ -518,12 +520,12 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Check each pair of style
|
//Check each pair of style
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||||
foreach (QString style, styles)
|
foreach (QString style, styles)
|
||||||
{
|
{
|
||||||
if (!rx.exactMatch(style)) continue;
|
if (rx!=QRegularExpression(style)) continue;
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.namedCaptureGroups().at(1);
|
||||||
QString style_value = rx.cap(2);
|
QString style_value = rx.namedCaptureGroups().at(2);
|
||||||
if (style_name == "line-style")
|
if (style_name == "line-style")
|
||||||
{
|
{
|
||||||
if (style_value == "dashed") _linestyle = DashedStyle;
|
if (style_value == "dashed") _linestyle = DashedStyle;
|
||||||
|
|||||||
@@ -407,54 +407,6 @@ QPainterPath PartLine::shadowShape() const
|
|||||||
return (pps.createStroke(shape));
|
return (pps.createStroke(shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief PartLine::fourShapePoints
|
|
||||||
@return a list with the two points that delimite the line
|
|
||||||
+ the four points surrounding these two points
|
|
||||||
*/
|
|
||||||
QList<QPointF> PartLine::fourShapePoints() const
|
|
||||||
{
|
|
||||||
const qreal marge = 2.0;
|
|
||||||
|
|
||||||
QPointF a = m_line.p1();
|
|
||||||
QPointF b = m_line.p2();
|
|
||||||
|
|
||||||
QList<QPointF> result;
|
|
||||||
|
|
||||||
//Special case, the line is defined by one point
|
|
||||||
if (a == b)
|
|
||||||
{
|
|
||||||
result << QPointF(a.x() - marge, a.y() - marge);
|
|
||||||
result << QPointF(a.x() - marge, a.y() + marge);
|
|
||||||
result << QPointF(a.x() + marge, a.y() + marge);
|
|
||||||
result << QPointF(a.x() + marge, a.y() - marge);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//We calcule the vector AB : (xb-xa, yb-ya)
|
|
||||||
QPointF v_ab = b - a;
|
|
||||||
|
|
||||||
//And the distance AB: root of the coordinates of the vector squared
|
|
||||||
qreal ab = sqrt(pow(v_ab.x(), 2) + pow(v_ab.y(), 2));
|
|
||||||
|
|
||||||
//Next, we define the vector u(a, b) wich is equal to the vector AB divided
|
|
||||||
//by is length and multiplied by the length of marge.
|
|
||||||
QPointF u = v_ab / ab * marge;
|
|
||||||
|
|
||||||
//We define the vector v(-b, a) wich is perpendicular to AB
|
|
||||||
QPointF v(-u.y(), u.x());
|
|
||||||
QPointF m = -u + v; // we have vector M = -u + v
|
|
||||||
QPointF n = -u - v; // and vector N=-u-v
|
|
||||||
QPointF h = a + m; // H = A + M
|
|
||||||
QPointF k = a + n; // K = A + N
|
|
||||||
QPointF i = b - n; // I = B - N
|
|
||||||
QPointF j = b - m; // J = B - M
|
|
||||||
|
|
||||||
result << h << i << j << k;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartLine::firstEndCircleRect
|
@brief PartLine::firstEndCircleRect
|
||||||
@return the rectangle bordering the entirety of the first extremity
|
@return the rectangle bordering the entirety of the first extremity
|
||||||
@@ -491,35 +443,6 @@ QRectF PartLine::secondEndCircleRect() const
|
|||||||
return(end_rect);
|
return(end_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief PartLine::debugPaint
|
|
||||||
Display several composante of the drawing
|
|
||||||
-the bounding rect
|
|
||||||
-special points at each extremity
|
|
||||||
-the quadrature of the circle at each extremity, even if itself is an other type
|
|
||||||
@param painter
|
|
||||||
*/
|
|
||||||
void PartLine::debugPaint(QPainter *painter)
|
|
||||||
{
|
|
||||||
painter -> save();
|
|
||||||
painter -> setPen(Qt::gray);
|
|
||||||
painter -> drawRect(boundingRect());
|
|
||||||
|
|
||||||
painter -> setPen(Qt::green);
|
|
||||||
painter -> drawRect(firstEndCircleRect());
|
|
||||||
painter -> drawRect(secondEndCircleRect());
|
|
||||||
|
|
||||||
painter -> setPen(Qt::red);
|
|
||||||
|
|
||||||
foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length))
|
|
||||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
|
||||||
|
|
||||||
foreach(QPointF pointy, fourEndPoints(m_line.p2(), m_line.p1(), second_length))
|
|
||||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
|
||||||
|
|
||||||
painter -> restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief PartLine::boundingRect
|
@brief PartLine::boundingRect
|
||||||
@return the bounding rect of this part
|
@return the bounding rect of this part
|
||||||
|
|||||||
@@ -110,10 +110,8 @@ class PartLine : public CustomElementGraphicPart
|
|||||||
void removeHandler();
|
void removeHandler();
|
||||||
|
|
||||||
QPainterPath path() const;
|
QPainterPath path() const;
|
||||||
QList<QPointF> fourShapePoints() const;
|
|
||||||
QRectF firstEndCircleRect() const;
|
QRectF firstEndCircleRect() const;
|
||||||
QRectF secondEndCircleRect() const;
|
QRectF secondEndCircleRect() const;
|
||||||
void debugPaint(QPainter *);
|
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
Qet::EndType first_end;
|
Qet::EndType first_end;
|
||||||
|
|||||||
@@ -555,7 +555,10 @@ void QETElementEditor::setupInterface()
|
|||||||
m_tools_dock = new QDockWidget(tr("Informations", "dock title"), this);
|
m_tools_dock = new QDockWidget(tr("Informations", "dock title"), this);
|
||||||
m_tools_dock -> setObjectName("informations");
|
m_tools_dock -> setObjectName("informations");
|
||||||
m_tools_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
m_tools_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
m_tools_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_tools_dock -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
//m_tools_dock -> setMinimumWidth(380);
|
//m_tools_dock -> setMinimumWidth(380);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_tools_dock);
|
addDockWidget(Qt::RightDockWidgetArea, m_tools_dock);
|
||||||
m_tools_dock -> setWidget(m_tools_dock_stack);
|
m_tools_dock -> setWidget(m_tools_dock_stack);
|
||||||
@@ -564,7 +567,10 @@ void QETElementEditor::setupInterface()
|
|||||||
m_undo_dock = new QDockWidget(tr("Annulations", "dock title"), this);
|
m_undo_dock = new QDockWidget(tr("Annulations", "dock title"), this);
|
||||||
m_undo_dock -> setObjectName("undo");
|
m_undo_dock -> setObjectName("undo");
|
||||||
m_undo_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
m_undo_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_undo_dock -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
m_undo_dock -> setMinimumWidth(290);
|
m_undo_dock -> setMinimumWidth(290);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_undo_dock);
|
addDockWidget(Qt::RightDockWidgetArea, m_undo_dock);
|
||||||
QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this);
|
||||||
@@ -582,7 +588,10 @@ void QETElementEditor::setupInterface()
|
|||||||
m_parts_dock = new QDockWidget(tr("Parties", "dock title"), this);
|
m_parts_dock = new QDockWidget(tr("Parties", "dock title"), this);
|
||||||
m_parts_dock -> setObjectName("parts_list");
|
m_parts_dock -> setObjectName("parts_list");
|
||||||
m_parts_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
m_parts_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
m_parts_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_parts_dock -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
m_parts_dock -> setMinimumWidth(290);
|
m_parts_dock -> setMinimumWidth(290);
|
||||||
tabifyDockWidget(m_undo_dock, m_parts_dock);
|
tabifyDockWidget(m_undo_dock, m_parts_dock);
|
||||||
m_parts_dock -> setWidget(m_parts_list);
|
m_parts_dock -> setWidget(m_parts_list);
|
||||||
|
|||||||
@@ -378,12 +378,12 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p,
|
|||||||
updateForm();
|
updateForm();
|
||||||
|
|
||||||
auto main_layout = new QVBoxLayout();
|
auto main_layout = new QVBoxLayout();
|
||||||
main_layout -> setMargin(0);
|
main_layout -> setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
main_layout -> addWidget(new QLabel("<u>" + tr("Apparence :") + "</u> "));
|
||||||
|
|
||||||
outline_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
outline_color->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
filling_color->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
filling_color->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
auto grid_layout = new QGridLayout(this);
|
auto grid_layout = new QGridLayout(this);
|
||||||
grid_layout->addWidget(new QLabel(tr("Contour :")), 0,0, Qt::AlignRight);
|
grid_layout->addWidget(new QLabel(tr("Contour :")), 0,0, Qt::AlignRight);
|
||||||
grid_layout->addWidget(outline_color, 0, 1);
|
grid_layout->addWidget(outline_color, 0, 1);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
|
|
||||||
// disposition verticale
|
// disposition verticale
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
QVBoxLayout *vlayout = new QVBoxLayout(this);
|
||||||
vlayout -> setMargin(0);
|
vlayout -> setContentsMargins(0,0,0,0);
|
||||||
vlayout -> setSpacing(0);
|
vlayout -> setSpacing(0);
|
||||||
vlayout -> addWidget(filter_textfield);
|
vlayout -> addWidget(filter_textfield);
|
||||||
vlayout -> addWidget(elements_panel);
|
vlayout -> addWidget(elements_panel);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class QGraphicsItem;
|
class QGraphicsItem;
|
||||||
class DiagramTextItem;
|
class DiagramTextItem;
|
||||||
|
|||||||
@@ -443,18 +443,10 @@ void ExportDialog::generateDxf(
|
|||||||
|
|
||||||
//Add project elements (lines, rectangles, circles, texts) to dxf file
|
//Add project elements (lines, rectangles, circles, texts) to dxf file
|
||||||
if (epw -> exportProperties().draw_border) {
|
if (epw -> exportProperties().draw_border) {
|
||||||
double bx0 = Diagram::margin * Createdxf::xScale;
|
QRectF rect(Diagram::margin,Diagram::margin,width,height);
|
||||||
double by0 = Diagram::margin * Createdxf::yScale;
|
Createdxf::drawRectangle(file_path,rect,0);
|
||||||
Createdxf::drawRectangle(
|
|
||||||
file_path,
|
|
||||||
bx0,
|
|
||||||
-by0,
|
|
||||||
double(width)*Createdxf::xScale,
|
|
||||||
double(height)*Createdxf::yScale,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
diagram -> border_and_titleblock.drawDxf(file_path,
|
diagram -> border_and_titleblock.drawDxf(file_path, 0);
|
||||||
0);
|
|
||||||
|
|
||||||
// Build the lists of elements.
|
// Build the lists of elements.
|
||||||
QList<Element *> list_elements;
|
QList<Element *> list_elements;
|
||||||
@@ -503,9 +495,6 @@ void ExportDialog::generateDxf(
|
|||||||
qreal elem_pos_x = elmt -> pos().x();
|
qreal elem_pos_x = elmt -> pos().x();
|
||||||
qreal elem_pos_y = elmt -> pos().y();// - (diagram -> margin / 2);
|
qreal elem_pos_y = elmt -> pos().y();// - (diagram -> margin / 2);
|
||||||
|
|
||||||
qreal hotspot_x = (elem_pos_x) * Createdxf::xScale;
|
|
||||||
qreal hotspot_y = Createdxf::sheetHeight - (elem_pos_y) * Createdxf::yScale;
|
|
||||||
|
|
||||||
ElementPictureFactory::primitives primitives = ElementPictureFactory::instance()->getPrimitives(elmt->location());
|
ElementPictureFactory::primitives primitives = ElementPictureFactory::instance()->getPrimitives(elmt->location());
|
||||||
|
|
||||||
for(QGraphicsSimpleTextItem *text : primitives.m_texts)
|
for(QGraphicsSimpleTextItem *text : primitives.m_texts)
|
||||||
@@ -514,125 +503,82 @@ void ExportDialog::generateDxf(
|
|||||||
if (fontSize < 0)
|
if (fontSize < 0)
|
||||||
fontSize = text->font().pixelSize();
|
fontSize = text->font().pixelSize();
|
||||||
|
|
||||||
fontSize *= Createdxf::yScale;
|
|
||||||
qreal x = elem_pos_x + text->pos().x();
|
qreal x = elem_pos_x + text->pos().x();
|
||||||
qreal y = elem_pos_y + text->pos().y();
|
qreal y = elem_pos_y + text->pos().y();
|
||||||
x *= Createdxf::xScale;
|
|
||||||
y = Createdxf::sheetHeight - (y * Createdxf::yScale);
|
|
||||||
|
|
||||||
qreal angle = text -> rotation() + rotation_angle;
|
qreal angle = text -> rotation() + rotation_angle;
|
||||||
qreal angler = angle * M_PI/180;
|
qreal angler = angle * M_PI/180;
|
||||||
int xdir = -sin(angler);
|
int xdir = -sin(angler);
|
||||||
int ydir = -cos(angler);
|
int ydir = -cos(angler);
|
||||||
|
|
||||||
QPointF transformed_point = rotation_transformed(x, y, hotspot_x, hotspot_y, rotation_angle);
|
QPointF transformed_point = rotation_transformed(x, y, elem_pos_x, elem_pos_y, -rotation_angle);
|
||||||
x = transformed_point.x() - ydir * fontSize * 0.5;
|
x = transformed_point.x() - ydir * fontSize * 0.5;
|
||||||
y = transformed_point.y() + xdir * fontSize * 0.5;
|
y = transformed_point.y() - xdir * fontSize * 0.5;
|
||||||
QStringList lines = text->text().split('\n');
|
QStringList lines = text->text().split('\n');
|
||||||
qreal offset = fontSize * 1.6;
|
qreal offset = fontSize * 1.6;
|
||||||
for (QString line : lines)
|
for (QString line : lines)
|
||||||
{
|
{
|
||||||
if (line.size() > 0 && line != "_" ) {
|
if (line.size() > 0 && line != "_" ) {
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, 360 - angle, 0, 0.72);
|
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360 - angle, 0, 0.72);
|
||||||
}
|
}
|
||||||
x += offset * xdir;
|
x += offset * xdir;
|
||||||
y += offset * ydir;
|
y -= offset * ydir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QLineF line : primitives.m_lines)
|
for (QLineF line : primitives.m_lines)
|
||||||
{
|
{
|
||||||
qreal x1 = (elem_pos_x + line.p1().x()) * Createdxf::xScale;
|
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + line.p1().y()) * Createdxf::yScale;
|
QLineF l = t.map(line);
|
||||||
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
Createdxf::drawLine(file_path, l, 0);
|
||||||
x1 = transformed_point.x();
|
|
||||||
y1 = transformed_point.y();
|
|
||||||
qreal x2 = (elem_pos_x + line.p2().x()) * Createdxf::xScale;
|
|
||||||
qreal y2 = Createdxf::sheetHeight - (elem_pos_y + line.p2().y()) * Createdxf::yScale;
|
|
||||||
transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x2 = transformed_point.x();
|
|
||||||
y2 = transformed_point.y();
|
|
||||||
Createdxf::drawLine(file_path, x1, y1, x2, y2, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QRectF rect : primitives.m_rectangles)
|
for (QRectF rect : primitives.m_rectangles)
|
||||||
{
|
{
|
||||||
qreal x1 = (elem_pos_x + rect.bottomLeft().x()) * Createdxf::xScale;
|
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + rect.bottomLeft().y()) * Createdxf::yScale;
|
QRectF r = t.mapRect(rect);
|
||||||
qreal w = rect.width() * Createdxf::xScale;
|
Createdxf::drawRectangle(file_path,r,0);
|
||||||
qreal h = rect.height() * Createdxf::yScale;
|
|
||||||
// opposite corner
|
|
||||||
qreal x2 = x1 + w;
|
|
||||||
qreal y2 = y1 + h;
|
|
||||||
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x1 = transformed_point.x();
|
|
||||||
y1 = transformed_point.y();
|
|
||||||
transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x2 = transformed_point.x();
|
|
||||||
y2 = transformed_point.y();
|
|
||||||
qreal bottom_left_x = (x1 < x2) ? x1 : x2;
|
|
||||||
qreal bottom_left_y = (y1 < y2) ? y1 : y2;
|
|
||||||
w = (x1 < x2) ? x2-x1 : x1-x2;
|
|
||||||
h = (y1 < y2) ? y2-y1 : y1-y2;
|
|
||||||
Createdxf::drawRectangle(file_path, bottom_left_x, bottom_left_y, w, h, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QRectF circle_rect : primitives.m_circles)
|
for (QRectF circle_rect : primitives.m_circles)
|
||||||
{
|
{
|
||||||
qreal x1 = (elem_pos_x + circle_rect.center().x()) * Createdxf::xScale;
|
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + circle_rect.center().y()) * Createdxf::yScale;
|
QPointF c = t.map(QPointF(circle_rect.center().x(),circle_rect.center().y()));
|
||||||
qreal r = circle_rect.width() * Createdxf::xScale / 2;
|
Createdxf::drawCircle(file_path,c,circle_rect.width()/2,0);
|
||||||
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x1 = transformed_point.x();
|
|
||||||
y1 = transformed_point.y();
|
|
||||||
Createdxf::drawCircle(file_path, r, x1, y1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QVector<QPointF> polygon : primitives.m_polygons)
|
for (QVector<QPointF> polygon : primitives.m_polygons)
|
||||||
{
|
{
|
||||||
if (polygon.size() == 0)
|
if (polygon.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
qreal x1 = (elem_pos_x + polygon.at(0).x()) * Createdxf::xScale;
|
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + polygon.at(0).y()) * Createdxf::yScale;
|
QPolygonF poly = t.map(polygon);
|
||||||
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
Createdxf::drawPolygon(file_path,poly,0);
|
||||||
x1 = transformed_point.x();
|
|
||||||
y1 = transformed_point.y();
|
|
||||||
for (int i = 1; i < polygon.size(); ++i ) {
|
|
||||||
qreal x2 = (elem_pos_x + polygon.at(i).x()) * Createdxf::xScale;
|
|
||||||
qreal y2 = Createdxf::sheetHeight - (elem_pos_y + polygon.at(i).y()) * Createdxf::yScale;
|
|
||||||
QPointF transformed_point = rotation_transformed(x2, y2, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x2 = transformed_point.x();
|
|
||||||
y2 = transformed_point.y();
|
|
||||||
Createdxf::drawLine(file_path, x1, y1, x2, y2, 0);
|
|
||||||
x1 = x2;
|
|
||||||
y1 = y2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw arcs and ellipses
|
// Draw arcs and ellipses
|
||||||
for (QVector<qreal> arc : primitives.m_arcs)
|
for (QVector<qreal> arc : primitives.m_arcs)
|
||||||
{
|
{
|
||||||
if (arc.size() == 0)
|
if (arc.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
qreal x = (elem_pos_x + arc.at(0)) * Createdxf::xScale;
|
qreal x = (elem_pos_x + arc.at(0));
|
||||||
qreal y = Createdxf::sheetHeight - (elem_pos_y + arc.at(1)) * Createdxf::yScale;
|
qreal y = (elem_pos_y + arc.at(1));
|
||||||
qreal w = arc.at(2) * Createdxf::xScale;
|
qreal w = arc.at(2);
|
||||||
qreal h = arc.at(3) * Createdxf::yScale;
|
qreal h = arc.at(3);
|
||||||
qreal startAngle = arc.at(4);
|
qreal startAngle = arc.at(4);
|
||||||
qreal spanAngle = arc .at(5);
|
qreal spanAngle = arc .at(5);
|
||||||
Createdxf::drawArcEllipse(file_path, x, y, w, h, startAngle, spanAngle, hotspot_x, hotspot_y, rotation_angle, 0);
|
QRectF r(x,y,w,h);
|
||||||
|
QPointF hotspot(elem_pos_x,elem_pos_y);
|
||||||
|
Createdxf::drawArcEllipse(file_path, r, startAngle, spanAngle, hotspot, rotation_angle, 0);
|
||||||
}
|
}
|
||||||
if (epw -> exportProperties().draw_terminals) {
|
if (epw -> exportProperties().draw_terminals) {
|
||||||
// Draw terminals
|
// Draw terminals
|
||||||
QList<Terminal *> list_terminals = elmt->terminals();
|
QList<Terminal *> list_terminals = elmt->terminals();
|
||||||
QColor col("red");
|
QColor col("red");
|
||||||
|
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
|
||||||
foreach(Terminal *tp, list_terminals) {
|
foreach(Terminal *tp, list_terminals) {
|
||||||
qreal x = (elem_pos_x + tp->dock_elmt_.x()) * Createdxf::xScale;
|
QPointF c = t.map(QPointF(tp->dock_elmt_.x(),tp->dock_elmt_.y()));
|
||||||
qreal y = Createdxf::sheetHeight - (elem_pos_y + tp->dock_elmt_.y()) * Createdxf::yScale;
|
Createdxf::drawCircle(file_path,c,3.0,Createdxf::dxfColor(col));
|
||||||
QPointF transformed_point = rotation_transformed(x, y, hotspot_x, hotspot_y, rotation_angle);
|
|
||||||
x = transformed_point.x();
|
|
||||||
y = transformed_point.y();
|
|
||||||
Createdxf::drawCircle(file_path, 3.0* Createdxf::xScale, x, y, Createdxf::dxfColor(col));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,31 +598,32 @@ void ExportDialog::generateDxf(
|
|||||||
Createdxf::drawPolyline(file_path,poly,0);
|
Createdxf::drawPolyline(file_path,poly,0);
|
||||||
//Draw conductor text item
|
//Draw conductor text item
|
||||||
ConductorTextItem *textItem = cond -> textItem();
|
ConductorTextItem *textItem = cond -> textItem();
|
||||||
if (textItem) {
|
|
||||||
qreal fontSize = textItem -> font().pointSizeF();
|
if (textItem) {
|
||||||
if (fontSize < 0)
|
qreal fontSize = textItem -> font().pointSizeF();
|
||||||
fontSize = textItem -> font().pixelSize();
|
if (fontSize < 0)
|
||||||
fontSize *= Createdxf::yScale;
|
fontSize = textItem -> font().pixelSize();
|
||||||
qreal angle = textItem -> rotation();
|
qreal angle = textItem -> rotation();
|
||||||
qreal angler = angle * M_PI/180;
|
qreal angler = angle * M_PI/180;
|
||||||
int xdir = -sin(angler);
|
int xdir = -sin(angler);
|
||||||
int ydir = -cos(angler);
|
int ydir = -cos(angler);
|
||||||
|
|
||||||
qreal x = (cond->pos().x() + textItem -> pos().x()) * Createdxf::xScale
|
qreal x = (cond->pos().x() + textItem -> pos().x())
|
||||||
+ xdir * fontSize * 1.8
|
+ xdir * fontSize * 1.8
|
||||||
- ydir * fontSize;
|
- ydir * fontSize;
|
||||||
qreal y = Createdxf::sheetHeight - ((cond->pos().y() + textItem -> pos().y()) * Createdxf::yScale)
|
qreal y = (cond->pos().y() + textItem -> pos().y())
|
||||||
+ ydir * fontSize * 1.8
|
- ydir * fontSize * 1.8
|
||||||
+ xdir * fontSize * 0.9;
|
- xdir * fontSize * 0.9;
|
||||||
QStringList lines = textItem->toPlainText().split('\n');
|
QStringList lines = textItem->toPlainText().split('\n');
|
||||||
qreal offset = fontSize * 1.6;
|
qreal offset = fontSize * 1.6;
|
||||||
foreach (QString line, lines) {
|
foreach (QString line, lines) {
|
||||||
if (line.size() > 0 && line != "_" )
|
if (line.size() > 0 && line != "_" )
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, 360-angle, 0, 0.72 );
|
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, 0, 0.72 );
|
||||||
x += offset * xdir;
|
x += offset * xdir;
|
||||||
y += offset * ydir;
|
y -= offset * ydir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the junctions
|
// Draw the junctions
|
||||||
QList<QPointF> junctions_list = cond->junctions();
|
QList<QPointF> junctions_list = cond->junctions();
|
||||||
if (!junctions_list.isEmpty()) {
|
if (!junctions_list.isEmpty()) {
|
||||||
@@ -687,30 +634,38 @@ void ExportDialog::generateDxf(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Draw text items
|
//Draw text items
|
||||||
foreach(DiagramTextItem *dti, list_texts) {
|
foreach(DiagramTextItem *dti, list_texts) {
|
||||||
qreal fontSize = dti -> font().pointSizeF();
|
qreal fontSize = dti -> font().pointSizeF();
|
||||||
if (fontSize < 0)
|
if (fontSize < 0)
|
||||||
fontSize = dti -> font().pixelSize();
|
fontSize = dti -> font().pixelSize();
|
||||||
fontSize *= Createdxf::yScale;
|
|
||||||
qreal angle = dti -> rotation();
|
qreal angle = dti -> rotation();
|
||||||
|
|
||||||
|
QGraphicsItem *parent = dti->parentItem();
|
||||||
|
while (parent) {
|
||||||
|
angle += parent->rotation();
|
||||||
|
parent = parent->parentItem();
|
||||||
|
}
|
||||||
|
|
||||||
qreal angler = angle * M_PI/180;
|
qreal angler = angle * M_PI/180;
|
||||||
int xdir = -sin(angler);
|
int xdir = -sin(angler);
|
||||||
int ydir = -cos(angler);
|
int ydir = -cos(angler);
|
||||||
qreal x = (dti->scenePos().x()) * Createdxf::xScale
|
qreal x = (dti->scenePos().x())
|
||||||
+ xdir * fontSize * 1.8
|
+ xdir * fontSize * 1.8
|
||||||
- ydir * fontSize;
|
- ydir * fontSize;
|
||||||
qreal y = Createdxf::sheetHeight - (dti->scenePos().y() * Createdxf::yScale)
|
qreal y = dti->scenePos().y()
|
||||||
+ ydir * fontSize * 1.8
|
- ydir * fontSize * 1.8
|
||||||
+ xdir * fontSize * 0.9;
|
- xdir * fontSize * 0.9;
|
||||||
QStringList lines = dti -> toPlainText().split('\n');
|
QStringList lines = dti -> toPlainText().split('\n');
|
||||||
qreal offset = fontSize * 1.6;
|
qreal offset = fontSize * 1.6;
|
||||||
foreach (QString line, lines) {
|
foreach (QString line, lines) {
|
||||||
if (line.size() > 0 && line != "_" )
|
if (line.size() > 0 && line != "_" )
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, 360-angle, 0, 0.72 );
|
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360-angle, Createdxf::dxfColor(dti->color()), 0.72 );
|
||||||
x += offset * xdir;
|
x += offset * xdir;
|
||||||
y += offset * ydir;
|
y -= offset * ydir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Createdxf::dxfEnd(file_path);
|
Createdxf::dxfEnd(file_path);
|
||||||
|
|
||||||
saveReloadDiagramParameters(diagram, false);
|
saveReloadDiagramParameters(diagram, false);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QAbstractTextDocumentLayout>
|
#include <QAbstractTextDocumentLayout>
|
||||||
#include <QGraphicsSimpleTextItem>
|
#include <QGraphicsSimpleTextItem>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
ElementPictureFactory* ElementPictureFactory::m_factory = nullptr;
|
||||||
|
|
||||||
@@ -568,11 +569,11 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
|
|||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
const QStringList styles = dom.attribute("style").split(";", Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
|
||||||
for (QString style : styles) {
|
for (QString style : styles) {
|
||||||
if (rx.exactMatch(style)) {
|
if (rx==QRegularExpression(style)) {
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.namedCaptureGroups().at(1);
|
||||||
QString style_value = rx.cap(2);
|
QString style_value = rx.namedCaptureGroups().at(2);
|
||||||
if (style_name == "line-style") {
|
if (style_name == "line-style") {
|
||||||
if (style_value == "dashed") pen.setStyle(Qt::DashLine);
|
if (style_value == "dashed") pen.setStyle(Qt::DashLine);
|
||||||
else if (style_value == "dotted") pen.setStyle(Qt::DotLine);
|
else if (style_value == "dotted") pen.setStyle(Qt::DotLine);
|
||||||
|
|||||||
@@ -77,26 +77,21 @@ PropertiesEditorWidget *PropertiesEditorFactory::propertiesEditor(
|
|||||||
PropertiesEditorWidget *editor,
|
PropertiesEditorWidget *editor,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
{
|
{
|
||||||
int count_ = items.size();
|
const int count_ = items.size();
|
||||||
|
if (count_ == 0) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
QGraphicsItem *item = items.first();
|
||||||
|
const int type_ = item->type();
|
||||||
|
|
||||||
//The editor widget can only edit one item
|
//The editor widget can only edit one item
|
||||||
//or several items of the same type
|
//or several items of the same type
|
||||||
if (count_ != 1)
|
for (auto qgi : items) {
|
||||||
{
|
if (qgi->type() != type_) {
|
||||||
if (count_ == 0) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int type_ = items.first()->type();
|
|
||||||
for (QGraphicsItem *qgi : items) {
|
|
||||||
if (qgi->type() != type_) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsItem *item = items.first();
|
|
||||||
const int type_ = item->type();
|
|
||||||
QString class_name;
|
QString class_name;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
class_name = editor->metaObject()->className();
|
class_name = editor->metaObject()->className();
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ int main(int argc, char **argv)
|
|||||||
my_ma->send_info_to_debug();
|
my_ma->send_info_to_debug();
|
||||||
delete my_ma;
|
delete my_ma;
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <QMetaEnum>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "xrefproperties.h"
|
#include "xrefproperties.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include <QMetaEnum>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief XRefProperties::XRefProperties
|
@brief XRefProperties::XRefProperties
|
||||||
|
|||||||
@@ -18,8 +18,10 @@
|
|||||||
#ifndef XREFPROPERTIES_H
|
#ifndef XREFPROPERTIES_H
|
||||||
#define XREFPROPERTIES_H
|
#define XREFPROPERTIES_H
|
||||||
|
|
||||||
#include "propertiesinterface.h"
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
|
#include "propertiesinterface.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief The XRefProperties class
|
@brief The XRefProperties class
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Permet de convertir une chaine de caracteres ("n", "s", "e" ou "w")
|
Permet de convertir une chaine de caracteres ("n", "s", "e" ou "w")
|
||||||
@@ -475,7 +476,7 @@ QStringList QET::splitWithSpaces(const QString &string) {
|
|||||||
// = avec un nombre nul ou pair de backslashes devant
|
// = avec un nombre nul ou pair de backslashes devant
|
||||||
|
|
||||||
#pragma message("@TODO remove code for QT 5.14 or later")
|
#pragma message("@TODO remove code for QT 5.14 or later")
|
||||||
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "),
|
QStringList escaped_strings = string.split(QRegularExpression("[^\\]?(?:\\\\)* "),
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
QString
|
QString
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -33,14 +33,14 @@
|
|||||||
#include "projectview.h"
|
#include "projectview.h"
|
||||||
#include "elementpicturefactory.h"
|
#include "elementpicturefactory.h"
|
||||||
#include "aboutqetdialog.h"
|
#include "aboutqetdialog.h"
|
||||||
|
#include "factory/elementfactory.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define QUOTE(x) STRINGIFY(x)
|
#define QUOTE(x) STRINGIFY(x)
|
||||||
#define STRINGIFY(x) #x
|
#define STRINGIFY(x) #x
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
#include "factory/elementfactory.h"
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <KAutoSaveFile>
|
#include <KAutoSaveFile>
|
||||||
|
|
||||||
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
#ifdef QET_ALLOW_OVERRIDE_CED_OPTION
|
||||||
@@ -911,7 +911,7 @@ QStringList QETApp::handledFileExtensions()
|
|||||||
if (!ext.count()) {
|
if (!ext.count()) {
|
||||||
ext << "qet";
|
ext << "qet";
|
||||||
ext << "elmt";
|
ext << "elmt";
|
||||||
ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegExp("^\\."));
|
ext << QString(TITLEBLOCKS_FILE_EXTENSION).remove(QRegularExpression("^\\."));
|
||||||
}
|
}
|
||||||
return(ext);
|
return(ext);
|
||||||
}
|
}
|
||||||
@@ -2102,10 +2102,10 @@ template <class T> void QETApp::addWindowsListToMenu(
|
|||||||
or -1 if none could be found.
|
or -1 if none could be found.
|
||||||
*/
|
*/
|
||||||
int QETApp::projectIdFromString(const QString &url) {
|
int QETApp::projectIdFromString(const QString &url) {
|
||||||
QRegExp embedded("^project([0-9]+)\\+embed.*$", Qt::CaseInsensitive);
|
QRegularExpression embedded("^project([0-9]+)\\+embed.*$", QRegularExpression::CaseInsensitiveOption);
|
||||||
if (embedded.exactMatch(url)) {
|
if (embedded==QRegularExpression(url)) {
|
||||||
bool conv_ok = false;
|
bool conv_ok = false;
|
||||||
int project_id = embedded.capturedTexts().at(1).toInt(&conv_ok);
|
int project_id = embedded.namedCaptureGroups().at(1).toInt(&conv_ok);
|
||||||
if (conv_ok) {
|
if (conv_ok) {
|
||||||
return(project_id);
|
return(project_id);
|
||||||
}
|
}
|
||||||
@@ -2227,10 +2227,10 @@ void QETApp::checkBackupFiles()
|
|||||||
for(const KAutoSaveFile *kasf : stale_files)
|
for(const KAutoSaveFile *kasf : stale_files)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//Remove the first character '/' before the name of the drive
|
//Remove the first character '/' before the name of the drive
|
||||||
text.append("<br>" + kasf->managedFile().path().remove(0,1));
|
text.append("<br>" + kasf->managedFile().path().remove(0,1));
|
||||||
#else
|
#else
|
||||||
text.append("<br>" + kasf->managedFile().path());
|
text.append("<br>" + kasf->managedFile().path());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2319,12 +2319,12 @@ void QETApp::fetchWindowStats(
|
|||||||
bool QETApp::eventFiltrer(QObject *object, QEvent *e) {
|
bool QETApp::eventFiltrer(QObject *object, QEvent *e) {
|
||||||
// gere l'ouverture de fichiers (sous MacOs)
|
// gere l'ouverture de fichiers (sous MacOs)
|
||||||
if (e -> type() == QEvent::FileOpen) {
|
if (e -> type() == QEvent::FileOpen) {
|
||||||
// nom du fichier a ouvrir
|
// nom du fichier a ouvrir
|
||||||
QString filename = static_cast<QFileOpenEvent *>(e) -> file();
|
QString filename = static_cast<QFileOpenEvent *>(e) -> file();
|
||||||
openFiles(QStringList() << filename);
|
openFiles(QStringList() << filename);
|
||||||
return(true);
|
return(true);
|
||||||
} else {
|
} else {
|
||||||
return QObject::eventFilter(object, e);
|
return QObject::eventFilter(object, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -149,7 +149,10 @@ void QETDiagramEditor::setUpElementsPanel()
|
|||||||
|
|
||||||
qdw_pa -> setObjectName ("projects panel");
|
qdw_pa -> setObjectName ("projects panel");
|
||||||
qdw_pa -> setAllowedAreas (Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
qdw_pa -> setAllowedAreas (Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
qdw_pa -> setFeatures (QDockWidget::AllDockWidgetFeatures);
|
qdw_pa -> setFeatures (
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
qdw_pa -> setMinimumWidth (160);
|
qdw_pa -> setMinimumWidth (160);
|
||||||
qdw_pa -> setWidget (pa = new ElementsPanelWidget(qdw_pa));
|
qdw_pa -> setWidget (pa = new ElementsPanelWidget(qdw_pa));
|
||||||
|
|
||||||
@@ -179,7 +182,10 @@ void QETDiagramEditor::setUpElementsCollectionWidget()
|
|||||||
m_qdw_elmt_collection = new QDockWidget(tr("Collections"), this);
|
m_qdw_elmt_collection = new QDockWidget(tr("Collections"), this);
|
||||||
m_qdw_elmt_collection->setObjectName("elements_collection_widget");
|
m_qdw_elmt_collection->setObjectName("elements_collection_widget");
|
||||||
m_qdw_elmt_collection->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
m_qdw_elmt_collection->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
m_qdw_elmt_collection->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_qdw_elmt_collection->setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
|
|
||||||
m_element_collection_widget = new ElementsCollectionWidget(m_qdw_elmt_collection);
|
m_element_collection_widget = new ElementsCollectionWidget(m_qdw_elmt_collection);
|
||||||
m_qdw_elmt_collection->setWidget(m_element_collection_widget);
|
m_qdw_elmt_collection->setWidget(m_element_collection_widget);
|
||||||
@@ -205,7 +211,10 @@ void QETDiagramEditor::setUpUndoStack()
|
|||||||
qdw_undo -> setObjectName("diagram_undo");
|
qdw_undo -> setObjectName("diagram_undo");
|
||||||
|
|
||||||
qdw_undo -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
qdw_undo -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
qdw_undo -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
qdw_undo -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
qdw_undo -> setMinimumWidth(160);
|
qdw_undo -> setMinimumWidth(160);
|
||||||
qdw_undo -> setWidget(undo_view);
|
qdw_undo -> setWidget(undo_view);
|
||||||
|
|
||||||
@@ -231,7 +240,10 @@ void QETDiagramEditor::setUpAutonumberingWidget()
|
|||||||
{
|
{
|
||||||
m_autonumbering_dock = new AutoNumberingDockWidget(this);
|
m_autonumbering_dock = new AutoNumberingDockWidget(this);
|
||||||
m_autonumbering_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
m_autonumbering_dock -> setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
m_autonumbering_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
m_autonumbering_dock -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, m_autonumbering_dock);
|
addDockWidget(Qt::RightDockWidgetArea, m_autonumbering_dock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
#ifndef ELEMENT_H
|
#ifndef ELEMENT_H
|
||||||
#define ELEMENT_H
|
#define ELEMENT_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <QPicture>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "qet.h"
|
#include "qet.h"
|
||||||
#include "qetgraphicsitem.h"
|
#include "qetgraphicsitem.h"
|
||||||
#include "diagramcontext.h"
|
#include "diagramcontext.h"
|
||||||
@@ -25,9 +29,6 @@
|
|||||||
#include "elementslocation.h"
|
#include "elementslocation.h"
|
||||||
#include "nameslist.h"
|
#include "nameslist.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <QPicture>
|
|
||||||
|
|
||||||
class QETProject;
|
class QETProject;
|
||||||
class Terminal;
|
class Terminal;
|
||||||
class Conductor;
|
class Conductor;
|
||||||
|
|||||||
@@ -965,30 +965,28 @@ bool QetShapeItem::toDXF(const QString &filepath,const QPen &pen)
|
|||||||
switch (m_shapeType)
|
switch (m_shapeType)
|
||||||
{
|
{
|
||||||
case Line:
|
case Line:
|
||||||
Createdxf::drawLine(filepath,
|
Createdxf::drawLine(filepath,
|
||||||
QLineF(mapToScene(m_P1),
|
QLineF( mapToScene(m_P1),
|
||||||
mapToScene(m_P2)),
|
mapToScene(m_P2)),
|
||||||
Createdxf::getcolorCode(pen.color().red(),
|
Createdxf::dxfColor(pen));
|
||||||
pen.color().green(),
|
return true;
|
||||||
pen.color().blue()));
|
|
||||||
return true;
|
|
||||||
case Rectangle:
|
case Rectangle:
|
||||||
Createdxf::drawRectangle(filepath,
|
Createdxf::drawRectangle(filepath,
|
||||||
QRectF(mapToScene(m_P1),
|
QRectF(mapToScene(m_P1),
|
||||||
mapToScene(m_P2)).normalized(),
|
mapToScene(m_P2)).normalized(),
|
||||||
Createdxf::getcolorCode(pen.color().red(),
|
Createdxf::dxfColor(pen));
|
||||||
pen.color().green(),
|
return true;
|
||||||
pen.color().blue()));
|
|
||||||
return true;
|
|
||||||
case Ellipse:
|
case Ellipse:
|
||||||
Createdxf::drawEllipse (filepath,
|
Createdxf::drawEllipse(filepath,
|
||||||
QRectF(mapToScene(m_P1),
|
QRectF(mapToScene(m_P1),
|
||||||
mapToScene(m_P2)).normalized(),
|
mapToScene(m_P2)).normalized(),
|
||||||
Createdxf::getcolorCode(pen.color().red(),
|
Createdxf::dxfColor(pen));
|
||||||
pen.color().green(),
|
return true;
|
||||||
pen.color().blue()));
|
case Polygon:
|
||||||
return true;
|
Createdxf::drawPolygon(filepath,m_polygon,Createdxf::dxfColor(pen));
|
||||||
default: return false;
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,12 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "qetinformation.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
|
#include "qetinformation.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETInformation::titleblockInfoKeys
|
@brief QETInformation::titleblockInfoKeys
|
||||||
@return all available key for use with a titleblock
|
@return all available key for use with a titleblock
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define QETINFORMATION_H
|
#define QETINFORMATION_H
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
namespace QETInformation
|
namespace QETInformation
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,13 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <utility>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
@@ -30,11 +37,6 @@
|
|||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
#include "assignvariables.h"
|
#include "assignvariables.h"
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <utility>
|
|
||||||
#include <QtConcurrent>
|
|
||||||
|
|
||||||
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -934,13 +936,17 @@ QETResult QETProject::write()
|
|||||||
return(error_message);
|
return(error_message);
|
||||||
|
|
||||||
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
||||||
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));
|
m_project_properties.addValue(
|
||||||
|
"saveddate",
|
||||||
|
QDate::currentDate().toString(
|
||||||
|
QLocale::system().toString(
|
||||||
|
QLocale::ShortFormat)));
|
||||||
m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm"));
|
m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm"));
|
||||||
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName());
|
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName());
|
||||||
m_project_properties.addValue("savedfilepath", filePath());
|
m_project_properties.addValue("savedfilepath", filePath());
|
||||||
|
|
||||||
emit(projectInformationsChanged(this));
|
emit(projectInformationsChanged(this));
|
||||||
updateDiagramsFolioData();
|
updateDiagramsFolioData();
|
||||||
|
|
||||||
setModified(false);
|
setModified(false);
|
||||||
return(QETResult());
|
return(QETResult());
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
#ifndef QET_PROJECT_H
|
#ifndef QET_PROJECT_H
|
||||||
#define QET_PROJECT_H
|
#define QET_PROJECT_H
|
||||||
|
|
||||||
|
#include <KAutoSaveFile>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "nameslist.h"
|
#include "nameslist.h"
|
||||||
#include "elementslocation.h"
|
#include "elementslocation.h"
|
||||||
#include "borderproperties.h"
|
#include "borderproperties.h"
|
||||||
@@ -28,8 +31,6 @@
|
|||||||
#include "projectdatabase.h"
|
#include "projectdatabase.h"
|
||||||
#include "reportproperties.h"
|
#include "reportproperties.h"
|
||||||
|
|
||||||
#include <KAutoSaveFile>
|
|
||||||
|
|
||||||
class Diagram;
|
class Diagram;
|
||||||
class ElementsLocation;
|
class ElementsLocation;
|
||||||
class QETResult;
|
class QETResult;
|
||||||
|
|||||||
@@ -16,12 +16,15 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "qetregexpvalidator.h"
|
#include "qetregexpvalidator.h"
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@param parent QObject parent
|
@param parent QObject parent
|
||||||
*/
|
*/
|
||||||
QETRegExpValidator::QETRegExpValidator(QObject *parent) : QRegExpValidator(parent) {
|
QETRegExpValidator::QETRegExpValidator(QObject *parent)
|
||||||
|
: QRegularExpressionValidator(parent)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +32,10 @@ QETRegExpValidator::QETRegExpValidator(QObject *parent) : QRegExpValidator(paren
|
|||||||
@param regexp Expression reguliere a valider
|
@param regexp Expression reguliere a valider
|
||||||
@param parent QObject parent
|
@param parent QObject parent
|
||||||
*/
|
*/
|
||||||
QETRegExpValidator::QETRegExpValidator(const QRegExp ®exp, QObject *parent) : QRegExpValidator(regexp, parent) {
|
QETRegExpValidator::QETRegExpValidator(
|
||||||
|
const QRegularExpression ®exp, QObject *parent) :
|
||||||
|
QRegularExpressionValidator(regexp, parent)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,13 +46,15 @@ QETRegExpValidator::~QETRegExpValidator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@see QRegExpValidator::validate
|
@see QRegularExpressionValidator::validate
|
||||||
@see validationFailed()
|
@see validationFailed()
|
||||||
Emet le signal validationFailed si la validation echoue
|
Emet le signal validationFailed si la validation echoue
|
||||||
*/
|
*/
|
||||||
QValidator::State QETRegExpValidator::validate(QString &input, int &pos) const
|
QValidator::State QETRegExpValidator::validate(QString &input, int &pos) const
|
||||||
{
|
{
|
||||||
QValidator::State result = QRegExpValidator::validate(input, pos);
|
QValidator::State result = QRegularExpressionValidator::validate(
|
||||||
if (result == QValidator::Invalid) emit(validationFailed());
|
input, pos);
|
||||||
|
if (result == QValidator::Invalid)
|
||||||
|
emit(validationFailed());
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,18 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef QET_REGEXP_VALIDATOR_H
|
#ifndef QET_REGEXP_VALIDATOR_H
|
||||||
#define QET_REGEXP_VALIDATOR_H
|
#define QET_REGEXP_VALIDATOR_H
|
||||||
#include <QRegExpValidator>
|
#include <QRegularExpressionValidator>
|
||||||
/**
|
/**
|
||||||
This class acts like a QRegExpValidator except it emits a signal when the
|
This class acts like a QRegularExpressionValidator
|
||||||
input validation fails.
|
except it emits a signal when the input validation fails.
|
||||||
*/
|
*/
|
||||||
class QETRegExpValidator : public QRegExpValidator {
|
class QETRegExpValidator : public QRegularExpressionValidator {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// constructors, destructor
|
// constructors, destructor
|
||||||
public:
|
public:
|
||||||
QETRegExpValidator(QObject *);
|
QETRegExpValidator(QObject *);
|
||||||
QETRegExpValidator(const QRegExp &, QObject *);
|
QETRegExpValidator(const QRegularExpression &, QObject *);
|
||||||
~QETRegExpValidator() override;
|
~QETRegExpValidator() override;
|
||||||
private:
|
private:
|
||||||
QETRegExpValidator(const QETRegExpValidator &);
|
QETRegExpValidator(const QETRegExpValidator &);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include "qfilenameedit.h"
|
#include "qfilenameedit.h"
|
||||||
#include "qetregexpvalidator.h"
|
#include "qetregexpvalidator.h"
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +36,7 @@ QFileNameEdit::QFileNameEdit(QWidget *parent) : QLineEdit(parent) {
|
|||||||
*/
|
*/
|
||||||
QFileNameEdit::QFileNameEdit(const QString &contents, QWidget *parent) : QLineEdit(parent) {
|
QFileNameEdit::QFileNameEdit(const QString &contents, QWidget *parent) : QLineEdit(parent) {
|
||||||
init();
|
init();
|
||||||
if (!contents.isEmpty() && regexp_.exactMatch(contents)) {
|
if (!contents.isEmpty() && regexp_==QRegularExpression(contents)) {
|
||||||
setText(contents);
|
setText(contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ bool QFileNameEdit::isEmpty()
|
|||||||
*/
|
*/
|
||||||
bool QFileNameEdit::isValid()
|
bool QFileNameEdit::isValid()
|
||||||
{
|
{
|
||||||
return(regexp_.exactMatch(text()));
|
return(regexp_==QRegularExpression(text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,7 +69,7 @@ bool QFileNameEdit::isValid()
|
|||||||
*/
|
*/
|
||||||
void QFileNameEdit::init()
|
void QFileNameEdit::init()
|
||||||
{
|
{
|
||||||
regexp_ = QRegExp("^[0-9a-z_\\-\\.]+$", Qt::CaseSensitive);
|
regexp_ = QRegularExpression("^[0-9a-z_\\-\\.]+$");
|
||||||
validator_ = new QETRegExpValidator(regexp_, this);
|
validator_ = new QETRegExpValidator(regexp_, this);
|
||||||
setValidator(validator_);
|
setValidator(validator_);
|
||||||
tooltip_text_ = QString(
|
tooltip_text_ = QString(
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
#ifndef Q_FILENAME_EDIT_H
|
#ifndef Q_FILENAME_EDIT_H
|
||||||
#define Q_FILENAME_EDIT_H
|
#define Q_FILENAME_EDIT_H
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QRegularExpression>
|
||||||
class QETRegExpValidator;
|
class QETRegExpValidator;
|
||||||
/**
|
/**
|
||||||
This class represents a textfield dedicated to input a portable filename (not
|
This class represents a textfield dedicated to input a portable filename (not
|
||||||
@@ -54,7 +54,7 @@ class QFileNameEdit : public QLineEdit {
|
|||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
QRegExp regexp_;
|
QRegularExpression regexp_;
|
||||||
QETRegExpValidator *validator_;
|
QETRegExpValidator *validator_;
|
||||||
QString tooltip_text_;
|
QString tooltip_text_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -507,7 +507,10 @@ void QETTitleBlockTemplateEditor::initWidgets()
|
|||||||
|
|
||||||
undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title"));
|
undo_dock_widget_ = new QDockWidget(tr("Annulations", "dock title"));
|
||||||
undo_dock_widget_ -> setObjectName("tbt_undo_dock");
|
undo_dock_widget_ -> setObjectName("tbt_undo_dock");
|
||||||
undo_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
undo_dock_widget_ -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
undo_dock_widget_ -> setWidget(undo_view_);
|
undo_dock_widget_ -> setWidget(undo_view_);
|
||||||
undo_dock_widget_ -> setMinimumWidth(290);
|
undo_dock_widget_ -> setMinimumWidth(290);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, undo_dock_widget_);
|
addDockWidget(Qt::RightDockWidgetArea, undo_dock_widget_);
|
||||||
@@ -526,7 +529,10 @@ void QETTitleBlockTemplateEditor::initWidgets()
|
|||||||
template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_);
|
template_cell_editor_widget_ = new TitleBlockTemplateCellWidget(tb_template_);
|
||||||
template_cell_editor_dock_widget_ = new QDockWidget(tr("Propriétés de la cellule", "dock title"), this);
|
template_cell_editor_dock_widget_ = new QDockWidget(tr("Propriétés de la cellule", "dock title"), this);
|
||||||
template_cell_editor_dock_widget_ -> setObjectName("tbt_celleditor_dock");
|
template_cell_editor_dock_widget_ -> setObjectName("tbt_celleditor_dock");
|
||||||
template_cell_editor_dock_widget_ -> setFeatures(QDockWidget::AllDockWidgetFeatures);
|
template_cell_editor_dock_widget_ -> setFeatures(
|
||||||
|
QDockWidget::DockWidgetClosable
|
||||||
|
|QDockWidget::DockWidgetMovable
|
||||||
|
|QDockWidget::DockWidgetFloatable);
|
||||||
template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_);
|
template_cell_editor_dock_widget_ -> setWidget(template_cell_editor_widget_);
|
||||||
template_cell_editor_dock_widget_ -> setMinimumWidth(180);
|
template_cell_editor_dock_widget_ -> setMinimumWidth(180);
|
||||||
template_cell_editor_dock_widget_ -> setMinimumHeight(250);
|
template_cell_editor_dock_widget_ -> setMinimumHeight(250);
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include "templatescollection.h"
|
#include "templatescollection.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
// make this class usable with QVariant
|
// make this class usable with QVariant
|
||||||
int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType<TitleBlockTemplateLocation>("TitleBlockTemplateLocation");
|
int TitleBlockTemplateLocation::MetaTypeId = qRegisterMetaType<TitleBlockTemplateLocation>("TitleBlockTemplateLocation");
|
||||||
|
|
||||||
@@ -98,9 +100,9 @@ bool TitleBlockTemplateLocation::isValid() const
|
|||||||
void TitleBlockTemplateLocation::fromString(const QString &loc_str) {
|
void TitleBlockTemplateLocation::fromString(const QString &loc_str) {
|
||||||
collection_ = QETApp::titleBlockTemplatesCollection(QUrl(loc_str).scheme());
|
collection_ = QETApp::titleBlockTemplatesCollection(QUrl(loc_str).scheme());
|
||||||
|
|
||||||
QRegExp name_from_url("^[^:]*:\\/\\/(.*)$");
|
QRegularExpression name_from_url("^[^:]*:\\/\\/(.*)$");
|
||||||
if (name_from_url.exactMatch(loc_str)) {
|
if (name_from_url==QRegularExpression(loc_str)) {
|
||||||
name_ = name_from_url.capturedTexts().at(1);
|
name_ = name_from_url.namedCaptureGroups().at(1);
|
||||||
} else {
|
} else {
|
||||||
name_ = QString();
|
name_ = QString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@param parent Parent QObject
|
@param parent Parent QObject
|
||||||
@@ -408,7 +410,7 @@ QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) c
|
|||||||
QStringList TitleBlockTemplatesFilesCollection::templates()
|
QStringList TitleBlockTemplatesFilesCollection::templates()
|
||||||
{
|
{
|
||||||
QStringList templates_names;
|
QStringList templates_names;
|
||||||
QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
QRegularExpression replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
||||||
foreach(QString name, dir_.entryList()) {
|
foreach(QString name, dir_.entryList()) {
|
||||||
templates_names << name.replace(replace_regexp, "");
|
templates_names << name.replace(replace_regexp, "");
|
||||||
}
|
}
|
||||||
@@ -544,7 +546,7 @@ bool TitleBlockTemplatesFilesCollection::isReadOnly(const QString &template_name
|
|||||||
@return the template name for \a file_name
|
@return the template name for \a file_name
|
||||||
*/
|
*/
|
||||||
QString TitleBlockTemplatesFilesCollection::toTemplateName(const QString &file_name) {
|
QString TitleBlockTemplatesFilesCollection::toTemplateName(const QString &file_name) {
|
||||||
static QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
static QRegularExpression replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
||||||
QString template_name(file_name);
|
QString template_name(file_name);
|
||||||
return(template_name.replace(replace_regexp, ""));
|
return(template_name.replace(replace_regexp, ""));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
// uncomment the line below to get more debug information
|
// uncomment the line below to get more debug information
|
||||||
//#define TITLEBLOCK_TEMPLATE_DEBUG
|
//#define TITLEBLOCK_TEMPLATE_DEBUG
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QRegularExpressionMatch>
|
||||||
/**
|
/**
|
||||||
@brief TitleBlockTemplate::TitleBlockTemplate
|
@brief TitleBlockTemplate::TitleBlockTemplate
|
||||||
Constructor
|
Constructor
|
||||||
@@ -386,7 +388,9 @@ bool TitleBlockTemplate::loadGrid(const QDomElement &xml_element) {
|
|||||||
void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
||||||
rows_heights_.clear();
|
rows_heights_.clear();
|
||||||
// parse the rows attribute: we expect a serie of absolute heights
|
// parse the rows attribute: we expect a serie of absolute heights
|
||||||
QRegExp row_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
|
QRegularExpression row_size_format
|
||||||
|
("^([0-9]+)(?:px)?$",
|
||||||
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
@@ -398,10 +402,11 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
|||||||
rows_string.split(QChar(';'), Qt::SkipEmptyParts);
|
rows_string.split(QChar(';'), Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
foreach (QString rows_description, rows_descriptions) {
|
foreach (QString rows_description, rows_descriptions) {
|
||||||
if (row_size_format.exactMatch(rows_description)) {
|
QRegularExpressionMatch match;
|
||||||
|
match = row_size_format.match(rows_description);
|
||||||
|
if (match.hasMatch()) {
|
||||||
int row_size =
|
int row_size =
|
||||||
row_size_format.capturedTexts().at(1).toInt(
|
match.captured(1).toInt(&conv_ok);
|
||||||
&conv_ok);
|
|
||||||
if (conv_ok)
|
if (conv_ok)
|
||||||
rows_heights_ << row_size;
|
rows_heights_ << row_size;
|
||||||
}
|
}
|
||||||
@@ -420,8 +425,12 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
|||||||
void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
||||||
columns_width_.clear();
|
columns_width_.clear();
|
||||||
// parse the cols attribute: we expect a serie of absolute or relative widths
|
// parse the cols attribute: we expect a serie of absolute or relative widths
|
||||||
QRegExp abs_col_size_format("^([0-9]+)(?:px)?$", Qt::CaseInsensitive);
|
QRegularExpression abs_col_size_format,rel_col_size_format;
|
||||||
QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive);
|
abs_col_size_format.setPattern("^([0-9]+)(?:px)?$");
|
||||||
|
abs_col_size_format.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||||
|
//QRegExp rel_col_size_format("^([rt])([0-9]+)%$", Qt::CaseInsensitive);
|
||||||
|
rel_col_size_format.setPattern("^([rt])([0-9]+)%$");
|
||||||
|
rel_col_size_format.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||||
@@ -433,18 +442,18 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
|||||||
cols_string.split(QChar(';'), Qt::SkipEmptyParts);
|
cols_string.split(QChar(';'), Qt::SkipEmptyParts);
|
||||||
#endif
|
#endif
|
||||||
foreach (QString cols_description, cols_descriptions) {
|
foreach (QString cols_description, cols_descriptions) {
|
||||||
if (abs_col_size_format.exactMatch(cols_description)) {
|
QRegularExpressionMatch match_abc,match_rel;
|
||||||
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
|
match_abc = abs_col_size_format.match(cols_description);
|
||||||
|
match_rel = rel_col_size_format.match(cols_description);
|
||||||
|
if (match_abc.hasMatch()) {
|
||||||
|
int col_size = match_abc.captured(1).toInt(&conv_ok);
|
||||||
if (conv_ok)
|
if (conv_ok)
|
||||||
columns_width_ << TitleBlockDimension(
|
columns_width_ << TitleBlockDimension(
|
||||||
col_size,
|
col_size,
|
||||||
QET::Absolute);
|
QET::Absolute);
|
||||||
} else if (rel_col_size_format.exactMatch(cols_description)) {
|
} else if (match_rel.hasMatch()) {
|
||||||
int col_size =
|
int col_size = match_rel.captured(2).toInt(&conv_ok);
|
||||||
rel_col_size_format.capturedTexts().at(2).toInt(
|
QET::TitleBlockColumnLength col_type = match_rel.captured(1)
|
||||||
&conv_ok);
|
|
||||||
QET::TitleBlockColumnLength col_type =
|
|
||||||
rel_col_size_format.capturedTexts().at(1)
|
|
||||||
== "t"
|
== "t"
|
||||||
? QET::RelativeToTotalLength
|
? QET::RelativeToTotalLength
|
||||||
: QET::RelativeToRemainingLength;
|
: QET::RelativeToRemainingLength;
|
||||||
@@ -1825,14 +1834,15 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter,
|
|||||||
@param h
|
@param h
|
||||||
@param color
|
@param color
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
|
void TitleBlockTemplate::renderTextCellDxf(
|
||||||
const QString &text,
|
QString &file_path,
|
||||||
const TitleBlockCell &cell,
|
const QString &text,
|
||||||
qreal x,
|
const TitleBlockCell &cell,
|
||||||
qreal y,
|
qreal x,
|
||||||
qreal w,
|
qreal y,
|
||||||
qreal h,
|
qreal w,
|
||||||
int color) const
|
qreal h,
|
||||||
|
int color) const
|
||||||
{
|
{
|
||||||
if (text.isEmpty()) return;
|
if (text.isEmpty()) return;
|
||||||
QFont text_font = TitleBlockTemplate::fontForCell(cell);
|
QFont text_font = TitleBlockTemplate::fontForCell(cell);
|
||||||
@@ -1841,61 +1851,73 @@ void TitleBlockTemplate::renderTextCellDxf(QString &file_path,
|
|||||||
textHeight = text_font.pixelSize();
|
textHeight = text_font.pixelSize();
|
||||||
|
|
||||||
qreal x2 = x + w;
|
qreal x2 = x + w;
|
||||||
qreal y1 = y;
|
qreal y1 = y;
|
||||||
|
|
||||||
int vAlign = 0;
|
int vAlign = 0;
|
||||||
int hAlign = 0;
|
int hAlign = 0;
|
||||||
|
|
||||||
x2 = x; // default
|
x2 = x; // default
|
||||||
|
|
||||||
if ( cell.alignment & Qt::AlignTop ) {
|
if ( cell.alignment & Qt::AlignTop )
|
||||||
vAlign = 3;
|
{
|
||||||
y1 = y + h - (textHeight*Createdxf::yScale / 8);
|
vAlign = 3;
|
||||||
} else if ( cell.alignment & Qt::AlignVCenter ) {
|
y1 = y + h - (textHeight*Createdxf::yScale / 8);
|
||||||
vAlign = 2;
|
}
|
||||||
y1 = y + h/2;
|
else if ( cell.alignment & Qt::AlignVCenter )
|
||||||
} else if ( cell.alignment & Qt::AlignBottom ) {
|
{
|
||||||
y1 = y + (textHeight*Createdxf::yScale / 8);
|
vAlign = 2;
|
||||||
}
|
y1 = y + h/2;
|
||||||
|
}
|
||||||
|
else if ( cell.alignment & Qt::AlignBottom )
|
||||||
|
{
|
||||||
|
y1 = y + (textHeight*Createdxf::yScale / 8);
|
||||||
|
}
|
||||||
|
|
||||||
if ( cell.alignment & Qt::AlignRight ) {
|
if ( cell.alignment & Qt::AlignRight )
|
||||||
|
{
|
||||||
hAlign = 2;
|
hAlign = 2;
|
||||||
x2 = x + w;
|
x2 = x + w;
|
||||||
} else if ( cell.alignment & Qt::AlignHCenter ) {
|
}
|
||||||
|
else if ( cell.alignment & Qt::AlignHCenter )
|
||||||
|
{
|
||||||
hAlign = 1;
|
hAlign = 1;
|
||||||
x2 = x + w/2;
|
x2 = x + w/2;
|
||||||
} else if (cell.alignment & Qt::AlignJustify ) {
|
}
|
||||||
|
else if (cell.alignment & Qt::AlignJustify )
|
||||||
|
{
|
||||||
hAlign = 5;
|
hAlign = 5;
|
||||||
vAlign = 0;
|
vAlign = 0;
|
||||||
x2 = x + w;
|
x2 = x + w;
|
||||||
y1 = y + textHeight*Createdxf::yScale / 8;
|
y1 = y + textHeight*Createdxf::yScale / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//painter.setFont(text_font);
|
//painter.setFont(text_font);
|
||||||
qreal ratio = 1.0;
|
qreal ratio = 1.0;
|
||||||
|
|
||||||
if (cell.hadjust) {
|
if (cell.hadjust)
|
||||||
// Scale font width to fit string in cell width w
|
{
|
||||||
// As DXF font aspect ratio is implementation dependent we add a fudge-factor based on tests with AutoCAD
|
// Scale font width to fit string in cell width w
|
||||||
int len = text.length() * textHeight * Createdxf::xScale * 1.2;
|
// As DXF font aspect ratio is implementation dependent we add a fudge-factor based on tests with AutoCAD
|
||||||
|
int len = text.length() * textHeight * Createdxf::xScale * 1.2;
|
||||||
|
|
||||||
if(len > w)
|
if(len > w)
|
||||||
ratio = (w/len);
|
ratio = (w/len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// x offset value below currently set heuristically based on appearance...
|
// x offset value below currently set heuristically based on appearance...
|
||||||
Createdxf::drawTextAligned(file_path,
|
Createdxf::drawTextAligned(
|
||||||
text,
|
file_path,
|
||||||
x - 2*Createdxf::xScale,
|
text,
|
||||||
y1,
|
x - 2*Createdxf::xScale,
|
||||||
textHeight*Createdxf::yScale,
|
y1,
|
||||||
0,
|
textHeight*Createdxf::yScale,
|
||||||
0,
|
0,
|
||||||
hAlign,
|
0,
|
||||||
vAlign,
|
hAlign,
|
||||||
x2,
|
vAlign,
|
||||||
ratio,
|
x2,
|
||||||
color);
|
ratio,
|
||||||
|
color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2019,7 +2041,8 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) {
|
|||||||
@param cell :
|
@param cell :
|
||||||
Potentially spanning cell
|
Potentially spanning cell
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell) {
|
void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell)
|
||||||
|
{
|
||||||
if (!cell || (!cell -> row_span && !cell -> col_span)) return;
|
if (!cell || (!cell -> row_span && !cell -> col_span)) return;
|
||||||
if (cell -> span_state == TitleBlockCell::Disabled) return;
|
if (cell -> span_state == TitleBlockCell::Disabled) return;
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#include "diagramcontextwidget.h"
|
#include "diagramcontextwidget.h"
|
||||||
#include "ui_diagramcontextwidget.h"
|
#include "ui_diagramcontextwidget.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
DiagramContextWidget::DiagramContextWidget(QWidget *parent) :
|
DiagramContextWidget::DiagramContextWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::DiagramContextWidget)
|
ui(new Ui::DiagramContextWidget)
|
||||||
@@ -118,7 +120,7 @@ void DiagramContextWidget::clear()
|
|||||||
*/
|
*/
|
||||||
int DiagramContextWidget::highlightNonAcceptableKeys()
|
int DiagramContextWidget::highlightNonAcceptableKeys()
|
||||||
{
|
{
|
||||||
static QRegExp re(DiagramContext::validKeyRegExp());
|
static QRegularExpression re(DiagramContext::validKeyRegExp());
|
||||||
|
|
||||||
QBrush fg_brush = ui->m_table->palette().brush(QPalette::WindowText);
|
QBrush fg_brush = ui->m_table->palette().brush(QPalette::WindowText);
|
||||||
|
|
||||||
@@ -133,7 +135,7 @@ int DiagramContextWidget::highlightNonAcceptableKeys()
|
|||||||
bool highlight = false;
|
bool highlight = false;
|
||||||
if (!qtwi_name -> text().isEmpty())
|
if (!qtwi_name -> text().isEmpty())
|
||||||
{
|
{
|
||||||
if (!re.exactMatch(qtwi_name -> text()))
|
if (re!=QRegularExpression(qtwi_name -> text()))
|
||||||
{
|
{
|
||||||
highlight = true;
|
highlight = true;
|
||||||
++ invalid_keys;
|
++ invalid_keys;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#define DYNAMICELEMENTTEXTMODEL_H
|
#define DYNAMICELEMENTTEXTMODEL_H
|
||||||
|
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include <qstyleditemdelegate.h>
|
#include <qstyleditemdelegate.h>
|
||||||
#include "dynamicelementtextitem.h"
|
#include "dynamicelementtextitem.h"
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#ifndef LINKSINGLEELEMENTWIDGET_H
|
#ifndef LINKSINGLEELEMENTWIDGET_H
|
||||||
#define LINKSINGLEELEMENTWIDGET_H
|
#define LINKSINGLEELEMENTWIDGET_H
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "abstractelementpropertieseditorwidget.h"
|
#include "abstractelementpropertieseditorwidget.h"
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "abstractelementpropertieseditorwidget.h"
|
#include "abstractelementpropertieseditorwidget.h"
|
||||||
|
|
||||||
class Element;
|
class Element;
|
||||||
|
|||||||
@@ -15,13 +15,16 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "multipastedialog.h"
|
#include "multipastedialog.h"
|
||||||
#include "ui_multipastedialog.h"
|
#include "ui_multipastedialog.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
|
MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
|||||||
@@ -15,11 +15,14 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "potentialselectordialog.h"
|
#include "potentialselectordialog.h"
|
||||||
#include "ui_potentialselectordialog.h"
|
#include "ui_potentialselectordialog.h"
|
||||||
#include "conductor.h"
|
#include "conductor.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include <QRadioButton>
|
|
||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "shapegraphicsitempropertieswidget.h"
|
#include "shapegraphicsitempropertieswidget.h"
|
||||||
#include "ui_shapegraphicsitempropertieswidget.h"
|
#include "ui_shapegraphicsitempropertieswidget.h"
|
||||||
#include "qetshapeitem.h"
|
#include "qetshapeitem.h"
|
||||||
|
|||||||
@@ -15,12 +15,14 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "xrefpropertieswidget.h"
|
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QMetaEnum>
|
||||||
|
|
||||||
|
#include "xrefpropertieswidget.h"
|
||||||
#include "ui_xrefpropertieswidget.h"
|
#include "ui_xrefpropertieswidget.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include <QMetaEnum>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief XRefPropertiesWidget::XRefPropertiesWidget
|
@brief XRefPropertiesWidget::XRefPropertiesWidget
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#define XREFPROPERTIESWIDGET_H
|
#define XREFPROPERTIESWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "properties/xrefproperties.h"
|
#include "properties/xrefproperties.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QDomElement>
|
#include <QDomElement>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class Element;
|
class Element;
|
||||||
class DynamicElementTextItem;
|
class DynamicElementTextItem;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#define DELETEQGRAPHICSITEMCOMMAND_H
|
#define DELETEQGRAPHICSITEMCOMMAND_H
|
||||||
|
|
||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
#include "diagramcontent.h"
|
#include "diagramcontent.h"
|
||||||
|
|
||||||
class Diagram;
|
class Diagram;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class Diagram;
|
class Diagram;
|
||||||
class ConductorTextItem;
|
class ConductorTextItem;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class ConductorTextItem;
|
class ConductorTextItem;
|
||||||
class Diagram;
|
class Diagram;
|
||||||
|
|||||||
Reference in New Issue
Block a user