soccerman stan
soccerman stan

Reputation: 121

Show stand alone dialog box

I have a problem that I would like some help with. I am developing a Qt application, and I am currently working on the GUI portion of it. So I have developed a MainWindow (ContentManager) that users will be able to select options from. This MainWindow should handle information sent back from stand alone dialog boxes. The issue I am having is that I can't even get the MainWindow to call and open said dialog boxes.

The dialog boxes were made as follow:

Qt->Qt Designer Form->Dialog Without Buttons->addContentDialog.ui (NameofDialog.ui)

This just created an addContentDialog.ui file, and nothing else (no .h, or .cpp). I was following this http://www.qtcentre.org/archive/index.php/t-43157.html?s=9503de67fb7a2b4ec8e1f28007838fae but I am having no luck as my Qt form did not create a .h file. I have included the code for the MainWindow below

#include "contentmanager.h"
#include "ui_contentmanager.h"
#include "ui_addContentDialog.h"

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

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

void ContentManager::on_addContentBtn_clicked()
{
    Ui::AddContentDialog uiAddNewContent;
    QDialog d;
        uiAddNewContent.setupUi(&d);
        d.exec();

}

I eventually want the main window (which is a .cpp file) to handle information inputted into the dialog box.

Upvotes: 1

Views: 222

Answers (1)

László Papp
László Papp

Reputation: 53155

ui_addContentDialog.h is created on the fly by the UIC (UI compiler) when you run qmake. You just need to rerun qmake.

Upvotes: 1

Related Questions