Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QEvent to QEnterEvent
Qt 6.11 is out! See what's new in the release blog

QEvent to QEnterEvent

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roberrt
    wrote on last edited by
    #1

    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 function

    I 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?

    Christian EhrlicherC 1 Reply Last reply
    0
    • R Roberrt

      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 function

      I 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?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved