I have
class MyWidget : public QWidget
{
Q_OBJECT
public:
explicit MyWidget (QWidget *parent);
};
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
glWidget = new GLWidget(this, cluster);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(glWidget);
setLayout(mainLayout);
setWindowTitle("Visualization");
}
and the main window MainWindow w;.
I want to
- to create new instances of MyWidget from
w; - so that instances are destroyed after
QCloseEventor w(now they are destroyed only after QCloseEvent); - so that instances appear in new windows.
I create a new instance MyWidgetas follows:
void MainWindow::visualize()
{
MyWidget *widg = new MyWidget(this);
widg->show();
widg->raise();
widg->activateWindow();
}
When I try to create widgwith whow parent, it widgappears inside w(in the upper left corner).
What is the easiest and most understandable way to fix this?
Thank!
source
share