UI loaded with QUILoader, cannot stretch properly and clears when pressing escape
-
We are using QT 5.6, and using QUILoader to load ui files at runtime, from within qt resource files ... this all works great and there is no issue loading the ui or operation, connecting buttons and getting field values, etc ... what i do i create a top level QDialog, grab its layout, and add the loaded widget to the layout .. the issue is that (1) i want all the children to stretch nicely as the top level dialog is scaled, (how can i tell the top level all should stretch horizonally for example?) and (2) when i press escape the contents of my top level dialog are cleared, so the entire ui loaded from xml dissapears ... no idea why ... any help appreciated
-
Two things based on your description.
- Did you add the stretch factor for UILoaded widget when adding into layout ?
- Have you set the stretch factor for widgets present in the UILoaded widget ?
- When you are clearing the dialog, what is the code you ? Are you deleting the top level widget ? I suspect so. When you delete the widgets all the children are also deleted.
-
- i tried all sort of combinations of setting stretch factor, none seemed to work .. what is the recommended way? do i need to set on all objects?
- no i did not but i did try programmatically
- this happens automatically somehow, this is not programmed in, which is why i am asking how/why it happens?
-
Hi and welcome to devnet,
Please show us the code you use, that will make things easier.
-
after loading widget using quiloader, then i instantiate a child of QDialog, where in the constructor i use:
QLayout *layout = this->layout(); QWidget *myWidget = (loaded widget); myWidget->show(); layout->addWidget(myWidget); this->show(); this->activateWindow(); this->raise();
-
This code piece does not have any issue. I suggest you prepare a complete sample which is giving a problem.