将Qt的label设置成Halcon的窗口,并显示

    xiaoxiao2023-11-22  160

    h文件中:

    public:

    HTuple hv_WindowHandle;

    Hlong windID;

     

    cpp文件中

     windID = (Hlong)this->ui->label->winId();

    OpenWindow(0,0,ui->label->width(),ui->label->height(),windID,"visible","",hv_WindowHandle);

     

    SetDraw(hv_WindowHandle,"margin");

    SetLineWidth(hv_WindowHandle,2);

    SetColor(hv_WindowHandle,"red");

    SetSystem("filename_encoding","utf8");

     

    void DisplayImage(HObject image, HTuple windHandle)

    {

              HTuple  img_width , img_height;

             GetImageSize(image,&img_width,&img_height);

             SetPart(windHandle,0,0,img_height- 1 , img_width - 1);

             DispObj(image,windHandle);

    }

    最新回复(0)