spacepaste

  1.  
  2. from PyQt5.QtCore import Qt
  3. from PyQt5.QtWidgets import QApplication, QLineEdit, QTableWidget, QSplitter, QPushButton, QVBoxLayout, QFrame
  4. app = QApplication([])
  5. frame = QFrame()
  6. frame.setLayout(QVBoxLayout())
  7. splitter = QSplitter()
  8. table = QTableWidget(1, 1)
  9. lineEdit = QLineEdit()
  10. lineEdit.setAutoFillBackground(True)
  11. # commenting out the following line fixes the lineEdit-background problem
  12. splitter.setStyleSheet('QSplitter::handle { background-color: grey }')
  13. splitter.setChildrenCollapsible(False)
  14. splitter.setHandleWidth(1)
  15. table.setCellWidget(0, 0, lineEdit)
  16. splitter.addWidget(table)
  17. palette = lineEdit.palette()
  18. palette.setColor(lineEdit.backgroundRole(), Qt.yellow)
  19. lineEdit.setPalette(palette)
  20. frame.layout().addWidget(splitter)
  21. frame.show()
  22. app.exec()
  23.