qtpyqtpyqt5qt-designer

How to margin text in Textedit with Stylesheet on Qt


I have a project that uses PyQt5 to create a GUI. I used StyleSheet to change the widget appearance. Everything is fine but there is only 1 thing It's not okay. It's about left and center margin of the text in the textbox. I tried looking on stackoverflow and the Qt forum but didn't see anyone who had a way to margin the text. This is image my GUI: GUI

This is my styleSheet:

QWidget{
background-color: rgb(0, 0, 0);
border-bottom-right-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-top-left-radius:10px;
color: rgb(0, 0, 0);

}
QSpinBox {
color: rgb(0, 0, 0);
background-color: rgb(0, 0, 0);
border-bottom-right-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-top-left-radius:10px;
color: rgb(255, 255, 255);
background-color: rgb(150, 150, 150);
font: 75 10pt "MS Shell Dlg 2";
}
QSpinBox::up-button {
width:20px;
     height:20px;
}
QSpinBox::down-button {
width:20px;
     height:20px;
}
QDoubleSpinBox {
color: rgb(0, 0, 0);
background-color: rgb(0, 0, 0);
border-bottom-right-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-top-left-radius:10px;
color: rgb(255, 255, 255);
background-color: rgb(150, 150, 150);
font: 75 10pt "MS Shell Dlg 2";
}
QDoubleSpinBox::up-button {
width:20px;
     height:20px;
}
QDoubleSpinBox::down-button {
width:20px;
     height:20px;
}
QTextEdit{
border-bottom-right-radius:20px;
border-top-right-radius:20px;
border-bottom-left-radius:20px;
border-top-left-radius:20px;
background-color: rgb(150, 150, 150);
color: rgb(255, 255, 255);
}
QComboBox{
border-bottom-right-radius:5px;
border-top-right-radius:5px;
border-bottom-left-radius:5px;
border-top-left-radius:5px;
background-color: rgb(150, 150, 150);
color: rgb(255, 255, 255);
}

How to align the text in Qt with styleSheet? (I not good in english so i sorry if my question look weird)

Update: This is image my Textbox: enter image description here


Solution

  • Maybe you can try the following QSS QTextEdit{padding-left:5px;padding-top:5px;