c++ - QT : Removing gap from top of QLabel -
i showing image on qlabel. right having gap between top of window , top of qlabel(image) :
i don't want gap, ui current ui :
where label_image
object name qlabel containing image.
my constructor code :
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { this->setfixedsize(700,700); ui->setupui(this); ui->centralwidget->layout()->setmargin(0); ui->centralwidget->layout()->setspacing(0); } void mainwindow :: paintevent(qpaintevent * e) { qmainwindow::paintevent(e); if(1) { qimage image("/users/arqam/desktop/imagetocartoon/input/elonmusk.jpeg"); //some redundant code ui->label_image->setpixmap(qpixmap::fromimage(image)); } }
using changes in centralwidget
shown able image start left part, not able image start top.
edit : need image start top left
, left part done, top part left.
my xml part of ui : https://pastebin.com/thxhc2mj
to appear @ top use setalignment()
, in case
ui->label_image->setalignment(qt::aligntop);
Comments
Post a Comment