- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用 Qt 5.3.0。当我在 QPushButton 的选中状态上应用一些背景颜色时,按钮将在选中时填充灰色点(在我想要的背景颜色之上)。
这是一个小测试程序(使用 qtcreator 但也可以通过编码完成):1、创建一个qt应用2、拖入一个QPushButton,设置为flat and checkable3、在w.show()之前添加这几行
w.setStyleSheet("\
QPushButton { \
color:white; \
} \
QPushButton:checked{\
background-color: rgb(80, 80, 80);\
}\
QPushButton:hover{ \
background-color: grey; \
border-style: outset; \
} \
");
4、运行app并勾选按钮
您会看到按钮变为虚线,但我需要选中的按钮为纯色,如 rgb(80, 80, 80)。我错过了什么吗?
最佳答案
我只需在样式表的 QPushButton:checked
属性上设置 border: none;
即可删除这些点。
在你的例子中,它应该是这样的:
w.setStyleSheet("\
QPushButton { \
color:white; \
} \
QPushButton:checked{\
background-color: rgb(80, 80, 80);\
border: none; \
}\
QPushButton:hover{ \
background-color: grey; \
border-style: outset; \
} \
");
在这里您可以看到选中按钮时的结果:
关于css - 如何设置 QPushButton 选中状态的样式以移除灰点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24718722/
我创建了一个 GUI 宽度的 Qt Creator (Qt 5.0.1),当然也使用了布局。出于美学原因,我希望 QPushButton 与放置在 GUI 其他角落的另一个 QPushButton 具
如何扩展棕色的对象(QPushButton)。 坦率地说,我曾尝试通过添加 Horizontal layout 来做到这一点,但似乎效果不佳。 如图所示,当小部件最大化时,我想扩展(仅宽度)特定
我有一个二维数组QPushButton,当用户点击它时我如何获取按钮的索引?例如当用户点击按钮 a[2][3] 时,它会显示 (2,3) ? 最佳答案 这个例子是这样的: Qt 4/5 使用对象名称
最近想要那个QPushButton当鼠标指针进入时可以发出信号。我怎样才能做到? 我知道 QPushButton 有一些已经定义好的信号,比如 clicked() , pressed() , dest
我是 PySide 的新手。我想在其单击的插槽中获取 QPushButton obj(例如使用它来获取其文本)。 button = QtGui.QPushButton("start go") butt
请注意 redb.clicked[bool].connect(self.setColor) 行,为什么要添加 [bool] 部分?我试图删除该部分,将行修改为 redb.clicked.connect
我在 Qt Designer 中设计了两种不同的 QPushButton。一个是默认的,另一个我想说清楚。在 QT Designer 中,我将后者的初始样式表设置如下: background-colo
我有一个包含以下结构的小部件和布局的大布局: QVBoxLayout QTableView QPushButton 我将布局上的边距、内边距和间距设置为 0。这在 Mac OS X 上呈现的方
我有以下按钮样式表: QPushButton:hover{ background: qlineargradient(x1 : 0, y1 : 0, x2 : 0, y2 : 1,
我有两个小部件(真实的和假的),其中一个有 QPushButton。现在我希望在另一个小部件中显示相同的按钮。我该怎么做? 我不想创建副本,我希望在不更改父级的情况下同时显示另一个小部件上的相同 QO
我在我的程序中使用 QPushButton()。使用这些按钮,我可以旋转我的对象。 到目前为止工作正常。唯一的问题是我必须单击多次才能进一步旋转对象。这有点烦人。只要我按下按钮并且对象将进一步旋转,按
我正在使用以下代码创建一个按钮。它工作正常。但我在左角得到了黄色矩形。为什么?请帮我。提前致谢, backButton = new QPushButton(tr("Back"));
我想让一些按钮看起来像你在 Skype 中看到的按钮。如何设计 QPushButton自定义形状?我不知道这样做。所以我需要一些建议。例如,我想要我的 QPushButton看起来像这样 image
我想将 QPushButton 对齐到右下角,但没有固定大小,因为如果我使用固定大小并调整窗口大小,它看起来就不再好看了。这是我的代码: self.copy_btn = QtWidgets.Q
我从 Qt 开始,每当有人将鼠标悬停在 QPushButton 上时,我想将 QPushButton 设置为不同的图标。到目前为止,这是我的代码: #include QPushButton *but
我在使用 Qt 4.6.0 和 QPushButtons 快捷方式时遇到问题: 当用户单击按钮时,我想在QTextEdit中显示特殊文本,但仅当按下按钮时,如下一旦发布,我希望出现另一个文本。 一切正
我从 Qt 开始,我想在有人将鼠标悬停在 QPushButton 上时将其设置为不同的图标。到目前为止,这是我的代码: #include QPushButton *button = new QPus
是否可以向 QPushButton 添加工具提示。我的意思是,当您将鼠标悬停在按钮上时,会出现一个小文本框(通常是黄色)并告诉用户该按钮正在做什么。 谢谢。 最佳答案 QPushButton 是 QW
我尝试在通过 QtWidgets.QColorDialog 设置 PNG 图像的颜色后更改其颜色。使用Python ---> 至 尽管如此,当我应用代码时,结果是: 它改变了我的PNG图像的背景 PN
我正在连接一个 QPushButton,它将在其中隐藏/显示框架内的小部件。 我使用 .ui 方法加载/创建了我的 GUI。 对于这个 QPushButton,我设置并检查了属性 setChecked
我是一名优秀的程序员,十分优秀!