<?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[[SOLVED] QComboBox Items spacing]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a problem with a QComboBox. The list is 9 items long and some of them are 2 lines long.</p>
<p dir="auto">So it gets difficult to read the list. I would like to add some more space between the items.</p>
<p dir="auto">I tried using stylesheets, but it did not work. Do you have any ideas on how to do this?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/30901/solved-qcombobox-items-spacing</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 16:34:23 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/30901.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Aug 2013 19:38:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] QComboBox Items spacing on Wed, 21 Aug 2013 13:13:49 GMT]]></title><description><![CDATA[<p dir="auto">Here is a bonus for anyone having the same question as i did.</p>
<p dir="auto">here is what I did</p>
<p dir="auto">@QAbstractItemView *abVw = SetMode-&gt;view();<br />
QListView <em>listVw = qobject_cast&lt;QListView</em>&gt;(abVw);<br />
if (listVw) {<br />
listVw-&gt;setSpacing(2);<br />
listVw-&gt;setAlternatingRowColors(1);<br />
QPalette p= listVw-&gt;palette();<br />
p.setColor(QPalette::AlternateBase, Qt::lightGray);<br />
listVw-&gt;setPalette(p);<br />
}@</p>
<p dir="auto">where SetMode is a pointer to my ComboBox. It sets an alternating color for the comboBox at the same time giving it some nice spacing</p>
]]></description><link>https://forum.qt.io/post/191954</link><guid isPermaLink="true">https://forum.qt.io/post/191954</guid><dc:creator><![CDATA[bareil76]]></dc:creator><pubDate>Wed, 21 Aug 2013 13:13:49 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QComboBox Items spacing on Tue, 20 Aug 2013 11:57:36 GMT]]></title><description><![CDATA[<p dir="auto">THANK YOU!</p>
<p dir="auto">Just What I needed!</p>
]]></description><link>https://forum.qt.io/post/191714</link><guid isPermaLink="true">https://forum.qt.io/post/191714</guid><dc:creator><![CDATA[bareil76]]></dc:creator><pubDate>Tue, 20 Aug 2013 11:57:36 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] QComboBox Items spacing on Tue, 20 Aug 2013 08:38:39 GMT]]></title><description><![CDATA[<p dir="auto">QComboBox::view() will give a QAbstractItemView pointer. Since the view is a list view, you can cast it safely to QListView. Use QListView::setSpacing() to something of your choice. Default value is 0.<br />
@<br />
QAbstractItemView *abVw = comboInst-&gt;view();<br />
QListView <em>listVw = qobject_cast&lt;QListView</em>&gt;(abVw);<br />
if (listVw) {<br />
listVw-&gt;setSpacing(2);<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/191665</link><guid isPermaLink="true">https://forum.qt.io/post/191665</guid><dc:creator><![CDATA[pkj__]]></dc:creator><pubDate>Tue, 20 Aug 2013 08:38:39 GMT</pubDate></item></channel></rss>