擅长:python、mysql、java
<p>你可以用这个来获得背景色:</p>
<pre><code>treeWidgetItem.background(0)
</code></pre>
<p>返回如下内容:</p>
^{pr2}$
<p>现在把它放到一个字符串中,然后你就得到了答案。在</p>
<pre><code>originalBG = treeWidgetItem.background(0)
# New background
treeWidgetItem.setBackgroundColor(0, QtGui.QColor('green'))
# Old background
treeWidgetItem.setBackgroundColor(0, originalBG)
</code></pre>