PDA

View Full Version : Opening a qDialog



bharanideepan
4th August 2010, 15:17
Hai all,
I am new to qt. I want to open a dialog box . I created the dialog using form designer. But when i try to create a object to it , it shows an error

/home/bharani/browser/mainwindow.cpp:258: error: variable ‘Ui::Dialog d’ has initializer but incomplete type

After googling a found that the error is duo to missing header file. I have added both
dialog.h and qdialog to the mainwindow.cpp file. But the error is still there.

mainwindow.cpp file is

#include <QtGui>
#include <QtWebKit>
#include "mainwindow.h"
#include <QtDebug>
#include <QDialog>
#include "dialog.h"

void MainWindow::openPreferences()
{
Ui::Dialog d(this); //error
}

Any body tell me what i am missing here.
Thanks .

Lykurg
4th August 2010, 15:23
You also have to include the header which is generated by uic. it should be named something like ui_dialog.h.

EDIT: Question: how does your dialog.h look like? If it is a "ui formula" class then write:
Dialog d;

bharanideepan
4th August 2010, 15:31
You also have to include the header which is generated by uic. it should be named something like ui_dialog.h.

Thanks . That solved the problem.