喜在中心顯示我使用QLabel來顯示QtForm的圖像。 我的代碼是這樣圖像不是QtForm
QVBoxLayout *layout = new QVBoxLayout;
QHBoxLayout *hLayout = new QHBoxLayout;
layout->setMargin(5);
QLabel *imageLabel = new QLabel;
QPixmap pixmap("/images/test.jpg");
imageLabel->setPixmap(pixmap);
imageLabel->setMask(pixmap.mask());
imageLabel->setMinimumSize(160, 160);
imageLabel->resize(500, 320);
layout->addWidget(imageLabel,0,Qt::AlignTop | Qt::AlignCenter);
hLayout->addItem(layout);
widget->setLayout(hLayout);
scrollArea->setWidget(widget);
setCentralWidget(scrollArea);
,但圖像的左上角顯示任何一個可以建議我帶來的圖像中心到形式
發佈打印屏幕,所以我們可以看到它是怎麼樣的 – warunanc