Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, December 2006
Hide and show of Multiple windows


Message 1 in thread

Hi

I have one screen/(Widget or window) with one button as OK .
I have one more screen with button BACK.
These two windows i created using designer .

The requirement is if i click OK it should open screen2.And IF i click
BACK it should come back to SCREEN1.
In my code it is happening but once i come back to screen1 and close
that screen the shell prompt is not returned .Means still some application
is running. If i close the Complete Frame buffer then the prompt is
returned.

In my code which i attached with this  mails u can see what i did.

I did as
In my screen1*.cpp file i added the following

MainProcessingFormImpl *Main_Process_Screen; //This is screen 2.

This is declared as global variable.

And in the constructor function i added the following.
Main_Process_Screen = new MainProcessingFormImpl();

And in OK button click i am doing as follows

this->hide();  //It will hide first screen.
Main_Process_Screen->show();   //This will open second screen

And in the screen2 also i am doing same thing to come back .

I tryed somany alternatives but no use. In my application i need more than
10 windows.
I am just trying with two windows first.

In my code just see the files PatientInfoFormImpl.cpp
and  MainProcessingFormImpl.cpp
In that the following functions.

void PatientInfoFormImpl::NP_PATIENT_OK_BUTTON_Clicked()  // OK button
void MainProcessingFormImpl::MP_ANSINDEX_BUT_Clicked()   //Like BACK Button

Thanks in advance

Regards,
Harsha

Message 2 in thread

On Friday 01 December 2006 14:20, harshavardhanreddy mandeepala wrote:
> Hi
>
> I have one screen/(Widget or window) with one button as OK .
> I have one more screen with button BACK.
> These two windows i created using designer .
>
> The requirement is if i click OK it should open screen2.And IF i click
> BACK it should come back to SCREEN1.
> In my code it is happening but once i come back to screen1 and close
> that screen the shell prompt is not returned .Means still some application
> is running. If i close the Complete Frame buffer then the prompt is
> returned.

Which version of Qt is this?
If Qt-3: 
Have you tried
qApp->connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
?

http://doc.trolltech.com/3.3/qapplication.html#lastWindowClosed

--
 [ signature omitted ] 

Message 3 in thread

Hi Havard Wall,
Thanks for ur reply.
I am using qt-2.3.10.
But is that the right way of hiding and showing windows.
Means...
Each and every time if i want to show or hide a window
i have to create the object for that window using
classname *object;
classname new object.;
and then
object->show or hide?
Can't we dynamically close and hide windows.

Thanks for ur reply.

Regards,
Harsha


On 12/1/06, Håvard Wall <hwall@xxxxxxxxxxxxx> wrote:
>
> On Friday 01 December 2006 14:20, harshavardhanreddy mandeepala wrote:
> > Hi
> >
> > I have one screen/(Widget or window) with one button as OK .
> > I have one more screen with button BACK.
> > These two windows i created using designer .
> >
> > The requirement is if i click OK it should open screen2.And IF i click
> > BACK it should come back to SCREEN1.
> > In my code it is happening but once i come back to screen1 and close
> > that screen the shell prompt is not returned .Means still some
> application
> > is running. If i close the Complete Frame buffer then the prompt is
> > returned.
>
> Which version of Qt is this?
> If Qt-3:
> Have you tried
> qApp->connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
> ?
>
> http://doc.trolltech.com/3.3/qapplication.html#lastWindowClosed
>
> --
> hw
>
> >
> > In my code which i attached with this  mails u can see what i did.
> >
> > I did as
> > In my screen1*.cpp file i added the following
> >
> > MainProcessingFormImpl *Main_Process_Screen; //This is screen 2.
> >
> > This is declared as global variable.
> >
> > And in the constructor function i added the following.
> > Main_Process_Screen = new MainProcessingFormImpl();
> >
> > And in OK button click i am doing as follows
> >
> > this->hide();  //It will hide first screen.
> > Main_Process_Screen->show();   //This will open second screen
> >
> > And in the screen2 also i am doing same thing to come back .
> >
> > I tryed somany alternatives but no use. In my application i need more
> than
> > 10 windows.
> > I am just trying with two windows first.
> >
> > In my code just see the files PatientInfoFormImpl.cpp
> > and  MainProcessingFormImpl.cpp
> > In that the following functions.
> >
> > void PatientInfoFormImpl::NP_PATIENT_OK_BUTTON_Clicked()  // OK button
> > void MainProcessingFormImpl::MP_ANSINDEX_BUT_Clicked()   //Like BACK
> Button
> >
> > Thanks in advance
> >
> > Regards,
> > Harsha
>
> To unsubscribe - send "unsubscribe" in the subject to
> qt-embedded-interest-request@xxxxxxxxxxxxx
>
>

