7

In the QT application we develop we need to display several 'Viewer windows' (to display data in XY plane, YX plane, XZ plane and in 3D).

We were hoping to use MDI application model, but later the client asked for a requirement to drag and view 'Viewer windows' in multiple desktops (using multiple monitors). This can not be done using MDI window model, because we cannot move MDI window outside the Main Application Window.

Only possible way is to use Dock windows because they can be undocked from Main Application Window and move into other desktops, but Dock windows primary used for tool-palettes or utility windows.

(http://doc.qt.nokia.com/4.6/qdockwidget.html#details)

Is it a good practice to use Dock window for our requirement?

4

1 回答 1

4

我不会使用 QDockWindow,因为您似乎不会使用客户区。此外,您不希望停靠到 MainWindow 边框,而只是将小部件添加到 MainWindow。

我认为您可以尝试将多个 QWidget 与 QGridLayout 一起使用。将 QWidget 拖到 MainWindow 之外时,只需从布局中删除 QWidget。在 MainWindow 内拖动时,将 QWidget 添加到 QGridLayout 中的正确位置。使用此方法,您也可以将小部件的位置切换到主窗口。

我不知道它是否足够清楚,但我正在考虑将新元素拖入布局时在 QtDesigner 中完成的相同方式。拖动小部件时,您可以看到释放鼠标按钮时将添加它的位置。

在我看来,这种方法可能是您正在寻找的方法。

希望有帮助

于 2010-06-01T08:23:27.090 回答