Python PyQt5:如果QLineEdit为空,如何更改QLabel的颜色?

时间:2016-10-28 21:54:28

标签: python colors pyqt5 qlineedit qlabel

使用

myQLineEdit.textChanged.connect(
lambda: myQLabel.setStyleSheet("QLabel { color: green}"))

我可以在输入时更改文字颜色。 如果QLineEdit为空,我该如何更改文本颜色?

1 个答案:

答案 0 :(得分:1)

SELECT t1.Name, t3.Account, t5.Code FROM db_table1 AS 1 INNER JOIN db_table2 AS t2 ON t1.Name = t2.Name INNER JOIN db_table3 AS t3 ON t2.PhoneNum = t3.PhoneNum INNER JOIN db_table4 AS t4 ON t3.Account = t4.Account INNER JOIN db_table5 AS t5 ON t4.Zip = t5.Zip WHERE t2.ID = 16 AND t3.Account = 1234567 AND t5.Code = 'abcd' UNION SELECT t1.Name, t3.Account, t5.Code FROM db_table1 AS 1 INNER JOIN db_table2 AS t2 ON t1.Name = t2.Name INNER JOIN db_table3 AS t3 ON t2.PhoneNum = t3.PhoneNum INNER JOIN db_table4 AS t4 ON t3.Account = t4.Account INNER JOIN db_table5 AS t5 ON t4.Zip = t5.Zip WHERE t2.ID = 16 AND t3.Account = 2345678 AND t5.Code = 'bcde' UNION SELECT t1.Name, t3.Account, t5.Code FROM db_table1 AS 1 INNER JOIN db_table2 AS t2 ON t1.Name = t2.Name INNER JOIN db_table3 AS t3 ON t2.PhoneNum = t3.PhoneNum INNER JOIN db_table4 AS t4 ON t3.Account = t4.Account INNER JOIN db_table5 AS t5 ON t4.Zip = t5.Zip WHERE t2.ID = 16 AND t3.Account = 3456789 AND t5.Code = 'cdef' ; 信号将文本作为参数发送,因此您可以使用它来切换颜色:

OR