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. lineEdit = QLineEdit()
  9. lineEdit.setAutoFillBackground(True)
  10. # commenting out the following line fixes the lineEdit-background problem
  11. splitter.setStyleSheet('QSplitter::handle { background-color: grey }')
  12. splitter.setChildrenCollapsible(False)
  13. splitter.setHandleWidth(1)
  14. splitter.addWidget(lineEdit)
  15. palette = lineEdit.palette()
  16. palette.setColor(lineEdit.backgroundRole(), Qt.yellow)
  17. lineEdit.setPalette(palette)
  18. frame.layout().addWidget(splitter)
  19. frame.show()
  20. app.exec()
  21.