[SOLVED] Creating Instance of dialog error
-
I tried to create test app from your example and everything works as you expected.
So my only suggestions could be to check whether or not your class is called "dialog" or "Dialog" (case sensitive).
You also don't need to include dialog.h twice, so you can remove it from mainwindow.cpp file (optional).
As I mentioned earlier, try to locate the line where there error pops up. Check the line and couple lines above you might find some bug there.
-
[quote author="dvez43" date="1317047321"]I commented out all of the instantiations. and dialog.exec() 's and the error when bye bye... so now I am confused![/quote]
Did you checked the class name for dialog? Try to comment definition in mainwindow.h file.
-
thats what I did I believe. As in definition do you mean instantiation? (thats kinda what I use for the terminology) :P
I commented out the definitions/instantiations in the mainwindow.h and the .exec() in mainwindow.cpp and the error disappears and the program compiles correctly.
This dialog box dialog has its own class file as well and also a .ui file since I am using Qt designer.
-
So if you created a dialog using Qt Creator and you haven't change a single thing during wizard you should try change:
@dialog dia;@
to
@Dialog dia;@
in mainwindow.h file and try to recompile...
-
Heres my dialog.h file
@
#ifndef DIALOG_H
#define DIALOG_H#include <QDialog>
namespace Ui {
class dialog;
}class dialog : public QDialog
{
Q_OBJECTpublic:
explicit dialog(QWidget *parent = 0);
~dialog();public slots:
private:
Ui::dialog *ui;
};#endif // DIALOG_H
@
EDIT:
My actual dialog that I did create is named "settings", its to set settings on the serial port being used in my application. I use this dialog box twice within the mainwindow since if the user resets the settings then the object has to be destroyed, and then recreated. I am trying to make my class instantiation global throughout mainwindow.cpp. And I am failing epically :Pso instead of dialog everywhere, you would see settings... so in my header file for mainwindow.cpp i have settings diasettings; as my instantiation