PDA

View Full Version : open a second window error!!!



arninio123
21st April 2012, 14:52
Hello
i have a problem.
What i try to do is to open a dialog when i click a button.
But i get a error when i compile can someone help me pls.

mainwindowimpl.cpp
#include "mainwindowimpl.h"
#include "dialogimpl.h"
//
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
{
setupUi(this);
}
//

void MainWindowImpl::on_start_clicked()
{
DialogImpl * dia = new DialogImpl(this);
dia->show();
}

Error message!!
7610

Thanks already!! :)

programmer251
22nd April 2012, 14:48
1) I found some "mistakes" in your code like:

You dont have to declare every parent class member like this: public blablabla, public she, public he...

it just can be like this: public blablabla, she, he
2) in private member of class declare:

Ui::DialogImpl * ui;
and than construct your DialogImpl 's .cpp file like this:

DialogImpl::DialogImpl(QWidget * parent,Qt::WFlags *f) : QDialog(parent,f),
ui(new Ui::DialogImpl)
{
ui->setupUi(this);
}

maybe there is some "little" errors too, but I cant see it on picture...

Best regards programmer251

ChrisW67
23rd April 2012, 05:40
arninio123 is choosing to inherit the generated UI class rather than incorporating it by composition as is more often the case. This is not of itself an error.

The error message indicates that that generated ui_dialog.h does not define a class Dialog in the namespace Ui. This name comes from the name of the top-most widget in the Designer so chances are that is not named "Dialog".


@arninio123: Please use
... tags around your code. You can also copy an paste the text of the error messages: smaller, faster, and easier to read.