Unsolved Changing a parent of a widget in qt creator designer.
-
Hello. How can I do the subject?
I have searched the internet but only solution i found is cutting/pasting a widget. I can't use it because it changes a widget position. Why is it so painfully hard to do? -
@OmegaDoom Parent of a widget is the widget where the child widget is placed. So, if your child widget is on widget A, then A is its parent. If you want widget B to be the parent then you need to move the child to B. You can't put the child on A and have B as parent. And why would you want this? What is your use case?
-
Yes, it's what my question about. How can I move existing widgets to another parent? The only way I found so far by cutting/pasting. But it's not suitable because it changes widget position and not good for moving many widgets. The only other solutions i can come up with is to edit form manually. Do I really need to do this? And it changes absolute position - sucks.
My case is simple - I want to move some widgets to a frame in order or enable/disable them by enabling/disabling their parent. -
@OmegaDoom Why not simply drag and drop the widget to the new parent? Works fine for me.
And I still don't understand how you want to change parent of a widget without changing its position? The new parent is another widget at another position, so you have to move your child widget to another position. -
I have the same issue. I know I can drag & drop, but it some cases it is unnecessarily difficult. For example, if I have horizontal layout within a vertical layout, the horizontal layout by default squishes into a thin line. It's now close to impossible to drag a widget inside that thin horizontal layout. I know I can work around it, but it is unnecessarily difficult. It would be much easier if I could drag & drop in the object hierarchy browser, but this doesn't seem possible.
-
@Otso
Yeah for layout where you remove margins or simply have no Widgets yet its near impossible to hit
the right spot. You have to set a temporary min size as not have it to collapse totally.
Drag and drop in the object hierarchy browser would be great. -
With Qt, of course, everything is possible! You just have to, like an idiot, find the correct elements in *.ui file, edit it manually, and if the God will stand with you, you may be able to manage this uneasy task.