Results 1 to 4 of 4

Thread: Problem with QLineEdit BlinkCursor (PyQt4)

  1. #1
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Problem with QLineEdit BlinkCursor (PyQt4)

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with QLineEdit BlinkCursor (PyQt4)

    Do you draw the text and blinking cursor in your paint event?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QLineEdit BlinkCursor (PyQt4)

    Quote Originally Posted by wysota View Post
    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with QLineEdit BlinkCursor (PyQt4)

    Quote Originally Posted by Goodwin View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    Goodwin (26th September 2014)

Similar Threads

  1. Replies: 2
    Last Post: 6th September 2011, 11:27
  2. Replies: 0
    Last Post: 27th May 2011, 09:12
  3. Problem with pyqt4
    By eltico in forum Qt Programming
    Replies: 0
    Last Post: 27th April 2011, 00:37
  4. [PYQT4] QToolButton problem with its state
    By trapanator in forum Qt Programming
    Replies: 0
    Last Post: 14th September 2010, 10:57
  5. PyQt4 to Py3exe problem
    By WinchellChung in forum Newbie
    Replies: 3
    Last Post: 9th August 2007, 19:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.