Hello,
How do you do reparenting within Designer?
Is there an equivalent of the old UIM/X widget browser where you drag-and-drop a widget tree hiearchy into the new parent? Or, is there another way?
Thanks,
Ben
Hello,
How do you do reparenting within Designer?
Is there an equivalent of the old UIM/X widget browser where you drag-and-drop a widget tree hiearchy into the new parent? Or, is there another way?
Thanks,
Ben
throwaway_acct (5th September 2020)
What do you mean *re*parent with designer?
Reparnting means changing a parent to an object, which suggests a dynamic process (i.e at run time).
By reparenting ... I mean changing the widget hiearchary ... moving an entire tree from a given node to another. For example, I might want to move (or copy) the children nodes of one parent widget to another. This might occur when wanting a set of widgets to be managed by some other widget.
It could be that I still don't understand, but when you move a widget from one container widget to the other, the new container widget becomes the new parent of the moved/copied widget...
But this you might know already, so I guess I just don't follow...
Moving is a different concept from changing parent. Perhaps that's the best way of explaining. I'm referring to changing the "ownship" of the widget ... changing which parent "contains" the child widget[s]. The reason I ask this is that sometimes it's very difficult to do this graphically ... with a move operation ... because the parent widgets may have very little screen space to actually drag the widgets into. Other tools I've used in the past have an editor that strictly shows the widget hierarchy. They also have an explicit parent field that can be edited ... which would also accomplish the reparenting.
Not in designer.Moving is a different concept from changing parent.
And it does makes sense - see below.
But you can change the parent in code, which will also move the widget physically on to the new parent.
Yes, we are talking of the same thing, but in this case, visually containing also means being the parent of the widget.I'm referring to changing the "ownship" of the widget ... changing which parent "contains" the child widget[s].
Hmm... then somthing in the grphical design of your GUI must be wrong.because the parent widgets may have very little screen space to actually drag the widgets into
What is the point of such a small container, that is so small you cant drag and drop in to it?
It means you just see a small speck on the GUI...
However,what you can try is, cut the widget you want to insert in to the small container, select the container, and then paste.
It's only initially small ... while editing.
An example ... when I create a grid layout widget and add the first child ... it resizes so that it's difficult to add the second widget graphically to the correct parent.
Another example ... when I want to move widgets to a new parent that's not visible.
I'll try that (e.g. selecting in Object Inspector ... then pasting). I'm still on the learning curve.
So first position widgets and then apply a layout, not the other way round.
Are we talking design or run time? If the former, then all widgets are visible (provided you didn't shrink it manually, forgot to set sizeHints or layouts or stack some other widget on top of it - all of them being design flaws of your gui not the editor.Another example ... when I want to move widgets to a new parent that's not visible.
Maybe you have a wrong approach here? Try to first build a hierarchy of objects you need, apply layouts to each hierarchy and only then position the groups as they should remain and as the last point, apply the layout to the form itself.I'll try that (e.g. selecting in Object Inspector ... then pasting). I'm still on the learning curve.
That's probably it. I'm used to desigers that also support a top-down approach ... which can be useful for refactoring.Originally Posted by wysota
Does this approach work well with redesigning an interface?Originally Posted by wysota
Designer supports it too, but if you have trouble using it, you can try a different approach (which is in my opinion more intuitive anyway).
Sure, you can always break a layout and reposition your widgets.Does this approach work well with redesigning an interface?
To be honest I'm not fond of statements "I have seen xxx do yyy. Why Designer/Qt does it differently?". I could probably ask you dozens of questions asking why xxx doesn't do zzz which is supported by Designer/Qt. Remember, nobody forces you to use either Designer or Qt. Most people like Qt also because it is easy to program using it. If you are used to bad habits, then maybe it is time to try to get rid of them and try a bit different approach, maybe you'll learn something new and if you do, you'll have the knowledge and experience to compare both approaches and choose one which fits you better. Not all that is expensive/commercial is well designed just because of being commercial, you should be aware of that when you enter a new environment. BTW, Qt is commercial too - all those statements apply to it as well. If you use Qt, use it because you like it, not because it is commercial/open source.
We all learn by comarison and contrast.Originally Posted by wysota
I am "forcing" myself because I think it’s built upon a well designed framework. I do think there is room for improvement with Designer though. BTW, that's not intended as a personal insult to you ... just my humble opinionOriginally Posted by wysota
But you should try first and compare later, not the other way round.
Then stop forcing yourself and see if you like it.I am "forcing" myself because I think it’s built upon a well designed framework.
I didn't say there isn't. But I have used Designer for few years now, I've seen it develop and I know its flaws, so I can try to formulate opinions how to improve it. You are just starting to use it and you probably haven't seen half of its features yet.I do think there is room for improvement with Designer though.
I didn't take it as an insult. I'm just expressing my thoughts too.BTW, that's not intended as a personal insult to you ... just my humble opinion
> Remember, nobody forces you to use either Designer or Qt. Most people like Qt also because it is easy to program using it. If you are used to bad habits, then maybe it is time to try to get rid of them and try a bit different approach
Yikes - what a hostile and rude response to a completely valid user experience challenge. Other people like myself are encountering the same thing:
* https://stackoverflow.com/questions/...e-right-parent
* https://forum.qt.io/topic/4793/how-t...2-2-0-designer
You realize you are complaining about a 14 year old post? Some of those people are still around and active in this forum, though.Yikes - what a hostile and rude response to a completely valid user experience challenge. Other people like myself are encountering the same thing:
In Wysota's defense, while he can be brusque at times, his point is nonetheless valid: If you don't like the tool, don't use it. All Qt Designer is is a visible interface on top of an XML editor. The creators of Qt Designer chose a particular interaction style, which as the OP pointed out, is different from the one that he / she was used to when working in a different GUI environment. If you don't like Qt Designer, then you can build your GUI in C++ code without a ui file (which I often do for QMainWindow classes) or you can learn the ui XML syntax and hand code it (which I occasionally do when I want to tweak an interface or when I've screwed it up so badly in Designer that I have to fix it first before editing it again).
There are several quirks to using Qt Designer that take time to understand and to work around. Over the 14 years since this original post, Qt Designer has improved so some of these interactions are not so frustrating as they once were. Some quirks remain, especially around the use of layouts. If you add certain widgets to a layout before others, it can be extremely difficult to add the new widgets because the first widget has expanded to take up all the space. On a high-res monitor, the line between being inside a layout and outside it can require extremely precise mouse movements to get the UI to show that you are inside the box. A layout that has been locked can't be modified and it can be difficult to select the layout itself and not one of the objects within it. And on and on. Over time and with enough use, you learn the idiosyncrasies and find workarounds.
Prior to Qt5, there was no form layout, for example. It was added because the vertical, horizontal, and grid layouts didn't handle the layouts of forms where you might want editing widgets to align in a pleasing visual arrangement. 14 years ago, this didn't exist.
It can be frustrating for a new user. And in the case of the OP's original question, the use of terminology ("reparenting" which has an entirely different meaning in the Qt world) contributed to the confusion about the question.
Both of the links you posted involve these quirks with the use of layouts. In the second case, the poster is using a transparent (rectangular) widget with a non-rectangular image and trying to use existing (rectangular) layouts to look right, without a lot of success. As one of the responses said, he may have to develop his own layout manager that takes into account the irregular image.
Last edited by d_stranz; 5th September 2020 at 20:55.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
I fully second d_stranz's answer.'
And he actually took much more time and effort to answer your post then I would be inclined to.
I don't see what is "hostile" about the answer you quoted.
The first part is a dry fact - no one, indeed, is forcing anyone to use any tool, and the second it a good advice.
And I know wysota personally, he talks straight, but not offensive - if you see offence in this text, it is of your own making - as the saying goes: "beauty is the eye of the beholder" - this is true for anything really.
As long as no foul or clearly abusive language is used, I see no issue.
If you feel offended from a post that is not violating the forums rules, simply ignore it (and without offending: if you find yourself being offended often in this manner, it might be a good idea to look inwards to see why you are quick to interpret posts as offending so often, again, *if*, and this sentence was not meant as a jab as as a friendly suggestion).
Oh, and don't speak in the name of "other people" unless they actually told you so - we didn't get other complaints so far (on this subject).
If someone else has encountered abusive comments, they can, and should use the report button as you did - so if someone does contact you about it, please tell them to report.
P.S
In his last comment wysota wrote he following:
I think this should make his intention clear to NOT be rude.I didn't take it as an insult. I'm just expressing my thoughts too.
Cheers.
Last edited by high_flyer; 5th September 2020 at 18:47.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Bookmarks