添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode . Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript). Create Style fusion
Apply style/palette/etc
Then I load my qss file with some overrides & load that & apply to qapp to entire app.
Once I do that, when I look at my buttons, they are all at "minimum" width size. QMessageBox "OK" button is like 20 pixels wide.

If I do not apply my qss, everything works as it should.
How can I bite this ? Is there any rule in CSS that I Can specify on per button bassis to somehow "retain" accurate width ?
Something like this:

auto style = QFile(":/styleThemes/styleDark");
style.open(QIODevice::ReadOnly);
qApp.setStyleSheet(style.readAll());

Style has stuff like

QPushButton{

That I set on the app, it removes the native Fusion style & at the same time button wont size-width properly.

So it's exactly what I wrote: that style is applied to all the QPushButtons of your application.

Using stylesheet on a widget will replace it's style by the one used to handle the stylesheet.

If you only want to apply it on a specific button, then you have to write it accordingly.

@SGaist Yes, I want to apply style to entire aspp. But I don't want to affect button width sizing using the style. None of my QPushButton{} options change any width sizing related settings. I suppose as it removed fusion by default it also removes some width sizing aprameter of a button. So I wonder what style-width-parameter do I have to re-configure to retain it?