PDA

View Full Version : How to overcome the shade of the label in the background image?



harish
25th November 2011, 06:46
Hi All,
I had attached a picture in which i have set the background and also kept two labels in it.
The Problem i have is the label border is above the background image and looks like a block in front.
I have to hide the border and only the wordings should alone be displayed!!!


Can anyone help me in finding a solution will be highly appreciated!!!


Thanks in advance and Regards, 7129

ChrisW67
26th November 2011, 06:43
How did you apply the background?

harish
28th November 2011, 05:11
I had done it with UI design and not through codewise.

ChrisW67
28th November 2011, 23:15
You need to be more specific about what widgets will have the background applied. At the moment you are probably setting a background on the main widget and this cascades to all widgets placed on it.



#include <QtGui>
#include <QDebug>

class MainWindow: public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *p = 0): QMainWindow(p) {
QWidget *central = new QWidget(this);
central->setObjectName("centralWidget");
// this
central->setStyleSheet("#centralWidget { background: url('gradient.png'); }" );
// not this
// central->setStyleSheet("* { background: url('gradient.png'); }" );


QVBoxLayout *layout = new QVBoxLayout(central);
QLabel *label1 = new QLabel("Label 1", this);
QLabel *label2 = new QLabel("Label 2", this);

layout->addWidget(label1);
layout->addWidget(label2);

central->setLayout(layout);
setCentralWidget(central);
}
public slots:
private:
};

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"