1

I have the following question. My QTableView has background color set to black and color (of contents) to white. So, white text appears on a black background - everything seems to be correct. However, when editing (typing in editing mode) content color is changed to black and it becomes completely invisible due to black background, but editing works fine. After confirming - color reverts back to white. How to set color of currently-being-edited text to white (preferably via stylesheets) or stop such change in this case?

4

2 回答 2

1

您必须在样式表中使用:edit-focus和/或:focus状态。

QTableView:edit-focus {
   // style here
}

有关所有可用状态的列表,请查看此处

于 2011-11-09T19:29:22.640 回答
0

设置调色板终于奏效了。

QPalette 调色板;

调色板.setColor(QPalette::Text, Qt::white);

qApp->setPalette(调色板);

于 2015-08-28T17:50:27.970 回答