
Originally Posted by
IrYoKu
AFAIK, you can add wigets without parent into QLayout objects, and they convert from top level windows into normal widgets.
...by reparenting the widget (see the attached example).
Edit: And another example:
#include <QApplication>
#include <QWidget>
int main(int argc, char **argv){
// QWidget c1;
c1.setParent(&top);
return 0;
}
#include <QApplication>
#include <QWidget>
int main(int argc, char **argv){
QApplication app(argc, argv);
// QWidget c1;
QWidget top;
QWidget c1;
c1.setParent(&top);
return 0;
}
To copy to clipboard, switch view to plain text mode
Try running this app and then run it again after uncommenting 6th and commenting the 8th line of this snippet. Compare results.
Bookmarks