I had another go, and still no luck. If you say it's possible, then it must the case.
I'm using stylesheets and the css file is picked up for QLabels, but no luck with the background image. Any idea what am I doing wrong? Thanks again.
#include "CentralContainer.h"
{
this->setObjectName("CentralContainer");
titleLabel->setObjectName("CentralContainerTitle");
leftPanel = new LeftPanel(this);
topPanel = new TopPanel(this);
bottomPanel = new BottomPanel(this);
layout->addWidget(titleLabel, 0, 0, 1, 2);
layout->addWidget(leftPanel, 1, 0, 2, 1);
layout->addWidget(topPanel, 1, 1);
layout->addWidget(bottomPanel, 2, 1);
setLayout(layout);
}
#include "CentralContainer.h"
CentralContainer::CentralContainer(QWidget *parent) : QWidget(parent)
{
this->setObjectName("CentralContainer");
QLabel *titleLabel = new QLabel("Central Container");
titleLabel->setObjectName("CentralContainerTitle");
leftPanel = new LeftPanel(this);
topPanel = new TopPanel(this);
bottomPanel = new BottomPanel(this);
QGridLayout *layout = new QGridLayout();
layout->addWidget(titleLabel, 0, 0, 1, 2);
layout->addWidget(leftPanel, 1, 0, 2, 1);
layout->addWidget(topPanel, 1, 1);
layout->addWidget(bottomPanel, 2, 1);
setLayout(layout);
}
To copy to clipboard, switch view to plain text mode
background-image: url(images/background.png);
}
QLabel#CentralContainerTitle { background-color: aqua;
color: purple;
}
background-color: transparent;
color: blue;
}
QWidget#CentralContainer {
background-image: url(images/background.png);
}
QLabel#CentralContainerTitle {
background-color: aqua;
color: purple;
}
CentralContainer QLabel {
background-color: transparent;
color: blue;
}
To copy to clipboard, switch view to plain text mode
Bookmarks