<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Op 23-8-2013 17:58, Scott Aron Bloom
schreef:<br>
</div>
<blockquote
cite="mid:6FD2E165340D9A429CF831C7A2D4F42E28A7681D@WIN-R92V03RFJ85.onshorecs.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Create
a proxy model (derive from
</span><span style="font-size:10.0pt;font-family:"Courier
New";color:#020002">QSortFilterProxyModel if you have
never created one and don’t have any sorting or filtering
turned on) and override the data method, returning QVariant
for the icon role.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:#020002"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:#020002">Then set the source model for the
proxy model, to your original, and the model for the
combobox to the proxy model.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"Courier
New";color:#020002">Scott</span></p>
</div>
</blockquote>
If you're not going to do any sorting or filtering with the proxy, I
would advise to use QIdentityProxyModel as your base class instead
of QSortFilterProxyModel.<br>
<br>
André<br>
<br>
<blockquote
cite="mid:6FD2E165340D9A429CF831C7A2D4F42E28A7681D@WIN-R92V03RFJ85.onshorecs.local"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><a moz-do-not-send="true"
name="_MailEndCompose"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
<a class="moz-txt-link-abbreviated" href="mailto:interest-bounces+scott.bloom=onshorecs.com@qt-project.org">interest-bounces+scott.bloom=onshorecs.com@qt-project.org</a>
[<a class="moz-txt-link-freetext" href="mailto:interest-bounces+scott.bloom=onshorecs.com@qt-project.org">mailto:interest-bounces+scott.bloom=onshorecs.com@qt-project.org</a>]
<b>On Behalf Of </b>Etienne Sandré-Chardonnal<br>
<b>Sent:</b> Friday, August 23, 2013 8:02 AM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:interest@qt-project.org">interest@qt-project.org</a><br>
<b>Subject:</b> [Interest] Hide icon in a QComboBox
associated with a Model<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Dear
all,<br>
<br>
I have a model representing the objects loaded in my
app. This model provides icons for the IconRole, so
that the object list docking widget looks nice.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">In
another control, I want to link a QComboBox with the
model. This works very well as the QComboBox updates
itself with the model updates with no additionnal code.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I want to
hide the icons in the QComboBox. I can find no functions
for disabling them, setting the size to 0 is a workaround,
but a space remains before the text, which looks not so
nice (maybe some non-zero layout spacing which remains,
even if the icon widget is zero-sized)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Is there
any better and simple option? Maybe adding a hideIcons()
feature in QComboBox would help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<br>
<br>
Etienne<o:p></o:p></p>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Interest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Interest@qt-project.org">Interest@qt-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.qt-project.org/mailman/listinfo/interest">http://lists.qt-project.org/mailman/listinfo/interest</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
You like Qt?
I am looking for collegues to join me at i-Optics!
</pre>
</body>
</html>