c++ - 带有图标的按钮边框
问题描述
在构造函数中,我设置了表单和按钮的样式:
{
ui->setupUi(this);
this->setStyleSheet("QWidget {background: rgb(49, 54, 59); color: rgb(220, 221, 218); selection-color: lightyellow; selection-background-color: darkcyan;}"
"QPushButton::hover {color: darkcyan; border: 2px solid grey; border-radius: 3px};");
}
接下来,在icon
按钮的属性(参数)中,我添加了一个via 资源,我也使用参数 -icon
设置了图标大小,我也设置了-参数。iconSize
20x20
flat
True
这就是我将光标悬停在按钮上时得到的结果:
当图片设置为 时,按钮本身的大小是使用布局和 is 形成size
的。32x26
20x20
请告诉我如何在按钮的和gap
之间删除它?picture
border
我尝试静态设置按钮大小,大约22x22
然后一切都或多或少很好,但我不想诉诸这种激进的解决方案。谢谢。
解决方案
推荐阅读
- java - 从 SharedPreferences 中删除项目(索引)
- r - 将情节与常见图例组合以仅显示一个图例
- python - 使用 Pygame 进行原子模拟
- html - Div 在另一个 Div 上滚动
- oracle - 有没有一种方法可以将数据从 oracle 迁移到 Bonita 的 postgres 数据库?
- com - MSIX -> COM 服务器的本地激活权限
- android - 如何使用android管理API获取设备的位置信息
- bixby - 从响应中渲染原始图像
- javascript - Squarespace 中的 JavaScript imagemappro.js 编辑器集成
- bash - 如何使用 sed 生成要通过 rm 删除的文件列表?