QLineEdit Rounded Corners?

Is there a way to get around the corners of a QLineEdit widget? If not, a similar widget, could I do this?

Visual meaning:

enter image description here

Solved: (see below for more information)

      QLineEdit *lineEdit = new QLineEdit;

      lineEdit -> setStyleSheet("QLineEdit {  border: 2px solid gray;"
                                             "border-radius: 5px;}");
+5
source share
2 answers

You can use StyleSheets to style the Qt components in the same way you would use them when creating a website. You can set the stylesheet in two ways: in the application code or in QtDesiner.

QtDesiner ( ), , , " StyleSheet" (, , " ", , Qt , ). , .

, , , , CSS.

():

SomeComponent->setStyleSheet("QLineEdit { border-radius: 5px; }");

- .

+5

. http://doc.qt.io/archives/qt-4.7/stylesheet-examples.html:

QLineEdit {
 border: 2px solid gray;
 border-radius: 10px;
}

, paintEvent, , .

+2

All Articles