mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-13 10:04:13 +02:00
Merge pull request #662 from arummler/master-fix-slot
Fix broken signal/slot relations
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "../numerotationcontext.h"
|
#include "../numerotationcontext.h"
|
||||||
#include "../numerotationcontextcommands.h"
|
#include "../numerotationcontextcommands.h"
|
||||||
#include "ui_autonumberingdockwidget.h"
|
#include "ui_autonumberingdockwidget.h"
|
||||||
|
#include "../../undocommand/changetitleblockcommand.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -371,6 +372,16 @@ void AutoNumberingDockWidget::on_m_folio_cb_activated(int) {
|
|||||||
ip.folio = "%id/%total";
|
ip.folio = "%id/%total";
|
||||||
m_project->setDefaultTitleBlockProperties(ip);
|
m_project->setDefaultTitleBlockProperties(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_project_view && m_project_view->currentDiagram()) {
|
||||||
|
Diagram *diagram = m_project_view->currentDiagram()->diagram();
|
||||||
|
TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock();
|
||||||
|
TitleBlockProperties new_properties = old_properties;
|
||||||
|
new_properties.auto_page_num = ip.auto_page_num;
|
||||||
|
new_properties.folio = ip.folio;
|
||||||
|
if (new_properties != old_properties)
|
||||||
|
diagram->undoStack().push(new ChangeTitleBlockCommand(diagram, old_properties, new_properties));
|
||||||
|
}
|
||||||
emit(folioAutoNumChanged(current_autonum));
|
emit(folioAutoNumChanged(current_autonum));
|
||||||
refreshRow(AutoNumCategory::Folio);
|
refreshRow(AutoNumCategory::Folio);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
|
|||||||
|
|
||||||
connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
|
connect(m_diagram, SIGNAL(showDiagram(Diagram*)), this, SIGNAL(showDiagram(Diagram*)));
|
||||||
connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect()));
|
connect(m_diagram, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustSceneRect()));
|
||||||
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)));
|
connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation)));
|
||||||
|
|
||||||
QShortcut *edit_conductor_color_shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this);
|
QShortcut *edit_conductor_color_shortcut = new QShortcut(QKeySequence(Qt::Key_F2), this);
|
||||||
|
|||||||
@@ -140,12 +140,21 @@ 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_, SIGNAL(mapped(int)), this, SLOT(slot_previewDiagram(int)));
|
connect(preview_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_previewDiagram(int)));
|
||||||
connect(width_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctHeight(int)));
|
connect(width_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctHeight(int)));
|
||||||
connect(height_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctWidth(int)));
|
connect(height_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_correctWidth(int)));
|
||||||
connect(ratio_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_keepRatioChanged(int)));
|
connect(ratio_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_keepRatioChanged(int)));
|
||||||
connect(reset_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_resetSize(int)));
|
connect(reset_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_resetSize(int)));
|
||||||
connect(clipboard_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_exportToClipBoard(int)));
|
connect(clipboard_mapper_, SIGNAL(mapped(int)), this, SLOT(slot_exportToClipBoard(int)));
|
||||||
|
#else
|
||||||
|
connect(preview_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_previewDiagram);
|
||||||
|
connect(width_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctHeight);
|
||||||
|
connect(height_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_correctWidth);
|
||||||
|
connect(ratio_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_keepRatioChanged);
|
||||||
|
connect(reset_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_resetSize);
|
||||||
|
connect(clipboard_mapper_, &QSignalMapper::mappedInt, this, &ExportDialog::slot_exportToClipBoard);
|
||||||
|
#endif
|
||||||
|
|
||||||
diagrams_list_layout_ = new QGridLayout();
|
diagrams_list_layout_ = new QGridLayout();
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -124,8 +124,11 @@ QETApp::QETApp() :
|
|||||||
initSplashScreen();
|
initSplashScreen();
|
||||||
initSystemTray();
|
initSystemTray();
|
||||||
|
|
||||||
connect(&signal_map, SIGNAL(mapped(QWidget *)),
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedObject() always available
|
||||||
this, SLOT(invertMainWindowVisibility(QWidget *)));
|
connect(&signal_map, SIGNAL(mapped(QWidget *)), this, SLOT(invertMainWindowVisibility(QWidget *)));
|
||||||
|
#else
|
||||||
|
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,7 +107,11 @@ 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, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *)));
|
connect(&windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(activateWidget(QWidget *)));
|
||||||
|
#else
|
||||||
|
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);
|
||||||
|
|||||||
@@ -244,7 +244,6 @@ class QETProject : public QObject
|
|||||||
/// rebuild their rule lists; this one just says "re-read me".
|
/// rebuild their rule lists; this one just says "re-read me".
|
||||||
void autoNumContextUpdated();
|
void autoNumContextUpdated();
|
||||||
void folioAutoNumRemoved();
|
void folioAutoNumRemoved();
|
||||||
void folioAutoNumChanged(QString);
|
|
||||||
void defaultTitleBlockPropertiesChanged();
|
void defaultTitleBlockPropertiesChanged();
|
||||||
void conductorAutoNumChanged();
|
void conductorAutoNumChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,11 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na
|
|||||||
connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
connect(replace_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
||||||
connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
connect(rename_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
||||||
connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
connect(cancel_button, SIGNAL(clicked()), signal_mapper, SLOT(map()));
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // TODO Qt6 only: remove, mappedInt() always available
|
||||||
connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int)));
|
connect(signal_mapper, SIGNAL(mapped(int)), rename_dialog, SLOT(done(int)));
|
||||||
|
#else
|
||||||
|
connect(signal_mapper, &QSignalMapper::mappedInt, rename_dialog, &QDialog::done);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
rd_label -> setText(
|
rd_label -> setText(
|
||||||
QString(tr(
|
QString(tr(
|
||||||
|
|||||||
@@ -396,17 +396,29 @@ void ProjectAutoNumConfigPage::buildConnections()
|
|||||||
//Conductor Tab
|
//Conductor Tab
|
||||||
connect(m_saw_conductor, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextConductor);
|
connect(m_saw_conductor, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextConductor);
|
||||||
connect(m_saw_conductor, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextConductor);
|
connect(m_saw_conductor, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextConductor);
|
||||||
connect(m_saw_conductor->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextConductor(QString)));
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available
|
||||||
|
connect(m_saw_conductor->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextConductor(QString)));
|
||||||
|
#else
|
||||||
|
connect(m_saw_conductor->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextConductor);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Element Tab
|
//Element Tab
|
||||||
connect(m_saw_element, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextElement);
|
connect(m_saw_element, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextElement);
|
||||||
connect(m_saw_element, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextElement);
|
connect(m_saw_element, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextElement);
|
||||||
connect(m_saw_element->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextElement(QString)));
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available
|
||||||
|
connect(m_saw_element->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextElement(QString)));
|
||||||
|
#else
|
||||||
|
connect(m_saw_element->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextElement);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Folio Tab
|
//Folio Tab
|
||||||
connect(m_saw_folio, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextFolio);
|
connect(m_saw_folio, &SelectAutonumW::applyPressed, this, &ProjectAutoNumConfigPage::saveContextFolio);
|
||||||
connect(m_saw_folio, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextFolio);
|
connect(m_saw_folio, &SelectAutonumW::removeClicked, this, &ProjectAutoNumConfigPage::removeContextFolio);
|
||||||
connect(m_saw_folio->contextComboBox(), SIGNAL(currentIndexChanged(QString)), this, SLOT(updateContextFolio(QString)));
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // TODO Qt6 only: remove, textActivated() always available
|
||||||
|
connect(m_saw_folio->contextComboBox(), SIGNAL(activated(QString)), this, SLOT(updateContextFolio(QString)));
|
||||||
|
#else
|
||||||
|
connect(m_saw_folio->contextComboBox(), &QComboBox::textActivated, this, &ProjectAutoNumConfigPage::updateContextFolio);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Auto Folio Numbering
|
// Auto Folio Numbering
|
||||||
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
|
connect (m_faw, SIGNAL (applyPressed()), this, SLOT (applyAutoNum()));
|
||||||
@@ -491,6 +503,10 @@ void ProjectAutoNumConfigPage::removeContextElement()
|
|||||||
return;
|
return;
|
||||||
m_project->removeElementAutoNum (m_saw_element->contextComboBox()->currentText());
|
m_project->removeElementAutoNum (m_saw_element->contextComboBox()->currentText());
|
||||||
m_saw_element->contextComboBox()->removeItem (m_saw_element->contextComboBox()->currentIndex());
|
m_saw_element->contextComboBox()->removeItem (m_saw_element->contextComboBox()->currentIndex());
|
||||||
|
// removeItem() removes the current selection programmatically but
|
||||||
|
// textActivated() does not react to (by design, see buildConnections()).
|
||||||
|
// Refresh the displayed pattern explicitly so it matches the new selection.
|
||||||
|
updateContextElement(m_saw_element->contextComboBox()->currentText());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -678,6 +694,10 @@ void ProjectAutoNumConfigPage::removeContextConductor()
|
|||||||
if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
if ( m_saw_conductor->contextComboBox()-> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||||
m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() );
|
m_project -> removeConductorAutoNum (m_saw_conductor->contextComboBox()-> currentText() );
|
||||||
m_saw_conductor->contextComboBox()-> removeItem (m_saw_conductor->contextComboBox()-> currentIndex() );
|
m_saw_conductor->contextComboBox()-> removeItem (m_saw_conductor->contextComboBox()-> currentIndex() );
|
||||||
|
// removeItem() removes the current selection programmatically but
|
||||||
|
// textActivated() does not react to (by design, see buildConnections()).
|
||||||
|
// Refresh the displayed pattern explicitly so it matches the new selection.
|
||||||
|
updateContextConductor(m_saw_conductor->contextComboBox()->currentText());
|
||||||
project()->conductorAutoNumRemoved();
|
project()->conductorAutoNumRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,6 +711,10 @@ void ProjectAutoNumConfigPage::removeContextFolio()
|
|||||||
if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
if ( m_saw_folio->contextComboBox() -> currentText() == tr("Nom de la nouvelle numérotation") ) return;
|
||||||
m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() );
|
m_project -> removeFolioAutoNum (m_saw_folio->contextComboBox() -> currentText() );
|
||||||
m_saw_folio->contextComboBox() -> removeItem (m_saw_folio->contextComboBox() -> currentIndex() );
|
m_saw_folio->contextComboBox() -> removeItem (m_saw_folio->contextComboBox() -> currentIndex() );
|
||||||
|
// removeItem() removes the current selection programmatically but
|
||||||
|
// textActivated() does not react to (by design, see buildConnections()).
|
||||||
|
// Refresh the displayed pattern explicitly so it matches the new selection.
|
||||||
|
updateContextFolio(m_saw_folio->contextComboBox()->currentText());
|
||||||
project()->folioAutoNumRemoved();
|
project()->folioAutoNumRemoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user