QLineEdit qss
时间: 2024-03-07 15:22:42 浏览: 19
As an AI language model, I do not have the capability to create a graphical user interface, but I can provide information on how to style a QLineEdit using qss.
Qss (Qt Style Sheets) is a powerful tool to customize the look and feel of Qt-based applications. Here's an example of how to style a QLineEdit:
```
QLineEdit {
border: 2px solid gray;
border-radius: 10px;
padding: 5px;
background-color: #f3f3f3;
}
QLineEdit:focus {
border: 2px solid blue;
outline: none;
}
```
In the code above, we have defined the following styles for a QLineEdit:
- `border`: sets the width, style, and color of the border around the widget.
- `border-radius`: sets the radius of the corners of the widget.
- `padding`: sets the space between the widget's content and its border.
- `background-color`: sets the background color of the widget.
The `:focus` pseudo-state is used to set the style when the widget has focus. In this case, we have changed the border color and removed the default outline.
You can apply these styles to a specific QLineEdit widget by setting its `styleSheet` property:
```
QLineEdit *lineEdit = new QLineEdit(this);
lineEdit->setStyleSheet("/* style sheet code here */");
```