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

  • Home
  • SEARCH
  • 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 7701531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:00:34+00:00 2026-05-31T23:00:34+00:00

I have created a very simple GUI project in Qt as follows: main: #include

  • 0

I have created a very simple GUI project in Qt as follows:

main:

#include <QApplication>
#include "dialog.h"
int main(int c, char* v[])
{
    QApplication app(c,v);
    Dialog* d = new Dialog;
    d->show();
    app.exec();
}

dialog.h:

#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>
#include "ui_dialog.h"
#include "progress_dialog.h"

class Dialog : public QDialog, private Ui::Dialog
{
    Q_OBJECT

public:
    explicit Dialog(QWidget *parent = 0);
    ~Dialog();

private:
    progress_dialog* progress_dialog_;
public slots:
    void create_and_show_progress_dialog();
    void delete_progress_dialog();
};

#endif // DIALOG_H

dialog.cpp:

#include "dialog.h"
#include "ui_dialog.h"
#include <QMessageBox>
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),progress_dialog_(new progress_dialog)
{
    setupUi(this);
    connect(pushButton,SIGNAL(clicked()),this,SLOT(create_and_show_progress_dialog()));
    connect(progress_dialog_,SIGNAL(rejected()),this,SLOT(delete_progress_dialog()));
}

void Dialog::create_and_show_progress_dialog()
{
    if (!progress_dialog_)
        progress_dialog_ = new progress_dialog;
    progress_dialog_->exec();
}

void Dialog::delete_progress_dialog()
{
    delete progress_dialog_;
    progress_dialog_ = nullptr;
    QMessageBox::information(this,"Progress destroyed","I've just destroyed progress");
}

Dialog::~Dialog()
{
}

progress_dialog:

#ifndef PROGRESS_DIALOG_H
#define PROGRESS_DIALOG_H

#include "ui_progress_dialog.h"

class progress_dialog : public QDialog, private Ui::progress_dialog
{
    Q_OBJECT

public:
    explicit progress_dialog(QWidget *parent = 0);
public slots:
    void exec_me();
};

#endif // PROGRESS_DIALOG_H

progress_dialog.cpp:

#include "progress_dialog.h"

progress_dialog::progress_dialog(QWidget *parent) :
    QDialog(parent)
{
    setupUi(this);
}

So the problem is that after running this app and pressing push_button on main dialog, progress_dialog is being displayed. After clicking on push_buttong on progress_dialog which is connected to a reject slot this dialog is closing and message is being displayed: QMessageBox::information(this,”Progress destroyed”,”I’ve just destroyed progress”);

But when I do this second time (press button on main dialog and then close the progress_dialog) no message is being displayed. Tried to debug this and set breakpoint on:

void Dialog::delete_progress_dialog()
{
    delete progress_dialog_;//HERE BREAKPOINT WAS PLACED
    progress_dialog_ = nullptr;
    QMessageBox::information(this,"Progress destroyed","I've just destroyed progress");
}

but this breakpoint is being hit just first time, and after that no hits on this breakpoint are performed.
What’s going on?

  • 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-31T23:00:35+00:00Added an answer on May 31, 2026 at 11:00 pm

    You need to reconnect the signal each time you create a new progress_dialog – when you destroy the old one, the connection is lost (how could that be otherwise, you’ve just zapped the source of the signal).

    So do the connection in create_and_show_progress_dialog when you create a new object.

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

Sidebar

Related Questions

I have created a very simple wpf app with mvvm light. I have rows
I have created a very simple Rails 3.1 app with basic stuffs like following:
I have created a GUI for starting a Thread which does something very simple.
I have created a very simple sharepoint timer job. All i want it to
I am using SQL Server 2008 Enterprise. I have created a very simple test
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a very simple nested loop example and am struggling to write
I have to create a very simple GUI for an iPad application. I have
I have created a very simple ASP.NET HttpHandler and for some reason it is
I am new to Objective-C and as a very simple learning exercise, I have

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.