QWidget设置模态窗口

setAttribute(Qt::WA_ShowModal, true);增加这一句就可以实现了。

QTableWidget设置图片居中显示:

    增加一个QLabel,图片在QLabel居中显示

    QLabel *plabel = new QLabel();
    plabel->setAlignment(Qt::AlignCenter);
    plabel->setPixmap(QPixmap(":/images/red.png"));
    tableWidget->setCellWidget(0, 1, plabel);

猜你喜欢

转载自blog.csdn.net/st_spring/article/details/83650170