QEvent to QEnterEvent
-
I'm trying to update an old Qt project I was getting an error in this line:
protected: void enterEvent(QEnterEvent *event) override;error: Non-virtual member function marked 'override' hides virtual member functionI modified it to:
protected: void enterEvent(QEnterEvent *event) override;Solved the error, but now I'm getting an error in this line:
InteractiveButtonBase::enterEvent(new QEvent(QEvent::Type::None));C2664: 'void InteractiveButtonBase::enterEvent(QEnterEvent *)': cannot convert argument 1 from 'QEvent *' to 'QEnterEvent *' error C2664: 'void InteractiveButtonBase::enterEvent(QEnterEvent *)': cannot convert argument 1 from 'QEvent *' to 'QEnterEvent *' note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast note: see declaration of 'InteractiveButtonBase::enterEvent'I'm not sure how to fix it, could i get any help?
-
I'm trying to update an old Qt project I was getting an error in this line:
protected: void enterEvent(QEnterEvent *event) override;error: Non-virtual member function marked 'override' hides virtual member functionI modified it to:
protected: void enterEvent(QEnterEvent *event) override;Solved the error, but now I'm getting an error in this line:
InteractiveButtonBase::enterEvent(new QEvent(QEvent::Type::None));C2664: 'void InteractiveButtonBase::enterEvent(QEnterEvent *)': cannot convert argument 1 from 'QEvent *' to 'QEnterEvent *' error C2664: 'void InteractiveButtonBase::enterEvent(QEnterEvent *)': cannot convert argument 1 from 'QEvent *' to 'QEnterEvent *' note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast note: see declaration of 'InteractiveButtonBase::enterEvent'I'm not sure how to fix it, could i get any help?
@Roberrt said in QEvent to QEnterEvent:
void enterEvent(QEnterEvent *event) override;error: Non-virtual member function marked 'override' hides virtual member function
I modified it to:
protected:
void enterEvent(QEnterEvent *event) override;What did you change? It's both the same
InteractiveButtonBase::enterEvent(new QEvent(QEvent::Type::None));
You must not generate such events by yourself - they're created by Qt.
If your function needs QEnterEvent you should create an QEnterEvent and not a QEvent.