Home > Back-end >  The custom of tank has a problem?? To solve the thank you
The custom of tank has a problem?? To solve the thank you

Time:10-24

# include & lt; QApplication>
# include & lt; QPushButton>
# include & lt; QTimer>
# include & lt; QDialog>
# include & lt; QLabel>
# include "layoutdlg. H"
# include "CV. H"
# include "cxcore. H"
# include "highgui. H"
LayoutDlg: : layoutDlg ()
{
SetWindowTitle (tr (" QT_Target "));
Label1=new QLabel (tr (" Video_Put "));
Label2=new QLabel (tr (" Hist_put "));
QHBoxLayout * topLayout=new QHBoxLayout;
TopLayout - & gt; AddWidget (label1);
TopLayout - & gt; AddWidget (label2);
OpengCamera=new QPushButton (tr (" OpenCamera "));
CloseCamera=new QPushButton (tr (" CloseCamera "));
ChangeRect=new QPushButton (tr (" ChangeRect "));
QuitProcess=new QPushButton (tr (" Quit "));
The connect (OpengCamera, SIGNAL (clicked ()), layoutDlg: : label1, SLOT (slotopen ()));
The connect (QuitProcess, SIGNAL (clicked ()), and this, SLOT (close ()));
QHBoxLayout * bottomlayout=new QHBoxLayout;
Bottomlayout - & gt; AddWidget (OpengCamera);
Bottomlayout - & gt; AddWidget (CloseCamera);
Bottomlayout - & gt; AddWidget (ChangeRect);
Bottomlayout - & gt; AddWidget (QuitProcess);
QGridLayout * mainLayout=new QGridLayout (this);
//mainLayout - & gt; SetMargin (15);
MainLayout - & gt; SetSpacing (10);
MainLayout - & gt; ,0,1,4 addLayout (topLayout, 0);
MainLayout - & gt; ,0,1,4 addLayout (bottomlayout, 1);
}

Void layoutDlg: : slotopen ()
{

IplImage * cvImage;
CvCapture * cvCap;
CvCap=cvCreateCameraCapture (1);
CvImage=cvQueryFrame (cvCap);
If (cvImage==NULL)
{
The return;
}

CvCvtColor (cvImage cvImage, CV_BGR2RGB);
QImage * CCC;
CCC=new QImage ((uchar *) cvImage - & gt; ImageData cvImage - & gt; Width, cvImage - & gt; Height, cvImage - & gt; WidthStep QImage: : Format_RGB888);

QPixmap BBB.
BBB=BBB. FromImage (* CCC, 0).
Label1 - & gt; SetPixmap (BBB);//display the picture the label on

}
Void layoutDlg: : slotclose ()
{
}
Void layoutDlg: : slotchange ()
{
}

CodePudding user response:

Bject: : connect: No to slot QLabel: : slotopen () in the. \ layoutdlg CPP: 27

CodePudding user response:

Go to QT version, this version of haunted by a ghost
  • Related