<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: Candara;color: #000000"><blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px"><p style="color: #AAAAAA; margin-top: 10px;">On 2/20/2019 6:21:15 PM, Maurizio Berti <maurizio.berti@gmail.com> wrote:</p><div style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex;border-left: 1px solid rgb(204,204,204);padding-left: 1ex;min-width: 500px"><div id="gmail-m_1375032271662792423__MailbirdStyleContent" style="font-size: 12pt;font-family: Candara"><blockquote class="gmail-m_1375032271662792423history_container" type="cite" style="color: rgb(0,0,0);border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px"><div style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote><div style="color:rgb(0,0,0)"><span style="color:rgb(59,89,152)">This is a fallout of the following peculiar fact:  My actual intention is to use a <span style="font-family:"Courier New"">QLabel</span> as the delegate editor widget, and not a <span style="font-family:"Courier New"">QLineEdit</span>.  I know that seems weird, but it gives me more precise control over the editing that occurs.  </span></div></div></blockquote><div><br></div><div>I'm not quite sure I'm following you on that.</div><div>I think I can understand your "precise control" needs, but if you can better explain what your needs are, we might help with that.</div><div>Using a QLabel for editing is not suggested, not only because it's not its purpose, but also because it doesn't provide sufficient editing cababilities and aidings, from both programming and UX perspectives (and I'm usually mostly focused on the latter).<br>Let me explain on that.</div><div>A label doesn't show the editing cursor (you might object that for simple editings it doesn't matter that much, but <i>knowing</i> where you're typing is a huge feedback) and it doesn't provide any selection nor clipboard implementation. From the user point of view that's not good, as its usage is not intuitive: while the user can "learn" how it works from its behavior, it's usage doesn't justify the change of behavior between similar and common [table/editing] user interfaces.</div></div></div></div></div></div></div></div></blockquote><div><span style="font-size: 12pt;color: rgb(0, 0, 0)"><b style="font-family: Candara;"><span style="color: #3B5998"></span></b><span style="color: rgb(59, 89, 152);">This is a surprisingly hot-button issue!  I posted a question to stackoverflow that involved this issue, and someone grilled me quite extensively on my use of <span style="font-family: Courier New">QLabel</span> for this.</span></span></div><div><span style="font-size: 12pt;font-family: Candara;color: #000000"><span style="color: #3B5998"><br></span></span></div><div><span style="font-size: 12pt;color: rgb(0, 0, 0)"><span style="color: rgb(59, 89, 152);">It may be that I could make it work fine using a <span style="font-family: Courier New">QLineEdit</span>.  I haven't played with it much, and I probably should.  There are two things I am doing with cell input that I think would be complicated using a <span style="font-family: Courier New">QLineEdit</span>:</span></span></div><div><ol><li><span style="color: #3b5998">Validating cell input character by character.  Each column in the table view has regular expression validation.  I catch a character when it is typed, determine what the cell contents <i>would be</i> with that character added, and disallow that input right at that moment if it would be invalid.<br>(I think this might be workable with a <font face="Courier New">QLineEdit</font>; I haven't messed with it ...)</span></li><li><span style="color: #3b5998">There are cases where I want to have different text style for different parts of the cell contents (for example, some part of the text in Italic and the rest not).<br>This is quite easy to do with a <font face="Courier New">QLabel</font> because it can contain rich text (e.g.,<font face="Courier New">'foo<span style="font-style: italic;">bar</span>'</font>).  This doesn't appear to work for the contents of a QLineEdit widget.</span></li></ol></div></div>