mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
use "%" for string-concatenation
Qt-Docs says it's less memory-usage...
This commit is contained in:
@@ -93,7 +93,10 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
|
||||
|
||||
connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
|
||||
connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect()));
|
||||
connect(&(m_diagram -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
|
||||
// TODO: review the following line. Old line commented out, been broken since commit
|
||||
// "27dcd5ef007a282d1a5a7f2f3dcaefc62669d668".
|
||||
// connect(&(m_diagram -> border_and_titleblock), SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(updateWindowTitle()));
|
||||
connect(&(m_diagram->border_and_titleblock), &BorderTitleBlock::informationChanged, this, &DiagramView::updateWindowTitle);
|
||||
connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation)));
|
||||
|
||||
QShortcut *edit_conductor_color_shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this);
|
||||
@@ -203,18 +206,9 @@ void DiagramView::handleElementDrop(QDropEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
#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();
|
||||
@@ -283,17 +277,8 @@ void DiagramView::handleTextDrop(QDropEvent *e) {
|
||||
iti -> setHtml (e -> mimeData() -> text());
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||
|
||||
m_diagram->undoStack().push(new AddGraphicsObjectCommand(
|
||||
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 AddGraphicsObjectCommand(
|
||||
iti, m_diagram, e->position()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,15 +432,7 @@ 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(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)
|
||||
#endif
|
||||
{
|
||||
m_drag_last_pos = e->pos();
|
||||
viewport()->setCursor(Qt::ClosedHandCursor);
|
||||
@@ -505,14 +482,7 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
|
||||
|
||||
// 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)
|
||||
#endif
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
@@ -573,14 +543,7 @@ void DiagramView::mouseReleaseEvent(QMouseEvent *e)
|
||||
if (m_event_interface && m_event_interface->mouseReleaseEvent(e)) return;
|
||||
|
||||
// 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)
|
||||
#endif
|
||||
{
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
@@ -614,14 +577,7 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user