怎么把QLabel添加进QGraphicsItem
2014-01-23 15:05
197 查看
从国外网站找的答案;元标题是:How to add QLabel to QGraphicsItem
The QGraphicsProxyWidget forwards events to its widget and handles conversion between the different coordinate systems.
Now that you're looking at using a QLineEdit in the QGraphicsScene, you need to decide if you want to add it directly: -
Or you could add the QGraphicsProxyWidget as a member of your class and call its relevant functions, but adding it as a child is probably much simpler.
The QGraphicsProxyWidget forwards events to its widget and handles conversion between the different coordinate systems.
Now that you're looking at using a QLineEdit in the QGraphicsScene, you need to decide if you want to add it directly: -
QGraphicsScene* pScene = new QGraphicsScene; QLineEdit* pLineEdit = new QLineEdit("Some Text"); // add the widget - internally, the QGraphicsProxyWidget is created and returned QGraphicsProxyWidget* pProxyWidget = pScene->AddWidget(pLineEdit); //Or just add it to your current QGraphicsItem. Here, you can either add it as a child of the QGraphicsItem: - MyQGraphicsItem* pMyItem = new MyQGraphicsItem; QGraphicsProxyWidget* pMyProxy = new QGraphicsProxyWidget(pMyItem); // the proxy's parent is pMyItem pMyProxy->setWidget(pLineEdit); // adding the QWidget based object to the proxy
Or you could add the QGraphicsProxyWidget as a member of your class and call its relevant functions, but adding it as a child is probably much simpler.
相关文章推荐
- 虚拟机VirtualBox怎么添加新的虚拟硬盘
- 怎么往PPT里添加FLASH动画?
- 怎么使用Picasso添加图片
- firefox下怎么添加firebug
- 怎么删除linux中的$PATH中已添加的参数
- asp.net中怎么动态添加ul,li列表
- 很多人很想知道怎么扫一扫二维码就能打开网站,就能添加联系人,就能链接wifi,今天说下这些格式,明天做个demo
- WinForm怎么在窗口标题栏上添加按钮?[转]
- (转)怎么修改ubuntu系统的默认字体和格式? && 怎么在IDE中添加可选项之外的字体?
- 很多人很想知道怎么扫一扫二维码就能打开网站,就能添加联系人,就能链接wifi,今天做个demo(续集)
- 请问Android中怎么在一个线性布局里面添加多个图表控件
- html中input按钮怎么添加超链接
- 怎么添加自己的库文件路径及头文件路径
- 怎么给MindMapper添加特殊字符
- Windows 7系统怎么添加或删除输入法?方法介绍
- word 2013 没有控件菜单怎么办,添加控件菜单
- liunx中.源码包下载的软件怎么添加命令行到系统环境
- keil 5 中没有的 flash programming algorithm 该怎么添加
- win10系统中怎么在home文件夹中添加库
- VS2008 向对话框添加变量怎么出现“未能返回新代码元素,可能是语法错误”!!