如何从 QGridLayout 的单元格中删除小部件
我无法从 qgridlayout 中的单元格中删除特定的小部件。我尝试了在互联网上找到的几个代码......但我失败了!我的工作方式是,首先我创建了一个包含按钮、qpixmap、qplaintextedit 的 qwidget 类。然后我创建了这个类的一个对象,并在 QGridLayout 上动态设置它。然后使用该指针在当前小部件上设置布局。我可以在网格布局上添加小部件,但无法删除它..我想删除我创建的整个小部件,只有当像素图为空时!有谁知道解决这个问题的合适方法吗?
I am not able to remove a particular widget from a cell in a qgridlayout. I tried several codes found in internet... but i failed!! the way how i did the work was, first i created a qwidget class containing button,qpixmap,qplaintextedit. i then created an object of this class and it was set dynamically on the QGridLayout. the layout was then set on the current widget using this pointer. I am able to addwidgets on the gridlayout, but not able to delete it.. i want to delete the whole widget i created only if the pixmap is null!!! Do anyone knows a suitable remedy for this problem??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要删除小部件而不删除它,请调用
要删除并删除小部件,只需将其删除。
To remove a widget without deleting it, call
To remove and delete a widget, just delete it.