ОС: Windows 11
Когда я устанавливаю цвет фона элементов в моем Qtablewidget с использованием item.setbackground (Qcolor (210,210 210)) , цвет не заполняет ячейку, есть какой -то накладной, что накладки с закругленными углами: изображение
. The person in this post is also using .setBackground() but doesn't have this issue.
WHAT I TRIED :
When using QSS to change the background color of the table items, all the cells are filled-in correctly (image), however I want to be able to choose which rows to apply the background color to.
QTableView::item {
color: rgb(50,50,50);
background-color: rgb(0,180,0);
}
QTableView {
background-color: rgb(240, 240, 240);
font: 16px;
}
< /code>
Я также пытался возиться с границей и прокладкой, но это просто удаляет все цвета фона, независимо от значений. < /p>
QTableView::item {
color: rgb(50,50,50);
border: 0px;
padding: 4px;
}
< /code>
mre (в Windows 11): < /h2>
from PySide6.QtWidgets import QMainWindow, QApplication, QTableWidget, QTableWidgetItem, QVBoxLayout
from PySide6.QtGui import QColor
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
layout = QVBoxLayout()
table = QTableWidget()
table.setRowCount(1)
table.setColumnCount(1)
item = QTableWidgetItem()
table.setItem(0, 0, item)
item.setBackground(QColor(255,0,0))
self.setCentralWidget(table)
layout.addWidget(table)
self.setLayout(layout)
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.show()
app.exec()
Подробнее здесь: https://stackoverflow.com/questions/796 ... ed-padding
QtableWidget Cell Found Found Color имеет нежелательную «округлую прокладку» ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
QtableWidget Cell Found Found Color имеет нежелательную «округлую прокладку»
Anonymous » » в форуме Python - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Свойство SVG «color» не имеет приоритета над общим свойством CSS «color».
Anonymous » » в форуме CSS - 0 Ответы
- 110 Просмотры
-
Последнее сообщение Anonymous
-