c++ - Why does widget.resize() not work? -


my c++ code(use opencv , qt):

face_detect::face_detect(qwidget *parent) : qwidget(parent) {   imgwidget = new showwidget("d:\\sample.avi"); imgwidget->resize(qsize(640,480));   setwindowtitle(tr("face detection!"));      facenumlabel = new qlabel(tr("face_num:                                    ")); num = new qlabel; num->setframestyle(qframe::panel | qframe::sunken);  imgsource = new qlabel(tr("image source: "));  vediobtn = new qpushbutton(tr("from vedio")); localimgbtn = new qpushbutton(tr("local image"));  leftlayout = new qvboxlayout(); leftlayout->addwidget(imgwidget); leftlayout->addwidget(facenumlabel); leftlayout->addwidget(num); //leftlayout->addwidget(showimagelabel, 3, 0, 1, 2);  rightlayout = new qvboxlayout(); rightlayout->addwidget(imgsource); rightlayout->addwidget(vediobtn); rightlayout->addwidget(localimgbtn); rightlayout->addwidget(imgsource);  qhboxlayout *mainlayout = new qhboxlayout(this); mainlayout->addlayout(leftlayout); mainlayout->addlayout(rightlayout); mainlayout->setsizeconstraint(qlayout::setfixedsize);   connect(vediobtn, signal(clicked()), this, slot(openvedio())); connect(localimgbtn, signal(clicked()), this, slot(localimg())); } 

i call widget.resize() resize widget, , add layout. when run program, showimgwidget's not 640*480. why that?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -