| 45 | |
| 46 | |
| 47 | void watchChildChanges(QWidget* target, QObject* receiver, std::function<void()> action) |
| 48 | { |
| 49 | for (auto widget : target->findChildren<QWidget*>()) { |
| 50 | QCheckBox* checkBox; |
| 51 | QLineEdit* lineEdit; |
| 52 | QSpinBox* spinBox; |
| 53 | QDoubleSpinBox* doubleSpinBox; |
| 54 | QComboBox* comboBox; |
| 55 | QGroupBox* groupBox; |
| 56 | QTableWidget* tableWidget; |
| 57 | QPlainTextEdit* plainTextEdit; |
| 58 | |
| 59 | if ((checkBox = qobject_cast<QCheckBox*>(widget))) { |
| 60 | QObject::connect(checkBox, &QCheckBox::stateChanged, receiver, [=] (int) { action(); }); |
| 61 | } else if ((lineEdit = qobject_cast<QLineEdit*>(widget))) { |
| 62 | QObject::connect(lineEdit, &QLineEdit::textChanged, receiver, [=] (const QString&) { action(); }); |
| 63 | } else if ((spinBox = qobject_cast<QSpinBox*>(widget))) { |
| 64 | QObject::connect(spinBox, QOverload<int>::of(&QSpinBox::valueChanged), receiver, [=] (int) { action(); }); |
| 65 | } else if ((doubleSpinBox = qobject_cast<QDoubleSpinBox*>(widget))) { |
| 66 | QObject::connect(doubleSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), receiver, [=] (double) { action(); }); |
| 67 | } else if ((comboBox = qobject_cast<QComboBox*>(widget))) { |
| 68 | QObject::connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), receiver, [=] (int) { action(); }); |
| 69 | } else if ((groupBox = qobject_cast<QGroupBox*>(widget))) { |
| 70 | QObject::connect(groupBox, &QGroupBox::toggled, receiver, [=] (bool) { action(); }); |
| 71 | } else if ((tableWidget = qobject_cast<QTableWidget*>(widget))) { |
| 72 | QObject::connect(tableWidget, &QTableWidget::cellChanged, receiver, [=] (int, int) { action(); }); |
| 73 | } else if ((plainTextEdit = qobject_cast<QPlainTextEdit*>(widget))) { |
| 74 | QObject::connect(plainTextEdit, &QPlainTextEdit::textChanged,receiver, [=] () { action(); }); |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | QFont fontFromString(const QString& s) |
| 80 | { |
nothing calls this directly
no outgoing calls
no test coverage detected