mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 00:30:53 +01:00
Merge branch 'QT6' into master
initial release to Qt6 TODO: -remove KCoreAddons -remove KWidgetsAddons * QT6: (24 commits) QT6: No Qt::AA_EnableHighDpiScaling in QT6 QT6: TeDo mod QList for DeleteQGraphicsItemCommand QT6: Todo Fix QtConcurrent (remove KCoreAddons?) QT6: Todo QVariant::setValue QT6: std::min needs further tweaking QPrinting class needs further tweaking QT6: QStyleOptionGraphicsItem Add QActionGroup QT6: QStyleOptionGraphicsItem QT6: QLibraryInfo Totest QRegularExpression ok? QT6: QStyleOptionGraphicsItem QT6: QMouseEvent QT6: QDropEvent QT6: Fix deprecated QRegExp QT6: hooks added QT6: Mod unused function put in comments Add missing include QActionGroup QT6: set C++17 QT6: diagramitemweight set val to Font::Weight ...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
QT += core network
|
||||
CONFIG += c++11
|
||||
CONFIG += c++17
|
||||
|
||||
HEADERS += $$PWD/singleapplication.h \
|
||||
$$PWD/singleapplication_p.h
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
#include "singleapplication_p.h"
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -218,7 +218,22 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
|
||||
writeStream << blockServerName.toLatin1();
|
||||
writeStream << static_cast<quint8>(connectionType);
|
||||
writeStream << instanceNumber;
|
||||
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
quint16 checksum =
|
||||
qChecksum(
|
||||
initMsg.constData(),
|
||||
static_cast<quint32>(initMsg.length()));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
quint16 checksum =
|
||||
qChecksum(
|
||||
QByteArrayView(
|
||||
initMsg.constData(),
|
||||
static_cast<quint32>(initMsg.length())));
|
||||
#endif
|
||||
writeStream << checksum;
|
||||
|
||||
// The header indicates the message length that follows
|
||||
@@ -239,10 +254,21 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
|
||||
|
||||
quint16 SingleApplicationPrivate::blockChecksum()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
return qChecksum(
|
||||
static_cast <const char *>( memory->data() ),
|
||||
offsetof( InstancesInfo, checksum )
|
||||
);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
return qChecksum(
|
||||
QByteArrayView(
|
||||
static_cast <const char *>( memory->data() ),
|
||||
offsetof( InstancesInfo, checksum )));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
qint64 SingleApplicationPrivate::primaryPid()
|
||||
@@ -366,8 +392,21 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
|
||||
quint16 msgChecksum = 0;
|
||||
readStream >> msgChecksum;
|
||||
|
||||
const quint16 actualChecksum = qChecksum( msgBytes.constData(), static_cast<quint32>( msgBytes.length() - sizeof( quint16 ) ) );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
const quint16 actualChecksum =
|
||||
qChecksum(
|
||||
msgBytes.constData(),
|
||||
static_cast<quint32>( msgBytes.length() - sizeof( quint16 ) ) );
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
const quint16 actualChecksum =
|
||||
qChecksum(
|
||||
QByteArrayView(
|
||||
msgBytes.constData(),
|
||||
static_cast<quint32>(msgBytes.length() - sizeof(quint16))));
|
||||
#endif
|
||||
bool isValid = readStream.status() == QDataStream::Ok &&
|
||||
QLatin1String(latin1Name) == blockServerName &&
|
||||
msgChecksum == actualChecksum;
|
||||
|
||||
@@ -220,7 +220,7 @@ UI_SOURCES_DIR = sources/ui/
|
||||
UI_HEADERS_DIR = sources/ui/
|
||||
|
||||
# Configuration de la compilation
|
||||
CONFIG += c++11 debug_and_release warn_on
|
||||
CONFIG += c++17 debug_and_release warn_on
|
||||
|
||||
# Nom du binaire genere par la compilation
|
||||
TARGET = qelectrotech
|
||||
@@ -229,8 +229,8 @@ TARGET = qelectrotech
|
||||
unix:QMAKE_LIBS_THREAD -= -lpthread
|
||||
unix|win32: LIBS += -lsqlite3
|
||||
|
||||
# Enable C++11
|
||||
QMAKE_CXXFLAGS += -std=c++11
|
||||
# Enable C++17
|
||||
QMAKE_CXXFLAGS += -std=c++17
|
||||
|
||||
# Description de l'installation
|
||||
target.path = $$join(INSTALL_PREFIX,,,$${QET_BINARY_PATH})
|
||||
|
||||
@@ -144,11 +144,23 @@ bool ElementsLocation::operator!=(const ElementsLocation &other) const
|
||||
*/
|
||||
QString ElementsLocation::baseName() const
|
||||
{
|
||||
QRegExp regexp("^.*([^/]+)\\.elmt$");
|
||||
if (regexp.exactMatch(m_collection_path)) {
|
||||
return(regexp.capturedTexts().at(1));
|
||||
QRegularExpression regexp("^.*(?<name>[^/]+)\\.elmt$");
|
||||
if (!regexp.isValid())
|
||||
{
|
||||
qWarning() <<"this is an error in the code"
|
||||
<< regexp.errorString()
|
||||
<< regexp.patternErrorOffset();
|
||||
return QString();
|
||||
}
|
||||
return(QString());
|
||||
|
||||
QRegularExpressionMatch match = regexp.match(m_collection_path);
|
||||
if (!match.hasMatch())
|
||||
{
|
||||
qDebug()<<"no Match => return"
|
||||
<<m_collection_path;
|
||||
return QString();
|
||||
}
|
||||
return match.captured("name");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,9 +195,9 @@ QString ElementsLocation::projectCollectionPath() const
|
||||
return QString();
|
||||
else
|
||||
return QString("project"
|
||||
+ QString::number(QETApp::projectId(m_project))
|
||||
+ "+"
|
||||
+ collectionPath());
|
||||
+ QString::number(QETApp::projectId(m_project))
|
||||
+ "+"
|
||||
+ collectionPath());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +266,7 @@ void ElementsLocation::setPath(const QString &path)
|
||||
if (!match.hasMatch())
|
||||
{
|
||||
qDebug()<<"no Match => return"
|
||||
<<tmp_path;
|
||||
<<tmp_path;
|
||||
return;
|
||||
}
|
||||
bool conv_ok;
|
||||
@@ -344,7 +356,7 @@ bool ElementsLocation::addToPath(const QString &string)
|
||||
if (m_collection_path.endsWith(".elmt", Qt::CaseInsensitive))
|
||||
{
|
||||
qDebug() << "ElementsLocation::addToPath :"
|
||||
" Can't add string to the path of an element";
|
||||
" Can't add string to the path of an element";
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -368,12 +380,22 @@ bool ElementsLocation::addToPath(const QString &string)
|
||||
ElementsLocation ElementsLocation::parent() const
|
||||
{
|
||||
ElementsLocation copy(*this);
|
||||
QRegExp re1("^([a-z]+://)(.*)/*$");
|
||||
if (re1.exactMatch(m_collection_path)) {
|
||||
QString path_proto = re1.capturedTexts().at(1);
|
||||
QString path_path = re1.capturedTexts().at(2);
|
||||
QString parent_path = path_path.remove(QRegExp("/*[^/]+$"));
|
||||
copy.setPath(path_proto + parent_path);
|
||||
QRegularExpression re ("^(?<path_proto>[a-z]+://.*)/.*$");
|
||||
if (!re.isValid())
|
||||
{
|
||||
qWarning()
|
||||
<<QObject::tr("this is an error in the code")
|
||||
<< re.errorString()
|
||||
<< re.patternErrorOffset();
|
||||
}
|
||||
QRegularExpressionMatch match = re.match(m_collection_path);
|
||||
if (!match.hasMatch())
|
||||
{
|
||||
qDebug()
|
||||
<<"no Match => return"
|
||||
<<m_collection_path;
|
||||
}else {
|
||||
copy.setPath(match.captured("path_proto"));
|
||||
}
|
||||
return(copy);
|
||||
}
|
||||
@@ -700,7 +722,7 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
||||
if (xml_document.documentElement().tagName() != "definition")
|
||||
{
|
||||
qDebug() << "ElementsLocation::setXml :"
|
||||
" tag name of document element isn't 'definition'";
|
||||
" tag name of document element isn't 'definition'";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -734,6 +756,7 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
||||
//Element doesn't exist, we create the element
|
||||
else
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QString path_ = collectionPath(false);
|
||||
QRegExp rx ("^(.*)/(.*\\.elmt)$");
|
||||
|
||||
@@ -748,9 +771,14 @@ bool ElementsLocation::setXml(const QDomDocument &xml_document) const
|
||||
}
|
||||
else {
|
||||
qDebug() << "ElementsLocation::setXml :"
|
||||
" rx don't match";
|
||||
" rx don't match";
|
||||
}
|
||||
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +891,7 @@ QDebug operator<< (QDebug debug, const ElementsLocation &location)
|
||||
QString msg;
|
||||
msg += "ElementsLocation(";
|
||||
msg += (location.isProject()? location.projectCollectionPath()
|
||||
: location.collectionPath(true));
|
||||
: location.collectionPath(true));
|
||||
msg += location.exist()? ", true" : ", false";
|
||||
msg +=")";
|
||||
|
||||
|
||||
@@ -439,11 +439,11 @@ int Createdxf::getcolorCode (const long red, const long green, const long blue)
|
||||
}
|
||||
|
||||
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) {
|
||||
return Createdxf::dxfColor(pen.color());
|
||||
return Createdxf::dxfColor(pen.color());
|
||||
}
|
||||
|
||||
void Createdxf::drawArcEllipse(
|
||||
@@ -613,9 +613,9 @@ void Createdxf::drawRectangle (
|
||||
double height,
|
||||
const int &colour)
|
||||
{
|
||||
QRectF rect(x1,y1,width,height);
|
||||
QPolygonF poly(rect);
|
||||
drawPolyline(fileName,poly,colour,true);
|
||||
QRectF rect(x1,y1,width,height);
|
||||
QPolygonF poly(rect);
|
||||
drawPolyline(fileName,poly,colour,true);
|
||||
}
|
||||
|
||||
|
||||
@@ -678,16 +678,16 @@ void Createdxf::drawArc(
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Createdxf::drawText
|
||||
draw simple text in dxf format without any alignment specified
|
||||
@param fileName
|
||||
@param text
|
||||
@param x
|
||||
@param y
|
||||
@param height
|
||||
@param rotation
|
||||
@param colour
|
||||
@param xScaleW = 1
|
||||
@brief Createdxf::drawText
|
||||
draw simple text in dxf format without any alignment specified
|
||||
@param fileName
|
||||
@param text
|
||||
@param x
|
||||
@param y
|
||||
@param height
|
||||
@param rotation
|
||||
@param colour
|
||||
@param xScaleW = 1
|
||||
*/
|
||||
void Createdxf::drawText(
|
||||
const QString& fileName,
|
||||
@@ -699,40 +699,40 @@ void Createdxf::drawText(
|
||||
int colour,
|
||||
double xScaleW)
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
if (!file.open(QFile::Append)) {
|
||||
// error message
|
||||
QMessageBox errorFileOpen;
|
||||
errorFileOpen.setText("Error: File "+fileName+" was not written correctly.");
|
||||
errorFileOpen.setInformativeText("Close all Files and Re-Run");
|
||||
errorFileOpen.exec();
|
||||
// error message
|
||||
QMessageBox errorFileOpen;
|
||||
errorFileOpen.setText("Error: File "+fileName+" was not written correctly.");
|
||||
errorFileOpen.setInformativeText("Close all Files and Re-Run");
|
||||
errorFileOpen.exec();
|
||||
} else {
|
||||
QTextStream To_Dxf(&file);
|
||||
// Draw the text
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "TEXT" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
To_Dxf << 62 << "\r\n";
|
||||
To_Dxf << colour << "\r\n"; // Colour Code
|
||||
To_Dxf << 10 << "\r\n"; // XYZ
|
||||
To_Dxf << x << "\r\n"; // X in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 20 << "\r\n";
|
||||
To_Dxf << y << "\r\n"; // Y in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 30 << "\r\n";
|
||||
To_Dxf << 0.0 << "\r\n"; // Z in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 40 << "\r\n";
|
||||
To_Dxf << height << "\r\n"; // Text Height
|
||||
To_Dxf << 41 << "\r\n";
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << text << "\r\n"; // Text Value
|
||||
To_Dxf << 50 << "\r\n";
|
||||
To_Dxf << rotation << "\r\n"; // Text Rotation
|
||||
file.close();
|
||||
QTextStream To_Dxf(&file);
|
||||
// Draw the text
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "TEXT" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
To_Dxf << 62 << "\r\n";
|
||||
To_Dxf << colour << "\r\n"; // Colour Code
|
||||
To_Dxf << 10 << "\r\n"; // XYZ
|
||||
To_Dxf << x << "\r\n"; // X in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 20 << "\r\n";
|
||||
To_Dxf << y << "\r\n"; // Y in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 30 << "\r\n";
|
||||
To_Dxf << 0.0 << "\r\n"; // Z in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 40 << "\r\n";
|
||||
To_Dxf << height << "\r\n"; // Text Height
|
||||
To_Dxf << 41 << "\r\n";
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << text << "\r\n"; // Text Value
|
||||
To_Dxf << 50 << "\r\n";
|
||||
To_Dxf << rotation << "\r\n"; // Text Rotation
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* draw aligned text in DXF Format */
|
||||
@@ -778,7 +778,7 @@ void Createdxf::drawTextAligned(
|
||||
To_Dxf << 40 << "\r\n";
|
||||
To_Dxf << height << "\r\n"; // Text Height
|
||||
To_Dxf << 41 << "\r\n";
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << xScaleW << "\r\n"; // X Scale
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << text << "\r\n"; // Text Value
|
||||
To_Dxf << 50 << "\r\n";
|
||||
@@ -832,42 +832,42 @@ void Createdxf::drawPolyline(const QString &filepath,
|
||||
const QPolygonF &poly,
|
||||
const int &colorcode, bool preScaled)
|
||||
{
|
||||
qreal x,y;
|
||||
if (!filepath.isEmpty()) {
|
||||
qreal x,y;
|
||||
if (!filepath.isEmpty()) {
|
||||
QFile file(filepath);
|
||||
if (!file.open(QFile::Append)) {
|
||||
// error message
|
||||
QMessageBox errorFileOpen;
|
||||
errorFileOpen.setText("Error: File "+filepath+" was not written correctly.");
|
||||
errorFileOpen.setInformativeText("Close all Files and Re-Run");
|
||||
errorFileOpen.exec();
|
||||
// error message
|
||||
QMessageBox errorFileOpen;
|
||||
errorFileOpen.setText("Error: File "+filepath+" was not written correctly.");
|
||||
errorFileOpen.setInformativeText("Close all Files and Re-Run");
|
||||
errorFileOpen.exec();
|
||||
} else {
|
||||
QTextStream To_Dxf(&file);
|
||||
// Draw the Line
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "POLYLINE" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
To_Dxf << 62 << "\r\n";
|
||||
To_Dxf << colorcode << "\r\n"; // Colour Code
|
||||
To_Dxf << 66 << "\r\n";
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << 70 << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 10 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << 20 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << 30 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
foreach(QPointF p, poly)
|
||||
{
|
||||
QTextStream To_Dxf(&file);
|
||||
// Draw the Line
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "POLYLINE" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
To_Dxf << 62 << "\r\n";
|
||||
To_Dxf << colorcode << "\r\n"; // Colour Code
|
||||
To_Dxf << 66 << "\r\n";
|
||||
To_Dxf << 1 << "\r\n";
|
||||
To_Dxf << 70 << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 10 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << 20 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << 30 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n";
|
||||
foreach(QPointF p, poly)
|
||||
{
|
||||
if(preScaled) {
|
||||
x = p.x();
|
||||
y = p.y();
|
||||
x = p.x();
|
||||
y = p.y();
|
||||
} else {
|
||||
x = p.x() * xScale;
|
||||
y = sheetHeight - (p.y() * yScale);
|
||||
x = p.x() * xScale;
|
||||
y = sheetHeight - (p.y() * yScale);
|
||||
}
|
||||
|
||||
To_Dxf << 0 << "\r\n";
|
||||
@@ -882,16 +882,16 @@ void Createdxf::drawPolyline(const QString &filepath,
|
||||
To_Dxf << y << "\r\n"; // Y in UCS (User Coordinate System)coordinates
|
||||
To_Dxf << 30 << "\r\n";
|
||||
To_Dxf << 0.0 << "\r\n"; // Z in UCS (User Coordinate System)coordinates
|
||||
}
|
||||
}
|
||||
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "SEQEND" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
To_Dxf << 0 << "\r\n";
|
||||
To_Dxf << "SEQEND" << "\r\n";
|
||||
To_Dxf << 8 << "\r\n";
|
||||
To_Dxf << 0 << "\r\n"; // Layer number (default layer in autocad)
|
||||
|
||||
file.close();
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================
|
||||
@@ -951,7 +951,7 @@ void Createdxf::drawEllipse(
|
||||
const QRectF &rect,
|
||||
const int &colorcode)
|
||||
{
|
||||
drawArcEllipse(
|
||||
drawArcEllipse(
|
||||
filepath,
|
||||
rect.topLeft().x() * xScale,
|
||||
sheetHeight - (rect.topLeft().y() * yScale),
|
||||
@@ -961,38 +961,38 @@ void Createdxf::drawEllipse(
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Createdxf::drawRectangle
|
||||
Convenience function for draw rectangle
|
||||
@param filepath
|
||||
@param rect
|
||||
@param 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);
|
||||
//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
|
||||
@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()) {
|
||||
QPolygonF pg = poly;
|
||||
if(!poly.isClosed()) {
|
||||
pg << poly.at(0); // Close it
|
||||
}
|
||||
drawPolyline(filepath,pg,colorcode);
|
||||
}
|
||||
drawPolyline(filepath,pg,colorcode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1015,9 +1015,9 @@ void Createdxf::drawText(
|
||||
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);
|
||||
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,
|
||||
@@ -1028,23 +1028,23 @@ void Createdxf::drawArcEllipse(
|
||||
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);
|
||||
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;
|
||||
}
|
||||
//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;
|
||||
//}
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "changetitleblockcommand.h"
|
||||
#include "conductorcreator.h"
|
||||
|
||||
#include <QDropEvent>
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@param diagram Schema a afficher ; si diagram vaut 0, un nouveau Diagram est utilise
|
||||
@@ -200,7 +202,19 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), mapToScene(event->pos())));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
diagram()->setEventInterface(
|
||||
new DiagramEventAddElement(
|
||||
location, diagram(), mapToScene(event->pos())));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
diagram()->setEventInterface(
|
||||
new DiagramEventAddElement(
|
||||
location, diagram(), event->position()));
|
||||
#endif
|
||||
|
||||
//Set focus to the view to get event
|
||||
this->setFocus();
|
||||
}
|
||||
@@ -268,7 +282,19 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
iti -> setHtml (e -> mimeData() -> text());
|
||||
}
|
||||
|
||||
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(iti, m_diagram, mapToScene(e->pos())));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
m_diagram -> undoStack().push(
|
||||
new AddItemCommand<IndependentTextItem *>(
|
||||
iti, m_diagram, mapToScene(e->pos())));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
m_diagram -> undoStack().push(
|
||||
new AddItemCommand<IndependentTextItem *>(
|
||||
iti, m_diagram, e->position()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -423,7 +449,14 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
||||
|
||||
//Start drag view when hold the middle button
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
m_drag_last_pos = e->pos();
|
||||
viewport()->setCursor(Qt::ClosedHandCursor);
|
||||
@@ -473,7 +506,14 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||
|
||||
//Drag the view
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
@@ -534,7 +574,14 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||
|
||||
//Stop drag view
|
||||
if (e -> button() == Qt::MidButton)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
@@ -567,7 +614,15 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
});
|
||||
QMenu *menu = new QMenu(this);
|
||||
menu->addAction(act);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
menu->popup(e->globalPos());
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
menu->popup(e->pos());
|
||||
#endif
|
||||
}
|
||||
|
||||
m_free_rubberbanding = false;
|
||||
|
||||
@@ -373,7 +373,14 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
||||
@param e QMouseEvent decrivant l'evenement souris
|
||||
*/
|
||||
void ElementView::mousePressEvent(QMouseEvent *e) {
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
setCursor( (Qt::ClosedHandCursor));
|
||||
reference_view_ = e->pos();
|
||||
@@ -387,7 +394,14 @@ void ElementView::mousePressEvent(QMouseEvent *e) {
|
||||
Manage the event move mouse
|
||||
*/
|
||||
void ElementView::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
@@ -405,7 +419,15 @@ void ElementView::mouseMoveEvent(QMouseEvent *e) {
|
||||
Manage event release click mouse
|
||||
*/
|
||||
void ElementView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
if (e -> button() == Qt::MidButton) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (e->button() == Qt::MidButton)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (e->button() == Qt::MiddleButton)
|
||||
#endif
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
adjustSceneRect();
|
||||
return;
|
||||
|
||||
@@ -61,7 +61,14 @@ void PartArc::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
|
||||
//Always remove the brush
|
||||
painter -> setBrush(Qt::NoBrush);
|
||||
QPen t = painter -> pen();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
painter -> setPen(t);
|
||||
|
||||
if (isSelected())
|
||||
|
||||
@@ -55,8 +55,15 @@ void PartEllipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
||||
applyStylesToQPainter(*painter);
|
||||
|
||||
QPen t = painter -> pen();
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
if (isSelected())
|
||||
t.setColor(Qt::red);
|
||||
|
||||
|
||||
@@ -79,8 +79,15 @@ void PartLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
|
||||
applyStylesToQPainter(*painter);
|
||||
QPen t = painter -> pen();
|
||||
t.setJoinStyle(Qt::MiterJoin);
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
if (isSelected()) t.setColor(Qt::red);
|
||||
|
||||
painter -> setPen(t);
|
||||
|
||||
@@ -66,7 +66,14 @@ void PartPolygon::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
||||
applyStylesToQPainter(*painter);
|
||||
|
||||
QPen t = painter -> pen();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
if (isSelected()) t.setColor(Qt::red);
|
||||
painter -> setPen(t);
|
||||
|
||||
|
||||
@@ -51,8 +51,14 @@ void PartRectangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
|
||||
Q_UNUSED(widget);
|
||||
applyStylesToQPainter(*painter);
|
||||
QPen t = painter -> pen();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(options && options -> levelOfDetailFromTransform(painter->worldTransform()) < 1.0);
|
||||
#endif
|
||||
if (isSelected())
|
||||
t.setColor(Qt::red);
|
||||
|
||||
|
||||
@@ -62,37 +62,52 @@ const QDomElement PartTerminal::toXml(QDomDocument &xml_document) const
|
||||
|
||||
/**
|
||||
Dessine la borne
|
||||
@param p QPainter a utiliser pour rendre le dessin
|
||||
@param painter QPainter a utiliser pour rendre le dessin
|
||||
@param options Options pour affiner le rendu
|
||||
@param widget Widget sur lequel le rendu est effectue
|
||||
*/
|
||||
void PartTerminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidget *widget) {
|
||||
void PartTerminal::paint(
|
||||
QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *options,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
p -> save();
|
||||
painter -> save();
|
||||
|
||||
// annulation des renderhints
|
||||
p -> setRenderHint(QPainter::Antialiasing, false);
|
||||
p -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
|
||||
QPen t;
|
||||
t.setWidthF(1.0);
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
t.setCosmetic(options && options -> levelOfDetail < 1.0);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
t.setCosmetic(
|
||||
options
|
||||
&& options->levelOfDetailFromTransform(
|
||||
painter->worldTransform())
|
||||
< 1.0);
|
||||
#endif
|
||||
// dessin de la borne en rouge
|
||||
t.setColor(isSelected() ? Terminal::neutralColor : Qt::red);
|
||||
p -> setPen(t);
|
||||
p -> drawLine(QPointF(0.0, 0.0), d -> second_point);
|
||||
painter -> setPen(t);
|
||||
painter -> drawLine(QPointF(0.0, 0.0), d -> second_point);
|
||||
|
||||
// dessin du point d'amarrage au conducteur en bleu
|
||||
t.setColor(isSelected() ? Qt::red : Terminal::neutralColor);
|
||||
p -> setPen(t);
|
||||
p -> setBrush(Terminal::neutralColor);
|
||||
p -> drawPoint(QPointF(0.0, 0.0));
|
||||
p -> restore();
|
||||
painter -> setPen(t);
|
||||
painter -> setBrush(Terminal::neutralColor);
|
||||
painter -> drawPoint(QPointF(0.0, 0.0));
|
||||
painter -> restore();
|
||||
|
||||
if (m_hovered)
|
||||
drawShadowShape(p);
|
||||
drawShadowShape(painter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,7 +55,10 @@ class PartTerminal : public CustomElementGraphicPart {
|
||||
QString xmlName() const override { return(QString("terminal")); }
|
||||
void fromXml(const QDomElement &) override;
|
||||
const QDomElement toXml(QDomDocument &) const override;
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
|
||||
void paint(
|
||||
QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *,
|
||||
QWidget *) override;
|
||||
|
||||
QPainterPath shape() const override;
|
||||
QPainterPath shadowShape() const override {return shape();}
|
||||
|
||||
@@ -1471,7 +1471,14 @@ void QETElementEditor::slot_createPartsList()
|
||||
QString part_desc = cep -> name();
|
||||
QListWidgetItem *qlwi = new QListWidgetItem(part_desc);
|
||||
QVariant v;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
v.setValue<QGraphicsItem *>(qgi);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
qlwi -> setData(42, v);
|
||||
m_parts_list -> addItem(qlwi);
|
||||
qlwi -> setSelected(qgi -> isSelected());
|
||||
|
||||
@@ -46,9 +46,9 @@ void Machine_info::send_info_to_debug()
|
||||
{
|
||||
qInfo()<<"debugging enabled:"
|
||||
<< QLibraryInfo::isDebugBuild();
|
||||
|
||||
qInfo()<< "Qt library version:"
|
||||
<< QLibraryInfo::version();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
qInfo()<< "Qt library location default prefix:"
|
||||
<< QLibraryInfo::location(QLibraryInfo::PrefixPath);
|
||||
qInfo()<< "Qt library location documentation:"
|
||||
@@ -80,6 +80,43 @@ void Machine_info::send_info_to_debug()
|
||||
#ifndef Q_OS_WIN
|
||||
qInfo()<< "Qt library location Qt settings:"
|
||||
<< QLibraryInfo::location(QLibraryInfo::SettingsPath);
|
||||
#endif
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qInfo()<< "Qt library path default prefix:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::PrefixPath);
|
||||
qInfo()<< "Qt library path documentation:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::DocumentationPath);
|
||||
qInfo()<< "Qt library path headers:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::HeadersPath);
|
||||
qInfo()<< "Qt library path libraries:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::LibrariesPath);
|
||||
qInfo()<< "Qt library path executables:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath);
|
||||
qInfo()<< "Qt library path Qt binaries:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::BinariesPath);
|
||||
qInfo()<< "Qt library path Qt plugins:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::PluginsPath);
|
||||
// qInfo()<< "Qt library path installed QML extensions:"
|
||||
// << QLibraryInfo::path(QLibraryInfo::ImportsPath);
|
||||
qInfo()<< "Qt library path installed QML extensions:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath);
|
||||
qInfo()<< "Qt library path dependent Qt data:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::ArchDataPath);
|
||||
qInfo()<< "Qt library path independent Qt data:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::DataPath);
|
||||
qInfo()<< "Qt library path translation:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
qInfo()<< "Qt library path examples:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::ExamplesPath);
|
||||
qInfo()<< "Qt library path Qt testcases:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::TestsPath);
|
||||
#ifndef Q_OS_WIN
|
||||
qInfo()<< "Qt library path Qt settings:"
|
||||
<< QLibraryInfo::path(QLibraryInfo::SettingsPath);
|
||||
#endif
|
||||
#endif
|
||||
qInfo()<< "GitRevision " + QString(GIT_COMMIT_SHA);
|
||||
qInfo()<< "QElectroTech V " + QET::displayedVersion;
|
||||
@@ -224,11 +261,11 @@ void Machine_info::init_get_cpu_info_winnt()
|
||||
|
||||
QProcess wingpuraminfo;
|
||||
wingpuraminfo.start("wmic",
|
||||
QStringList()
|
||||
<< "PATH"
|
||||
<< "Win32_videocontroller"
|
||||
<< "get"
|
||||
<< "AdapterRAM ");
|
||||
QStringList()
|
||||
<< "PATH"
|
||||
<< "Win32_videocontroller"
|
||||
<< "get"
|
||||
<< "AdapterRAM ");
|
||||
wingpuraminfo.waitForFinished();
|
||||
QString WinGPURAMOutput = wingpuraminfo.readAllStandardOutput();
|
||||
pc.gpu.RAM=QString("RAM Total : %1 B").arg(
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
@param msg : Message
|
||||
*/
|
||||
void myMessageOutput(QtMsgType type,
|
||||
const QMessageLogContext &context,
|
||||
const QString &msg)
|
||||
const QMessageLogContext &context,
|
||||
const QString &msg)
|
||||
{
|
||||
|
||||
QString txt=QTime::currentTime().toString("hh:mm:ss.zzz");
|
||||
@@ -110,8 +110,8 @@ void myMessageOutput(QtMsgType type,
|
||||
txt+=")\n";
|
||||
}
|
||||
QFile outFile(QETApp::configDir()
|
||||
+QDate::currentDate().toString("yyyyMMdd")
|
||||
+".log");
|
||||
+QDate::currentDate().toString("yyyyMMdd")
|
||||
+".log");
|
||||
if(outFile.open(QIODevice::WriteOnly | QIODevice::Append))
|
||||
{
|
||||
QTextStream ts(&outFile);
|
||||
@@ -166,7 +166,13 @@ int main(int argc, char **argv)
|
||||
QCoreApplication::setApplicationName("QElectroTech");
|
||||
//Creation and execution of the application
|
||||
//HighDPI
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
#endif
|
||||
SingleApplication app(argc, argv, true);
|
||||
#ifdef Q_OS_MACOS
|
||||
//Handle the opening of QET when user double click on a .qet .elmt .tbt file
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
#include "qeticons.h"
|
||||
|
||||
#include <QPrintPreviewWidget>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
#include <QDesktopWidget>
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
#endif
|
||||
#include <QScreen>
|
||||
#include <QPainter>
|
||||
#include <QPageSetupDialog>
|
||||
@@ -45,7 +51,14 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QWidget *parent)
|
||||
}
|
||||
|
||||
auto printer_ = new QPrinter();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
printer_->setOrientation(QPrinter::Landscape);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
printer_->setDocName(doc_name);
|
||||
printer_->setOutputFileName(file_name);
|
||||
printer_->setCreator(QString("QElectroTech %1").arg(QET::displayedVersion));
|
||||
@@ -55,7 +68,14 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QWidget *parent)
|
||||
print_dialog.setWindowFlags(Qt::Sheet);
|
||||
#endif
|
||||
print_dialog.setWindowTitle(tr("Options d'impression", "window title"));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
print_dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintShowPageSize);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
if (print_dialog.exec() == QDialog::Rejected) {
|
||||
delete printer_;
|
||||
return;
|
||||
@@ -95,7 +115,7 @@ QString ProjectPrintWindow::docName(QETProject *project)
|
||||
* @param parent
|
||||
*/
|
||||
ProjectPrintWindow::ProjectPrintWindow(QETProject *project, QPrinter *printer, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::ProjectPrintWindow),
|
||||
m_project(project),
|
||||
m_printer(printer)
|
||||
@@ -213,8 +233,15 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
||||
diagram->render(painter, QRectF(), diagram_rect, Qt::KeepAspectRatio);
|
||||
} else {
|
||||
//Print on one or several pages
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
auto printed_rect = full_page ? printer->paperRect() : printer->pageRect();
|
||||
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) : printer->pageRect(QPrinter::Millimeter);
|
||||
#endif
|
||||
auto used_width = printed_rect.width();
|
||||
auto used_height = printed_rect.height();
|
||||
auto h_pages_count = horizontalPagesCount(diagram, option, full_page);
|
||||
@@ -231,9 +258,16 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
||||
auto x_offset = 0;
|
||||
for (auto j=0 ; j<h_pages_count ; ++j)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
page_grid.last() << QRect(QPoint(x_offset, y_offset),
|
||||
QSize(qMin(used_width, diagram_rect.width() - x_offset),
|
||||
qMin(used_height, diagram_rect.height() - y_offset)));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
x_offset += used_width;
|
||||
}
|
||||
y_offset += used_height;
|
||||
@@ -294,9 +328,18 @@ QRect ProjectPrintWindow::diagramRect(Diagram *diagram, const ExportProperties &
|
||||
* @return The width of the "poster" in number of page for print the diagram
|
||||
* with the orientation and the paper format used by the actual printer
|
||||
*/
|
||||
int ProjectPrintWindow::horizontalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
int ProjectPrintWindow::horizontalPagesCount(
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
{
|
||||
QRect printable_area = full_page ? m_printer-> paperRect() : m_printer-> pageRect();
|
||||
QRect printable_area;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
printable_area = full_page ? m_printer-> paperRect() : m_printer-> pageRect();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
QRect diagram_rect = diagramRect(diagram, option);
|
||||
|
||||
int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width())));
|
||||
@@ -311,9 +354,18 @@ int ProjectPrintWindow::horizontalPagesCount(Diagram *diagram, const ExportPrope
|
||||
* @return The height of the "poster" in number of pages for print the diagram
|
||||
* with the orientation and paper format used by the actual printer
|
||||
*/
|
||||
int ProjectPrintWindow::verticalPagesCount(Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
int ProjectPrintWindow::verticalPagesCount(
|
||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||
{
|
||||
QRect printable_area = full_page ? m_printer->paperRect() : m_printer->pageRect();
|
||||
QRect printable_area;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
printable_area = full_page ? m_printer->paperRect() : m_printer->pageRect();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
QRect diagram_rect = diagramRect(diagram, option);
|
||||
|
||||
int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height())));
|
||||
@@ -371,6 +423,7 @@ QString ProjectPrintWindow::settingsSectionName(const QPrinter *printer)
|
||||
|
||||
void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QSettings settings;
|
||||
QString printer_section = settingsSectionName(m_printer);
|
||||
|
||||
@@ -413,10 +466,17 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
||||
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
|
||||
void ProjectPrintWindow::savePageSetupForCurrentPrinter()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QSettings settings;
|
||||
QString printer_section = settingsSectionName(m_printer);
|
||||
|
||||
@@ -444,6 +504,12 @@ void ProjectPrintWindow::savePageSetupForCurrentPrinter()
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
settings.sync();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QSaveFile>
|
||||
#include <QTextStream>
|
||||
#include <QRegularExpression>
|
||||
#include <QActionGroup>
|
||||
|
||||
/**
|
||||
Permet de convertir une chaine de caracteres ("n", "s", "e" ou "w")
|
||||
@@ -164,9 +165,9 @@ bool QET::lineContainsPoint(const QLineF &line, const QPointF &point) {
|
||||
@return true si le projete orthogonal du point sur la droite appartient au
|
||||
segment de droite.
|
||||
*/
|
||||
bool QET::orthogonalProjection(const QPointF &point,
|
||||
const QLineF &line,
|
||||
QPointF *intersection) {
|
||||
bool QET::orthogonalProjection(
|
||||
const QPointF &point,const QLineF &line,QPointF *intersection)
|
||||
{
|
||||
// recupere le vecteur normal de `line'
|
||||
QLineF line_normal_vector(line.normalVector());
|
||||
QPointF normal_vector(line_normal_vector.dx(), line_normal_vector.dy());
|
||||
@@ -210,9 +211,9 @@ bool QET::orthogonalProjection(const QPointF &point,
|
||||
@param entier Pointeur facultatif vers un entier
|
||||
@return true si l'attribut est bien un entier, false sinon
|
||||
*/
|
||||
bool QET::attributeIsAnInteger(const QDomElement &e,
|
||||
const QString& nom_attribut,
|
||||
int *entier) {
|
||||
bool QET::attributeIsAnInteger(
|
||||
const QDomElement &e,const QString& nom_attribut,int *entier)
|
||||
{
|
||||
// verifie la presence de l'attribut
|
||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||
// verifie la validite de l'attribut
|
||||
@@ -231,9 +232,9 @@ bool QET::attributeIsAnInteger(const QDomElement &e,
|
||||
@param reel Pointeur facultatif vers un double
|
||||
@return true si l'attribut est bien un reel, false sinon
|
||||
*/
|
||||
bool QET::attributeIsAReal(const QDomElement &e,
|
||||
const QString& nom_attribut,
|
||||
qreal *reel) {
|
||||
bool QET::attributeIsAReal(
|
||||
const QDomElement &e,const QString& nom_attribut,qreal *reel)
|
||||
{
|
||||
// verifie la presence de l'attribut
|
||||
if (!e.hasAttribute(nom_attribut)) return(false);
|
||||
// verifie la validite de l'attribut
|
||||
@@ -258,13 +259,14 @@ bool QET::attributeIsAReal(const QDomElement &e,
|
||||
@return la proposition decrivant le nombre d'elements, de conducteurs et de
|
||||
textes
|
||||
*/
|
||||
QString QET::ElementsAndConductorsSentence(int elements_count,
|
||||
int conductors_count,
|
||||
int texts_count,
|
||||
int images_count,
|
||||
int shapes_count,
|
||||
int element_text_count,
|
||||
int tables_count)
|
||||
QString QET::ElementsAndConductorsSentence(
|
||||
int elements_count,
|
||||
int conductors_count,
|
||||
int texts_count,
|
||||
int images_count,
|
||||
int shapes_count,
|
||||
int element_text_count,
|
||||
int tables_count)
|
||||
{
|
||||
QString text;
|
||||
if (elements_count) {
|
||||
@@ -333,9 +335,14 @@ QString QET::ElementsAndConductorsSentence(int elements_count,
|
||||
/**
|
||||
@return the list of \a tag_name elements directly under the \a e XML element.
|
||||
*/
|
||||
QList<QDomElement> QET::findInDomElement(const QDomElement &e, const QString &tag_name) {
|
||||
QList<QDomElement> QET::findInDomElement(
|
||||
const QDomElement &e, const QString &tag_name)
|
||||
{
|
||||
QList<QDomElement> return_list;
|
||||
for (QDomNode node = e.firstChild() ; !node.isNull() ; node = node.nextSibling()) {
|
||||
for (QDomNode node = e.firstChild() ;
|
||||
!node.isNull() ;
|
||||
node = node.nextSibling())
|
||||
{
|
||||
if (!node.isElement()) continue;
|
||||
QDomElement element = node.toElement();
|
||||
if (element.isNull() || element.tagName() != tag_name) continue;
|
||||
@@ -352,18 +359,24 @@ QList<QDomElement> QET::findInDomElement(const QDomElement &e, const QString &ta
|
||||
@param children tag XML a rechercher
|
||||
@return La liste des elements XML children
|
||||
*/
|
||||
QList<QDomElement> QET::findInDomElement(const QDomElement &e,
|
||||
const QString &parent,
|
||||
const QString &children) {
|
||||
QList<QDomElement> QET::findInDomElement(
|
||||
const QDomElement &e,const QString &parent,const QString &children)
|
||||
{
|
||||
QList<QDomElement> return_list;
|
||||
|
||||
// parcours des elements parents
|
||||
for (QDomNode enfant = e.firstChild() ; !enfant.isNull() ; enfant = enfant.nextSibling()) {
|
||||
for (QDomNode enfant = e.firstChild() ;
|
||||
!enfant.isNull() ;
|
||||
enfant = enfant.nextSibling())
|
||||
{
|
||||
// on s'interesse a l'element XML "parent"
|
||||
QDomElement parents = enfant.toElement();
|
||||
if (parents.isNull() || parents.tagName() != parent) continue;
|
||||
// parcours des enfants de l'element XML "parent"
|
||||
for (QDomNode node_children = parents.firstChild() ; !node_children.isNull() ; node_children = node_children.nextSibling()) {
|
||||
for (QDomNode node_children = parents.firstChild() ;
|
||||
!node_children.isNull() ;
|
||||
node_children = node_children.nextSibling())
|
||||
{
|
||||
// on s'interesse a l'element XML "children"
|
||||
QDomElement n_children = node_children.toElement();
|
||||
if (!n_children.isNull() && n_children.tagName() == children) return_list.append(n_children);
|
||||
@@ -404,8 +417,8 @@ QString QET::license()
|
||||
*/
|
||||
QList<QChar> QET::forbiddenCharacters()
|
||||
{
|
||||
return(QList<QChar>() << '\\' << '/' << ':' << '*' << '?' << '"'
|
||||
<< '<' << '>' << '|');
|
||||
return(QList<QChar>()
|
||||
<< '\\' << '/' << ':' << '*' << '?' << '"'<< '<' << '>' << '|');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -614,7 +627,14 @@ bool QET::writeXmlFile(QDomDocument &xml_doc, const QString &filepath, QString *
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
out.setCodec("UTF-8");
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
out.setGenerateByteOrderMark(false);
|
||||
out << xml_doc.toString(4);
|
||||
if (!file.commit())
|
||||
@@ -741,7 +761,14 @@ bool QET::writeToFile(QDomDocument &xml_doc, QFile *file, QString *error_message
|
||||
|
||||
QTextStream out(file);
|
||||
out.seek(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
out.setCodec("UTF-8");
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
out.setGenerateByteOrderMark(false);
|
||||
out << xml_doc.toString(4);
|
||||
if (opened_here) {
|
||||
|
||||
@@ -105,12 +105,12 @@ QETApp::QETApp() :
|
||||
if (qet_arguments_.files().isEmpty())
|
||||
{
|
||||
setSplashScreenStep(tr("Chargement... Éditeur de schéma",
|
||||
"splash screen caption"));
|
||||
"splash screen caption"));
|
||||
new QETDiagramEditor();
|
||||
} else
|
||||
{
|
||||
setSplashScreenStep(tr("Chargement... Ouverture des fichiers",
|
||||
"splash screen caption"));
|
||||
"splash screen caption"));
|
||||
openFiles(qet_arguments_);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,14 @@ void QETApp::setLanguage(const QString &desired_language) {
|
||||
QString languages_path = languagesPath();
|
||||
|
||||
// load Qt library translations
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QString qt_l10n_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
QString qt_l10n_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
|
||||
#endif
|
||||
if (!qtTranslator.load("qt_" + desired_language, qt_l10n_path)) {
|
||||
qtTranslator.load("qt_" + desired_language, languages_path);
|
||||
}
|
||||
@@ -549,7 +556,7 @@ TitleBlockTemplatesFilesCollection *QETApp::customTitleBlockTemplatesCollection(
|
||||
new TitleBlockTemplatesFilesCollection(
|
||||
QETApp::customTitleBlockTemplatesDir());
|
||||
m_custom_tbt_collection -> setTitle(tr("Cartouches utilisateur",
|
||||
"title of the user's \
|
||||
"title of the user's \
|
||||
title block templates collection"));
|
||||
m_custom_tbt_collection -> setProtocol(QETAPP_CUSTOM_TBT_PROTOCOL);
|
||||
m_custom_tbt_collection -> setCollection(QET::QetCollection::Custom);
|
||||
@@ -651,7 +658,7 @@ QString QETApp::commonElementsDir()
|
||||
* relatif au dossier contenant le binaire executable
|
||||
*/
|
||||
return(QCoreApplication::applicationDirPath()
|
||||
+ "/" + QUOTE(QET_COMMON_COLLECTION_PATH));
|
||||
+ "/" + QUOTE(QET_COMMON_COLLECTION_PATH));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -752,7 +759,7 @@ QString QETApp::commonTitleBlockTemplatesDir()
|
||||
* to the directory that contains the executable binary
|
||||
*/
|
||||
return(QCoreApplication::applicationDirPath()
|
||||
+ "/" + QUOTE(QET_COMMON_TBT_PATH));
|
||||
+ "/" + QUOTE(QET_COMMON_TBT_PATH));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -860,7 +867,7 @@ QString QETApp::realPath(const QString &sym_path) {
|
||||
directory = customTitleBlockTemplatesDir();
|
||||
} else return(QString());
|
||||
return(directory
|
||||
+ QDir::toNativeSeparators(sym_path.right(sym_path.length() - 9)));
|
||||
+ QDir::toNativeSeparators(sym_path.right(sym_path.length() - 9)));
|
||||
}
|
||||
|
||||
|
||||
@@ -1081,7 +1088,7 @@ QString QETApp::languagesPath()
|
||||
* au dossier contenant le binaire executable
|
||||
*/
|
||||
return(QCoreApplication::applicationDirPath()
|
||||
+ "/" + QUOTE(QET_LANG_PATH));
|
||||
+ "/" + QUOTE(QET_LANG_PATH));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -1126,9 +1133,9 @@ QFont QETApp::diagramTextsFont(qreal size)
|
||||
|
||||
//Font to use
|
||||
QString diagram_texts_family = settings.value("diagramfont",
|
||||
"Sans Serif").toString();
|
||||
"Sans Serif").toString();
|
||||
qreal diagram_texts_size = settings.value("diagramsize",
|
||||
9.0).toDouble();
|
||||
9.0).toDouble();
|
||||
|
||||
if (size != -1.0) {
|
||||
diagram_texts_size = size;
|
||||
@@ -1155,8 +1162,9 @@ QFont QETApp::diagramTextsItemFont(qreal size)
|
||||
"Sans Serif").toString();
|
||||
qreal diagram_texts_item_size = settings.value("diagramitemsize",
|
||||
9.0).toDouble();
|
||||
qreal diagram_texts_item_weight = settings.value("diagramitemweight"
|
||||
).toDouble();
|
||||
auto diagram_texts_item_weight =
|
||||
static_cast<QFont::Weight>(
|
||||
settings.value("diagramitemweight").toInt());
|
||||
QString diagram_texts_item_style = settings.value("diagramitemstyle",
|
||||
"normal").toString();
|
||||
|
||||
@@ -1290,15 +1298,15 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget()
|
||||
widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont());
|
||||
widget -> orientationWidget() -> setUsableTexts(QList<QString>()
|
||||
<< QETApp::tr("Q",
|
||||
"Single-letter example text - translate length, not meaning")
|
||||
"Single-letter example text - translate length, not meaning")
|
||||
<< QETApp::tr("QET",
|
||||
"Small example text - translate length, not meaning")
|
||||
"Small example text - translate length, not meaning")
|
||||
<< QETApp::tr("Schema",
|
||||
"Normal example text - translate length, not meaning")
|
||||
"Normal example text - translate length, not meaning")
|
||||
<< QETApp::tr("Electrique",
|
||||
"Normal example text - translate length, not meaning")
|
||||
"Normal example text - translate length, not meaning")
|
||||
<< QETApp::tr("QElectroTech",
|
||||
"Long example text - translate length, not meaning")
|
||||
"Long example text - translate length, not meaning")
|
||||
);
|
||||
return(widget);
|
||||
}
|
||||
@@ -1699,7 +1707,7 @@ void QETApp::openElementLocations(const QList<ElementsLocation> &locations_list)
|
||||
@see QETTitleBlockTemplateEditor::setOpenForDuplication()
|
||||
*/
|
||||
void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location,
|
||||
bool duplicate) {
|
||||
bool duplicate) {
|
||||
QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor();
|
||||
qet_template_editor -> setOpenForDuplication(duplicate);
|
||||
qet_template_editor -> edit(location);
|
||||
@@ -1822,7 +1830,7 @@ QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(
|
||||
foreach(QWidget *qw, qApp->topLevelWidgets()) {
|
||||
if (!qw -> isWindow()) continue;
|
||||
if (qobject_cast<QToolBar *>(qw)
|
||||
|| qobject_cast<QDockWidget *>(qw)) {
|
||||
|| qobject_cast<QDockWidget *>(qw)) {
|
||||
if (qw -> parent() == window) widgets << qw;
|
||||
}
|
||||
}
|
||||
@@ -1935,7 +1943,7 @@ void QETApp::setSplashScreenStep(const QString &message) {
|
||||
if (!m_splash_screen) return;
|
||||
if (!message.isEmpty()) {
|
||||
m_splash_screen -> showMessage(message,
|
||||
Qt::AlignBottom | Qt::AlignLeft);
|
||||
Qt::AlignBottom | Qt::AlignLeft);
|
||||
}
|
||||
qApp->processEvents();
|
||||
}
|
||||
@@ -2016,7 +2024,7 @@ void QETApp::initConfiguration()
|
||||
void QETApp::initSystemTray()
|
||||
{
|
||||
setSplashScreenStep(tr("Chargement... icône du systray",
|
||||
"splash screen caption"));
|
||||
"splash screen caption"));
|
||||
// initialization of the icon menus in the systray
|
||||
// initialisation des menus de l'icone dans le systray
|
||||
menu_systray = new QMenu(tr("QElectroTech", "systray menu title"));
|
||||
@@ -2118,7 +2126,7 @@ int QETApp::projectIdFromString(const QString &url) {
|
||||
if (!match.hasMatch())
|
||||
{
|
||||
qDebug()<<"no Match => return"
|
||||
<<url;
|
||||
<<url;
|
||||
return(-1);
|
||||
}
|
||||
bool conv_ok = false;
|
||||
@@ -2240,8 +2248,8 @@ void QETApp::checkBackupFiles()
|
||||
text.append(tr("<b>Les fichiers de restauration suivant on été trouvé,<br>"
|
||||
"Voulez-vous les ouvrir ?</b><br>"));
|
||||
}
|
||||
for(const KAutoSaveFile *kasf : stale_files)
|
||||
{
|
||||
for(const KAutoSaveFile *kasf : stale_files)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
//Remove the first character '/' before the name of the drive
|
||||
text.append("<br>" + kasf->managedFile().path().remove(0,1));
|
||||
@@ -2329,19 +2337,19 @@ void QETApp::fetchWindowStats(
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
/**
|
||||
Gere les evenements, en particulier l'evenement FileOpen sous MacOs.
|
||||
@param e Evenement a gerer
|
||||
Gere les evenements, en particulier l'evenement FileOpen sous MacOs.
|
||||
@param e Evenement a gerer
|
||||
*/
|
||||
bool QETApp::eventFiltrer(QObject *object, QEvent *e) {
|
||||
// gere l'ouverture de fichiers (sous MacOs)
|
||||
if (e -> type() == QEvent::FileOpen) {
|
||||
// gere l'ouverture de fichiers (sous MacOs)
|
||||
if (e -> type() == QEvent::FileOpen) {
|
||||
// nom du fichier a ouvrir
|
||||
QString filename = static_cast<QFileOpenEvent *>(e) -> file();
|
||||
openFiles(QStringList() << filename);
|
||||
return(true);
|
||||
} else {
|
||||
} else {
|
||||
return QObject::eventFilter(object, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ bool QetGraphicsTableItem::toDXF(const QString &filepath)
|
||||
//QRectF rect = boundingRect();
|
||||
QRectF rect(0,0, m_header_item->rect().width(), m_current_size.height());
|
||||
QPolygonF poly(rect);
|
||||
Createdxf::drawPolygon(filepath,mapToScene(poly),0);
|
||||
Createdxf::drawPolygon(filepath,mapToScene(poly),0);
|
||||
|
||||
//Draw vertical lines
|
||||
auto offset= 0;
|
||||
@@ -970,6 +970,7 @@ void QetGraphicsTableItem::adjustColumnsWidth()
|
||||
int sum_=0;
|
||||
for(auto i= 0 ; i<m_model->columnCount() ; ++i)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
auto at_a = std::min(m_minimum_column_width.size()-1, i); //In case of the I is higher than m_minimum_column_width or
|
||||
auto at_b = std::min(m_header_item->minimumSectionWidth().size()-1, i); //m_header_item->minimumSectionWidth().size()
|
||||
m_header_item->resizeSection(
|
||||
@@ -978,6 +979,12 @@ void QetGraphicsTableItem::adjustColumnsWidth()
|
||||
m_minimum_column_width.at(at_a),
|
||||
m_header_item->minimumSectionWidth().at(at_b))+b);
|
||||
sum_+= m_header_item->sectionSize(i);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -470,15 +470,15 @@ QPointF Conductor::extendTerminal(const QPointF &terminal, Qet::Orientation term
|
||||
|
||||
/**
|
||||
Dessine le conducteur sans antialiasing.
|
||||
@param qp Le QPainter a utiliser pour dessiner le conducteur
|
||||
@param painter Le QPainter a utiliser pour dessiner le conducteur
|
||||
@param options Les options de style pour le conducteur
|
||||
@param qw Le QWidget sur lequel on dessine
|
||||
*/
|
||||
void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWidget *qw)
|
||||
void Conductor::paint(QPainter *painter, const QStyleOptionGraphicsItem *options, QWidget *qw)
|
||||
{
|
||||
Q_UNUSED(qw);
|
||||
qp -> save();
|
||||
qp -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> save();
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
// Set the color of conductor
|
||||
QColor final_conductor_color(m_properties.color);
|
||||
@@ -500,7 +500,7 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
conductor_pen.setWidthF(m_mouse_over? (m_properties.cond_size) +4 : (m_properties.cond_size));
|
||||
|
||||
//Set the QPen and QBrush to the QPainter
|
||||
qp -> setBrush(conductor_brush);
|
||||
painter -> setBrush(conductor_brush);
|
||||
QPen final_conductor_pen = conductor_pen;
|
||||
|
||||
//Set the conductor style
|
||||
@@ -509,14 +509,22 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot
|
||||
|
||||
//Use a cosmetique line, below a certain zoom
|
||||
if (options && options -> levelOfDetail < 1.0) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (options && options -> levelOfDetail < 1.0)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
|
||||
#endif
|
||||
{
|
||||
final_conductor_pen.setCosmetic(true);
|
||||
}
|
||||
|
||||
qp -> setPen(final_conductor_pen);
|
||||
painter -> setPen(final_conductor_pen);
|
||||
|
||||
//Draw the conductor
|
||||
qp -> drawPath(path());
|
||||
painter -> drawPath(path());
|
||||
//Draw the second color
|
||||
if(m_properties.m_bicolor)
|
||||
{
|
||||
@@ -525,20 +533,20 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
QVector<qreal> dash_pattern;
|
||||
dash_pattern << m_properties.m_dash_size-2 << m_properties.m_dash_size;
|
||||
final_conductor_pen.setDashPattern(dash_pattern);
|
||||
qp->save();
|
||||
qp->setPen(final_conductor_pen);
|
||||
qp->drawPath(path());
|
||||
qp->restore();
|
||||
painter->save();
|
||||
painter->setPen(final_conductor_pen);
|
||||
painter->drawPath(path());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if (m_properties.type == ConductorProperties::Single) {
|
||||
qp -> setBrush(final_conductor_color);
|
||||
painter -> setBrush(final_conductor_color);
|
||||
m_properties.singleLineProperties.draw(
|
||||
qp,
|
||||
painter,
|
||||
middleSegment() -> isHorizontal() ? QET::Horizontal : QET::Vertical,
|
||||
QRectF(middleSegment() -> middle() - QPointF(12.0, 12.0), QSizeF(24.0, 24.0))
|
||||
);
|
||||
if (isSelected()) qp -> setBrush(Qt::NoBrush);
|
||||
if (isSelected()) painter -> setBrush(Qt::NoBrush);
|
||||
}
|
||||
|
||||
//Draw the junctions
|
||||
@@ -546,15 +554,15 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
||||
if (!junctions_list.isEmpty()) {
|
||||
final_conductor_pen.setStyle(Qt::SolidLine);
|
||||
QBrush junction_brush(final_conductor_color, Qt::SolidPattern);
|
||||
qp -> setPen(final_conductor_pen);
|
||||
qp -> setBrush(junction_brush);
|
||||
qp -> setRenderHint(QPainter::Antialiasing, true);
|
||||
painter -> setPen(final_conductor_pen);
|
||||
painter -> setBrush(junction_brush);
|
||||
painter -> setRenderHint(QPainter::Antialiasing, true);
|
||||
foreach(QPointF point, junctions_list) {
|
||||
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
||||
painter -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
||||
}
|
||||
}
|
||||
|
||||
qp -> restore();
|
||||
painter -> restore();
|
||||
}
|
||||
|
||||
/// @return le Diagram auquel ce conducteur appartient, ou 0 si ce conducteur est independant
|
||||
@@ -1014,8 +1022,8 @@ bool Conductor::fromXml(QDomElement &dom_element)
|
||||
@return Un element XML representant le conducteur
|
||||
*/
|
||||
QDomElement Conductor::toXml(QDomDocument &dom_document,
|
||||
QHash<Terminal *,
|
||||
int> &table_adr_id) const
|
||||
QHash<Terminal *,
|
||||
int> &table_adr_id) const
|
||||
{
|
||||
QDomElement dom_element = dom_document.createElement("conductor");
|
||||
|
||||
@@ -1514,7 +1522,7 @@ QPainterPath Conductor::path() const
|
||||
the other values of property stay unmodified
|
||||
*/
|
||||
void Conductor::setPropertyToPotential(const ConductorProperties &property,
|
||||
bool only_text)
|
||||
bool only_text)
|
||||
{
|
||||
setProperties(property);
|
||||
QSet <Conductor *> potential_list = relatedPotentialConductors();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "elementtextitemgroup.h"
|
||||
#include "elementpicturefactory.h"
|
||||
#include "iostream"
|
||||
#include <QDomElement>
|
||||
|
||||
class ElementXmlRetroCompatibility
|
||||
{
|
||||
@@ -45,11 +46,11 @@ class ElementXmlRetroCompatibility
|
||||
{
|
||||
int i = 0;
|
||||
while (!dom_element.attribute(seq +
|
||||
QString::number(i+1)).isEmpty())
|
||||
QString::number(i+1)).isEmpty())
|
||||
{
|
||||
list->append(dom_element.attribute(
|
||||
seq +
|
||||
QString::number(i+1)));
|
||||
seq +
|
||||
QString::number(i+1)));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -210,7 +211,15 @@ void Element::paint(
|
||||
drawHighlight(painter, options);
|
||||
}
|
||||
|
||||
if (options && options -> levelOfDetail < 1.0) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (options && options -> levelOfDetail < 1.0)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
|
||||
#endif
|
||||
{
|
||||
painter->drawPicture(0, 0, m_low_zoom_picture);
|
||||
} else {
|
||||
painter->drawPicture(0, 0, m_picture);
|
||||
@@ -228,7 +237,7 @@ void Element::paint(
|
||||
QRectF Element::boundingRect() const
|
||||
{
|
||||
return(QRectF(QPointF(-hotspot_coord.x(), -hotspot_coord.y()),
|
||||
dimensions));
|
||||
dimensions));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,7 +366,7 @@ void Element::drawHighlight(
|
||||
painter -> save();
|
||||
|
||||
qreal gradient_radius = qMin(boundingRect().width(),
|
||||
boundingRect().height()) / 2.0;
|
||||
boundingRect().height()) / 2.0;
|
||||
QRadialGradient gradient(
|
||||
boundingRect().center(),
|
||||
gradient_radius,
|
||||
@@ -457,8 +466,8 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
||||
//scroll of the Children of the Definition: Parts of the Drawing
|
||||
int parsed_elements_count = 0;
|
||||
for (QDomNode node = xml_def_elmt.firstChild() ;
|
||||
!node.isNull() ;
|
||||
node = node.nextSibling())
|
||||
!node.isNull() ;
|
||||
node = node.nextSibling())
|
||||
{
|
||||
QDomElement elmts = node.toElement();
|
||||
if (elmts.isNull())
|
||||
@@ -471,8 +480,8 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
||||
QList <QDomElement> input_field;
|
||||
bool have_label = false;
|
||||
for (QDomElement input_node = node.firstChildElement("input") ;
|
||||
!input_node.isNull() ;
|
||||
input_node = input_node.nextSiblingElement("input"))
|
||||
!input_node.isNull() ;
|
||||
input_node = input_node.nextSiblingElement("input"))
|
||||
{
|
||||
if (!input_node.isNull())
|
||||
{
|
||||
@@ -488,8 +497,8 @@ bool Element::buildFromXml(const QDomElement &xml_def_elmt, int *state)
|
||||
|
||||
//Parse the definition
|
||||
for (QDomNode n = node.firstChild() ;
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling())
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling())
|
||||
{
|
||||
QDomElement qde = n.toElement();
|
||||
if (qde.isNull())
|
||||
@@ -588,7 +597,7 @@ bool Element::parseInput(const QDomElement &dom_element)
|
||||
QTransform transform;
|
||||
//First make the rotation
|
||||
transform.rotate(dom_element.attribute("rotation",
|
||||
"0").toDouble());
|
||||
"0").toDouble());
|
||||
QPointF pos = transform.map(
|
||||
QPointF(0,
|
||||
-deti->boundingRect().height()/2));
|
||||
@@ -753,17 +762,23 @@ bool Element::fromXml(
|
||||
// copie des associations id / adr
|
||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
||||
table_id_adr.insert(id_trouve,
|
||||
priv_id_adr.value(id_trouve));
|
||||
priv_id_adr.value(id_trouve));
|
||||
}
|
||||
}
|
||||
|
||||
//load uuid of connected elements
|
||||
QList <QDomElement> uuid_list = QET::findInDomElement(e,
|
||||
"links_uuids",
|
||||
"link_uuid");
|
||||
"links_uuids",
|
||||
"link_uuid");
|
||||
foreach (QDomElement qdo, uuid_list)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
tmp_uuids_link << qdo.attribute("uuid");
|
||||
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
//uuid of this element
|
||||
m_uuid= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
|
||||
|
||||
@@ -810,9 +825,9 @@ bool Element::fromXml(
|
||||
//***Dynamic texts item***//
|
||||
//************************//
|
||||
for (const QDomElement& qde : QET::findInDomElement(
|
||||
e,
|
||||
"dynamic_texts",
|
||||
DynamicElementTextItem::xmlTagName()))
|
||||
e,
|
||||
"dynamic_texts",
|
||||
DynamicElementTextItem::xmlTagName()))
|
||||
{
|
||||
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
|
||||
addDynamicTextItem(deti);
|
||||
@@ -842,7 +857,7 @@ bool Element::fromXml(
|
||||
if (qFuzzyCompare(qreal(dom_input.attribute("x").toDouble()),
|
||||
m_converted_text_from_xml_description.value(deti).x()) &&
|
||||
qFuzzyCompare(qreal(dom_input.attribute("y").toDouble()),
|
||||
m_converted_text_from_xml_description.value(deti).y()))
|
||||
m_converted_text_from_xml_description.value(deti).y()))
|
||||
{
|
||||
//Once again this 'if', is only for retrocompatibility with old old old project
|
||||
//when element text with tagg "label" is not null, but the element information "label" is.
|
||||
@@ -913,9 +928,9 @@ bool Element::fromXml(
|
||||
m_converted_text_from_xml_description.clear();
|
||||
|
||||
for (QDomElement qde : QET::findInDomElement(
|
||||
e,
|
||||
"texts_groups",
|
||||
ElementTextItemGroup::xmlTaggName()))
|
||||
e,
|
||||
"texts_groups",
|
||||
ElementTextItemGroup::xmlTaggName()))
|
||||
{
|
||||
ElementTextItemGroup *group =
|
||||
addTextGroup("loaded_from_xml_group");
|
||||
@@ -991,11 +1006,11 @@ bool Element::fromXml(
|
||||
{
|
||||
if(!label.isEmpty() && la &&
|
||||
((!comment.isEmpty() && c)
|
||||
|| (!location.isEmpty() && lo)))
|
||||
|| (!location.isEmpty() && lo)))
|
||||
{
|
||||
//#2 in the converted list one text must have text from = element info and info name = label
|
||||
for(DynamicElementTextItem *deti
|
||||
: successfully_converted)
|
||||
: successfully_converted)
|
||||
{
|
||||
if(deti->textFrom()== DynamicElementTextItem::ElementInfo
|
||||
&& deti->infoName() == "label")
|
||||
@@ -1058,10 +1073,10 @@ bool Element::fromXml(
|
||||
addTextToGroup(deti, group);
|
||||
if(comment_text)
|
||||
addTextToGroup(comment_text,
|
||||
group);
|
||||
group);
|
||||
if(location_text)
|
||||
addTextToGroup(location_text,
|
||||
group);
|
||||
group);
|
||||
group->setAlignment(Qt::AlignVCenter);
|
||||
group->setVerticalAdjustment(-4);
|
||||
group->setRotation(rotation);
|
||||
@@ -1354,7 +1369,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name)
|
||||
if(m_texts_group.isEmpty())
|
||||
{
|
||||
ElementTextItemGroup *group = new ElementTextItemGroup(name,
|
||||
this);
|
||||
this);
|
||||
m_texts_group << group;
|
||||
emit textsGroupAdded(group);
|
||||
return group;
|
||||
@@ -1454,7 +1469,7 @@ QList<ElementTextItemGroup *> Element::textGroups() const
|
||||
@return : true if the text was succesfully added to the group.
|
||||
*/
|
||||
bool Element::addTextToGroup(DynamicElementTextItem *text,
|
||||
ElementTextItemGroup *group)
|
||||
ElementTextItemGroup *group)
|
||||
{
|
||||
if(!m_dynamic_text_list.contains(text))
|
||||
return false;
|
||||
@@ -1643,7 +1658,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
*/
|
||||
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
Q_UNUSED(e)
|
||||
|
||||
foreach (Element *elmt, linkedElements())
|
||||
elmt -> setHighlighted(true);
|
||||
@@ -1661,7 +1676,7 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
|
||||
*/
|
||||
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
Q_UNUSED(e)
|
||||
|
||||
foreach (Element *elmt, linkedElements())
|
||||
elmt -> setHighlighted(false);
|
||||
@@ -1703,10 +1718,10 @@ void Element::setUpFormula(bool code_letter)
|
||||
|
||||
m_autoNum_seq.clear();
|
||||
autonum::setSequential(formula,
|
||||
m_autoNum_seq,
|
||||
nc,
|
||||
diagram(),
|
||||
element_currentAutoNum);
|
||||
m_autoNum_seq,
|
||||
nc,
|
||||
diagram(),
|
||||
element_currentAutoNum);
|
||||
diagram()->project()->addElementAutoNum(element_currentAutoNum,
|
||||
ncc.next());
|
||||
|
||||
|
||||
@@ -262,23 +262,30 @@ void Terminal::removeConductor(Conductor *conductor)
|
||||
/**
|
||||
@brief Terminal::paint
|
||||
Fonction de dessin des bornes
|
||||
@param p Le QPainter a utiliser
|
||||
@param painter Le QPainter a utiliser
|
||||
@param options Les options de dessin
|
||||
*/
|
||||
void Terminal::paint(
|
||||
QPainter *p,
|
||||
QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *options,
|
||||
QWidget *)
|
||||
{
|
||||
// en dessous d'un certain zoom, les bornes ne sont plus dessinees
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (options && options -> levelOfDetail < 0.5) return;
|
||||
|
||||
p -> save();
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
|
||||
return;
|
||||
#endif
|
||||
painter -> save();
|
||||
|
||||
//annulation des renderhints
|
||||
p -> setRenderHint(QPainter::Antialiasing, false);
|
||||
p -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> setRenderHint(QPainter::TextAntialiasing, false);
|
||||
painter -> setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
|
||||
// on travaille avec les coordonnees de l'element parent
|
||||
QPointF c = mapFromParent(d->m_pos);
|
||||
@@ -287,23 +294,31 @@ void Terminal::paint(
|
||||
QPen t;
|
||||
t.setWidthF(1.0);
|
||||
|
||||
if (options && options -> levelOfDetail < 1.0) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
if (options && options -> levelOfDetail < 1.0)
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
|
||||
#endif
|
||||
{
|
||||
t.setCosmetic(true);
|
||||
}
|
||||
|
||||
// dessin de la borne en rouge
|
||||
t.setColor(Qt::red);
|
||||
p -> setPen(t);
|
||||
p -> drawLine(c, e);
|
||||
painter -> setPen(t);
|
||||
painter -> drawLine(c, e);
|
||||
|
||||
// dessin du point d'amarrage au conducteur en bleu
|
||||
t.setColor(hovered_color_);
|
||||
p -> setPen(t);
|
||||
p -> setBrush(hovered_color_);
|
||||
painter -> setPen(t);
|
||||
painter -> setBrush(hovered_color_);
|
||||
if (hovered_) {
|
||||
p -> setRenderHint(QPainter::Antialiasing, true);
|
||||
p -> drawEllipse(QRectF(c.x() - 2.5, c.y() - 2.5, 5.0, 5.0));
|
||||
} else p -> drawPoint(c);
|
||||
painter -> setRenderHint(QPainter::Antialiasing, true);
|
||||
painter -> drawEllipse(QRectF(c.x() - 2.5, c.y() - 2.5, 5.0, 5.0));
|
||||
} else painter -> drawPoint(c);
|
||||
|
||||
//Draw help line if needed,
|
||||
if (diagram() && m_draw_help_line)
|
||||
@@ -365,7 +380,7 @@ void Terminal::paint(
|
||||
m_help_line_a -> setLine(line);
|
||||
}
|
||||
|
||||
p -> restore();
|
||||
painter -> restore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,8 +61,10 @@ class Terminal : public QGraphicsObject
|
||||
*/
|
||||
int type() const override { return Type; }
|
||||
|
||||
void paint (QPainter *,const QStyleOptionGraphicsItem *,
|
||||
QWidget *) override;
|
||||
void paint(
|
||||
QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *,
|
||||
QWidget *) override;
|
||||
void drawHelpLine (bool draw = true);
|
||||
QLineF HelpLine () const;
|
||||
QRectF boundingRect () const override;
|
||||
@@ -127,10 +129,10 @@ class Terminal : public QGraphicsObject
|
||||
|
||||
/// Parent electrical element
|
||||
Element *parent_element_{nullptr};
|
||||
public:
|
||||
public:
|
||||
/// docking point for parent element
|
||||
QPointF dock_elmt_;
|
||||
private:
|
||||
private:
|
||||
/// List of conductors attached to the terminal
|
||||
QList<Conductor *> conductors_;
|
||||
/**
|
||||
@@ -185,6 +187,6 @@ inline QString Terminal::name() const
|
||||
}
|
||||
|
||||
QList<Terminal *> relatedPotentialTerminal (const Terminal *terminal,
|
||||
const bool all_diagram = true);
|
||||
const bool all_diagram = true);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
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 "diagram.h"
|
||||
@@ -37,6 +32,13 @@
|
||||
#include "numerotationcontextcommands.h"
|
||||
#include "assignvariables.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QStandardPaths>
|
||||
#include <utility>
|
||||
#include <QtConcurrent>
|
||||
#include <QHash>
|
||||
#include <QtDebug>
|
||||
|
||||
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
||||
|
||||
/**
|
||||
@@ -178,7 +180,7 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
|
||||
bool opened_here = file->isOpen() ? false : true;
|
||||
if (!file->isOpen()
|
||||
&& !file->open(QIODevice::ReadOnly
|
||||
| QIODevice::Text)) {
|
||||
| QIODevice::Text)) {
|
||||
return FileOpenFailed;
|
||||
}
|
||||
QFileInfo fi(*file);
|
||||
@@ -887,7 +889,7 @@ QDomDocument QETProject::toXml()
|
||||
for(Diagram *diagram : diagrams_list)
|
||||
{
|
||||
qDebug() << QString("exporting diagram \"%1\""
|
||||
).arg(diagram -> title())
|
||||
).arg(diagram -> title())
|
||||
<< "["
|
||||
<< diagram
|
||||
<< "]";
|
||||
@@ -1080,7 +1082,7 @@ ElementsLocation QETProject::importElement(ElementsLocation &location)
|
||||
//Element doesn't exist in the collection, we just import it
|
||||
else {
|
||||
ElementsLocation loc(m_elements_collection->addElement(
|
||||
location), this);
|
||||
location), this);
|
||||
|
||||
if (!loc.exist()) {
|
||||
qDebug() << "failed to import location. "
|
||||
@@ -1370,8 +1372,8 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
||||
|
||||
int diagram_order = -1;
|
||||
if (!QET::attributeIsAnInteger(diagram_xml_element,
|
||||
"order",
|
||||
&diagram_order))
|
||||
"order",
|
||||
&diagram_order))
|
||||
diagram_order = 500000;
|
||||
|
||||
addDiagram(diagram, diagram_order-1);
|
||||
@@ -1691,11 +1693,16 @@ NamesList QETProject::namesListForIntegrationCategory()
|
||||
*/
|
||||
void QETProject::writeBackup()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
QDomDocument xml_project(toXml());
|
||||
QtConcurrent::run(QET::writeToFile,
|
||||
xml_project,
|
||||
&m_backup_file,
|
||||
nullptr);
|
||||
QtConcurrent::run(
|
||||
QET::writeToFile,xml_project,&m_backup_file,nullptr);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -274,7 +274,14 @@ bool QETXML::writeXmlFile(
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
out.setCodec("UTF-8");
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
out.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
out.setGenerateByteOrderMark(false);
|
||||
out << xml_document.toString(4);
|
||||
file.close();
|
||||
@@ -314,9 +321,9 @@ QVector<QDomElement> QETXML::directChild(
|
||||
{
|
||||
QVector<QDomElement> return_list;
|
||||
for (
|
||||
QDomNode node = element.firstChild() ;
|
||||
!node.isNull() ;
|
||||
node = node.nextSibling())
|
||||
QDomNode node = element.firstChild() ;
|
||||
!node.isNull() ;
|
||||
node = node.nextSibling())
|
||||
{
|
||||
if (!node.isElement()) continue;
|
||||
QDomElement element = node.toElement();
|
||||
@@ -345,18 +352,18 @@ QVector<QDomElement> QETXML::subChild(
|
||||
QVector<QDomElement> return_list;
|
||||
|
||||
for (
|
||||
QDomNode child = element.firstChild() ;
|
||||
!child.isNull() ;
|
||||
child = child.nextSibling())
|
||||
QDomNode child = element.firstChild() ;
|
||||
!child.isNull() ;
|
||||
child = child.nextSibling())
|
||||
{
|
||||
QDomElement parents = child.toElement();
|
||||
if (parents.isNull() || parents.tagName() != parent_tag_name)
|
||||
continue;
|
||||
|
||||
for (
|
||||
QDomNode node_children = parents.firstChild() ;
|
||||
!node_children.isNull() ;
|
||||
node_children = node_children.nextSibling())
|
||||
QDomNode node_children = parents.firstChild() ;
|
||||
!node_children.isNull() ;
|
||||
node_children = node_children.nextSibling())
|
||||
{
|
||||
QDomElement n_children = node_children.toElement();
|
||||
if (!n_children.isNull() && n_children.tagName() == children_tag_name)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
#include "qtextorientationwidget.h"
|
||||
#include <algorithm>
|
||||
#include <QMouseEvent>
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@@ -254,8 +255,14 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) {
|
||||
*/
|
||||
void QTextOrientationWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (read_only_) return;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
bool drawn_angle_hovered = positionIsASquare(event -> localPos(), &highlight_angle_);
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
bool drawn_angle_hovered = positionIsASquare(event -> position(), &highlight_angle_);
|
||||
#endif
|
||||
|
||||
if (must_highlight_angle_ != drawn_angle_hovered) {
|
||||
must_highlight_angle_ = drawn_angle_hovered;
|
||||
@@ -271,8 +278,14 @@ void QTextOrientationWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (read_only_) return;
|
||||
|
||||
double clicked_angle;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
bool drawn_angle_clicked = positionIsASquare(event -> localPos(), &clicked_angle);
|
||||
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
bool drawn_angle_clicked = positionIsASquare(event -> position(), &clicked_angle);
|
||||
#endif
|
||||
if (drawn_angle_clicked) {
|
||||
setOrientation(clicked_angle);
|
||||
emit(orientationChanged(clicked_angle));
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QActionGroup>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -86,14 +87,14 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace qdesigner_internal {
|
||||
// Richtext simplification filter helpers: Elements to be discarded
|
||||
static inline bool filterElement(const QStringRef &name)
|
||||
static inline bool filterElement(const QStringView &name)
|
||||
{
|
||||
return name != QLatin1String("meta") && name != QLatin1String("style");
|
||||
}
|
||||
|
||||
// Richtext simplification filter helpers: Filter attributes of elements
|
||||
static inline void filterAttributes(
|
||||
const QStringRef &name,
|
||||
const QStringView &name,
|
||||
QXmlStreamAttributes *atts,
|
||||
bool *paragraphAlignmentFound)
|
||||
{
|
||||
@@ -122,8 +123,8 @@ namespace qdesigner_internal {
|
||||
}
|
||||
}
|
||||
|
||||
// Richtext simplification filter helpers: Check for blank QStringRef.
|
||||
static inline bool isWhiteSpace(const QStringRef &in)
|
||||
// Richtext simplification filter helpers: Check for blank QStringView.
|
||||
static inline bool isWhiteSpace(const QStringView &in)
|
||||
{
|
||||
const int count = in.size();
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -150,7 +151,7 @@ namespace qdesigner_internal {
|
||||
case QXmlStreamReader::StartElement:
|
||||
elementCount++;
|
||||
if (filterElement(reader.name())) {
|
||||
const QStringRef name = reader.name();
|
||||
const QStringView name = reader.name();
|
||||
QXmlStreamAttributes attributes = reader.attributes();
|
||||
filterAttributes(name, &attributes, ¶graphAlignmentFound);
|
||||
writer.writeStartElement(name.toString());
|
||||
|
||||
@@ -56,7 +56,7 @@ TitleBlockCell *TitleBlockTemplate::createCell(
|
||||
const TitleBlockCell *existing_cell) {
|
||||
TitleBlockCell *new_cell =
|
||||
existing_cell ? new TitleBlockCell(*existing_cell)
|
||||
: new TitleBlockCell();
|
||||
: new TitleBlockCell();
|
||||
registered_cells_ << new_cell;
|
||||
return(new_cell);
|
||||
}
|
||||
@@ -260,8 +260,8 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const
|
||||
*/
|
||||
void TitleBlockTemplate::loadInformation(const QDomElement &xml_element) {
|
||||
for (QDomNode n = xml_element.firstChild() ;
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
if (n.isElement() && n.toElement().tagName() == "information") {
|
||||
setInformation(n.toElement().text());
|
||||
}
|
||||
@@ -291,12 +291,12 @@ bool TitleBlockTemplate::loadLogos(const QDomElement &xml_element, bool reset) {
|
||||
|
||||
// we look for //logos/logo elements
|
||||
for (QDomNode n = xml_element.firstChild() ;
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
if (n.isElement() && n.toElement().tagName() == "logos") {
|
||||
for (QDomNode p = n.firstChild() ;
|
||||
!p.isNull() ;
|
||||
p = p.nextSibling()) {
|
||||
!p.isNull() ;
|
||||
p = p.nextSibling()) {
|
||||
if (p.isElement() && p.toElement().tagName()
|
||||
== "logo") {
|
||||
loadLogo(p.toElement());
|
||||
@@ -357,8 +357,8 @@ bool TitleBlockTemplate::loadGrid(const QDomElement &xml_element) {
|
||||
// we parse the first available "grid" XML element
|
||||
QDomElement grid_element;
|
||||
for (QDomNode n = xml_element.firstChild() ;
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
if (n.isElement() && n.toElement().tagName() == "grid") {
|
||||
grid_element = n.toElement();
|
||||
break;
|
||||
@@ -430,10 +430,10 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
||||
QRegularExpression abs_col_size_format,rel_col_size_format;
|
||||
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;
|
||||
qDebug() <<"is QRegularExpression ok?";
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
|
||||
QStringList cols_descriptions =
|
||||
@@ -471,7 +471,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
||||
foreach (TitleBlockColDimension icd, columns_width_) {
|
||||
qDebug() << Q_FUNC_INFO
|
||||
<< QString("%1 [%2]").arg(icd.value).arg(
|
||||
QET::titleBlockColumnLengthToString(icd.type));
|
||||
QET::titleBlockColumnLengthToString(icd.type));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -487,8 +487,8 @@ bool TitleBlockTemplate::loadCells(const QDomElement &xml_element) {
|
||||
// we are interested by the "logo" and "field" elements
|
||||
QDomElement grid_element;
|
||||
for (QDomNode n = xml_element.firstChild() ;
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
!n.isNull() ;
|
||||
n = n.nextSibling()) {
|
||||
if (!n.isElement()) continue;
|
||||
QDomElement cell_element = n.toElement();
|
||||
if (cell_element.tagName() == "field"
|
||||
@@ -648,9 +648,9 @@ void TitleBlockTemplate::saveCell(TitleBlockCell *cell,
|
||||
cell_elmt.setAttribute("row", cell -> num_row);
|
||||
cell_elmt.setAttribute("col", cell -> num_col);
|
||||
if (cell -> row_span) cell_elmt.setAttribute("rowspan",
|
||||
cell -> row_span);
|
||||
cell -> row_span);
|
||||
if (cell -> col_span) cell_elmt.setAttribute("colspan",
|
||||
cell -> col_span);
|
||||
cell -> col_span);
|
||||
|
||||
// save other information
|
||||
cell -> saveContentToXml(cell_elmt);
|
||||
@@ -1134,8 +1134,8 @@ void TitleBlockTemplate::addColumn(int i) {
|
||||
@return true
|
||||
*/
|
||||
bool TitleBlockTemplate::insertColumn(const TitleBlockDimension &dimension,
|
||||
const QList<TitleBlockCell *> &column,
|
||||
int i) {
|
||||
const QList<TitleBlockCell *> &column,
|
||||
int i) {
|
||||
int index = (i == -1) ? columns_width_.count() : i;
|
||||
cells_.insert(index, column);
|
||||
columns_width_.insert(index, dimension);
|
||||
@@ -1213,11 +1213,11 @@ QSet<TitleBlockCell *> TitleBlockTemplate::spannedCells(
|
||||
if (!final_row_span && !final_col_span) return(set);
|
||||
|
||||
for (int i = given_cell -> num_col ;
|
||||
i <= given_cell -> num_col + final_col_span ;
|
||||
++ i) {
|
||||
i <= given_cell -> num_col + final_col_span ;
|
||||
++ i) {
|
||||
for (int j = given_cell -> num_row ;
|
||||
j <= given_cell -> num_row + final_row_span ;
|
||||
++ j) {
|
||||
j <= given_cell -> num_row + final_row_span ;
|
||||
++ j) {
|
||||
if (i == given_cell -> num_col && j
|
||||
== given_cell -> num_row)
|
||||
continue;
|
||||
@@ -1257,7 +1257,7 @@ QHash<TitleBlockCell *, QPair<int, int> > TitleBlockTemplate::getAllSpans(
|
||||
@param spans :
|
||||
*/
|
||||
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *,
|
||||
QPair<int, int> > &spans) {
|
||||
QPair<int, int> > &spans) {
|
||||
foreach (TitleBlockCell *cell, spans.keys()) {
|
||||
cell -> row_span = spans[cell].first;
|
||||
cell -> col_span = spans[cell].second;
|
||||
@@ -1344,9 +1344,9 @@ bool TitleBlockTemplate::addLogoFromFile(const QString &filepath,
|
||||
|
||||
// we then try to add it as a bitmap image
|
||||
return addLogo(filename,
|
||||
&file_content,
|
||||
filepath_info.suffix(),
|
||||
"base64");
|
||||
&file_content,
|
||||
filepath_info.suffix(),
|
||||
"base64");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1405,7 +1405,7 @@ bool TitleBlockTemplate::removeLogo(const QString &logo_name) {
|
||||
@return
|
||||
*/
|
||||
bool TitleBlockTemplate::renameLogo(const QString &logo_name,
|
||||
const QString &new_name) {
|
||||
const QString &new_name) {
|
||||
if (!data_logos_.contains(logo_name)
|
||||
|| data_logos_.contains(new_name)) {
|
||||
return(false);
|
||||
@@ -1531,8 +1531,8 @@ void TitleBlockTemplate::render(QPainter &painter,
|
||||
// calculate the border rect of the current cell
|
||||
int x = lengthRange(0, cells_[i][j] -> num_col, widths);
|
||||
int y = lengthRange(0,
|
||||
cells_[i][j] -> num_row,
|
||||
rows_heights_);
|
||||
cells_[i][j] -> num_row,
|
||||
rows_heights_);
|
||||
|
||||
int row_span = 0, col_span = 0;
|
||||
if (cells_[i][j] -> span_state
|
||||
@@ -1541,11 +1541,11 @@ void TitleBlockTemplate::render(QPainter &painter,
|
||||
col_span = cells_[i][j] -> applied_col_span;
|
||||
}
|
||||
int w = lengthRange(cells_[i][j] -> num_col,
|
||||
cells_[i][j] -> num_col + 1 + col_span,
|
||||
widths);
|
||||
cells_[i][j] -> num_col + 1 + col_span,
|
||||
widths);
|
||||
int h = lengthRange(cells_[i][j] -> num_row,
|
||||
cells_[i][j] -> num_row + 1 + row_span,
|
||||
rows_heights_);
|
||||
cells_[i][j] -> num_row + 1 + row_span,
|
||||
rows_heights_);
|
||||
QRect cell_rect(x, y, w, h);
|
||||
|
||||
renderCell(painter, *cells_[i][j],
|
||||
@@ -1576,7 +1576,7 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect,
|
||||
QList<int> widths = columnsWidth(titleblock_width);
|
||||
|
||||
// draw the titleblock border
|
||||
double xCoord = title_block_rect.topLeft().x()*Createdxf::xScale;
|
||||
double xCoord = title_block_rect.topLeft().x()*Createdxf::xScale;
|
||||
double yCoord =
|
||||
Createdxf::sheetHeight
|
||||
- title_block_rect.bottomLeft().y()
|
||||
@@ -1600,9 +1600,9 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect,
|
||||
|
||||
// calculate the border rect of the current cell
|
||||
double x = lengthRange(0, cells_[i][j] -> num_col,
|
||||
widths);
|
||||
widths);
|
||||
double y = lengthRange(0, cells_[i][j] -> num_row,
|
||||
rows_heights_);
|
||||
rows_heights_);
|
||||
|
||||
int row_span = 0, col_span = 0;
|
||||
if (cells_[i][j] -> span_state
|
||||
@@ -1611,11 +1611,11 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect,
|
||||
col_span = cells_[i][j] -> applied_col_span;
|
||||
}
|
||||
double w = lengthRange(cells_[i][j] -> num_col,
|
||||
cells_[i][j] -> num_col + 1 + col_span,
|
||||
widths);
|
||||
cells_[i][j] -> num_col + 1 + col_span,
|
||||
widths);
|
||||
double h = lengthRange(cells_[i][j] -> num_row,
|
||||
cells_[i][j] -> num_row + 1 + row_span,
|
||||
rows_heights_);
|
||||
cells_[i][j] -> num_row + 1 + row_span,
|
||||
rows_heights_);
|
||||
|
||||
x = xCoord + x*Createdxf::xScale;
|
||||
h *= Createdxf::yScale;
|
||||
@@ -1655,9 +1655,9 @@ void TitleBlockTemplate::renderDxf(QRectF &title_block_rect,
|
||||
Rectangle the cell must be rendered into.
|
||||
*/
|
||||
void TitleBlockTemplate::renderCell(QPainter &painter,
|
||||
const TitleBlockCell &cell,
|
||||
const DiagramContext &diagram_context,
|
||||
const QRect &cell_rect) const
|
||||
const TitleBlockCell &cell,
|
||||
const DiagramContext &diagram_context,
|
||||
const QRect &cell_rect) const
|
||||
{
|
||||
// draw the border rect of the current cell
|
||||
QPen pen(QBrush(), 0.0, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
|
||||
@@ -1819,7 +1819,7 @@ void TitleBlockTemplate::renderTextCell(QPainter &painter,
|
||||
QRectF new_world_cell_rect(cell_rect);
|
||||
new_world_cell_rect.moveTo(0, 0.0);
|
||||
new_world_cell_rect.setWidth(new_world_cell_rect.width()
|
||||
/ ratio);
|
||||
/ ratio);
|
||||
painter.drawText(new_world_cell_rect,
|
||||
cell.alignment,
|
||||
text);
|
||||
@@ -2014,11 +2014,11 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) {
|
||||
|
||||
// ensure cells that will be spanned are either empty or free
|
||||
for (int i = cell -> num_col ;
|
||||
i <= cell -> num_col + cell -> applied_col_span ;
|
||||
++ i) {
|
||||
i <= cell -> num_col + cell -> applied_col_span ;
|
||||
++ i) {
|
||||
for (int j = cell -> num_row ;
|
||||
j <= cell -> num_row + cell -> applied_row_span ;
|
||||
++ j) {
|
||||
j <= cell -> num_row + cell -> applied_row_span ;
|
||||
++ j) {
|
||||
if (i == cell -> num_col && j == cell -> num_row)
|
||||
continue;
|
||||
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
|
||||
@@ -2031,8 +2031,8 @@ bool TitleBlockTemplate::checkCellSpan(TitleBlockCell *cell) {
|
||||
current_cell -> spanner_cell
|
||||
&& current_cell -> spanner_cell
|
||||
!= cell
|
||||
)
|
||||
) {
|
||||
)
|
||||
) {
|
||||
cell -> span_state = TitleBlockCell::Disabled;
|
||||
return(true);
|
||||
}
|
||||
@@ -2058,11 +2058,11 @@ void TitleBlockTemplate::applyCellSpan(TitleBlockCell *cell)
|
||||
|
||||
// goes through every spanned cell
|
||||
for (int i = cell -> num_col ;
|
||||
i <= cell -> num_col + cell -> applied_col_span ;
|
||||
++ i) {
|
||||
i <= cell -> num_col + cell -> applied_col_span ;
|
||||
++ i) {
|
||||
for (int j = cell -> num_row ;
|
||||
j <= cell -> num_row + cell -> applied_row_span ;
|
||||
++ j) {
|
||||
j <= cell -> num_row + cell -> applied_row_span ;
|
||||
++ j) {
|
||||
// avoid the spanning cell itself
|
||||
if (i == cell -> num_col && j == cell -> num_row)
|
||||
continue;
|
||||
|
||||
@@ -191,7 +191,14 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
|
||||
|
||||
if (exist_ == false)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
m_connected_terminals.append(qMakePair<Terminal *, Terminal *>(hub_terminal, t));
|
||||
#else
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove code for QT 6 or later")
|
||||
#endif
|
||||
qDebug()<<"Help code for QT 6 or later";
|
||||
#endif
|
||||
Conductor *new_cond = new Conductor(hub_terminal, t);
|
||||
new_cond->setProperties(properties);
|
||||
new AddItemCommand<Conductor*>(new_cond, t->diagram(), QPointF(), this);
|
||||
|
||||
@@ -285,6 +285,10 @@ void LinkElementCommand::makeLink(const QList<Element *> &element_list)
|
||||
|
||||
//All elements stored in to_unlink is unwanted we unlink it from m_element
|
||||
if (!to_unlink.isEmpty())
|
||||
{
|
||||
foreach(Element *elmt, to_unlink)
|
||||
{
|
||||
m_element->unlinkElement(elmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user