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 7691387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:36:40+00:00 2026-05-31T20:36:40+00:00

Not too sure how to formulate my question and I hope that this is

  • 0

Not too sure how to formulate my question and I hope that this is more clear. I want to have a baseclass that looks something like this:

class Base : public QObject { 
    Q_OBJECT


    void doSomething() { emit test(this); }

    virtual void doSomethingElse() = 0;

signals:
     void test(Base*);
}

And then in the derived class do this:

 class Derived : public Base {

     void doSomethingElse() { emit test(this); }

 }

If I now listen to the signals of this object and do I listen to test(Derived*) or/and test(Base*)?

  • 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-31T20:36:42+00:00Added an answer on May 31, 2026 at 8:36 pm

    The moc generates at compile time a list of the slots and signals based on the way you declared them in the classes that use the Q_OBJECT macro.

    This list is a list of strings, so if you declared:

    signals:
         void test(Base*);
    

    the item in the list would be the string "test(Base*)" (you can see that list in the variable qt_meta_YourClass of the file moc_yourclass.cpp in the output directory).

    The macros SIGNAL and SLOT also return strings, connect() canonize them so they are formatted like the one from the moc generated list, and compares them to those in that list.

    When you derive the class, the string hasn’t changed, so you still have to use SIGNAL(test(Base*)).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not too sure if I'm doing this right. It looks a bit more convoluted
I'm just not too sure the proper way of doing this. I basically have
Not really too sure how to word this question, therefore if you don't particularly
I have a strange issue that I'm not too sure on how to fix
I'm sorry for a question like this. I'm not too sure about the difference
I'm not too sure how to explain this, but I will try. I have
This is a question from a past exam paper. I am not too sure
I'm not too sure why my code is causing this. I have this jquery
I'm not too sure if this is the best place to pose this question
I'm not too sure how to ask this question. I need to store a

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.