Sorry for not being clear from the beginning.
First attachment 1.jpg (two "independent" windows, I can close one (no mater which one), and second stays open):
Form *fr = new Form();
fr->setVisible(true);
Form *fr = new Form();
fr->setVisible(true);
To copy to clipboard, switch view to plain text mode
and qDebug() << this-parent(); gave me: QObject(0x0)
Second attachment 2.jpg (Form overpainted on MainWindow):
Form *fr = new Form( this );
Form *fr = new Form( this );
To copy to clipboard, switch view to plain text mode
and qDebug() << this-parent(); gave me: MainWindow(0x22fe80, name = "MainWindow")
and third example 3.jpg, that's what I want to achieve (Form as "child" window to MainWindow, don't know if "naming" is correct):
Form *fr = new Form( this );
fr->setWindowFlags( Qt::Window );
Form *fr = new Form( this );
fr->setWindowFlags( Qt::Window );
To copy to clipboard, switch view to plain text mode
and qDebug() << this-parent(); gave me: MainWindow(0x22fe80, name = "MainWindow")
To test parent I use:
{
ui->setupUi(this);
qDebug() << this->parent();
}
Form::Form(QWidget *parent) : QWidget(parent), ui(new Ui::Form)
{
ui->setupUi(this);
qDebug() << this->parent();
}
To copy to clipboard, switch view to plain text mode
And I don't know why/how setWindowFlags() resets window flags or sets properly parent object.
Also haw can I use setParent(QWidget *parent) to set parent in that scenario?
Best regards and thanks for help.
Bookmarks