在label里放了张图,然后把label放在表格里面,但是没有垂直居中
QLabel *l2 = new QLabel(); //创建lable
QImage image;
image.load(":/photo/Resource/icons/对勾.png");
QImage result = image.scaled(16, 16).scaled(30, 30, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//放缩图片,以固定大小显示
l2->setPixmap(QPixmap::fromImage(result)); //加载图片
l2->setAlignment(Qt::AlignHCenter); //设置居中
ui->tableWidget_2->setCellWidget(i,2,l2); //显示
使用了setAlignment但是只水平居中没有垂直居中,如何解决
这不是有吗, 还有 Qt::AlignCenter 可以用呢