Frankly, I have trouble following the logic in your code and explanations.
And at least what you posted so far is very "scatchy" for me to see a specific one problem.
Again, instead of creating and deleting your dynamic widget, just use show() and hide() for it. (if you don't want to work with QDialog)
It is better for many reasons in comparison to creating deleting it all the time.
In addition to dangerous thins as not checking pointers have a look at this (see comments in code:
if(static Screen is visible)
{
hide static screen;
}
if(dynscrn is object ! = NULL) //means dynamic widget is currently exist
{
delete dynamic widget;
dynamic widget = NULL;
}
//you are showing (and for you showing = creating) a new dynamic widget, even if the
// 'if' above was not true, resulting in a memory leak at best, and maybe other
//problems such as you focus problems at worst.
if(messageid == 500) //show dynamic scrn
{
create a dynamic widget from dynscrn and will be displayed by its constructor;
}
else //show static screen
{
...
}
if(static Screen is visible)
{
hide static screen;
}
if(dynscrn is object ! = NULL) //means dynamic widget is currently exist
{
delete dynamic widget;
dynamic widget = NULL;
}
//you are showing (and for you showing = creating) a new dynamic widget, even if the
// 'if' above was not true, resulting in a memory leak at best, and maybe other
//problems such as you focus problems at worst.
if(messageid == 500) //show dynamic scrn
{
create a dynamic widget from dynscrn and will be displayed by its constructor;
}
else //show static screen
{
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks