In order to abstract a problem to a global level (I know..) I've built a static "create_keypad" function that provides most of the default initialization and such.
In the current implementation I pass in a parent widget, though I've done it both ways. Either way I do it (manual memory management or garbage collection) the keypad kills my main window on exit. Because it didn't before I abstracted I have to assume it has something to do with a modal dialog box becoming some sort of "primary window" in the main event loop despite giving it my window as a parent (or not.)
Possibly the accept() or reject() signals going to the main-event loop (I'd assume..?) implies that the loop should end?
If someone could shed light on this it'd be quite helpful; as I'd prefer a generic static/global function for this task. (After all, someone else may wish to use it in the future outside of this class.) I may note that the initialization could (mostly) be abstracted to another subclass of my subclass (of QDialog), but that seems unnecessary (and I'm unsure if it's better design at that point or not.)
Snippet for completion:
class Thang
: public QDialog {/*...*/};
static Thang
* create_thang
(QWidget* parent
) //!!remember, with or without this parent my program quits {
Thang* thang = new Thang(parent);
//..
//bunch of init code..
return thang;
}
static void use_Thang (Thang* thang)
{
thang->exec();
//..
//special value handling/signal emission..
}
class Thang : public QDialog {/*...*/};
static Thang* create_thang(QWidget* parent) //!!remember, with or without this parent my program quits
{
Thang* thang = new Thang(parent);
//..
//bunch of init code..
return thang;
}
static void use_Thang (Thang* thang)
{
thang->exec();
//..
//special value handling/signal emission..
}
To copy to clipboard, switch view to plain text mode
Whether or not I'm critiqued on the obvious strangeness of the design, (it just feels* right to me,) I'd like to know why the loop is getting killed (or I if not, why my other windows are getting killed and thus the loop being killed.)
*[for the sake of keeping changes for the many keypads entry/exit point the same and thus the code to modify these the same/in-one-place]
Thanks for any info!
Bookmarks