<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QTableView focusCell - background color transparent]]></title><description><![CDATA[<p dir="auto">I would like to style the focusCell in a QTableView onyl with a border,<br />
but without a (maybe styled) background.</p>
<p dir="auto">So the background color of a cell with focus shall have the same color<br />
as the background of the cell (without focus)</p>
<p dir="auto">Any suggestions how to proceed ?</p>
]]></description><link>https://forum.qt.io/topic/59962/qtableview-focuscell-background-color-transparent</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 18:43:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/59962.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Oct 2015 10:00:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QTableView focusCell - background color transparent on Tue, 03 Nov 2015 16:48:45 GMT]]></title><description><![CDATA[<p dir="auto">So after some hours debugging the QStyle::drawControl code in the library I have found a solution.</p>
<p dir="auto">The problem were that we are using an application style sheet.<br />
So the used style for rendering the tablecell and the content is <strong>QStyleSheetStyle</strong>.</p>
<p dir="auto">If the application is working with QStyleSheetStyle it seem to be not possible to render the content of a tabelcell selection<br />
without a stylesheet.</p>
<p dir="auto">After using another style (the fusion style in this case) the styling of the selected tablecell is possible.</p>
<p dir="auto">If somebody is interested in the working code:</p>
<pre><code>// somewhere in the constructor
// m_unstyledView is type of QTableView*
// m_fusionStyle  is type of QStyle*

m_unstyledView = new QTableView; 
m_fusionStyle = QStyleFactory::create(s3Utf8String("fusion"));

void DataTableDelegate::paint(QPainter* painter, const QStyleOptionViewItem&amp; option, 
                              const QModelIndex&amp; index) const
{
    QStyleOptionViewItemV4 opt = option;
    initStyleOption(&amp;opt, index);

    opt.palette.setColor(QPalette::All, QPalette::Highlight, QColor::fromRgb(255, 255, 0));
    opt.palette.setColor(QPalette::All, QPalette::HighlightedText, QColor::fromRgb(255, 0, 0));

    m_unstyledView-&gt;setPalette(opt.palette);

    m_fusionStyle-&gt;drawControl(QStyle::CE_ItemViewItem, &amp;opt, painter, m_unstyledView);
}
</code></pre>
]]></description><link>https://forum.qt.io/post/296443</link><guid isPermaLink="true">https://forum.qt.io/post/296443</guid><dc:creator><![CDATA[karlheinzreichel]]></dc:creator><pubDate>Tue, 03 Nov 2015 16:48:45 GMT</pubDate></item><item><title><![CDATA[Reply to QTableView focusCell - background color transparent on Wed, 28 Oct 2015 16:01:47 GMT]]></title><description><![CDATA[<p dir="auto">Can you show the code of your paint function ?</p>
]]></description><link>https://forum.qt.io/post/295533</link><guid isPermaLink="true">https://forum.qt.io/post/295533</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 28 Oct 2015 16:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to QTableView focusCell - background color transparent on Wed, 28 Oct 2015 15:40:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi thanks for your answer...<br />
I render already the table cells in the derived QStyledItemDelegate.<br />
E.g.</p>
<p dir="auto"><code>drawControl(QStyle::CE_ItemViewItem, &amp;opt, painter, widget); </code><br />
My question is, how to render the selected cell (With which style items QStyle::CE_xxx???).</p>
]]></description><link>https://forum.qt.io/post/295525</link><guid isPermaLink="true">https://forum.qt.io/post/295525</guid><dc:creator><![CDATA[karlheinzreichel]]></dc:creator><pubDate>Wed, 28 Oct 2015 15:40:36 GMT</pubDate></item><item><title><![CDATA[Reply to QTableView focusCell - background color transparent on Thu, 22 Oct 2015 22:07:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">You should be able to achieve that either using QPalette or QStyleSheet. Another option would be to write a QStyledItemDelegate and reimplement the paint method.</p>
]]></description><link>https://forum.qt.io/post/294843</link><guid isPermaLink="true">https://forum.qt.io/post/294843</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 22 Oct 2015 22:07:34 GMT</pubDate></item></channel></rss>