Solved Centering an uploaded photo after rounding it
-
@Christian-Ehrlicher
Hi, I tried to addui->photo_label->setAlignment(Qt::AlignVCenter); ui->photo_label->setAlignment(Qt::AlignHCenter);
but the result is:
-
Hi,
What are the exact dimensions of your picture ?
-
@SGaist Hi, it's 200x200 pixels.
-
With the rounded part in its center ?
-
The photo is this one, and I want it round (just ignore the fact that a circle is inside it)
-
I saw your error, you changed the alignement.
You need to use Qt::AlignCenter
-
-
One issue I can see is that you are are calling size in your constructor. At this stage, the widget does not have any size yet. But also, why your QMainWindow size to create your target pixmap ?
-
@SGaist Ok, I replaced
QPixmap target = QPixmap(size());
with
QPixmap target = QPixmap(400, 400);
and now it gives me
-
Looks like you are good, aren't you ?
-
@SGaist Yes, but I also toyed with the position/alignment settings in the .ui designer and got it to work :)