[SOLVED]myWindow.exe exited with code -1073741819
I am trying to use a QListwidget so that when I click on it ,the text in the items changes accordingly.The header code is as follows
class MyWindow:public QWidget
and the implementation code is as follows:
QListWidget *mWdgt=new QListWidget(this);
QPushButton *button1=new QPushButton("Click Me",this);
QVBoxLayout *myVLayout=new QVBoxLayout;
The code compiles nice but when i run it he following message pops up after a windows error message."exe exited with code -1073741819"
Any help would be appreciated since this has been bugging me for some time.When I start from the Gui project
it works.I just want to be able to do it from raw code.
mWdgt you create in the constructor (line 4) is a local variable, in no way connected to private mWdgt declared in the header and modified in the ::processItems() slot.
Add this to your constructor. I suggest rethinking the rest of the design a bit, too.
this->mWdgt = mWdgt;
Just to be clear: the reason your app crashes is that currently the mWdgt pointer in the processItems() is a dangling pointer (not initialised).
Thanks sierdzio ,I did as you said and it worked.I am learning c++ and exploring the concepts of classes using Qt.Thanks again!
Sure thing, have fun and ask more if something is not clear :)