Hi.
I'm using a stacked widget with 6 page on.
I would like to change the background to a image that I get from a server, the image is put into a pixmap
I have the following code, and it works ok, but there must be a more easy way to do this, I did try to change the palette but I can't get it to work
void MainWindow:n_receive_albumcover(QPixmap *p)
{
qDebug()<<"Got a picture";
//ui->label_7->setPixmap(*p);
p->save("cover_test.jpg");
ui->stackedWidget->setStyleSheet("QWidget#page{border-image: url(cover_test.jpg) ;}QWidget{background-color: rgb(44, 44, 44);}");
}
I manage to get this code working, but only if I do not have any thing in the stylesheet. as soon as I put something into the stylesheet in the desigen it do not work anymore.
Code for change of palette
ui->stackedWidget->setAutoFillBackground(true);
QPalette pal(ui->stackedWidget->palette());
pal.setBrush(QPalette::Window,QBrush(*p));
ui->stackedWidget->setPalette(pal);
So if I put this into the stylesheet. The palette do not work anymore
QPushButtonressed{
background-color: qlineargradient(spreadad, x1:0.494, y1:1, x2:0.523, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));
border-style:inset;
border-top: 1px solid gray;
border-right: 1px solid gray;
border-bottom: 1px solid white;
border-left: 1px solid white;
border-radius: 10px;
Question why is this ?
and is there a way to use the pixmap pointer direct to the stylesheet
and one last thing, the stylesheet in ui-stackedwidget is quite big, and it looks like you need to write everything if you use setStyleSheet.
Br.
Michael Rahr
Bookmarks