c++ - QT : Removing gap from top of QLabel -


i showing image on qlabel. right having gap between top of window , top of qlabel(image) :

enter image description here

i don't want gap, ui current ui :

enter image description here

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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -