Hi guys,
I am using old version of Qt which comes with the Friendly arm device for embedded development. 
It consists of Qtopia 2.2.0 with Qt2 designer.
I prepared a small application for testing using a QListView. I drew ListView widget on my form which i named ListView and named ny UI file as myapp_base.ui.
In my header file i wrote-
	
	- #ifndef MYAPP_H 
- #define MYAPP_H 
-   
- #include "myapp_base.h" 
-   
- class MyApp : public MyAppBase 
- { 
- public: 
-         MyApp (QWidget *- parent =0- , const char *- name =0- , WFlags fl =0)- ; 
-         ~MyApp(); 
-   
- } 
        #ifndef MYAPP_H
#define MYAPP_H
#include "myapp_base.h"
class MyApp : public MyAppBase
{
public:
        MyApp(QWidget *parent=0,const char *name=0, WFlags fl=0);
        ~MyApp();
}
To copy to clipboard, switch view to plain text mode 
  
My implementation file is following-
	
	- #include "myapp.h" 
- #include <qlistview.h> 
-   
- MyApp ::MyApp(QWidget *- parent,  const char *- name,WFlags fl ):
- MyAppBase(parent,name,fl) 
- { 
-    QListViewItem *newItem; 
-    newItem->setText(0,"newItem"); 
-    ListView->insertItem(newItem);      
- } 
-   
- MyApp::~MyApp() 
- { 
- } 
        #include "myapp.h"
#include <qlistview.h>
MyApp::MyApp(QWidget *parent, const char *name,WFlags fl):
MyAppBase(parent,name,fl)
{
   QListViewItem *newItem;
   newItem->setText(0,"newItem");
   ListView->insertItem(newItem);     
}
MyApp::~MyApp()
{
}
To copy to clipboard, switch view to plain text mode 
  
And my main file is-
	
	- #include "myapp.h" 
- #include <qapplication.h> 
-   
- int main(int argc, char *argv[]) 
- { 
-     MyApp *obj; 
-     obj->show(); 
-   
-    return app.exec(); 
- } 
        #include "myapp.h"
#include <qapplication.h>
int main(int argc, char *argv[])
{
    QApplication app(argc,argv);
    MyApp *obj;
    obj->show();
   return app.exec();
}
To copy to clipboard, switch view to plain text mode 
  
My code gets compiled successfully but gives a runtime segmentation fault. What is the problem??
				
			
Bookmarks