QT与HALCON(入门)

#include "qtdesign.h"
#include <QtGui/QApplication>
#include "halconcpp.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //在界面设计里添加一个Label,把QTDesign里的UI设置为public;
    QTDesign w;
    long WndID = (long)(w.ui.pic_lab->winId());
    HalconCpp::HImage m_SrcImage_Hal;
    HalconCpp::ReadImage(&m_SrcImage_Hal, "fabrik");
    HalconCpp::HTuple  hv_WindowHandle;

    HalconCpp::SetWindowAttr("background_color","black");
    HalconCpp::OpenWindow(0,0,-1,-1,WndID,"","",&hv_WindowHandle);
    HalconCpp::HDevWindowStack::Push(hv_WindowHandle);
    if(HalconCpp::HDevWindowStack::IsOpen())
        HalconCpp::DispObj(m_SrcImage_Hal,HalconCpp::HDevWindowStack::GetActive());
    w.show();
    return a.exec();
}

 

posted @ 2017-02-27 16:21  冂冋冏囧  阅读(2768)  评论(2编辑  收藏  举报