Quote:
Originally Posted by darkstarbyte
Oh, with the hide function. (If I am naming the right one.)
Thanks for your response, I was starting to think I was a very lonely coder.
|
I got what you were looking for. I have two main windows in my program. you may have created a variable of the second window in the first windows header file and initiated it in the first windows constructor. So, set its parent to 0. if you do this, you can close the first window then.
here's a sample:
first window header
Code:
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
SettingsWindow *settings;
first window constructor:
Code:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
settings = new SettingsWindow(cfg,0);
second (settings) window constructor:
Code:
SettingsWindow::SettingsWindow(ConfigSource &src, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::SettingsWindow)
{
you may not worry about the first parameter of settings window, COnfigSource, I mean, I have added this myself. you simply have one parameter which is QWidget *parent. set it to 0.
(problem solved
)