0

I'm working on an app in C++/Qt I have used the design tool to design a Qdialog box.

The Dialog box is defined as below.

c++ file

#include "dialogwarning.h"
#include "ui_dialogwarning.h"

DialogWarning::DialogWarning(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogWarning)
{
    ui->setupUi(this);
}

DialogWarning::~DialogWarning()
{
    delete ui;
}

header file

#include <QDialog>

namespace Ui {
class DialogWarning;
}

class DialogWarning : public QDialog
{
    Q_OBJECT

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

private:
    Ui::DialogWarning *ui;
};

The source use it as below:

WarningDialog = new DialogWarning();
QLabel *label = new QLabel("File/Folder name already exist", WarningDialog);
label->setGeometry(WarningDialog->rect().center().x() - label->rect().width()/2,
                   WarningDialog->rect().center().y() - label->rect().height()*2,
                   WarningDialog->rect().width(),
                   WarningDialog->rect().height());
WarningDialog->exec();

I'm using exec instead of show because the exec primitive allow me to be stucked inside the dialog until a press on the "Ok" button.

What is strange is that the OK button is not working. I do not need any specific behavior just wait the OK press to continue to run the code.

Thanks

jww
  • 97,681
  • 90
  • 411
  • 885
Seb
  • 2,929
  • 4
  • 30
  • 73

1 Answers1

0

i'm not quite sure assuming u have connected everything. could be that the application is frozen.

why not put the calculation in a different thread and connect the same signal that shows the dialog to thread pause.

the signal of the ok pushbutten should be connected to close the dialog and thread resume...

Philipp
  • 137
  • 1
  • 2
  • 11