def updateLockStatus(self, status, reason):
indicationColor = Qt.black
if status == QCamera.Searching:
self.ui.statusbar.showMessage("Focusing...")
self.ui.lockButton.setText("Focusing...")
indicationColor = Qt.yellow
elif status == QCamera.Locked:
self.ui.lockButton.setText("Unlock")
self.ui.statusbar.showMessage("Focused", 2000)
indicationColor = Qt.darkGreen
elif status == QCamera.Unlocked:
self.ui.lockButton.setText("Focus")
if reason == QCamera.LockFailed:
self.ui.statusbar.showMessage("Focus Failed", 2000)
indicationColor = Qt.red
palette = self.ui.lockButton.palette()
palette.setColor(QPalette.ButtonText, indicationColor)
self.ui.lockButton.setPalette(palette)
评论列表
文章目录