QMessage box buttons size/others have incorrect width after setting style.
-
Hey
More or less this is my flow
Start app
Create pallette
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 ?
TIA -
Hi,
How do you specify your style sheet ?
If you are not precise enough, it will just apply to everything.
-
@SGaist
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?
-
Depending on your exact issue, give size information for the buttons that do not show as you want.