PDA

View Full Version : Problem with QLineEdit BlinkCursor (PyQt4)



Goodwin
18th September 2014, 07:23
I’m trying to redefine QLineEdit as private class – and it’s works well.
But I want to paint lineEdit with my style, and when I use paintEvent it’s work well except Blink cursor… Because there is no cursor, and there is no text in lineedit box.
It’s look like text and cursor are hiden behind paint event

Please some one tell me, how I can use paintevent and show normal text and cursor

For example in QSpinBox when I use paintevent the cursor is on his place… So why in lineedit such a problem?
What I do wrong?
Thanks

wysota
20th September 2014, 21:06
Do you draw the text and blinking cursor in your paint event?

Goodwin
22nd September 2014, 14:39
Do you draw the text and blinking cursor in your paint event?
that is the point, I don't wanna repaint text and cursor... I thought I can find a way to use system cursor
In paintEvent I just paint lineedit field and use opacity option

wysota
25th September 2014, 12:23
that is the point, I don't wanna repaint text and cursor... I thought I can find a way to use system cursor
In paintEvent I just paint lineedit field and use opacity option

The text and cursor are painted within paintEvent of QLineEdit, so if you don't let the default implementation work, you won't get neither and will have to paint them yourself. A possibility to overcome this is to implement your own style (or a style proxy) that will bypass painting the default frame of the widget so that you can both do your own painting and call the base class implementation to paint the text and cursor.