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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:49:17+00:00 2026-05-17T01:49:17+00:00

In my project I am using a custom circle-shaped button widget derived from the

  • 0

In my project I am using a custom circle-shaped button widget derived from the QWidget class. I have added several of these widgets to a parent widget.

When one of these custom buttons is clicked, how do I find out which one was clicked?

Adding custom button to parent widget:

void ShotViewCTRL::addShot(QString shotNanme)
{
    ShotButton *btnShot=new ShotButton(this);
    btnShot->shotName=shotNanme;

    connect(btnShot,SIGNAL(Shot_Selected()),this,SLOT(SHOT_CLICKED()));
    btnShot->CreateButton();
    btnShot->show();

}

My parent widget is ShotViewCTRL (inherits from QWidget), the child widget is ShotButton (custom control, inherits from QWidget).

The control is working fine. It’s sending sending to parent object. In my problem, I added the same custom control 10 times.

I need to find which control was clicked? Please help me find the solution.

I have referred to the Qt documentation to find the child widget, but I did’t understand. Some sample code would be great.

  • 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-17T01:49:18+00:00Added an answer on May 17, 2026 at 1:49 am

    QSignalMapper is what you are looking for. With QSignalMapper, you can add something like an Id (or even a pointer to the QButton itself) as additional data to the signal emittance and you have to adjust your slot so it takes additional data (ID or Pointer).

    Then either distinguish in the slot itself by the id you give your objects some virtual function type() so you can distinguish with that or even try casting and catch errors (Tip: don’t try the last method, it may work differently on different compiler).

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

Sidebar

Related Questions

In my project I am using custom android devices and I have to encrypt
We are using jQuery in our project. We have numerous custom javascript files in
Using jQuery timepickr: http://archive.plugins.jquery.com/project/jquery-timepickr Having included these files: jquery-1.7.1.min.js jquery-ui-1.8.21.custom.min.js ui.timepickr.js And getting this
I have a project using a ViewPager which works correctly: I can page from
I have an ASP.net project which involves using a custom IHttpModule. This module will
I have created a custom dialog for Visual Studio Setup Project using the steps
In my project I am using a custom usercontrol that inherits from devexpress gridcontrol.
When using custom assemblies in a visual studio project. How does one check in
I am using Custom InfoPath Task Forms in my project. For form registering, I
I'm writing a custom makefile project using QtCreator and I want to delete 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.