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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:35:19+00:00 2026-05-30T17:35:19+00:00

I have a qdialog, with a buttonbox at the bottom; Why isn’t this slot

  • 0

I have a qdialog, with a buttonbox at the bottom; Why isn’t this slot not getting fired when a “signal” occurs? The code look like the following:

    std::unique_ptr<MW::GenStd> box(new MW::GenStd(&tOut, &tIn));
    box->ui.ChoiceButtons->addButton ("Ask",
        QDialogButtonBox::AcceptRole );
    box->ui.ChoiceButtons->addButton ("OverWrite",
        QDialogButtonBox::AcceptRole );
    box->ui.ChoiceButtons->addButton ("merge",
        QDialogButtonBox::AcceptRole );
    box->ui.ChoiceButtons->addButton ("Skip",
        QDialogButtonBox::RejectRole );

    QObject::connect(box->ui.ChoiceButtons, SIGNAL(clicked(QPushButton* b)), box.get(), SLOT(OnClick(QPushButton* b)));

    return box->exec();

Where MW::GenStd is a dialog box (and ui.ChoicButtons a buttonbox). The modal dialog is correctly displayed – however it doesn’t seem to interact at all.. Pressing the buttons doesn’t fire the event. The slot is declared like the following:

public slots:
    void OnClick(QPushButton* b) {
        auto s(b->text());
        if (s == "Merge") {
            setResult(2);
        } else if (s == "Overwrite") {
            setResult(1);
        } else if (s == "Skip") {
            setResult(0);
        } else if (s == "Ask") {
            setResult(3);
        }
    }

};

(I know it’s terribly to do such a string comparison here, but it’s just as a quick mock up test to validate the buttons). But debugging shows the function isn’t ever reached!

EDIT: as suggested looking at the output showed a culprit:
Object::connect: No such signal QDialogButtonBox::clicked(QPushButton*) in AskGUISupport.cpp:150
However that seems totally strange as the QDialogButtonBox does have a clicked signal? documentation

  • 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-30T17:35:20+00:00Added an answer on May 30, 2026 at 5:35 pm

    QDialogButtonBox has a signal clicked ( QAbstractButton * button ) so you need to define a slot void OnClick(QAbstractButton* b) and connect to it. Use QAbstractButton, not QPushButton.

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

Sidebar

Related Questions

I have the following code: void Processmethod() { QDialog *ProcessMessage = new QDialog; Ui::DialogProcessMessage
I have the following source code: Processmethod() { QDialog *ProcessMessage = new QDialog; Ui::DialogProcessMessage
I have the following source code: void Processmethod() { QDialog *ProcessMessage = new QDialog;
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
I have the following source code: void Processmethod() { QDialog *ProcessMessage = new QDialog;
I have a QDialog which I open like this: void MyModule::openDialog() { this->dialog->open(); printf(Hello
I think I have some fundamental misunderstanding of how the Qt signal/slot mechanism works.
I have this sample of code: import sys import time from PyQt4.QtGui import *
I have this sample of code: import sys from PyQt4.QtGui import (QApplication, QHBoxLayout, QVBoxLayout,
I have created a QDialog based app using Qt Creator and all is well

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.