user1090729
user1090729

Reputation: 1563

QLineEdit change border color without changing border style

I can change the background color of a QLineEdit widget in PyQt4 by doing this:

myEditField.setStyleSheet("QLineEdit { background-color : green;}")

Changing the border color requires me to do something like this:

myEditField.setStyleSheet("QLineEdit { border : 2px solid green;}")

This however is undesirable because it also changes the default shape and size of the border, I've tried using border-color instead, but it apparently only works if you have already specified border. Is there an easy way to do this?

Upvotes: 3

Views: 6127

Answers (1)

Nitish Jain
Nitish Jain

Reputation: 206

You can set the stylesheet with following values:

       border-style: outset;
            border-width: 2px;
            border-color: green;

Upvotes: 6

Related Questions