[Qt-interest] Preventing highlighting of QLineEdit

KC Jones kc at asperasoft.com
Fri Jan 15 02:59:21 CET 2010


Thanks for the suggestions, but no luck.

Setting Qt::NoFocus makes the widget inaccessible and inactive, which
is not what I want.

setReadOnly(false) seems to have no effect.

A little more context: I am implementing a toolbar search widget that
surrounds the QLineEdit with QLabels that "paint" a oval lozenge
around the edit box.  I'm not convinced this approach will work, but
I'm trying to avoid having to write my own paint() method.  So taking
this composite widget approach, the highlighting "flair" that Qt draws
when the QLineEdit has focus is not wanted.

I don't care if I accomplish this with style sheets or by other means.
 It just seems like this is something that should be handled via style
sheets.

On Thu, Jan 14, 2010 at 4:24 PM, Paul England <pengland at cmt-asia.com> wrote:
> Are you dead set on using a style?
> I'm assuming that setFocusPolicy( Qt::NoFocus) would get the job done.
> I use it on QTableWidget all the time.  I'm not sure if adding a style
> will over write this or not though.  The other thing is if it's editable
> or not.
> setReadOnly( false ) I'm pretty sure will eliminate the problem altogether,
> but introduce a huge one if it's not read only. :)
>
> KC Jones wrote:
>> I have a QLineEdit widget where I do not want to see any frame or
>> frame highlighting.  I know how to eliminate the frame, either by
>> calling the setFrame(false) or via style sheet.  But I have not had
>> any luck getting rid of the edit highlight.  I've played with the
>> :edit-focus pseudo state:
>>
>> QLineEdit:focus { border-style: none; }
>>
>> but so far nothing is working.  I know the ":focus" is the state I
>> want since I can set other properties and see them applied correctly.
>> But the fuzzy blue (Mac) highlighting is still drawn.  Any
>> suggestions?
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>




More information about the Qt-interest-old mailing list