SOLVED: Scale image in Table Widget Cell
I am trying to scale an image with scaledtoHeight() so it can fit in a tableWidget cell. But the image is displayed in its real size so only part of it is shown. I looked up the problem and saw someone had put the image inside a layout. But the image still can't be scaled properly, Please look at the code below and help me out:
@QLabel *imageLabel = new QLabel;
QPixmap *image = new QPixmap(":/images/pack.png");
QWidget wdg = new QWidget;
QHBoxLayout *Layout = new QHBoxLayout(wdg);
ui->tableWidget->setCellWidget(0, 1, wdg);@
Thanks in Advance
Hi, scaledToHeight returns a copy of the image.
Change your code with:
And you should be good
Thanks SGalst, it worked. But how do I mark a discussion as SOLVED
You're welcome !
Simply prepend solved to the thread's title and you're good