Qt 4.6 QLineEdit Style. How do I style the gray highlight border so it's rounded?

Posted by krunk on Stack Overflow See other posts from Stack Overflow or by krunk
Published on 2010-04-06T22:16:37Z Indexed on 2010/04/14 3:03 UTC
Read the original article Hit count: 442

Filed under:

I'm styling a QLineEdit to have rounded borders for use as a search box. The rounding of the borders themselves were easy, but I can't figure out for the life of me how to round the highlighted portion of the widget when it has focus. I've tried QLineEdit::focus, but this only modifies the interior border. The images below show how the illusion of a rounded qlineedit is lost when it gains focus.

QListView, QLineEdit {
    color: rgb(127, 0, 63);
    selection-color: white;   
    border: 2px groove gray;
    border-radius: 10px;
    padding: 2px 4px;
}

Images with and without focus: without with

© Stack Overflow or respective owner

Related posts about qt4