Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt QPushButton可设置检查时的样式表(true)_Qt_Qtstylesheets_Qpushbutton - Fatal编程技术网

Qt QPushButton可设置检查时的样式表(true)

Qt QPushButton可设置检查时的样式表(true),qt,qtstylesheets,qpushbutton,Qt,Qtstylesheets,Qpushbutton,当我使用 myButton->setCheckable(true); 有一种——我不知道怎么称呼它——一种网格: 有没有可能没有这个网格,而这里只有我的绿色背景?使用选中的属性: QPushButton:checked{ background-color: ... border: none; } 如果您想更改,按下也同样适用 注意:您可以阅读有关属性的所有信息(只需搜索QPushButton即可找到作为按钮一部分的属性。根据文档,删除边框似乎是必要的(否则可能不会应用背景色)

当我使用

myButton->setCheckable(true);
有一种——我不知道怎么称呼它——一种网格:


有没有可能没有这个网格,而这里只有我的绿色背景?

使用
选中的
属性:

QPushButton:checked{
  background-color: ...
  border: none;
}
如果您想更改,按下
也同样适用

注意:您可以阅读有关属性的所有信息(只需搜索
QPushButton
即可找到作为按钮一部分的属性。根据文档,删除边框似乎是必要的(否则可能不会应用背景色)。

myButton->setStyleSheet(“QPushButton:选中”){背景色:绿色;}”);