How to find usb camera id for opencv4 and qt5?

i use opencv videocapture.open,id 0~21,running can not get the usb camera stream

make sure your USB camera is functional, you can refer to this link https://blog.csdn.net/nb124667390/article/details/132069651