You are not logged in.

1

Thursday, March 16th 2006, 10:02am

How to propagate from one class to another

hi,

I am in a big confussion now.

My application main.cpp is calling a class View defined in the file View.cpp. Later in progress of the program, It calls another class PB in the file PB.cpp. But i don't know how to exit from the previous class and proceed to the new class.

I tried it as

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "screen.h" /*  #in# Variables*/
#include "PB.h"
#include "View.h"

#include <qapplication.h>

int main( int argc, char **argv )
{
    QApplication app( argc, argv );
    while(true) {
        if(inView == true)
	{
           View window;
	    window.setCaption( "View" );
	    app.setMainWidget( &window );
	    window.show();
	    return app.exec();
	    inView = false;
	}
	else if(inPB == true)
	{
	    PB window;
	    window.setCaption( "PB" );
	    app.setMainWidget( &window );
	    window.show();
	    return app.exec();
	    inPB = false;
	}
}


But I cant able to return from the View Class.

delete this; in View class creates Segmentation Fault.

Plz help

mahe2310

2

Thursday, March 16th 2006, 12:47pm

RE: How to propagate from one class to another

i make use of widgets/dialogs from the main Widget.
But still i couldnt make the propagation using PB::show().

mahe2310

3

Friday, March 31st 2006, 1:02pm

RE: How to propagate from one class to another

why delete of this is not working???

4

Saturday, April 15th 2006, 11:51am

RE: How to propagate from one class to another

hi ,

I couldn't understand what ur problem was.are you trying to come out of class means? u want to close view? If so ,did you try dialog->close()?

or else could u brief it plz.


thnx

5

Wednesday, April 19th 2006, 2:17pm

RE: How to propagate from one class to another

I am having an application that propagate across widgets...
Can you suggest me a way to propagate ...

Please make sure that you are releasing the memory soon after you moved into next widget.
The reason is that i dont have much memory to spare...

It will be nice if you can provide a sample application that propagate over 5 widgets...

Mahe2310