from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QLineEdit, QTableWidget, QSplitter, QPushButton, QVBoxLayout, QFrame app = QApplication([]) frame = QFrame() frame.setLayout(QVBoxLayout()) splitter = QSplitter() lineEdit = QLineEdit() lineEdit.setAutoFillBackground(True) # commenting out the following line fixes the lineEdit-background problem splitter.setStyleSheet('QSplitter::handle { background-color: grey }') splitter.setChildrenCollapsible(False) splitter.setHandleWidth(1) splitter.addWidget(lineEdit) palette = lineEdit.palette() palette.setColor(lineEdit.backgroundRole(), Qt.yellow) lineEdit.setPalette(palette) frame.layout().addWidget(splitter) frame.show() app.exec()