Unsolved QT window+tab layout to autoresize to match image size automatically
-
Hi guys i've been trying to get QT window to autoresize automatically but each attempt has always failed somewhere.
My layout is this way.centralWidget->tabWidget->tab#->label
However the label resizes automatically, note I have tried auto-adjust to content which didn't work either.
Any help will be greatly appreciated as this is a feature in a program most of you know Cloud_Commander XDA-DEV PAGE.
A screen cap of QTdesigner
here is part of the code which is hooked to a refresh timer.
PASTEBIN
Commented is one of my attempts.void MainWindow::Load_adb_Image() { QPixmap pixmapObject("capture.png"); ui.label_31->setPixmap(pixmapObject); ui.label_31->setFixedSize(pixmapObject.size()); if(!pixmapObject) { QPixmap pixmapObject("nodevice.png"); ui.label_31->setPixmap(pixmapObject); ui.label_31->setFixedSize(pixmapObject.size()); } QFile::remove("capture.png") ; //system("del capture.png"); /** ofstream log ("log.txt"); log << "MW Height x Width :"<< this->height()<<"x"<<this->width()<<endl; log<< "CW Height x Width :"<< ui.centralWidget->height()<<"x"<< ui.centralWidget->width()<<endl; log<< "TB Height x Width :"<< ui.tab->height()<<"x"<< ui.tab->width()<<endl; log<< "F8 Height x Width :"<< ui.frame_8->height()<<"x"<< ui.frame_8->width()<<endl; log<< "LB Height x Width :"<< ui.label_31->height()<<"x"<< ui.label_31->width()<<endl; if(ui.label_31->height()>this->height()) this->setFixedHeight(ui.label_31->height()+80+ui.label_31->height()-this->height()); if(ui.label_31->width()>this->width()) this->setFixedWidth(ui.label_31->width()+ui.label_31->width()-this->width()); if(ui.label_31->height()>ui.tabWidget->height()) ui.tabWidget->setFixedHeight(ui.label_31->height()+80+ui.label_31->height()-ui.tabWidget->height()); if(ui.label_31->width()>ui.tabWidget->width()) ui.tabWidget->setFixedWidth(ui.label_31->width()+ui.label_31->width()-ui.tabWidget->width()); if(ui.label_31->height()>ui.frame_8->height()) ui.frame_8->setFixedHeight(ui.label_31->height()+80+ui.label_31->height()-ui.frame_8->height()); if(ui.label_31->width()>ui.frame_8->width()) ui.frame_8->setFixedWidth(ui.label_31->width()+ui.label_31->width()-ui.frame_8->width()); if(ui.label_31->height()> ui.centralWidget->height()) ui.centralWidget->setFixedHeight(ui.label_31->height()+80+ui.label_31->height()- ui.centralWidget->height()); if(ui.label_31->width()>ui.centralWidget->width()) ui.centralWidget->setFixedWidth(ui.label_31->width()+ui.label_31->width()-ui.centralWidget->width()); if(ui.label_31->height()> ui.tab_3->height()) ui.tab_3->setFixedHeight(ui.label_31->height()+80+ui.label_31->height()-ui.tab_3->height()); if(ui.label_31->width()>ui.centralWidget->width()) ui.tab_3->setFixedWidth(ui.label_31->width()+ui.label_31->width()-ui.tab_3->width()); **/ }