Results 1 to 2 of 2

Thread: QLineEdit, draw only text

  1. #1
    Join Date
    Jun 2008
    Posts
    57
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QLineEdit, draw only text

    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
    Qt Code:
    1. QPalette p = palette();
    2. p.setBrush(backgroundRole(), QBrush(Qt::transparent));
    3. setPalette(p);
    To copy to clipboard, switch view to plain text mode 
    but the thin blue line is still painted. In Qt's source there is:
    Qt Code:
    1. initStyleOption(&panel);
    2. style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by Radagast; 28th March 2009 at 11:17.

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLineEdit, draw only text

    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.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QLineEdit and background text
    By SnarlCat in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2009, 22:17
  3. Text before editting on QLineEdit
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 8th September 2008, 15:51
  4. QLineEdit text() crash - Qt3
    By user_mail07 in forum Qt Programming
    Replies: 7
    Last Post: 10th June 2008, 09:42
  5. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13

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.