2 Attachment(s)
QGraphicsDropShadowEffect not working properly in QLable
I was trying to add shadow effect in the qlabel using QGraphicsDropShadowEffect. so i added the effect like this .
Code:
QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
effect->setBlurRadius(0);
effect
->setColor
(QColor(255,
0,
0));
effect->setOffset(1,1);
label1->setGraphicsEffect(effect);
but the effect is looking weird as for other widget like spinbox it is working proper .
Attachment 10045 here the shadow is coming for the whole QLabel and not for the text in qlabel .
the right one is a qspinbox , it works properly for it but for qlable ,it looks odd. it behaves same as for all the labels in the parent .
but if i take the code and make a sample application it works properly ..
the sample app
Code:
centralWidget->setLayout(gridLayout);
window->setCentralWidget(centralWidget);
window->setWindowTitle("QLabel With Shadow");
sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
label->setSizePolicy(sizePolicy);
label
->setMinimumSize
(QSize(0,
0));
label
->setMaximumSize
(QSize(16777215,
16777215));
label
->setStyleSheet
(QString::fromUtf8("font-size: 12px,0.2em; \n" "font-family: Segoe Regular; \n"
"color: rgb(0, 0, 0);"));
gridLayout->addWidget(spinIt, 0, 2, 1, 1);
gridLayout->addWidget(label, 0, 0, 1, 1);
QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
effect->setBlurRadius(0);
effect
->setColor
(QColor(255,
0,
0));
effect->setOffset(1,1);
label->setGraphicsEffect(effect);
window->show();
return app.exec();
this sample application gives me what i require Attachment 10046 but not in my main application .
please help me what i might doing wrong ..?