Issue
It's quite well documented how to make line edit widget read only, but if I want to make it even more obvious, i.e. to change the background or text color, then there is nothing to be found. Is there any way to use QColor somehow to achieve desired? Thanks
Solution
Use Qt style-sheet to create complex color style your own, read here to see a lot of example;
import sys
from PyQt4 import QtGui
myQApplication = QtGui.QApplication(sys.argv)
myQLineEdit = QtGui.QLineEdit()
myQLineEdit.setStyleSheet('''
QLineEdit {
border: 2px solid rgb(63, 63, 63);
color: rgb(255, 255, 255);
background-color: rgb(0, 0, 0);
}
''')
myQLineEdit.show()
sys.exit(myQApplication.exec_())
Note: PyQt4 & PySide implement same.
Answered By - Kitsune Meyoko
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.