- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在这里创建类似的自定义布局:http://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-flowlayout-cpp.html
我想要一些方法将复选框放在自定义按钮的顶部。目前有
setGeometry(QRect(QPoint(...
按钮和复选框的方法,但无论我是先为按钮还是复选框做这件事,复选框仍然出现在按钮“下方”,我看不到/点击它。
我怎样才能把复选框放在按钮上面?
最佳答案
只需将复选框设为按钮的子项,并调用与按钮相关的 setGeometry。 child 总是被吸引到 parent 之上。
QPushButton button("Hello World!", &w);
button.setGeometry(0,0,100,100);
button.show();
QCheckBox checkBox(&button);
checkBox.setGeometry(button.rect());
checkBox.show();
无需将复选框放入布局中。
关于c++ - doLayout : how to setGeometry on top of another widget?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34173778/
在将子 QWidget 添加到父 QWidget 后,我无法立即设置它的尺寸。问题是它根本没有设置几何图形: from PyQt4 import QtCore, QtGui class MyWid
我查看了以下链接,但找不到解决我的问题的方法: Qt setGeometry: Unable to set geometry Unable to set geometry in Qt https://
我的环境如下: Qt 5.4,使用 -platform win32-msvc2013 -opengl desktop -no-icu -skip webkit 从源代码构建 Visual Studio
我正在尝试使用 qt 小部件覆盖 Maya 的事件 View 3d。 我有一个 Canvas 基类(一个透明的小部件),我可以在上面做一些绘画工作。它的父级是包装的 avtice 3d View 。一
我正在使用 PyQt5 开发一个非常简单的应用程序,用于显示和排序图像。我是 Python 和 Qt 的新手,特别是我遇到了一些问题。我试图在 QLabel 对象中显示 QPixmap 图像,并且它们
我想在这里创建类似的自定义布局:http://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-flowlayout-cpp.html 我想要一些方法将复选框放在
为什么? setGeometry: Unable to set geometry 22x22+320+145 on QWidgetWindow/'WidgetClassWindow'. Resulti
所以我是 Famo.us 的新手,这可能是个愚蠢的问题(我希望不是)。 var Mesh = require('famous/webgl-renderables/Mesh'); ..... var m
我将一些代码从 Qt 5.6.0 迁移到了 5.12.0。令人惊讶的是,我收到了很多与 QWindowsWindow::setGeometry 相关的警告。每当一个对话框显示在另一个对话框之上时,我都
我是一名优秀的程序员,十分优秀!