PyQt QLineEdit with rounded corners
- PyQt5 >= 5.8
python -m pip install pyqt-rounded-corners-lineedit
- absresgetter - To get absolute path of resource file
Rounded corners, borderless line edit.
If you want to add the border, add code like below.
lineEdit.setStyleSheet(lineEdit.styleSheet() + 'QLineEdit { border: 1px solid black; }')
Code Sample
from PyQt5.QtWidgets import QApplication, QGridLayout, QWidget
from pyqt_rounded_corners_lineedit import RoundedCornersLineEdit
class Widget(QWidget):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
lineEdit = RoundedCornersLineEdit()
# if you want to set the border
# lineEdit.setStyleSheet(lineEdit.styleSheet() + 'QLineEdit { border: 1px solid black; }')
lay = QGridLayout()
lay.addWidget(lineEdit)
self.setLayout(lay)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
widget = Widget()
widget.show()
app.exec_()