quality_control.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:smhr 作者: andycasey 项目源码 文件源码
def check_lineedit_state(self, *args, **kwargs):
        """
        Update the background color of a QLineEdit object based on whether the
        input is valid.
        """

        sender = self.sender()
        state = sender.validator().validate(sender.text(), 0)[0]

        color = {
            QtGui.QValidator.Acceptable: 'none',        # Normal background
            QtGui.QValidator.Intermediate: "#FFF79A",   # Yellow
        }.get(state, "#F6989D")                         # Red

        sender.setStyleSheet("QLineEdit {{ background-color: {} }}".format(color))

        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号