mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-16 19:54:13 +02:00
Remove all Qt version checks and branches for <5.15.12 as such versions are no longer supported.
This commit is contained in:
@@ -130,12 +130,7 @@ bool PhysicalTerminal::setLevelOf(const QSharedPointer<RealTerminal> &terminal,
|
|||||||
const int i = m_real_terminal.indexOf(terminal);
|
const int i = m_real_terminal.indexOf(terminal);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
|
|
||||||
m_real_terminal.swapItemsAt(i, std::min<int>(level, static_cast<int>(m_real_terminal.size())-1));
|
m_real_terminal.swapItemsAt(i, std::min<int>(level, static_cast<int>(m_real_terminal.size())-1));
|
||||||
#else
|
|
||||||
auto j = std::min(level, m_real_terminal.size()-1);
|
|
||||||
std::swap(m_real_terminal.begin()[i], m_real_terminal.begin()[j]);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -64,11 +64,8 @@ bool TerminalStripData::fromXml(const QDomElement &xml_element)
|
|||||||
"due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName();
|
"due to wrong tag name. Expected " << this->xmlTagName() << " used " << xml_element.tagName();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
|
||||||
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
m_uuid = QUuid::fromString(xml_element.attribute(QStringLiteral("uuid")));
|
||||||
#else
|
|
||||||
m_uuid = QUuid(xml_element.attribute(QStringLiteral("uuid")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto &xml_info :
|
for (auto &xml_info :
|
||||||
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
QETXML::findInDomElement(xml_element.firstChildElement(QStringLiteral("informations")),
|
||||||
|
|||||||
@@ -37,11 +37,7 @@ TerminalStripTreeDockWidget::TerminalStripTreeDockWidget(QETProject *project, QW
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setProject(project);
|
setProject(project);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||||
#else
|
|
||||||
ui->m_tree_view->expandAll();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
|
TerminalStripTreeDockWidget::~TerminalStripTreeDockWidget()
|
||||||
@@ -95,11 +91,7 @@ void TerminalStripTreeDockWidget::reload()
|
|||||||
|
|
||||||
buildTree();
|
buildTree();
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
ui->m_tree_view->expandRecursively(ui->m_tree_view->rootIndex());
|
||||||
#else
|
|
||||||
ui->m_tree_view->expandAll();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Reselect the tree widget item of the current edited strip
|
//Reselect the tree widget item of the current edited strip
|
||||||
auto item = m_item_strip_H.key(current_);
|
auto item = m_item_strip_H.key(current_);
|
||||||
|
|||||||
@@ -72,14 +72,8 @@ bool ConductorNumExport::toCsv()
|
|||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
stream << wiresNum() << endl;
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
stream << wiresNum() << &Qt::endl(stream);
|
stream << wiresNum() << &Qt::endl(stream);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -48,14 +48,8 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
|||||||
m_button_group.addButton(ui->m_protection_cb, 5);
|
m_button_group.addButton(ui->m_protection_cb, 5);
|
||||||
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
m_button_group.addButton(ui->m_thumbnail_cb, 6);
|
||||||
m_button_group.addButton(ui->m_plc_cb, 7);
|
m_button_group.addButton(ui->m_plc_cb, 7);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::idClicked), [this](int id)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
auto check_box = static_cast<QCheckBox *>(m_button_group.button(0));
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
|
|||||||
@@ -458,14 +458,7 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
if (m_event_interface && m_event_interface->mousePressEvent(e)) return;
|
||||||
|
|
||||||
//Start drag view when hold the middle button
|
//Start drag view when hold the middle button
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
m_drag_last_pos = e->pos();
|
m_drag_last_pos = e->pos();
|
||||||
viewport()->setCursor(Qt::ClosedHandCursor);
|
viewport()->setCursor(Qt::ClosedHandCursor);
|
||||||
@@ -515,14 +508,7 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||||
|
|
||||||
// Drag the view
|
// Drag the view
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->buttons() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->buttons() == Qt::MiddleButton)
|
if (e->buttons() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QScrollBar *h = horizontalScrollBar();
|
QScrollBar *h = horizontalScrollBar();
|
||||||
QScrollBar *v = verticalScrollBar();
|
QScrollBar *v = verticalScrollBar();
|
||||||
@@ -583,14 +569,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||||
|
|
||||||
// Stop drag view
|
// Stop drag view
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
viewport()->setCursor(Qt::ArrowCursor);
|
viewport()->setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,14 +276,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
|||||||
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
|
for (int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
|
||||||
if (my_items_list[i] -> isSelected()) {
|
if (my_items_list[i] -> isSelected()) {
|
||||||
if (!my_items_list[i +1] -> isSelected()) {
|
if (!my_items_list[i +1] -> isSelected()) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
|
||||||
my_items_list.swap(i, i + 1);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
|
||||||
#endif
|
|
||||||
my_items_list.swapItemsAt(i, i + 1);
|
my_items_list.swapItemsAt(i, i + 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,14 +294,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
|||||||
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
|
for (int i = 1 ; i < my_items_list.count() ; ++ i) {
|
||||||
if (my_items_list[i] -> isSelected()) {
|
if (my_items_list[i] -> isSelected()) {
|
||||||
if (!my_items_list[i - 1] -> isSelected()) {
|
if (!my_items_list[i - 1] -> isSelected()) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0) // ### Qt 6: remove
|
|
||||||
my_items_list.swap(i, i - 1);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.13 or later")
|
|
||||||
#endif
|
|
||||||
my_items_list.swapItemsAt(i, i - 1);
|
my_items_list.swapItemsAt(i, i - 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,14 +372,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
|
|||||||
*/
|
*/
|
||||||
void ElementView::mousePressEvent(QMouseEvent* e)
|
void ElementView::mousePressEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
setCursor( (Qt::ClosedHandCursor));
|
setCursor( (Qt::ClosedHandCursor));
|
||||||
reference_view_ = e->pos();
|
reference_view_ = e->pos();
|
||||||
@@ -394,14 +387,7 @@ void ElementView::mousePressEvent(QMouseEvent* e)
|
|||||||
*/
|
*/
|
||||||
void ElementView::mouseMoveEvent(QMouseEvent* e)
|
void ElementView::mouseMoveEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (e->buttons() == Qt::MidButton)
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
#endif
|
|
||||||
if (e->buttons() == Qt::MiddleButton)
|
if (e->buttons() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QScrollBar *h = horizontalScrollBar();
|
QScrollBar *h = horizontalScrollBar();
|
||||||
QScrollBar *v = verticalScrollBar();
|
QScrollBar *v = verticalScrollBar();
|
||||||
@@ -420,14 +406,7 @@ void ElementView::mouseMoveEvent(QMouseEvent* e)
|
|||||||
*/
|
*/
|
||||||
void ElementView::mouseReleaseEvent(QMouseEvent* e)
|
void ElementView::mouseReleaseEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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)
|
if (e->button() == Qt::MiddleButton)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
adjustSceneRect();
|
adjustSceneRect();
|
||||||
|
|||||||
@@ -423,11 +423,9 @@ void ElementPropertiesEditorWidget::on_m_base_type_cb_currentIndexChanged(int in
|
|||||||
ui->m_master_gb->setVisible(master);
|
ui->m_master_gb->setVisible(master);
|
||||||
ui->m_terminal_gb->setVisible(terminal);
|
ui->m_terminal_gb->setVisible(terminal);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
|
||||||
ui->tabWidget->setTabVisible(1,
|
ui->tabWidget->setTabVisible(1,
|
||||||
(type_ == ElementData::Simple ||
|
(type_ == ElementData::Simple ||
|
||||||
type_ == ElementData::Master));
|
type_ == ElementData::Master));
|
||||||
#endif
|
|
||||||
|
|
||||||
updateTree();
|
updateTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,21 +140,12 @@ QWidget *ExportDialog::initDiagramsListPart()
|
|||||||
reset_mapper_ = new QSignalMapper(this);
|
reset_mapper_ = new QSignalMapper(this);
|
||||||
clipboard_mapper_ = new QSignalMapper(this);
|
clipboard_mapper_ = new QSignalMapper(this);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available
|
|
||||||
connect(preview_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_previewDiagram);
|
|
||||||
connect(width_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_correctHeight);
|
|
||||||
connect(height_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_correctWidth);
|
|
||||||
connect(ratio_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_keepRatioChanged);
|
|
||||||
connect(reset_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_resetSize);
|
|
||||||
connect(clipboard_mapper_, qOverload<int>(&QSignalMapper::mapped), this, &ExportDialog::slot_exportToClipBoard);
|
|
||||||
#else
|
|
||||||
connect(preview_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_previewDiagram);
|
connect(preview_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_previewDiagram);
|
||||||
connect(width_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctHeight);
|
connect(width_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctHeight);
|
||||||
connect(height_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctWidth);
|
connect(height_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctWidth);
|
||||||
connect(ratio_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_keepRatioChanged);
|
connect(ratio_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_keepRatioChanged);
|
||||||
connect(reset_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_resetSize);
|
connect(reset_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_resetSize);
|
||||||
connect(clipboard_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_exportToClipBoard);
|
connect(clipboard_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_exportToClipBoard);
|
||||||
#endif
|
|
||||||
|
|
||||||
diagrams_list_layout_ = new QGridLayout();
|
diagrams_list_layout_ = new QGridLayout();
|
||||||
|
|
||||||
|
|||||||
@@ -63,14 +63,7 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
|
|||||||
auto printer_ = new QPrinter();
|
auto printer_ = new QPrinter();
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
printer_->setDocName(ProjectPrintWindow::docName(project));
|
printer_->setDocName(ProjectPrintWindow::docName(project));
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
printer_->setOrientation(QPrinter::Landscape);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
# endif
|
|
||||||
printer_->setPageOrientation(QPageLayout::Landscape);
|
printer_->setPageOrientation(QPageLayout::Landscape);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (format == QPrinter::NativeFormat) //To physical printer
|
if (format == QPrinter::NativeFormat) //To physical printer
|
||||||
{
|
{
|
||||||
@@ -204,7 +197,6 @@ ProjectPrintWindow::~ProjectPrintWindow()
|
|||||||
*/
|
*/
|
||||||
void ProjectPrintWindow::requestPaint()
|
void ProjectPrintWindow::requestPaint()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
@@ -229,7 +221,6 @@ void ProjectPrintWindow::requestPaint()
|
|||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!m_project->diagrams().count()) {
|
if (!m_project->diagrams().count()) {
|
||||||
return;
|
return;
|
||||||
@@ -317,16 +308,10 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
|
|||||||
diagram->render(painter, QRectF(), diagram_rect, Qt::KeepAspectRatio);
|
diagram->render(painter, QRectF(), diagram_rect, Qt::KeepAspectRatio);
|
||||||
} else {
|
} else {
|
||||||
// Print on one or several pages
|
// Print on one or several pages
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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) :
|
auto printed_rect = full_page ? printer->paperRect(QPrinter::Millimeter) :
|
||||||
printer->pageRect(QPrinter::Millimeter);
|
printer->pageRect(QPrinter::Millimeter);
|
||||||
#endif
|
|
||||||
auto used_width = printed_rect.width();
|
auto used_width = printed_rect.width();
|
||||||
auto used_height = printed_rect.height();
|
auto used_height = printed_rect.height();
|
||||||
auto h_pages_count = horizontalPagesCount(diagram, option, full_page);
|
auto h_pages_count = horizontalPagesCount(diagram, option, full_page);
|
||||||
@@ -476,17 +461,12 @@ int ProjectPrintWindow::horizontalPagesCount(
|
|||||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||||
{
|
{
|
||||||
QRect printable_area;
|
QRect printable_area;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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
|
|
||||||
printable_area =
|
printable_area =
|
||||||
full_page ?
|
full_page ?
|
||||||
m_printer->pageLayout().fullRectPixels(m_printer->resolution()) :
|
m_printer->pageLayout().fullRectPixels(m_printer->resolution()) :
|
||||||
m_printer->pageLayout().paintRectPixels(m_printer->resolution());
|
m_printer->pageLayout().paintRectPixels(m_printer->resolution());
|
||||||
#endif
|
|
||||||
QRect diagram_rect = diagramRect(diagram, option);
|
QRect diagram_rect = diagramRect(diagram, option);
|
||||||
|
|
||||||
int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width())));
|
int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width())));
|
||||||
@@ -505,17 +485,12 @@ int ProjectPrintWindow::verticalPagesCount(
|
|||||||
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
Diagram *diagram, const ExportProperties &option, bool full_page) const
|
||||||
{
|
{
|
||||||
QRect printable_area;
|
QRect printable_area;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### 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
|
|
||||||
printable_area =
|
printable_area =
|
||||||
full_page ?
|
full_page ?
|
||||||
m_printer->pageLayout().fullRectPixels(m_printer->resolution()) :
|
m_printer->pageLayout().fullRectPixels(m_printer->resolution()) :
|
||||||
m_printer->pageLayout().paintRectPixels(m_printer->resolution());
|
m_printer->pageLayout().paintRectPixels(m_printer->resolution());
|
||||||
#endif
|
|
||||||
QRect diagram_rect = diagramRect(diagram, option);
|
QRect diagram_rect = diagramRect(diagram, option);
|
||||||
|
|
||||||
int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height())));
|
int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height())));
|
||||||
@@ -588,43 +563,7 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
settings.beginGroup(printer_section);
|
settings.beginGroup(printer_section);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
if (settings.contains("orientation")) {
|
|
||||||
QString value = settings.value("orientation", "landscape").toString();
|
|
||||||
m_printer -> setOrientation(value == "landscape" ? QPrinter::Landscape : QPrinter::Portrait);
|
|
||||||
}
|
|
||||||
if (settings.contains("papersize")) {
|
|
||||||
int value = settings.value("papersize", QPrinter::A4).toInt();
|
|
||||||
if (value == QPrinter::Custom) {
|
|
||||||
bool w_ok, h_ok;
|
|
||||||
int w = settings.value("customwidthmm", -1).toInt(&w_ok);
|
|
||||||
int h = settings.value("customheightmm", -1).toInt(&h_ok);
|
|
||||||
if (w_ok && h_ok && w != -1 && h != -1) {
|
|
||||||
m_printer -> setPaperSize(QSizeF(w, h), QPrinter::Millimeter);
|
|
||||||
}
|
|
||||||
} else if (value < QPrinter::Custom) {
|
|
||||||
m_printer -> setPaperSize(static_cast<QPrinter::PaperSize>(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal margins[4];
|
|
||||||
m_printer -> getPageMargins(&margins[0], &margins[1], &margins[2], &margins[3], QPrinter::Millimeter);
|
|
||||||
QStringList margins_names(QStringList() << "left" << "top" << "right" << "bottom");
|
|
||||||
for (int i = 0 ; i < 4 ; ++ i) {
|
|
||||||
bool conv_ok;
|
|
||||||
qreal value = settings.value("margin" + margins_names.at(i), -1.0).toReal(&conv_ok);
|
|
||||||
if (conv_ok && value != -1.0) margins[i] = value;
|
|
||||||
}
|
|
||||||
m_printer->setPageMargins(
|
|
||||||
margins[0],
|
|
||||||
margins[1],
|
|
||||||
margins[2],
|
|
||||||
margins[3],
|
|
||||||
QPrinter::Millimeter);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 6 or later")
|
|
||||||
# endif
|
|
||||||
if (settings.contains("orientation"))
|
if (settings.contains("orientation"))
|
||||||
{
|
{
|
||||||
QString value = settings.value("orientation", "landscape").toString();
|
QString value = settings.value("orientation", "landscape").toString();
|
||||||
@@ -677,7 +616,7 @@ void ProjectPrintWindow::loadPageSetupForCurrentPrinter()
|
|||||||
m_printer->setPageMargins(
|
m_printer->setPageMargins(
|
||||||
QMarginsF(margins[0], margins[1], margins[2], margins[3]),
|
QMarginsF(margins[0], margins[1], margins[2], margins[3]),
|
||||||
QPageLayout::Millimeter);
|
QPageLayout::Millimeter);
|
||||||
#endif
|
|
||||||
m_printer->setFullPage(
|
m_printer->setFullPage(
|
||||||
settings.value("fullpage", "false").toString() == "true");
|
settings.value("fullpage", "false").toString() == "true");
|
||||||
|
|
||||||
@@ -694,35 +633,6 @@ void ProjectPrintWindow::savePageSetupForCurrentPrinter()
|
|||||||
settings.beginGroup("printers");
|
settings.beginGroup("printers");
|
||||||
settings.beginGroup(printer_section);
|
settings.beginGroup(printer_section);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 1) // ### Qt 6: remove
|
|
||||||
settings.setValue("orientation", m_printer -> orientation() == QPrinter::Portrait ? "portrait" : "landscape");
|
|
||||||
settings.setValue("papersize", int(m_printer -> paperSize()));
|
|
||||||
if (m_printer -> paperSize() == QPrinter::Custom) {
|
|
||||||
QSizeF size = m_printer -> paperSize(QPrinter::Millimeter);
|
|
||||||
settings.setValue("customwidthmm", size.width());
|
|
||||||
settings.setValue("customheightmm", size.height());
|
|
||||||
} else {
|
|
||||||
settings.remove("customwidthmm");
|
|
||||||
settings.remove("customheightmm");
|
|
||||||
}
|
|
||||||
qreal left, top, right, bottom;
|
|
||||||
m_printer
|
|
||||||
->getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
|
|
||||||
settings.setValue("marginleft", left);
|
|
||||||
settings.setValue("margintop", top);
|
|
||||||
settings.setValue("marginright", right);
|
|
||||||
settings.setValue("marginbottom", bottom);
|
|
||||||
settings.setValue("fullpage", m_printer->fullPage() ? "true" : "false");
|
|
||||||
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";
|
|
||||||
|
|
||||||
settings.setValue(
|
settings.setValue(
|
||||||
"orientation",
|
"orientation",
|
||||||
m_printer->pageLayout().orientation() == QPageLayout::Portrait ?
|
m_printer->pageLayout().orientation() == QPageLayout::Portrait ?
|
||||||
@@ -753,7 +663,6 @@ void ProjectPrintWindow::savePageSetupForCurrentPrinter()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.sync();
|
settings.sync();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-4
@@ -124,11 +124,8 @@ QETApp::QETApp() :
|
|||||||
initSplashScreen();
|
initSplashScreen();
|
||||||
initSystemTray();
|
initSystemTray();
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedObject() always available
|
|
||||||
connect(&signal_map, qOverload<QWidget*>(&QSignalMapper::mapped), this, [this](QObject *object) { invertMainWindowVisibility(qobject_cast<QWidget *>(object)); });
|
|
||||||
#else
|
|
||||||
connect(&signal_map, &QSignalMapper::mappedObject, this, [this](QObject *object) { invertMainWindowVisibility(qobject_cast<QWidget *>(object)); });
|
connect(&signal_map, &QSignalMapper::mappedObject, this, [this](QObject *object) { invertMainWindowVisibility(qobject_cast<QWidget *>(object)); });
|
||||||
#endif
|
|
||||||
qApp->setQuitOnLastWindowClosed(false);
|
qApp->setQuitOnLastWindowClosed(false);
|
||||||
connect(qApp, &QApplication::lastWindowClosed,
|
connect(qApp, &QApplication::lastWindowClosed,
|
||||||
this, &QETApp::checkRemainingWindows);
|
this, &QETApp::checkRemainingWindows);
|
||||||
|
|||||||
@@ -107,11 +107,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
m_workspace.setTabsClosable(true);
|
m_workspace.setTabsClosable(true);
|
||||||
|
|
||||||
//Set the signal mapper
|
//Set the signal mapper
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedObject() always available
|
|
||||||
connect(&windowMapper, qOverload<QWidget*>(&QSignalMapper::mapped), this, [this](QObject *object) { activateWidget(qobject_cast<QWidget *>(object)); });
|
|
||||||
#else
|
|
||||||
connect(&windowMapper, &QSignalMapper::mappedObject, this, [this](QObject *object) { activateWidget(qobject_cast<QWidget *>(object)); });
|
connect(&windowMapper, &QSignalMapper::mappedObject, this, [this](QObject *object) { activateWidget(qobject_cast<QWidget *>(object)); });
|
||||||
#endif
|
|
||||||
|
|
||||||
setWindowTitle(tr("QElectroTech", "window title"));
|
setWindowTitle(tr("QElectroTech", "window title"));
|
||||||
setWindowIcon(QET::Icons::QETLogo);
|
setWindowIcon(QET::Icons::QETLogo);
|
||||||
|
|||||||
@@ -451,16 +451,8 @@ void GraphicsTablePropertiesEditor::setUpEditConnection()
|
|||||||
m_edit_connection << connect(ui->m_table_left_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_left_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_table_right_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_right_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_table_bottom_margin, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &GraphicsTablePropertiesEditor::apply);
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_table_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(m_header_button_group, QOverload<int>::of(&QButtonGroup::idClicked), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
#endif
|
|
||||||
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::apply);
|
||||||
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
|
m_edit_connection << connect(ui->m_display_n_row_sb, QOverload<int>::of(&QSpinBox::valueChanged), this, &GraphicsTablePropertiesEditor::updateInfoLabel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,11 +216,7 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na
|
|||||||
connect(replace_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
connect(replace_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
||||||
connect(rename_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
connect(rename_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
||||||
connect(cancel_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
connect(cancel_button, &QPushButton::clicked, signal_mapper, qOverload<>(&QSignalMapper::map));
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available
|
|
||||||
connect(signal_mapper, qOverload<int>(&QSignalMapper::mapped), rename_dialog, &QDialog::done);
|
|
||||||
#else
|
|
||||||
connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done);
|
connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rd_label -> setText(
|
rd_label -> setText(
|
||||||
QString(tr(
|
QString(tr(
|
||||||
|
|||||||
@@ -83,14 +83,7 @@ int BOMExportDialog::exec()
|
|||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
if (file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
|
|
||||||
stream << getBom() << endl;
|
|
||||||
#else
|
|
||||||
#if TODO_LIST
|
|
||||||
#pragma message("@TODO remove code for QT 5.15 or later")
|
|
||||||
#endif
|
|
||||||
stream << getBom() << &Qt::endl(stream);
|
stream << getBom() << &Qt::endl(stream);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user