How dose the qss influence the size of the QPushbutton
-
I've created a Pushbutton by inputing nothing,I just want to using the qss file to deside the button size.How would I do ?
I tried to using the width,max-width,image or background-image of the qss grammar.
But in fact its hard to understand which is the major factor to deside the fact width and height of the pushbutton.
The api on the official website is hard to understand.QPushButton[ui_type="button_icon"] { /*background-color: #004AA9; padding:3px; text-align:right;*/ max-width:126px; max-height:28px;/**/ image:url(:/img/img/img_back.png); background-color: rgba(0,0,0,0); background-repeat:no-repeat; } QPushButton[ui_type="button_icon"]:hover{ /*padding:3px; text-align:right; */ max-width:126px; max-height:36px; image:url(:/img/img/img_back.png); background-color: rgba(0,0,0,120); background-position: center; background-origin: content; background-repeat:no-repeat; border:1px solid #D4D6D9; } -
I've created a Pushbutton by inputing nothing,I just want to using the qss file to deside the button size.How would I do ?
I tried to using the width,max-width,image or background-image of the qss grammar.
But in fact its hard to understand which is the major factor to deside the fact width and height of the pushbutton.
The api on the official website is hard to understand.QPushButton[ui_type="button_icon"] { /*background-color: #004AA9; padding:3px; text-align:right;*/ max-width:126px; max-height:28px;/**/ image:url(:/img/img/img_back.png); background-color: rgba(0,0,0,0); background-repeat:no-repeat; } QPushButton[ui_type="button_icon"]:hover{ /*padding:3px; text-align:right; */ max-width:126px; max-height:36px; image:url(:/img/img/img_back.png); background-color: rgba(0,0,0,120); background-position: center; background-origin: content; background-repeat:no-repeat; border:1px solid #D4D6D9; }@nicker-player said in How dose the qss influence the size of the QPushbutton:
tried to using the width,max-width,image or background-image of the qss grammar.
And what happened with this code? Did any of the properties apply or none? In the hover or non-hover case? Would changing the maximum height of this button have any effect? Did you try
heightbefore tryingmax-height? -
For example,the width and the height of the image named img_back.png is 72X28,but when I put these codes into the project.It may not work ,the image in fact always has a scale cause the button width and height.
I just dont know the scale factor or the ohter factors to influence the button size.
I thought there would be some guide codes to tell me how to write the right and effecient codes.