I've got a new little problem with the use of parent.
I create a new class based on QGridLayout.
In the constructor I create some new QWidget like label in this way
lbArray
[N
] = new QLabel(parent
);
lbArray[N] = new QLabel(parent);
To copy to clipboard, switch view to plain text mode
where parent is an argument of the constructor of my class:
IOPortConfig(QWidget *parent = 0);
To copy to clipboard, switch view to plain text mode
In the MainWindow I create the new QWidget in this way:
d_IOInitConfig = new IOPortConfig(this);
hboxIOInitConfig->insertLayout(0, d_IOInitConfig);
d_IOInitConfig = new IOPortConfig(this);
hboxIOInitConfig->insertLayout(0, d_IOInitConfig);
To copy to clipboard, switch view to plain text mode
hboxIOInitConfig is an Horizontal Layout partially created by the Designer.
The "problem" is that, in this way, I've got this warning:
QLayout: Attempting to add QLayout "" to MainWindow "MainWindow", which already has a layout
I want to use the parent so I don't need to worry about deleting the QWidget that I created in my class.
How should I do?
Bookmarks