Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QLineEdit Rounded Corners?

Is there a way to round the corners of a QLineEdit widget? If not is there a similar widget I could do this to?

Visual Meaning:

enter image description here

Solved: (See below for additional information)

      QLineEdit *lineEdit = new QLineEdit;

      lineEdit -> setStyleSheet("QLineEdit {  border: 2px solid gray;"
                                             "border-radius: 5px;}");
like image 662
Brandon Clark Avatar asked Jul 17 '12 06:07

Brandon Clark


1 Answers

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

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

Also, you can always override paintEvent if you want to get your hands dirty.

like image 172
Rolle Avatar answered Oct 17 '22 08:10

Rolle