Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7536725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:39:16+00:00 2026-05-30T06:39:16+00:00

Recently, I wanted that QPushButton can emit a signal, when the mouse pointer enters.

  • 0

Recently, I wanted that QPushButton can emit a signal, when the mouse pointer enters. How can I make it?

I know that QPushButton has some already defined signal, such as clicked(), pressed(), destory() and so on. But no signal like hover(), enter(), …

I looked some information about it: Someone said it can be done by css. I don’t understand. Can you give me some advice ? Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:39:17+00:00Added an answer on May 30, 2026 at 6:39 am

    You can use QWidget::enterEvent ( QEvent * event ) for this.

    You override this event and send a custom defined signal when ever this event occurs.

    First you have to enable mouse tracking for this widget (setMouseTracking(true) in the constructor for example).

    Header file:

    class my_button
    {
        // ...
    
    protected:
        virtual void enterEvent( QEvent* e );
    
    public Q_SIGNALS:
        void hovered();
    
        // ...
    };
    

    Source file:

    void my_button::enterEvent( QEvent* e )
    {
        Q_EMIT hovered();
    
        // don't forget to forward the event
        QWidget::enterEvent( e );
    }
    

    Where you use your button:

    connect( one_of_my_button, SIGNAL(hovered()), this, SLOT(do_something_when_button_hovered()) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something that's I've wanted to know recently, mostly out of curiousity. I'm
I recently wanted to test my application on another computer that has the latest
Recently, when porting some STL code to VS2008 I wanted to disable warnings generated
I recently downloaded Visual Studio 2010b2, and wanted to re-evaluate some of my questions
I have been bitten by something unexpected recently. I wanted to make something like
Recently switched to XFBML to make our page more efficient. However, we noticed that
So I recently wanted to use the jQuery to do some browser detection and
I am creating a game. I have some UI with text. Recently we wanted
I recently wanted use regex in Cocoa app. But I found that Cocoa does
Recently I wanted to try some of the new features in Scala 2.9 in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.