Message 4 in thread

Hi,

> Each and every time if i want to show or hide a window
> i have to create the object for that window using
> classname *object;
> classname new object.;
> and then
> object->show or hide?

It makes sense, calling hide() to hide a window and show() to show a 
window ;-) Could you explain what exactly is bothering you here. Maybe 
you're after QWidgetStack?

> Can't we dynamically close and hide windows.

What do you mean by that exactly?

--
 [ signature omitted ] 

Message 5 in thread

Dear Dimitri,
Thanks for ur reply.

I mean to say that ..
I created the windows(Widgets) using the Qt designer.
So inherited that class in my implimentation file.
So if i have a pointer to this function as
classnameimpl *testobject;
and
testobject->hide() or show should work.
But why i should do the

testobject = new classnameimpl;
and
testobject->hide() ;

Because the designer is doing allocating memory using new for the class .



Thanks in advance,

Regards,
Harsha

Message 6 in thread

Hi,

> I mean to say that ..
> I created the windows(Widgets) using the Qt designer.
> So inherited that class in my implimentation file.
> So if i have a pointer to this function as
> classnameimpl *testobject;
> and
> testobject->hide() or show should work.
> But why i should do the
> 
> testobject = new classnameimpl;
> and
> testobject->hide() ;
> 
> Because the designer is doing allocating memory using new for the class .

I'm sorry, I still don't understand.

Doesn't QWidgetStack help?

--
 [ signature omitted ] 

Message 7 in thread

Try QStackedWidget or QWidgetStack depending on what version you develop 
with.




harshavardhanreddy mandeepala wrote:
> Hi
> 
> I have one screen/(Widget or window) with one button as OK .
> I have one more screen with button BACK.
> These two windows i created using designer .
> 
> The requirement is if i click OK it should open screen2.And IF i click
> BACK it should come back to SCREEN1.
> In my code it is happening but once i come back to screen1 and close
> that screen the shell prompt is not returned .Means still some application
> is running. If i close the Complete Frame buffer then the prompt is 
> returned.
> 
> In my code which i attached with this  mails u can see what i did.
> 
> I did as
> In my screen1*.cpp file i added the following
> 
> MainProcessingFormImpl *Main_Process_Screen; //This is screen 2.
> 
> This is declared as global variable.
> 
> And in the constructor function i added the following.
> Main_Process_Screen = new MainProcessingFormImpl();
> 
> And in OK button click i am doing as follows
> 
> this->hide();  //It will hide first screen.
> Main_Process_Screen->show();  
> //This will open second screen
> 
> And in the screen2 also i am doing same thing to come back .
> 
> I tryed somany alternatives but no use. In my application i need more 
> than 10 windows.
> I am just trying with two windows first.
> 
> In my code just see the files PatientInfoFormImpl.cpp
> and  MainProcessingFormImpl.cpp
> In that the following functions.
> 
> void PatientInfoFormImpl::NP_PATIENT_OK_BUTTON_Clicked()  // OK button
> void MainProcessingFormImpl::MP_ANSINDEX_BUT_Clicked()   //Like BACK Button
> 
> Thanks in advance
> 
> Regards,
> Harsha

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx