0
点赞
收藏
分享

微信扫一扫

Halcon与QT混合编程 C++ QT中visualize_object_model_3d函数 去掉continue按钮的问题


 

使用visualize_object_model_3d函数时,右下角都会显示一个continue按钮。

而halcon代码中,不提供去掉continue按钮的选项。

而我在QT中调用visualize_object_model_3d函数,并查看源码,成功去掉了continue按钮。

 

这张图是有continue按钮的,在右下角

 

Halcon与QT混合编程 C++ QT中visualize_object_model_3d函数 去掉continue按钮的问题_图像

 

这张图是没有的。

 

Halcon与QT混合编程 C++ QT中visualize_object_model_3d函数 去掉continue按钮的问题_halcon_02

其实我现在也不是很懂原理,只是修改了一下源码调出来了。具体原理还没有弄懂。

有感兴趣的同学可以继续研究。

 

具体方法如下:

下面都需要修改visualize_object_model_3d函数的定义源码。

1.取消显示Continue的按钮

在dump_image_output函数中,注释掉最后的disp_continue_button(hv_WindowHandleBuffer);语句。

这是控制是否显示Continue的按钮的。

//Display the 'Exit' button
if (0 != (hv_DisplayContinueButton==HTuple("true")))
{
//todo
//disp_continue_button(hv_WindowHandleBuffer);
}

注释掉它之后,可以发现没有Continue的按钮了,但是点击原来Continue的按钮的区域,发现还是可以进行下一步。

2.取消点击操作

找到visualize_object_model_3d函数的定义。

首先是hv_WaitForButtonRelease变量,这是定义了两种模式,具体什么含义代码里有注释。(我也没太看懂)

hv_WaitForButtonRelease = "true";

然后我们向后继续看代码,找到下面代码这个地方。

我们发现根据hv_WaitForButtonRelease值的不同,有两种处理方式。

不管你选择何种处理方式,你只需要保证hv_ButtonReleased这个变量一直为0即可。如果它为1,就代表可以点击,如果为0,就不能点击。

if (0 != (hv_WaitForButtonRelease==HTuple("true")))
{
while (0 != 1)
{
GetMpositionSubPix(hv_WindowHandle, &hv_GraphButtonRow, &hv_GraphButtonColumn,
&hv_GraphButton);
if (0 != (HTuple(hv_GraphButton==0).TupleOr(hv_GraphButton==HTuple())))
{
if (0 != (HTuple(HTuple(HTuple(hv_GraphButtonRow>((hv_Height-hv_TextHeight)-25)).TupleAnd(hv_GraphButtonRow<hv_Height)).TupleAnd(hv_GraphButtonColumn>((hv_Width-hv_TextWidth)-15))).TupleAnd(hv_GraphButtonColumn<hv_Width)))
{
//todo
hv_ButtonReleased = 0;
}
else
{
hv_ButtonReleased = 0;
}
//
break;
}
//Keep waiting until mouse button is released or moved out of the window
}
}
else
{
//todo
hv_ButtonReleased = 1;
}

 

over~

 

 

举报

相关推荐

0 条评论