Function to update all autowidgets

This commit is contained in:
elecpower
2021-05-12 17:13:39 +10:00
parent 8b61ce5ce7
commit 0dddcd2ac8
14 changed files with 25 additions and 11 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QCheckBox>
class AutoBitsetCheckBox: public QCheckBox, AutoWidget
class AutoBitsetCheckBox: public QCheckBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QCheckBox>
class AutoCheckBox : public QCheckBox, AutoWidget
class AutoCheckBox : public QCheckBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -26,7 +26,7 @@
#include <QComboBox>
class AutoComboBox : public QComboBox, AutoWidget
class AutoComboBox : public QComboBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -28,7 +28,7 @@
#include <math.h>
#endif
class AutoDoubleSpinBox : public QDoubleSpinBox, AutoWidget
class AutoDoubleSpinBox : public QDoubleSpinBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -27,7 +27,7 @@
class QRegExpValidator;
class AutoHexSpinBox : public QSpinBox, AutoWidget
class AutoHexSpinBox : public QSpinBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QLabel>
class AutoLabel: public QLabel, AutoWidget
class AutoLabel: public QLabel, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -25,7 +25,7 @@
#include <QLineEdit>
#include <QRegExpValidator>
class AutoLineEdit: public QLineEdit, AutoWidget
class AutoLineEdit: public QLineEdit, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -25,7 +25,7 @@
#include <QComboBox>
#include <QString>
class AutoPrecisionComboBox : public QComboBox, AutoWidget
class AutoPrecisionComboBox : public QComboBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QSlider>
class AutoSlider : public QSlider, AutoWidget
class AutoSlider : public QSlider, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QSpinBox>
class AutoSpinBox : public QSpinBox, AutoWidget
class AutoSpinBox : public QSpinBox, public AutoWidget
{
Q_OBJECT
+1 -1
View File
@@ -24,7 +24,7 @@
#include <QTimeEdit>
class AutoTimeEdit : public QTimeEdit, AutoWidget
class AutoTimeEdit : public QTimeEdit, public AutoWidget
{
Q_OBJECT
+2
View File
@@ -25,6 +25,8 @@ class GenericPanel;
// Note: cannot be a Qt object otherwise it will create a compiler ambiguity in the inheriting class
class AutoWidget
{
friend class GenericPanel;
public:
explicit AutoWidget();
~AutoWidget();
+11
View File
@@ -19,6 +19,7 @@
*/
#include "genericpanel.h"
#include "autowidget.h"
#include <TimerEdit>
#include <QComboBox>
@@ -127,3 +128,13 @@ void GenericPanel::disableMouseScrolling()
foreach(QWidget * te, findChildren<TimerEdit*>())
setFocusFilter(te);
}
void GenericPanel::updateAutoWidgets()
{
foreach(QWidget *wdgt, findChildren<QWidget *>()) {
AutoWidget *autowdgt = dynamic_cast<AutoWidget *>(wdgt);
if (autowdgt) {
autowdgt->updateValue();
}
}
}
+1
View File
@@ -58,4 +58,5 @@ class GenericPanel : public QWidget
virtual bool eventFilter(QObject *obj, QEvent *event);
void setFocusFilter(QWidget * w);
void disableMouseScrolling();
void updateAutoWidgets();
};