I've done a lot of WPF and am now, for the first time, trying to get a grasp of Qt, so far fairly successful.
我已经做了很多WPF,现在,我第一次试图掌握Qt,到目前为止还算成功。
However, in WPF, I'm used to encapsulate self-enclosed parts of GUIs in User Controls so that I can then easily re-use them across dialogs or rearrange an entire block without having to touch every single element. If, for example, I was building a main window that would show information about a hospital, about the area it is in and about its manager, I would encapsulate each of the three blocks in a User Control and my main window would just contain three instances of those controls.
但是,在WPF中,我习惯于在用户控件中封装GUI的自封闭部分,这样我就可以轻松地在对话框中重复使用它们,或重新排列整个块,而无需触及每个元素。例如,如果我正在构建一个显示医院信息的主窗口,关于它所在的区域以及它的管理器,我会将三个块中的每一个封装在一个用户控件中,而我的主窗口只包含三个这些控件的实例。
With Qt, I was as yet unable to identify the concept I should use for this type of encapsulation. Should I be 'casting' those building blocks as custom widgets? My guess is that Qt has a concept for that which I can't find because I don't know what it's called.
有了Qt,我还是无法确定我应该用于这种封装的概念。我应该将这些构建块“转换”为自定义小部件吗?我的猜测是Qt有一个我无法找到的概念因为我不知道它叫什么。
Thanks for your help!
谢谢你的帮助!
FS
1 个解决方案
#1
4
You would create custom classes based on QWidget
or some other simple widget class (QFrame
for instance). It's pretty standard practice, no need for another concept.
您可以基于QWidget或其他一些简单的窗口小部件类(例如QFrame)创建自定义类。这是非常标准的做法,不需要其他概念。
#1
4
You would create custom classes based on QWidget
or some other simple widget class (QFrame
for instance). It's pretty standard practice, no need for another concept.
您可以基于QWidget或其他一些简单的窗口小部件类(例如QFrame)创建自定义类。这是非常标准的做法,不需要其他概念。