2015-01-17 9 views
0

아래 코드는 QSS 스타일 시트가 적용된 단일 QLineEdit()을 만듭니다. QSS를 사용하여 QLineEdit의 글꼴 크기와 글꼴 색을 변경하는 방법을 보여 주시면 감사하겠습니다. 나는 font-size: 12;을 시도했다. 그러나 그것은 효과가 없습니다.QSS를 사용하여 QLineEdit 글꼴 크기를 변경하는 방법은 무엇입니까?

enter image description here

from PyQt4.QtCore import * 
from PyQt4.QtGui import * 

app=QApplication([]) 

bgColor='#262626' 
style="""QLineEdit{{ color: #EBEBEB; border: 0px solid black; background-color: {0}; color: #EBEBEB }} QLineEdit:hover{{ border: 1px solid #ffa02f;}}""".format(bgColor) 

lineEdit=QLineEdit() 
lineEdit.setText('My Line Edit') 
lineEdit.setStyleSheet(style) 

lineEdit.show() 
sys.exit(app.exec_()) 

답변

1

단위와 폰트 크기를 지정; 다음과 같음 px, pt :

font-size: 30px; 
+0

감사합니다. 타겟에 맞춰 라! – alphanumeric

+0

@Sputnix, 아무쪼록. – falsetru