• 8964阅读
  • 4回复

如何在一个QMainWindow 上添加多个QWidget [复制链接]

上一主题 下一主题
离线downstairs
 

只看楼主 倒序阅读 楼主  发表于: 2010-01-26
如何在一个QMainWindow 上添加多个QWidget


如题。不让他们重叠。 。。。并排展开。。

貌似QMainWindow 设置setCentralWidget后 其它的WIDGET就不正常?
喜爱编程的猫头鹰
离线benbenmajia

只看该作者 1楼 发表于: 2010-01-26
有个东东叫QMDiArea,看看效果
安然.....
离线午小夜

只看该作者 2楼 发表于: 2010-01-26
A main window provides a framework for building an application's user interface. Qt has QMainWindow and its related classes for main window management. QMainWindow has its own layout to which you can add QToolBars, QDockWidgets, a QMenuBar, and a QStatusBar. The layout has a center area that can be occupied by any kind of widget. You can see an image of the layout below.

Note: Creating a main window without a central widget is not supported. You must have a central widget even if it is just a placeholder.

個人覺得,如果不是爲了更方便的去添加QToolBars, QDockWidgets, a QMenuBar, and a QStatusBar ,我寧願用QWidget類。
[操作系统版本]  Windows XP;Linux Ubuntu;Linux Fedora;
[Qt SDK版本]    4.7.0
[SDK 发布日期]  2010.05
[IDE(集成开发环境)] QtCreator
个人网页:http://hi.baidu.com/午小夜
學歷:Royal Jalidon
离线dbzhang800

只看该作者 3楼 发表于: 2010-01-26
引用楼主downstairs于2010-01-26 17:51发表的 如何在一个QMainWindow 上添加多个QWidget :
如何在一个QMainWindow 上添加多个QWidget
如题。不让他们重叠。 。。。并排展开。。
.......

先 QLayout 布局到一个QWidget 上,然后...
离线downstairs

只看该作者 4楼 发表于: 2010-01-27
用QMDIarea 问题解决了
参考:http://caterpillar.onlyfun.net/Gossip/Qt4Gossip/QMdiArea.html

但是。。无法捕获其中的一个窗口的INPUT。。。。

喜爱编程的猫头鹰
快速回复
限100 字节
 
上一个 下一个