• 5221阅读
  • 2回复

如何将画布和索引窗口关联起来 [复制链接]

上一主题 下一主题
离线cai0612123
 

只看楼主 倒序阅读 楼主  发表于: 2010-06-13
我先在主窗口(QMainWindow)上添加一个画布(QImage),
然后再在主窗口(QMainWindow)建一个索引窗口(QDockWidget),
我想让在画布上画的图也能在索引窗口上显示,
比如:我在画布上新建一页,此页就能在索引窗口上显示
如何将他们关联起来,如何自定义这种信号和槽函数,
敬请指点.....
离线xtfllbl

只看该作者 1楼 发表于: 2010-06-13
你可以将你的画布画在mainwindow中的一个widget中,然后利用setWidget,把这个widget设知道dock中去,这样,要显示都显示了,至于关联,就是一些控制方面的事情了,show,hide之类的比较好解决。
  1. void QDockWidget::setWidget ( QWidget * widget )
  2. Sets the widget for the dock widget to widget.
  3. If the dock widget is visible when widget is added, you must show() it explicitly.
  4. Note that you must add the layout of the widget before you call this function; if not, the widget will not be visible.
  5. See also widget().
上海欢迎您
离线cai0612123

只看该作者 2楼 发表于: 2010-06-13
回 1楼(xtfllbl) 的帖子
谢谢,非常感谢
快速回复
限100 字节
 
上一个 下一个