The changeEvent slot is a virtual, secure function found in a QWidget. Therefore, if you inherit a QWidget or any QWidget-based class, you can override this function. For example: -
class MyForm : public QWidget { protected slots: virtual void changeEvent(QEvent * event); } void MyForm::changeEvent(QEvent* event) {
If you want to know outside the event that the form has changed, you can add a signal to the form and emit it from changeEvent to pass the event: -
class MyForm : public QWidget { signals: void FormChanged(QEvent* event); protected slots: virtual void changeEvent(QEvent * event); } void MyForm::changeEvent(QEvent* event) { emit FormChanged(event); }
Now connect another class to the new signal using the Qt 5 connect syntax: -
connect(myFormObject, &MyForm::FormChanged, someclassObject, &SomeClass::HandleFormChanged);
TheDarkKnight
source share