-
- 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()
- table = QTableWidget(1, 1)
- 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)
-
- table.setCellWidget(0, 0, lineEdit)
- splitter.addWidget(table)
-
- palette = lineEdit.palette()
- palette.setColor(lineEdit.backgroundRole(), Qt.yellow)
- lineEdit.setPalette(palette)
-
- frame.layout().addWidget(splitter)
- frame.show()
-
- app.exec()
-