问题标签 [qstylesheet]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
qt - 如何在使用 QQmlApplicationEngine 时加载样式表
我目前正在尝试为一个简单的 Qt5 应用程序加载样式表。因此我使用以下代码:
但是,样式表已正确加载,但未应用。我如何更改上述代码才能使其正常工作?
c++ - QPushButton 动态背景色
我有一个QPushButton我想设置背景颜色的。我可以为此使用样式表:
但是我想在函数中使用它void foo(const QColor& a_color)。我如何确保样式表将此a_color作为参数?
所以是这样的:
有没有办法用样式表做到这一点?如果没有,没有他们我怎么能做到这一点?
python - 当它是qgraphics场景中的小部件时如何设置qlineedit的背景颜色
使用 PyQt,我正在尝试使用样式表来设置已添加到 QGraphicsScene 的 QLineEdit 的背景颜色。问题是背景颜色是我似乎无法更改的唯一属性。例如:
将行编辑的文本颜色设置为灰色,但背景颜色保持白色。
我究竟做错了什么?
qt - QStyleSheet - setting border-image for button also sets background image for its tooltip
I'm having a problem with setting the border-image property of a QToolButton (later on also of a QPushButton but I assume the problem will occur there too). Each of my custom buttons (inheriting from QToolButton and QPushButton respectively) has to have 3 states - inactive, running and error.
Inactive:
Running:
Error:
where self.cornerRadius is some number used to determine the roundness of my buttons in pixels and self.icon is an icon I have retrieved from somewhere.
All I do in my button's constructor (among other simple initializations) is
The clicked() signal of the button is connected to a slot in the same class where the state is changed (along with the style using self.setStyleSheet(...)) in respect to what the system's new state is.
For some unknown reason my tooltip receives the style changes of the button it "belongs to":
I've double-checked the Qt documentation and I see no reason that will explain this behaviour. I do NOT want to change the tooltip's style at all. Any ideas how to fix this?
c++ - 如何使用 QStyleSheet 控制 QDialog 的背景边框大小
使用样式表,如果我设置 QDialog 的背景颜色,我似乎无法控制可见颜色的宽度 - 内容和实际边框之间的差距。例如,如果我创建一个只有 QListWidget 的 QDialog,在 QGridLayout 中,我会看到背景颜色显示为 QListWidget 周围的边框。我想让这个更薄。
我怎样才能减少这个“边界”?如果 QDialog 支持盒子模型,它看起来好像背景剪辑会起作用。
如果有什么不同,我在 4.7
qt - 使用样式表在 QMenu 中设置图标?
如何通过样式表在 QMenu 中为 QAction 设置图标?
例如:
现在我想用 QT 样式表为 action1 和 action2 设置不同的图标。
样式表可以吗?
python - PyQt:如何在缩放模式下设置样式表内容?
我有一个应用程序,其中包含许多带有样式表的小部件,但是,我没有向界面添加任何布局,它也没有包含中央小部件,但是应用程序运行时没有任何问题。
但是,每当我尝试调整应用程序的大小(缩小)时,小部件当然不会缩放。
我进行了一些研究(因为我找不到与我的问题相关的任何其他内容),我在 Qt 文档、样式表参考中找到了这个:
“绘制的实际图像是使用与 QIcon 相同的算法确定的(即)图像永远不会按比例放大,但在必要时总是按比例缩小。”
如何使样式表随窗口缩小?(如果样式表有背景图片)
例如,我有带有样式表的按钮:
我怎样才能使这个按钮随着窗口缩小,我可以在没有布局的情况下实现这个吗?如果不是,我该如何使用布局?(没有限制太多)





![[qt 可以做到][2]。](https://i.stack.imgur.com/YDeMr.png)