My code is:
#include "testloadimage.h"
testLoadImage
::testLoadImage(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
QPixmap bac_image
(":/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png");
this->setStyleSheet("border-image: url(:/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png)");
QPixmap pix
(":/C:/Users/kimkeang/Pictures/blank-canvas.png");
ui.label->setPixmap(pix);
ui.
label->setGeometry
(QRect(180,
100,pix.
width(),pix.
height()));
ui.label->adjustSize();
resize(bac_image.width(), bac_image.height());
}
#include "testloadimage.h"
testLoadImage::testLoadImage(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags)
{
ui.setupUi(this);
QPixmap bac_image(":/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png");
this->setStyleSheet("border-image: url(:/testLoadImage/C:/Users/kimkeang/Pictures/bc-black-ui.png)");
QPixmap pix(":/C:/Users/kimkeang/Pictures/blank-canvas.png");
ui.label->setPixmap(pix);
ui.label->setGeometry(QRect(180,100,pix.width(),pix.height()));
ui.label->adjustSize();
resize(bac_image.width(), bac_image.height());
}
To copy to clipboard, switch view to plain text mode
whenever I re-size the form, I need the background and the label re-size too.
Can you tell me more specific?
Bookmarks