PDA

View Full Version : QLineEdit, draw only text



Radagast
28th March 2009, 10:32
Qt 4.4.3, Windows XP
I used 'search', but didn't find an answer...
Well I need to tune drawing of QLineEdit (I'm subclassing it) so it paints only text (possibly selected) and flicking cursor. No background and no frame. I can disable background with


QPalette p = palette();
p.setBrush(backgroundRole(), QBrush(Qt::transparent));
setPalette(p);

but the thin blue line is still painted. In Qt's source there is:


QStyleOptionFrameV2 panel;
initStyleOption(&panel);
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);

So is it possible not to draw the frame without total reimplementation of paintEvent (it's rather huge :( )?
thanks in advance.

Added: sorry, I didn't notice the setFrame :)

talk2amulya
28th March 2009, 11:15
two possible options..either u can draw the frame QLineEdit is drawing with ur background color or u can create custom style..override primitiveElement and do nothing in case the primitive element is QStyle::PE_PanelLineEdit.